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AC,gBAAgB,EAAE,aAAa,CAAC,EAAE;IAAW,GAChD,WAAW,SAAS;IAGtB,IAAI,WAAW,CAAA,GAAA,sBAAc;IAC7B,IAAI,QAAa;QACf,qCAAqC,SAAS,MAAM,GAAG;IACzD;IAEA,4LAA4L;IAC5L,qBACE,gCAAC;QAAI,KAAK;qBACR,gCAAC,CAAA,GAAA,yCAAO;QAAG,GAAG,aAAa;QAAE,QAAQ;sBACrC,gCAAC;QAAI,WAAW;QAAkB,OAAO;qBACvC,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WAAW;QACX,eAAY;OACX;AAKX","sources":["packages/@adobe/react-spectrum/src/overlays/Modal.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 {DOMRef, RefObject, StyleProps} from '@react-types/shared';\nimport modalStyles from '@adobe/spectrum-css-temp/components/modal/vars.css';\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 {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 ModalProps\n  extends AriaModalOverlayProps, StyleProps, Omit<OverlayProps, 'nodeRef' | 'shouldContainFocus'> {\n  children: ReactNode;\n  state: OverlayTriggerState;\n  type?: 'modal' | 'fullscreen' | 'fullscreenTakeover';\n}\n\ninterface ModalWrapperProps extends ModalProps {\n  isOpen?: boolean;\n  wrapperRef: RefObject<HTMLDivElement | null>;\n  children: ReactNode;\n}\n\nexport const Modal = forwardRef(function Modal(props: ModalProps, 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      <ModalWrapper {...props} wrapperRef={wrapperRef} ref={domRef}>\n        {children}\n      </ModalWrapper>\n    </Overlay>\n  );\n});\n\nlet typeMap = {\n  fullscreen: 'fullscreen',\n  fullscreenTakeover: 'fullscreenTakeover'\n};\n\nlet ModalWrapper = forwardRef(function (\n  props: ModalWrapperProps,\n  ref: ForwardedRef<HTMLDivElement | null>\n) {\n  let {type, children, state, isOpen, wrapperRef} = props;\n  let typeVariant = type != null ? typeMap[type] : undefined;\n  let {styleProps} = useStyleProps(props);\n  let objRef = useObjectRef(ref);\n  let {modalProps, underlayProps} = useModalOverlay(props, state, objRef);\n\n  let wrapperClassName = classNames(\n    modalStyles,\n    'spectrum-Modal-wrapper',\n    classNames(overrideStyles, 'spectrum-Modal-wrapper', 'react-spectrum-Modal-wrapper')\n  );\n\n  let modalClassName = classNames(\n    modalStyles,\n    'spectrum-Modal',\n    {\n      'is-open': isOpen\n    },\n    classNames(overrideStyles, 'spectrum-Modal', 'react-spectrum-Modal'),\n    {[`spectrum-Modal--${typeVariant}`]: typeVariant},\n    styleProps.className\n  );\n\n  let viewport = useViewportSize();\n  let style: any = {\n    '--spectrum-visual-viewport-height': viewport.height + 'px'\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={style}>\n        <div\n          {...styleProps}\n          {...modalProps}\n          ref={objRef}\n          className={modalClassName}\n          data-testid=\"modal\">\n          {children}\n        </div>\n      </div>\n    </div>\n  );\n});\n"],"names":[],"version":3,"file":"Modal.mjs.map"}