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ACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,WAAW;QACf,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,mBACA;YACE,CAAC,CAAC,iBAAiB,EAAE,aAAa,CAAC,EAAE;YACrC,gCAAgC;QAClC,GACA,WAAW,SAAS;QAEtB,KAAK;qBACL,0DAAC,CAAA,GAAA,8BAAG;QAAE,KAAK;QAAS,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,uBAAuB;qBAClE,0DAAC,CAAA,GAAA,sCAAW;QAAE,OAAO;OAClB,WAEF,+BACC,0DAAC,CAAA,GAAA,sCAAW;QACV,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,8BAA8B;QACvD,SAAA;QACA,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAS;qBACT,0DAAC,CAAA,GAAA,0DAAS;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 user interface.\n * Depending on the kind of Dialog, further interactions may be blocked until the Dialog is acknowledged.\n */\nexport const Dialog = React.forwardRef(function Dialog(props: SpectrumDialogProps, ref: DOMRef) {\n  props = useSlotProps(props, 'dialog');\n  let {\n    type = 'modal',\n    ...contextProps\n  } = 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    hero: {UNSAFE_className: styles['spectrum-Dialog-hero']},\n    heading: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-heading', {'spectrum-Dialog-heading--noHeader': !hasHeader, 'spectrum-Dialog-heading--noTypeIcon': !hasTypeIcon}), level: 2, ...titleProps},\n    header: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-header', {'spectrum-Dialog-header--noHeading': !hasHeading, 'spectrum-Dialog-header--noTypeIcon': !hasTypeIcon})},\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: {UNSAFE_className: classNames(styles, 'spectrum-Dialog-buttonGroup', {'spectrum-Dialog-buttonGroup--noFooter': !hasFooter}), align: 'end'}\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  }), [hasFooter, hasHeader, titleProps]);\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}>\n          {children}\n        </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.cjs.map"}