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GAAA,oCAAS,EACvB,CAAA,GAAA,mDAAS,GACT,iBACA;QACE,WAAW;QACX,8BAA8B;IAChC,GACA,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAa,GACb,iBACA,wBAEF,WAAW,SAAS;IAGtB,4LAA4L;IAC5L,qBACE,0DAAC;QAAI,KAAK;qBACR,0DAAC,CAAA,GAAA,kCAAO;QAAG,GAAG,aAAa;QAAE,QAAQ;sBACrC,0DAAC;QAAI,WAAW;QAAkB,OAAO;qBACvC,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,WAAW;QACX,KAAK;QACL,eAAY;qBACZ,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;QACpC,wBACD,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;;AAK/C","sources":["packages/@adobe/react-spectrum/src/overlays/Tray.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, useModalOverlay} from 'react-aria/useModalOverlay';\n\nimport {classNames} from '../utils/classNames';\nimport {DismissButton} from 'react-aria/Overlay';\nimport {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport {Overlay, OverlayProps} from './Overlay';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport overrideStyles from './overlays.css';\nimport React, {ForwardedRef, forwardRef, ReactNode, useRef} from 'react';\nimport trayStyles from '@adobe/spectrum-css-temp/components/tray/vars.css';\nimport {Underlay} from './Underlay';\nimport {useDOMRef} from '../utils/useDOMRef';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useStyleProps} from '../utils/styleProps';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\ninterface TrayProps extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n  children: ReactNode,\n  state: OverlayTriggerState,\n  isFixedHeight?: boolean\n}\n\ninterface TrayWrapperProps extends TrayProps {\n  isOpen?: boolean,\n  wrapperRef: RefObject<HTMLDivElement | null>\n}\n\nexport const Tray = forwardRef(function Tray(props: TrayProps, ref: DOMRef<HTMLDivElement>) {\n  let {children, state, ...otherProps} = props;\n  let domRef = useDOMRef(ref);\n  let wrapperRef = useRef<HTMLDivElement>(null);\n\n  return (\n    <Overlay {...otherProps} isOpen={state.isOpen} nodeRef={wrapperRef}>\n      <TrayWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n        {children}\n      </TrayWrapper>\n    </Overlay>\n  );\n});\n\nlet TrayWrapper = forwardRef(function (props: TrayWrapperProps, ref: ForwardedRef<HTMLDivElement | null>) {\n  let {\n    children,\n    isOpen,\n    isFixedHeight,\n    state,\n    wrapperRef\n  } = props;\n  let {styleProps} = useStyleProps(props);\n  let objRef = useObjectRef(ref);\n\n  let {modalProps, underlayProps} = useModalOverlay({\n    ...props,\n    isDismissable: true\n  }, state, objRef);\n\n  // We need to measure the window's height in JS rather than using percentages in CSS\n  // so that contents (e.g. menu) can inherit the max-height properly. Using percentages\n  // does not work properly because there is nothing to base the percentage on.\n  // We cannot use vh units because mobile browsers adjust the window height dynamically\n  // when the address bar/bottom toolbars show and hide on scroll and vh units are fixed.\n  // Also, the visual viewport is smaller than the layout viewport when the virtual keyboard\n  // is up, so use the VisualViewport API to ensure the tray is displayed above the keyboard.\n  let viewport = useViewportSize();\n  let wrapperStyle: any = {\n    '--spectrum-visual-viewport-height': viewport.height + 'px',\n    // position: fixed elements are clipped by Safari on iOS 26, so we use\n    // position: absolute and manually set the top to the scrollY.\n    // The page can't scroll while the tray is open so this doesn't need to update.\n    top: typeof window !== 'undefined' ? window.scrollY : 0\n  };\n\n  let wrapperClassName = classNames(\n    trayStyles,\n    'spectrum-Tray-wrapper'\n  );\n\n  let className = classNames(\n    trayStyles,\n    'spectrum-Tray',\n    {\n      'is-open': isOpen,\n      'spectrum-Tray--fixedHeight': isFixedHeight\n    },\n    classNames(\n      overrideStyles,\n      'spectrum-Tray',\n      'react-spectrum-Tray'\n    ),\n    styleProps.className\n  );\n\n  // Attach Transition's nodeRef to outer most wrapper for node.reflow: https://github.com/reactjs/react-transition-group/blob/c89f807067b32eea6f68fd6c622190d88ced82e2/src/Transition.js#L231\n  return (\n    <div ref={wrapperRef}>\n      <Underlay {...underlayProps} isOpen={isOpen} />\n      <div className={wrapperClassName} style={wrapperStyle}>\n        <div\n          {...styleProps}\n          {...modalProps}\n          className={className}\n          ref={objRef}\n          data-testid=\"tray\">\n          <DismissButton onDismiss={state.close} />\n          {children}\n          <DismissButton onDismiss={state.close} />\n        </div>\n      </div>\n    </div>\n  );\n});\n"],"names":[],"version":3,"file":"Tray.cjs.map"}