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QACE,GAAG,UAAU;QACb,GAAG,WAAW;QACf,WAAW,CAAA,GAAA,yCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,EAAE;YACrC,gCAAgC;QAClC,GACA,WAAW,SAAS;QAEtB,KAAK;qBACL,gCAAC,CAAA,GAAA,yCAAG;QAAE,KAAK;QAAS,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,uBAAuB;qBAClE,gCAAC,CAAA,GAAA,yCAAW;QAAE,OAAO;OAAQ,WAC5B,+BACC,gCAAC,CAAA,GAAA,yCAAW;QACV,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,8BAA8B;QACvD,SAAA;QACA,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAS;qBACT,gCAAC,CAAA,GAAA,gCAAS;AAMtB","sources":["packages/@adobe/react-spectrum/src/dialog/Dialog.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 {ActionButton} from '../button/ActionButton';\n\nimport {AriaDialogProps, useDialog} from 'react-aria/useDialog';\nimport {classNames} from '../utils/classNames';\nimport CrossLarge from '@spectrum-icons/ui/CrossLarge';\nimport {DialogContext, DialogContextValue} from './context';\nimport {DOMRef, StyleProps} from '@react-types/shared';\nimport {Grid} from '../layout/Grid';\nimport intlMessages from '../../intl/dialog/*.json';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ReactNode, useContext, useMemo, useRef} from 'react';\nimport {SlotProvider, useSlotProps} from '../utils/Slots';\n// @ts-ignore\nimport styles from '@adobe/spectrum-css-temp/components/dialog/vars.css';\nimport {unwrapDOMRef, useDOMRef} from '../utils/useDOMRef';\nimport {useHasChild} from '../utils/useHasChild';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumDialogProps extends AriaDialogProps, StyleProps {\n  /** The contents of the Dialog. */\n  children: ReactNode;\n  /** The size of the Dialog. Only applies to \"modal\" type Dialogs. */\n  size?: 'S' | 'M' | 'L';\n  /** Whether the Dialog is dismissable. See the [examples](#examples) for more details. */\n  isDismissable?: boolean;\n  /** Handler that is called when the 'x' button of a dismissable Dialog is clicked. */\n  onDismiss?: () => void;\n}\n\nlet sizeMap = {\n  S: 'small',\n  M: 'medium',\n  L: 'large',\n  fullscreen: 'fullscreen',\n  fullscreenTakeover: 'fullscreenTakeover'\n};\n\n/**\n * Dialogs are windows containing contextual information, tasks, or workflows that appear over the\n * user interface. Depending on the kind of Dialog, further interactions may be blocked until the\n * Dialog is acknowledged.\n */\nexport const Dialog = React.forwardRef(function Dialog(props: SpectrumDialogProps, ref: DOMRef) {\n  props = useSlotProps(props, 'dialog');\n  let {type = 'modal', ...contextProps} = useContext(DialogContext) || ({} as DialogContextValue);\n  let {\n    children,\n    isDismissable = contextProps.isDismissable,\n    onDismiss = contextProps.onClose,\n    size,\n    ...otherProps\n  } = props;\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/dialog');\n  let {styleProps} = useStyleProps(otherProps);\n\n  size = type === 'popover' ? size || 'S' : size || 'L';\n\n  let domRef = useDOMRef(ref);\n  let gridRef = useRef(null);\n  let sizeVariant = sizeMap[type] || sizeMap[size];\n  let {dialogProps, titleProps} = useDialog(mergeProps(contextProps, props), domRef);\n\n  let hasHeader = useHasChild(`.${styles['spectrum-Dialog-header']}`, unwrapDOMRef(gridRef));\n  let hasHeading = useHasChild(`.${styles['spectrum-Dialog-heading']}`, unwrapDOMRef(gridRef));\n  let hasFooter = useHasChild(`.${styles['spectrum-Dialog-footer']}`, unwrapDOMRef(gridRef));\n  let hasTypeIcon = useHasChild(`.${styles['spectrum-Dialog-typeIcon']}`, unwrapDOMRef(gridRef));\n\n  let slots = useMemo(\n    () => ({\n      hero: {UNSAFE_className: styles['spectrum-Dialog-hero']},\n      heading: {\n        UNSAFE_className: classNames(styles, 'spectrum-Dialog-heading', {\n          'spectrum-Dialog-heading--noHeader': !hasHeader,\n          'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon\n        }),\n        level: 2,\n        ...titleProps\n      },\n      header: {\n        UNSAFE_className: classNames(styles, 'spectrum-Dialog-header', {\n          'spectrum-Dialog-header--noHeading': !hasHeading,\n          'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon\n        })\n      },\n      typeIcon: {UNSAFE_className: styles['spectrum-Dialog-typeIcon']},\n      divider: {UNSAFE_className: styles['spectrum-Dialog-divider'], size: 'M'},\n      content: {UNSAFE_className: styles['spectrum-Dialog-content']},\n      footer: {UNSAFE_className: styles['spectrum-Dialog-footer']},\n      buttonGroup: {\n        UNSAFE_className: classNames(styles, 'spectrum-Dialog-buttonGroup', {\n          'spectrum-Dialog-buttonGroup--noFooter': !hasFooter\n        }),\n        align: 'end'\n      }\n    }),\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n    [hasFooter, hasHeader, titleProps]\n  );\n\n  return (\n    <section\n      {...styleProps}\n      {...dialogProps}\n      className={classNames(\n        styles,\n        'spectrum-Dialog',\n        {\n          [`spectrum-Dialog--${sizeVariant}`]: sizeVariant,\n          'spectrum-Dialog--dismissable': isDismissable\n        },\n        styleProps.className\n      )}\n      ref={domRef}>\n      <Grid ref={gridRef} UNSAFE_className={styles['spectrum-Dialog-grid']}>\n        <SlotProvider slots={slots}>{children}</SlotProvider>\n        {isDismissable && (\n          <ActionButton\n            UNSAFE_className={styles['spectrum-Dialog-closeButton']}\n            isQuiet\n            aria-label={stringFormatter.format('dismiss')}\n            onPress={onDismiss}>\n            <CrossLarge />\n          </ActionButton>\n        )}\n      </Grid>\n    </section>\n  );\n});\n"],"names":[],"version":3,"file":"Dialog.mjs.map"}