@depup/react-aria-components 1.19.0-depup.27 → 1.21.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NavigationTree/package.json +5 -0
- package/PreviewTrigger/package.json +5 -0
- package/README.md +2 -2
- package/TokenField/package.json +5 -0
- package/changes.json +1 -1
- package/dist/exports/GridList.cjs.map +1 -1
- package/dist/exports/GridList.js.map +1 -1
- package/dist/exports/GridList.mjs.map +1 -1
- package/dist/exports/Menu.cjs +1 -0
- package/dist/exports/Menu.cjs.map +1 -1
- package/dist/exports/Menu.js +2 -2
- package/dist/exports/Menu.js.map +1 -1
- package/dist/exports/Menu.mjs +2 -2
- package/dist/exports/Menu.mjs.map +1 -1
- package/dist/exports/NavigationTree.cjs +37 -0
- package/dist/exports/NavigationTree.cjs.map +1 -0
- package/dist/exports/NavigationTree.js +25 -0
- package/dist/exports/NavigationTree.js.map +1 -0
- package/dist/exports/NavigationTree.mjs +25 -0
- package/dist/exports/NavigationTree.mjs.map +1 -0
- package/dist/exports/PreviewTrigger.cjs +26 -0
- package/dist/exports/PreviewTrigger.cjs.map +1 -0
- package/dist/exports/PreviewTrigger.js +21 -0
- package/dist/exports/PreviewTrigger.js.map +1 -0
- package/dist/exports/PreviewTrigger.mjs +21 -0
- package/dist/exports/PreviewTrigger.mjs.map +1 -0
- package/dist/exports/TokenField.cjs +31 -0
- package/dist/exports/TokenField.cjs.map +1 -0
- package/dist/exports/TokenField.js +21 -0
- package/dist/exports/TokenField.js.map +1 -0
- package/dist/exports/TokenField.mjs +21 -0
- package/dist/exports/TokenField.mjs.map +1 -0
- package/dist/exports/Tree.cjs.map +1 -1
- package/dist/exports/Tree.js.map +1 -1
- package/dist/exports/Tree.mjs.map +1 -1
- package/dist/exports/index.cjs +25 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +12 -2
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +12 -2
- package/dist/exports/index.mjs.map +1 -1
- package/dist/private/Checkbox.cjs.map +1 -1
- package/dist/private/Checkbox.js.map +1 -1
- package/dist/private/Checkbox.mjs.map +1 -1
- package/dist/private/ComboBox.cjs +21 -2
- package/dist/private/ComboBox.cjs.map +1 -1
- package/dist/private/ComboBox.js +21 -2
- package/dist/private/ComboBox.js.map +1 -1
- package/dist/private/ComboBox.mjs +21 -2
- package/dist/private/ComboBox.mjs.map +1 -1
- package/dist/private/Dialog.cjs +21 -1
- package/dist/private/Dialog.cjs.map +1 -1
- package/dist/private/Dialog.js +21 -1
- package/dist/private/Dialog.js.map +1 -1
- package/dist/private/Dialog.mjs +21 -1
- package/dist/private/Dialog.mjs.map +1 -1
- package/dist/private/DragAndDrop.cjs +1 -0
- package/dist/private/DragAndDrop.cjs.map +1 -1
- package/dist/private/DragAndDrop.js +1 -0
- package/dist/private/DragAndDrop.js.map +1 -1
- package/dist/private/DragAndDrop.mjs +1 -0
- package/dist/private/DragAndDrop.mjs.map +1 -1
- package/dist/private/DropZone.cjs +5 -2
- package/dist/private/DropZone.cjs.map +1 -1
- package/dist/private/DropZone.js +5 -3
- package/dist/private/DropZone.js.map +1 -1
- package/dist/private/DropZone.mjs +5 -2
- package/dist/private/DropZone.mjs.map +1 -1
- package/dist/private/FileTrigger.cjs +1 -0
- package/dist/private/FileTrigger.cjs.map +1 -1
- package/dist/private/FileTrigger.js +1 -0
- package/dist/private/FileTrigger.js.map +1 -1
- package/dist/private/FileTrigger.mjs +1 -0
- package/dist/private/FileTrigger.mjs.map +1 -1
- package/dist/private/GridLayout.cjs +3 -1
- package/dist/private/GridLayout.cjs.map +1 -1
- package/dist/private/GridLayout.js +3 -1
- package/dist/private/GridLayout.js.map +1 -1
- package/dist/private/GridLayout.mjs +3 -1
- package/dist/private/GridLayout.mjs.map +1 -1
- package/dist/private/GridList.cjs +12 -1
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js +12 -1
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs +12 -1
- package/dist/private/GridList.mjs.map +1 -1
- package/dist/private/ListBox.cjs +9 -1
- package/dist/private/ListBox.cjs.map +1 -1
- package/dist/private/ListBox.js +9 -1
- package/dist/private/ListBox.js.map +1 -1
- package/dist/private/ListBox.mjs +9 -1
- package/dist/private/ListBox.mjs.map +1 -1
- package/dist/private/Menu.cjs +59 -2
- package/dist/private/Menu.cjs.map +1 -1
- package/dist/private/Menu.js +60 -4
- package/dist/private/Menu.js.map +1 -1
- package/dist/private/Menu.mjs +60 -4
- package/dist/private/Menu.mjs.map +1 -1
- package/dist/private/Meter.cjs +2 -1
- package/dist/private/Meter.cjs.map +1 -1
- package/dist/private/Meter.js +2 -1
- package/dist/private/Meter.js.map +1 -1
- package/dist/private/Meter.mjs +2 -1
- package/dist/private/Meter.mjs.map +1 -1
- package/dist/private/Modal.cjs +2 -0
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.js +2 -0
- package/dist/private/Modal.js.map +1 -1
- package/dist/private/Modal.mjs +2 -0
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/NavigationTree.cjs +272 -0
- package/dist/private/NavigationTree.cjs.map +1 -0
- package/dist/private/NavigationTree.js +258 -0
- package/dist/private/NavigationTree.js.map +1 -0
- package/dist/private/NavigationTree.mjs +257 -0
- package/dist/private/NavigationTree.mjs.map +1 -0
- package/dist/private/Popover.cjs +34 -9
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.js +34 -9
- package/dist/private/Popover.js.map +1 -1
- package/dist/private/Popover.mjs +34 -9
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/PreviewTrigger.cjs +88 -0
- package/dist/private/PreviewTrigger.cjs.map +1 -0
- package/dist/private/PreviewTrigger.js +80 -0
- package/dist/private/PreviewTrigger.js.map +1 -0
- package/dist/private/PreviewTrigger.mjs +79 -0
- package/dist/private/PreviewTrigger.mjs.map +1 -0
- package/dist/private/ProgressBar.cjs +6 -1
- package/dist/private/ProgressBar.cjs.map +1 -1
- package/dist/private/ProgressBar.js +6 -1
- package/dist/private/ProgressBar.js.map +1 -1
- package/dist/private/ProgressBar.mjs +6 -1
- package/dist/private/ProgressBar.mjs.map +1 -1
- package/dist/private/RadioGroup.cjs.map +1 -1
- package/dist/private/RadioGroup.js.map +1 -1
- package/dist/private/RadioGroup.mjs.map +1 -1
- package/dist/private/Select.cjs.map +1 -1
- package/dist/private/Select.js.map +1 -1
- package/dist/private/Select.mjs.map +1 -1
- package/dist/private/Switch.cjs +8 -2
- package/dist/private/Switch.cjs.map +1 -1
- package/dist/private/Switch.js +9 -3
- package/dist/private/Switch.js.map +1 -1
- package/dist/private/Switch.mjs +9 -3
- package/dist/private/Switch.mjs.map +1 -1
- package/dist/private/Table.cjs +26 -14
- package/dist/private/Table.cjs.map +1 -1
- package/dist/private/Table.js +26 -14
- package/dist/private/Table.js.map +1 -1
- package/dist/private/Table.mjs +26 -14
- package/dist/private/Table.mjs.map +1 -1
- package/dist/private/TableLayout.cjs +3 -1
- package/dist/private/TableLayout.cjs.map +1 -1
- package/dist/private/TableLayout.js +3 -1
- package/dist/private/TableLayout.js.map +1 -1
- package/dist/private/TableLayout.mjs +3 -1
- package/dist/private/TableLayout.mjs.map +1 -1
- package/dist/private/TagGroup.cjs +1 -0
- package/dist/private/TagGroup.cjs.map +1 -1
- package/dist/private/TagGroup.js +1 -0
- package/dist/private/TagGroup.js.map +1 -1
- package/dist/private/TagGroup.mjs +1 -0
- package/dist/private/TagGroup.mjs.map +1 -1
- package/dist/private/Text.cjs +3 -1
- package/dist/private/Text.cjs.map +1 -1
- package/dist/private/Text.js +4 -2
- package/dist/private/Text.js.map +1 -1
- package/dist/private/Text.mjs +4 -2
- package/dist/private/Text.mjs.map +1 -1
- package/dist/private/ToggleButton.cjs.map +1 -1
- package/dist/private/ToggleButton.js.map +1 -1
- package/dist/private/ToggleButton.mjs.map +1 -1
- package/dist/private/TokenField.cjs +235 -0
- package/dist/private/TokenField.cjs.map +1 -0
- package/dist/private/TokenField.js +225 -0
- package/dist/private/TokenField.js.map +1 -0
- package/dist/private/TokenField.mjs +223 -0
- package/dist/private/TokenField.mjs.map +1 -0
- package/dist/private/Tooltip.cjs +10 -2
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.js +10 -2
- package/dist/private/Tooltip.js.map +1 -1
- package/dist/private/Tooltip.mjs +10 -2
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/private/Tree.cjs +11 -1
- package/dist/private/Tree.cjs.map +1 -1
- package/dist/private/Tree.js +11 -1
- package/dist/private/Tree.js.map +1 -1
- package/dist/private/Tree.mjs +11 -1
- package/dist/private/Tree.mjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.cjs +11 -6
- package/dist/private/TreeDropTargetDelegate.cjs.map +1 -1
- package/dist/private/TreeDropTargetDelegate.js +11 -6
- package/dist/private/TreeDropTargetDelegate.js.map +1 -1
- package/dist/private/TreeDropTargetDelegate.mjs +11 -6
- package/dist/private/TreeDropTargetDelegate.mjs.map +1 -1
- package/dist/private/Virtualizer.cjs +18 -16
- package/dist/private/Virtualizer.cjs.map +1 -1
- package/dist/private/Virtualizer.js +18 -16
- package/dist/private/Virtualizer.js.map +1 -1
- package/dist/private/Virtualizer.mjs +18 -16
- package/dist/private/Virtualizer.mjs.map +1 -1
- package/dist/private/useDragAndDrop.cjs +7 -0
- package/dist/private/useDragAndDrop.cjs.map +1 -1
- package/dist/private/useDragAndDrop.js +7 -0
- package/dist/private/useDragAndDrop.js.map +1 -1
- package/dist/private/useDragAndDrop.mjs +7 -0
- package/dist/private/useDragAndDrop.mjs.map +1 -1
- package/dist/private/utils.cjs.map +1 -1
- package/dist/private/utils.js.map +1 -1
- package/dist/private/utils.mjs.map +1 -1
- package/dist/types/exports/GridList.d.ts +1 -1
- package/dist/types/exports/Menu.d.ts +2 -2
- package/dist/types/exports/NavigationTree.d.ts +8 -0
- package/dist/types/exports/PreviewTrigger.d.ts +3 -0
- package/dist/types/exports/TokenField.d.ts +5 -0
- package/dist/types/exports/Tree.d.ts +1 -1
- package/dist/types/exports/index.d.ts +14 -5
- package/dist/types/src/Breadcrumbs.d.ts +2 -2
- package/dist/types/src/Button.d.ts +1 -1
- package/dist/types/src/Calendar.d.ts +6 -6
- package/dist/types/src/Checkbox.d.ts +8 -8
- package/dist/types/src/Collection.d.ts +1 -1
- package/dist/types/src/ComboBox.d.ts +6 -3
- package/dist/types/src/DateField.d.ts +4 -4
- package/dist/types/src/DatePicker.d.ts +2 -2
- package/dist/types/src/Dialog.d.ts +2 -2
- package/dist/types/src/Disclosure.d.ts +2 -2
- package/dist/types/src/GridList.d.ts +18 -7
- package/dist/types/src/Group.d.ts +1 -1
- package/dist/types/src/Header.d.ts +1 -1
- package/dist/types/src/Input.d.ts +1 -1
- package/dist/types/src/Label.d.ts +1 -1
- package/dist/types/src/Link.d.ts +1 -1
- package/dist/types/src/ListBox.d.ts +6 -6
- package/dist/types/src/Menu.d.ts +25 -6
- package/dist/types/src/Meter.d.ts +1 -1
- package/dist/types/src/Modal.d.ts +2 -2
- package/dist/types/src/NavigationTree.d.ts +80 -0
- package/dist/types/src/NumberField.d.ts +1 -1
- package/dist/types/src/OverlayArrow.d.ts +1 -1
- package/dist/types/src/Popover.d.ts +8 -1
- package/dist/types/src/PreviewTrigger.d.ts +23 -0
- package/dist/types/src/RadioGroup.d.ts +8 -8
- package/dist/types/src/SearchField.d.ts +1 -1
- package/dist/types/src/Select.d.ts +3 -3
- package/dist/types/src/Separator.d.ts +1 -1
- package/dist/types/src/Slider.d.ts +5 -5
- package/dist/types/src/Switch.d.ts +7 -7
- package/dist/types/src/Table.d.ts +32 -8
- package/dist/types/src/Tabs.d.ts +5 -5
- package/dist/types/src/TagGroup.d.ts +3 -3
- package/dist/types/src/Text.d.ts +1 -1
- package/dist/types/src/TextField.d.ts +1 -1
- package/dist/types/src/Toast.d.ts +3 -3
- package/dist/types/src/ToggleButton.d.ts +1 -1
- package/dist/types/src/ToggleButtonGroup.d.ts +1 -1
- package/dist/types/src/TokenField.d.ts +111 -0
- package/dist/types/src/Toolbar.d.ts +1 -1
- package/dist/types/src/Tooltip.d.ts +1 -1
- package/dist/types/src/Tree.d.ts +12 -10
- package/dist/types/src/Virtualizer.d.ts +4 -0
- package/dist/types/src/utils.d.ts +19 -5
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +33 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,0BAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GACnF;YACA,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBACzB;gBACA;gB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CAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,CAAA,GAAA,6CAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
|
|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AAM,aAAa;gBAAA;aACtF;YACD;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK7B,qCAAqC;AACvC;AAcA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,mCAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,yCAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,uDAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,CAAA,GAAA,6CAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n // oxlint-disable react/react-compiler\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
|
package/dist/private/Modal.js
CHANGED
|
@@ -135,6 +135,7 @@ function $46ccb41fa2c44f44$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
135
135
|
'--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,
|
|
136
136
|
'--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
|
|
137
137
|
};
|
|
138
|
+
// oxlint-disable react/react-compiler
|
|
138
139
|
return /*#__PURE__*/ (0, $auKl7$react).createElement((0, $auKl7$Overlay), {
|
|
139
140
|
isExiting: props.isExiting,
|
|
140
141
|
portalContainer: UNSTABLE_portalContainer
|
|
@@ -164,6 +165,7 @@ function $46ccb41fa2c44f44$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
164
165
|
]
|
|
165
166
|
]
|
|
166
167
|
}, renderProps.children)));
|
|
168
|
+
// oxlint-enable react/react-compiler
|
|
167
169
|
}
|
|
168
170
|
function $46ccb41fa2c44f44$var$ModalContent(props) {
|
|
169
171
|
let { modalProps: modalProps, modalRef: modalRef, isExiting: isExiting, isDismissable: isDismissable } = (0, $auKl7$useContext)($46ccb41fa2c44f44$var$InternalModalContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,oBAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GACnF;YACA,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBACzB;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACD;YACD,MAAM,eAAe,OAAO,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA,MAAO,WAAW,GAAG,CAAC;YACrE,QAAQ,IAAI,CACV,CAAC,wDAAwD,EAAE,aAAa,IAAI,CAAC,MAAM,+CAA+C,CAAC;QAEvI;QACA,qBACE,gCAAC;YAAc,GAAG,KAAK;YAAE,UAAU;WAChC,MAAM,QAAQ;IAGrB;IAEA,IAAI,iBACF,aAAa,6BACb,yBAAyB,UACzB,MAAM,eACN,WAAW,gBACX,YAAY,YACZ,QAAQ,cACR,UAAU,aACV,SAAS,4BACT,wBAAwB,gCACxB,4BAA4B,EAC5B,GAAG,YACJ,GAAG;IAEJ,qBACE,gCAAC;QACC,eAAe;QACf,2BAA2B;QAC3B,QAAQ;QACR,aAAa;QACb,cAAc;QACd,YAAY;QACZ,WAAW;QACX,0BAA0B;QAC1B,8BAA8B;qBAC9B,gCAAC;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QAAQ;YACN;gBACE;gBACA;gCAAC;8BAAY;oBAAU,WAAW,MAAM,SAAS;oBAAE,eAAe,MAAM,aAAa;gBAAA;aACtF;YACD;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK/B;AAcA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,mBAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,wBAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,oBAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GACnF;YACA,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBACzB;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACD;YACD,MAAM,eAAe,OAAO,IAAI,CAAC,OAAO,MAAM,CA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BACZ;mBACA;QACF;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n // oxlint-disable react/react-compiler\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.js.map"}
|
package/dist/private/Modal.mjs
CHANGED
|
@@ -135,6 +135,7 @@ function $8b8d26808cb8cb53$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
135
135
|
'--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,
|
|
136
136
|
'--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
|
|
137
137
|
};
|
|
138
|
+
// oxlint-disable react/react-compiler
|
|
138
139
|
return /*#__PURE__*/ (0, $gJBoF$react).createElement((0, $gJBoF$Overlay), {
|
|
139
140
|
isExiting: props.isExiting,
|
|
140
141
|
portalContainer: UNSTABLE_portalContainer
|
|
@@ -164,6 +165,7 @@ function $8b8d26808cb8cb53$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
164
165
|
]
|
|
165
166
|
]
|
|
166
167
|
}, renderProps.children)));
|
|
168
|
+
// oxlint-enable react/react-compiler
|
|
167
169
|
}
|
|
168
170
|
function $8b8d26808cb8cb53$var$ModalContent(props) {
|
|
169
171
|
let { modalProps: modalProps, modalRef: modalRef, isExiting: isExiting, isDismissable: isDismissable } = (0, $gJBoF$useContext)($8b8d26808cb8cb53$var$InternalModalContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,oBAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GACnF;YACA,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBACzB;gBACA;g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a,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.mjs.map"}
|
|
1
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F;YACD;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK7B,qCAAqC;AACvC;AAcA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,mBAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,wBAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\n SlotProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n // oxlint-disable react/react-compiler\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.mjs.map"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
var $048d76b84370f141$exports = require("./utils.cjs");
|
|
2
|
+
var $993df839da838aaa$exports = require("./Link.cjs");
|
|
3
|
+
var $8b1888e80597ea2d$exports = require("./Tree.cjs");
|
|
4
|
+
var $38I3X$reactariaprivateutilsgetScrollParent = require("react-aria/private/utils/getScrollParent");
|
|
5
|
+
var $38I3X$reactariaprivateutilsshadowdomDOMFunctions = require("react-aria/private/utils/shadowdom/DOMFunctions");
|
|
6
|
+
var $38I3X$react = require("react");
|
|
7
|
+
var $38I3X$reactariaprivateutilsscrollIntoView = require("react-aria/private/utils/scrollIntoView");
|
|
8
|
+
var $38I3X$reactariauseObjectRef = require("react-aria/useObjectRef");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function $parcel$interopDefault(a) {
|
|
12
|
+
return a && a.__esModule ? a.default : a;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function $parcel$export(e, n, v, s) {
|
|
16
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$parcel$export(module.exports, "NavigationTreeContext", function () { return $afbb4be38057f532$export$8e343761409a7fb5; });
|
|
20
|
+
$parcel$export(module.exports, "NavigationTreeItemStateContext", function () { return $afbb4be38057f532$export$b9f1b2079cbb81f1; });
|
|
21
|
+
$parcel$export(module.exports, "NavigationTree", function () { return $afbb4be38057f532$export$6e5dd080808827ae; });
|
|
22
|
+
$parcel$export(module.exports, "NavigationTreeItem", function () { return $afbb4be38057f532$export$4040580f267549f5; });
|
|
23
|
+
$parcel$export(module.exports, "NavigationTreeItemContent", function () { return $afbb4be38057f532$export$e83a20cfc1acabb9; });
|
|
24
|
+
$parcel$export(module.exports, "NavigationTreeSection", function () { return $afbb4be38057f532$export$ab0c034528c794e5; });
|
|
25
|
+
$parcel$export(module.exports, "NavigationTreeHeader", function () { return $afbb4be38057f532$export$ad4480f0a22f5045; });
|
|
26
|
+
/*
|
|
27
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
28
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
29
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
30
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
31
|
+
*
|
|
32
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
33
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
34
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
35
|
+
* governing permissions and limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const $afbb4be38057f532$export$8e343761409a7fb5 = /*#__PURE__*/ (0, $38I3X$react.createContext)(null);
|
|
45
|
+
const $afbb4be38057f532$var$InternalNavigationTreeContext = /*#__PURE__*/ (0, $38I3X$react.createContext)({});
|
|
46
|
+
const $afbb4be38057f532$var$NavigationTreeItemLinkContext = /*#__PURE__*/ (0, $38I3X$react.createContext)({});
|
|
47
|
+
const $afbb4be38057f532$export$b9f1b2079cbb81f1 = /*#__PURE__*/ (0, $38I3X$react.createContext)({
|
|
48
|
+
isCurrentAncestor: false
|
|
49
|
+
});
|
|
50
|
+
const $afbb4be38057f532$export$6e5dd080808827ae = /*#__PURE__*/ (0, $38I3X$react.forwardRef)(function NavigationTree(props, ref) {
|
|
51
|
+
[props, ref] = (0, $048d76b84370f141$exports.useContextProps)(props, ref, $afbb4be38057f532$export$8e343761409a7fb5);
|
|
52
|
+
let { className: className, style: style, children: children, selectedRoute: selectedRoute, ...rest } = props;
|
|
53
|
+
let syncedRouteRef = (0, $38I3X$react.useRef)(undefined);
|
|
54
|
+
let treeRef = (0, $38I3X$reactariauseObjectRef.useObjectRef)(ref);
|
|
55
|
+
let context = (0, $38I3X$react.useMemo)(()=>({
|
|
56
|
+
selectedRoute: selectedRoute,
|
|
57
|
+
syncedRouteRef: syncedRouteRef,
|
|
58
|
+
treeRef: treeRef
|
|
59
|
+
}), [
|
|
60
|
+
selectedRoute,
|
|
61
|
+
treeRef
|
|
62
|
+
]);
|
|
63
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$InternalNavigationTreeContext.Provider, {
|
|
64
|
+
value: context
|
|
65
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.Tree), {
|
|
66
|
+
...rest,
|
|
67
|
+
ref: treeRef,
|
|
68
|
+
className: className ?? 'react-aria-NavigationTree',
|
|
69
|
+
style: style,
|
|
70
|
+
selectionMode: "none",
|
|
71
|
+
keyboardNavigationBehavior: "tab"
|
|
72
|
+
}, children));
|
|
73
|
+
});
|
|
74
|
+
const $afbb4be38057f532$export$4040580f267549f5 = /*#__PURE__*/ (0, $38I3X$react.forwardRef)(function NavigationTreeItem(props, ref) {
|
|
75
|
+
let { href: href, hrefLang: hrefLang, target: target, rel: rel, download: download, ping: ping, referrerPolicy: referrerPolicy, routerOptions: routerOptions, className: className, style: style, render: render, ...rest } = props;
|
|
76
|
+
let { selectedRoute: selectedRoute, treeRef: treeRef } = (0, $38I3X$react.useContext)($afbb4be38057f532$var$InternalNavigationTreeContext);
|
|
77
|
+
let hasLink = href != null && href.length > 0;
|
|
78
|
+
let isCurrent = hasLink && href === selectedRoute;
|
|
79
|
+
let [isLinkFocused, setLinkFocused] = (0, $38I3X$react.useState)(false);
|
|
80
|
+
// Additional render props NavigationTreeItem adds to what TreeItem already provides.
|
|
81
|
+
let getItemRenderProps = (renderProps)=>({
|
|
82
|
+
...renderProps,
|
|
83
|
+
isCurrent: isCurrent,
|
|
84
|
+
isCurrentAncestor: $afbb4be38057f532$var$hasSelectedDescendant(renderProps.id, renderProps.state, selectedRoute),
|
|
85
|
+
isFocusVisible: renderProps.isFocusVisible || renderProps.isFocusVisibleWithin && isLinkFocused
|
|
86
|
+
});
|
|
87
|
+
let objRef = (0, $38I3X$reactariauseObjectRef.useObjectRef)(ref);
|
|
88
|
+
(0, $38I3X$react.useEffect)(()=>{
|
|
89
|
+
if (isCurrent && objRef.current) {
|
|
90
|
+
let scrollParent = (0, $38I3X$reactariaprivateutilsgetScrollParent.getScrollParent)(objRef.current, true);
|
|
91
|
+
// Only scroll the tree's own scroll container into view — never an outer ancestor such as the
|
|
92
|
+
// page. When the tree isn't its own scroll container the nearest scroll parent is outside the
|
|
93
|
+
// tree, so we skip rather than hijack the surrounding scroll position.
|
|
94
|
+
let treeRoot = treeRef?.current;
|
|
95
|
+
if (treeRoot && (0, $38I3X$reactariaprivateutilsshadowdomDOMFunctions.nodeContains)(treeRoot, scrollParent)) (0, $38I3X$reactariaprivateutilsscrollIntoView.scrollIntoView)(scrollParent, objRef.current, {
|
|
96
|
+
block: 'center'
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, [
|
|
100
|
+
isCurrent,
|
|
101
|
+
objRef,
|
|
102
|
+
treeRef
|
|
103
|
+
]);
|
|
104
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$NavigationTreeItemLinkContext.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
href: href,
|
|
107
|
+
hrefLang: hrefLang,
|
|
108
|
+
target: target,
|
|
109
|
+
rel: rel,
|
|
110
|
+
download: download,
|
|
111
|
+
ping: ping,
|
|
112
|
+
referrerPolicy: referrerPolicy,
|
|
113
|
+
routerOptions: routerOptions,
|
|
114
|
+
isCurrent: isCurrent,
|
|
115
|
+
isLinkFocused: isLinkFocused,
|
|
116
|
+
setLinkFocused: setLinkFocused
|
|
117
|
+
}
|
|
118
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeItem), {
|
|
119
|
+
...rest,
|
|
120
|
+
ref: objRef,
|
|
121
|
+
href: href,
|
|
122
|
+
focusMode: hasLink ? 'child' : undefined,
|
|
123
|
+
allowsArrowNavigation: true,
|
|
124
|
+
"data-current": isCurrent || undefined,
|
|
125
|
+
className: typeof className === 'function' ? (renderProps)=>className(getItemRenderProps(renderProps)) : className ?? 'react-aria-NavigationTreeItem',
|
|
126
|
+
style: typeof style === 'function' ? (renderProps)=>style(getItemRenderProps(renderProps)) : style,
|
|
127
|
+
render: (domProps, renderProps)=>{
|
|
128
|
+
let values = getItemRenderProps(renderProps);
|
|
129
|
+
let { children: rowChildren, ...domRest } = domProps;
|
|
130
|
+
let dataProps = {
|
|
131
|
+
'data-focus-visible': values.isFocusVisible || undefined,
|
|
132
|
+
'data-current-ancestor': values.isCurrentAncestor || undefined
|
|
133
|
+
};
|
|
134
|
+
let content = /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$export$b9f1b2079cbb81f1.Provider, {
|
|
135
|
+
value: {
|
|
136
|
+
isCurrentAncestor: values.isCurrentAncestor
|
|
137
|
+
}
|
|
138
|
+
}, rowChildren);
|
|
139
|
+
return typeof render === 'function' ? render({
|
|
140
|
+
...domRest,
|
|
141
|
+
...dataProps,
|
|
142
|
+
children: content
|
|
143
|
+
}, values) : /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $048d76b84370f141$exports.dom).div, {
|
|
144
|
+
...domRest,
|
|
145
|
+
...dataProps
|
|
146
|
+
}, content);
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
150
|
+
// The collection key of the item whose href matches `route`, or null.
|
|
151
|
+
function $afbb4be38057f532$var$findKeyForRoute(collection, route) {
|
|
152
|
+
for (let key of collection.getKeys()){
|
|
153
|
+
if (collection.getItem(key)?.props?.href === route) return key;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
// Walks up from `key` to the closest ancestor that is actually rendered (all ancestors expanded).
|
|
158
|
+
// Returns `key` unchanged when already visible. A collapsed ancestor hides everything beneath it,
|
|
159
|
+
// so the highest collapsed ancestor is the closest visible row.
|
|
160
|
+
function $afbb4be38057f532$var$closestVisibleKey(collection, expandedKeys, key) {
|
|
161
|
+
let target = key;
|
|
162
|
+
let node = collection.getItem(key);
|
|
163
|
+
while(node?.parentKey != null){
|
|
164
|
+
let parent = collection.getItem(node.parentKey);
|
|
165
|
+
if (parent?.type === 'item' && !expandedKeys.has(node.parentKey)) target = node.parentKey;
|
|
166
|
+
node = parent;
|
|
167
|
+
}
|
|
168
|
+
return target;
|
|
169
|
+
}
|
|
170
|
+
// Moves the tree's focused key to the item matching selectedRoute. Runs when the route or the
|
|
171
|
+
// collection changes; the shared syncedRouteRef dedupes across items so it fires once per change.
|
|
172
|
+
function $afbb4be38057f532$var$useRouteFocusSync({ state: state }) {
|
|
173
|
+
let { selectedRoute: selectedRoute, syncedRouteRef: syncedRouteRef } = (0, $38I3X$react.useContext)($afbb4be38057f532$var$InternalNavigationTreeContext);
|
|
174
|
+
let { collection: collection, selectionManager: selectionManager, expandedKeys: expandedKeys } = state;
|
|
175
|
+
(0, $38I3X$react.useEffect)(()=>{
|
|
176
|
+
if (selectedRoute == null || syncedRouteRef == null || syncedRouteRef.current === selectedRoute) return;
|
|
177
|
+
let key = $afbb4be38057f532$var$findKeyForRoute(collection, selectedRoute);
|
|
178
|
+
if (key != null) {
|
|
179
|
+
key = $afbb4be38057f532$var$closestVisibleKey(collection, expandedKeys, key);
|
|
180
|
+
syncedRouteRef.current = selectedRoute;
|
|
181
|
+
selectionManager.setFocusedKey(key);
|
|
182
|
+
}
|
|
183
|
+
}, [
|
|
184
|
+
selectedRoute,
|
|
185
|
+
collection,
|
|
186
|
+
expandedKeys,
|
|
187
|
+
syncedRouteRef,
|
|
188
|
+
selectionManager
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
// Cache so each row doesn't have to walk up the tree every time.
|
|
192
|
+
let $afbb4be38057f532$var$selectedAncestorsCache = new WeakMap();
|
|
193
|
+
// The set of collection keys that are ancestors of the item matching `selectedRoute`.
|
|
194
|
+
function $afbb4be38057f532$var$getSelectedAncestors(state, selectedRoute) {
|
|
195
|
+
let { collection: collection } = state;
|
|
196
|
+
let cached = $afbb4be38057f532$var$selectedAncestorsCache.get(collection);
|
|
197
|
+
if (cached && cached.selection === selectedRoute) return cached.ancestors;
|
|
198
|
+
let matchKey = $afbb4be38057f532$var$findKeyForRoute(collection, selectedRoute);
|
|
199
|
+
let ancestors = new Set();
|
|
200
|
+
let node = matchKey != null ? collection.getItem(matchKey) : null;
|
|
201
|
+
while(node?.parentKey != null && !ancestors.has(node.parentKey)){
|
|
202
|
+
ancestors.add(node.parentKey);
|
|
203
|
+
node = collection.getItem(node.parentKey);
|
|
204
|
+
}
|
|
205
|
+
$afbb4be38057f532$var$selectedAncestorsCache.set(collection, {
|
|
206
|
+
selection: selectedRoute,
|
|
207
|
+
ancestors: ancestors
|
|
208
|
+
});
|
|
209
|
+
return ancestors;
|
|
210
|
+
}
|
|
211
|
+
// Whether the row `id` is an ancestor of the item matching `selectedRoute`.
|
|
212
|
+
function $afbb4be38057f532$var$hasSelectedDescendant(id, state, selectedRoute) {
|
|
213
|
+
if (id == null || selectedRoute == null || !state) return false;
|
|
214
|
+
return $afbb4be38057f532$var$getSelectedAncestors(state, selectedRoute).has(id);
|
|
215
|
+
}
|
|
216
|
+
function $afbb4be38057f532$export$e83a20cfc1acabb9(props) {
|
|
217
|
+
let linkCtx = (0, $38I3X$react.useContext)($afbb4be38057f532$var$NavigationTreeItemLinkContext);
|
|
218
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeItemContent), props, (treeRenderProps)=>/*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$NavigationTreeItemContentInner, {
|
|
219
|
+
treeRenderProps: treeRenderProps,
|
|
220
|
+
linkCtx: linkCtx,
|
|
221
|
+
children: props.children
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
function $afbb4be38057f532$var$NavigationTreeItemContentInner(props) {
|
|
225
|
+
let { treeRenderProps: treeRenderProps, linkCtx: linkCtx, children: children } = props;
|
|
226
|
+
let { isCurrent: isCurrent, isLinkFocused: isLinkFocused, setLinkFocused: setLinkFocused, ...linkProps } = linkCtx;
|
|
227
|
+
let { state: state, isFocusVisible: isFocusVisible, isFocusVisibleWithin: isFocusVisibleWithin, id: id, hasChildItems: hasChildItems } = treeRenderProps;
|
|
228
|
+
let { isCurrentAncestor: isCurrentAncestor } = (0, $38I3X$react.useContext)($afbb4be38057f532$export$b9f1b2079cbb81f1);
|
|
229
|
+
$afbb4be38057f532$var$useRouteFocusSync({
|
|
230
|
+
state: state
|
|
231
|
+
});
|
|
232
|
+
// isFocusVisible follows the link: true when the row itself is keyboard focused, or when a child
|
|
233
|
+
// is keyboard focused and that child is the link (not another button/action).
|
|
234
|
+
let linkFocusVisible = isFocusVisible || isFocusVisibleWithin && !!isLinkFocused;
|
|
235
|
+
let values = {
|
|
236
|
+
...treeRenderProps,
|
|
237
|
+
isCurrent: !!isCurrent,
|
|
238
|
+
isCurrentAncestor: isCurrentAncestor,
|
|
239
|
+
isFocusVisible: linkFocusVisible
|
|
240
|
+
};
|
|
241
|
+
let renderChildren = typeof children === 'function' ? children(values) : children;
|
|
242
|
+
// Provide onFocusChange so the link reports its focus up to NavigationTreeItem.
|
|
243
|
+
let linkContextValue = {
|
|
244
|
+
...linkProps,
|
|
245
|
+
'aria-current': isCurrent ? 'page' : undefined,
|
|
246
|
+
onFocusChange: setLinkFocused,
|
|
247
|
+
onPress: linkProps.href == null && hasChildItems ? ()=>state.toggleKey(id) : undefined
|
|
248
|
+
};
|
|
249
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $048d76b84370f141$exports.Provider), {
|
|
250
|
+
values: [
|
|
251
|
+
[
|
|
252
|
+
(0, $993df839da838aaa$exports.LinkContext),
|
|
253
|
+
linkContextValue
|
|
254
|
+
]
|
|
255
|
+
]
|
|
256
|
+
}, renderChildren);
|
|
257
|
+
}
|
|
258
|
+
function $afbb4be38057f532$export$ab0c034528c794e5(props) {
|
|
259
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeSection), {
|
|
260
|
+
className: "react-aria-NavigationTreeSection",
|
|
261
|
+
...props
|
|
262
|
+
}, props.children);
|
|
263
|
+
}
|
|
264
|
+
function $afbb4be38057f532$export$ad4480f0a22f5045(props) {
|
|
265
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeHeader), {
|
|
266
|
+
className: "react-aria-NavigationTreeHeader",
|
|
267
|
+
...props
|
|
268
|
+
}, props.children);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
//# sourceMappingURL=NavigationTree.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;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AI,mBAAC,eAAe,WAAE,OAAO,YAAE,QAAQ,EAAC,GAAG;IAC3C,IAAI,aAAC,SAAS,iBAAE,aAAa,kBAAE,cAAc,EAAE,GAAG,WAAU,GAAG;IAC/D,IAAI,SAAC,KAAK,kBAAE,cAAc,wBAAE,oBAAoB,MAAE,EAAE,iBAAE,aAAa,EAAC,GAAG;IACvE,IAAI,qBAAC,iBAAiB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAErC,wCAAkB;eAAC;IAAK;IAExB,iGAAiG;IACjG,8EAA8E;IAC9E,IAAI,mBAAmB,kBAAmB,wBAAwB,CAAC,CAAC;IACpE,IAAI,SAA0F;QAC5F,GAAG,eAAe;QAClB,WAAW,CAAC,CAAC;2BACb;QACA,gBAAgB;IAClB;IACA,IAAI,iBAAiB,OAAO,aAAa,aAAa,SAAS,UAAU;IACzE,gFAAgF;IAChF,IAAI,mBAAmB;QACrB,GAAG,SAAS;QACZ,gBAAgB,YAAY,SAAS;QACrC,eAAe;QACf,SAAS,UAAU,IAAI,IAAI,QAAQ,gBAAgB,IAAM,MAAM,SAAS,CAAC,MAAM;IACjF;IACA,qBAAO,0DAAC,CAAA,GAAA,kCAAO;QAAE,QAAQ;YAAC;gBAAC,CAAA,GAAA,qCAAU;gBAAG;aAAiB;SAAC;OAAG;AAC/D;AAOO,SAAS,0CACd,KAAoC;IAEpC,qBACE,0DAAC,CAAA,GAAA,qCAAU;QAAE,WAAU;QAAoC,GAAG,KAAK;OAChE,MAAM,QAAQ;AAGrB;AAOO,SAAS,0CAAqB,KAAgC;IACnE,qBACE,0DAAC,CAAA,GAAA,oCAAS;QAAE,WAAU;QAAmC,GAAG,KAAK;OAC9D,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/NavigationTree.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 {\n ChildrenOrFunction,\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n StyleRenderProps,\n useContextProps\n} from './utils';\nimport {Collection, forwardRefType, Key, Node, RouterOptions} from '@react-types/shared';\nimport {getScrollParent} from 'react-aria/private/utils/getScrollParent';\nimport {LinkContext} from './Link';\nimport {nodeContains} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactNode,\n RefObject,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {scrollIntoView} from 'react-aria/private/utils/scrollIntoView';\nimport {\n Tree,\n TreeHeader,\n TreeHeaderProps,\n TreeItem,\n TreeItemContent,\n TreeItemContentRenderProps,\n TreeItemProps,\n TreeItemRenderProps,\n TreeProps,\n TreeRenderProps,\n TreeSection,\n TreeSectionProps\n} from './Tree';\nimport {TreeState} from 'react-stately/useTreeState';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const NavigationTreeContext =\n createContext<ContextValue<NavigationTreeProps<any>, HTMLDivElement>>(null);\n\ninterface InternalNavigationTreeContextValue {\n /** The route that is currently selected. */\n selectedRoute?: string | null;\n /** The last route the focused key was synced to; dedupes the focus sync across items. */\n syncedRouteRef?: RefObject<string | undefined>;\n /** The NavigationTree's root element, used to keep current-route scrolling inside the tree. */\n treeRef?: RefObject<HTMLDivElement | null>;\n}\nconst InternalNavigationTreeContext = createContext<InternalNavigationTreeContextValue>({});\n\ninterface NavigationTreeItemLinkContextValue {\n href?: string;\n hrefLang?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n ping?: string;\n referrerPolicy?: ReferrerPolicy;\n routerOptions?: RouterOptions;\n isCurrent?: boolean;\n // Whether the item's link (as opposed to another focusable child such as a button) is focused.\n isLinkFocused?: boolean;\n setLinkFocused?: (isFocused: boolean) => void;\n}\nconst NavigationTreeItemLinkContext = createContext<NavigationTreeItemLinkContextValue>({});\n\nexport const NavigationTreeItemStateContext = createContext<{isCurrentAncestor: boolean}>({\n isCurrentAncestor: false\n});\n\nexport interface NavigationTreeRenderProps extends Pick<\n TreeRenderProps,\n 'isEmpty' | 'isFocused' | 'isFocusVisible' | 'state'\n> {}\n\nexport interface NavigationTreeProps<T>\n extends\n Omit<\n TreeProps<T>,\n | 'selectionMode'\n | 'selectionBehavior'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'disallowEmptySelection'\n | 'disabledBehavior'\n | 'keyboardNavigationBehavior'\n | 'escapeKeyBehavior'\n | 'shouldSelectOnPressUp'\n | 'dragAndDropHooks'\n | 'renderEmptyState'\n | 'onAction'\n | 'className'\n | 'style'\n | 'render'\n >,\n StyleRenderProps<NavigationTreeRenderProps> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-NavigationTree'\n */\n className?: ClassNameOrFunction<NavigationTreeRenderProps>;\n /** The route that is currently selected, matched against each item's `href`. */\n selectedRoute?: string | null;\n}\n\n/**\n * A NavigationTree provides users with a way to navigate a nested, hierarchical set of links.\n */\nexport const NavigationTree = /*#__PURE__*/ (forwardRef as forwardRefType)(function NavigationTree<\n T\n>(props: NavigationTreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NavigationTreeContext);\n let {className, style, children, selectedRoute, ...rest} = props;\n let syncedRouteRef = useRef<string | undefined>(undefined);\n let treeRef = useObjectRef(ref);\n let context = useMemo(() => ({selectedRoute, syncedRouteRef, treeRef}), [selectedRoute, treeRef]);\n\n return (\n <InternalNavigationTreeContext.Provider value={context}>\n <Tree\n {...rest}\n ref={treeRef}\n className={className ?? 'react-aria-NavigationTree'}\n style={style}\n selectionMode=\"none\"\n keyboardNavigationBehavior=\"tab\">\n {children}\n </Tree>\n </InternalNavigationTreeContext.Provider>\n );\n});\n\nexport interface NavigationTreeItemRenderProps extends TreeItemRenderProps {\n /**\n * Whether this item is the current route (its `href` matches the NavigationTree's\n * `selectedRoute`).\n *\n * @selector [data-current]\n */\n isCurrent: boolean;\n /**\n * Whether this item is an ancestor of the current-route item (at any level, regardless of whether\n * it is expanded or collapsed).\n *\n * @selector [data-current-ancestor]\n */\n isCurrentAncestor: boolean;\n}\n\nexport interface NavigationTreeItemProps<T = object>\n extends\n Omit<\n TreeItemProps<T>,\n | 'className'\n | 'style'\n | 'render'\n | 'onAction'\n | 'allowsArrowNavigation'\n | 'focusMode'\n | 'value'\n >,\n StyleRenderProps<NavigationTreeItemRenderProps> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-NavigationTreeItem'\n */\n className?: ClassNameOrFunction<NavigationTreeItemRenderProps>;\n /**\n * The content of the side nav item along with any nested children. Supports static nested side\n * nav items or use of a Collection to dynamically render nested side nav items.\n */\n children: ReactNode;\n}\n\n/**\n * A NavigationTreeItem represents an individual item in a NavigationTree.\n */\nexport const NavigationTreeItem = /*#__PURE__*/ (forwardRef as forwardRefType)(\n function NavigationTreeItem<T extends object>(\n props: NavigationTreeItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) {\n let {\n href,\n hrefLang,\n target,\n rel,\n download,\n ping,\n referrerPolicy,\n routerOptions,\n className,\n style,\n render,\n ...rest\n } = props;\n let {selectedRoute, treeRef} = useContext(InternalNavigationTreeContext);\n let hasLink = href != null && href.length > 0;\n let isCurrent = hasLink && href === selectedRoute;\n let [isLinkFocused, setLinkFocused] = useState(false);\n // Additional render props NavigationTreeItem adds to what TreeItem already provides.\n let getItemRenderProps = <R extends TreeItemRenderProps>(\n renderProps: R\n ): R & {isCurrent: boolean; isCurrentAncestor: boolean} => ({\n ...renderProps,\n isCurrent,\n isCurrentAncestor: hasSelectedDescendant(renderProps.id, renderProps.state, selectedRoute),\n isFocusVisible:\n renderProps.isFocusVisible || (renderProps.isFocusVisibleWithin && isLinkFocused)\n });\n\n let objRef = useObjectRef(ref);\n useEffect(() => {\n if (isCurrent && objRef.current) {\n let scrollParent = getScrollParent(objRef.current, true) as HTMLElement;\n // Only scroll the tree's own scroll container into view — never an outer ancestor such as the\n // page. When the tree isn't its own scroll container the nearest scroll parent is outside the\n // tree, so we skip rather than hijack the surrounding scroll position.\n let treeRoot = treeRef?.current;\n if (treeRoot && nodeContains(treeRoot, scrollParent)) {\n scrollIntoView(scrollParent, objRef.current, {block: 'center'});\n }\n }\n }, [isCurrent, objRef, treeRef]);\n\n return (\n <NavigationTreeItemLinkContext.Provider\n value={{\n href,\n hrefLang,\n target,\n rel,\n download,\n ping,\n referrerPolicy,\n routerOptions,\n isCurrent,\n isLinkFocused,\n setLinkFocused\n }}>\n <TreeItem\n {...rest}\n ref={objRef}\n href={href}\n focusMode={hasLink ? 'child' : undefined}\n allowsArrowNavigation\n data-current={isCurrent || undefined}\n className={\n typeof className === 'function'\n ? renderProps => className(getItemRenderProps(renderProps))\n : (className ?? 'react-aria-NavigationTreeItem')\n }\n style={\n typeof style === 'function'\n ? renderProps => style(getItemRenderProps(renderProps))\n : style\n }\n render={(domProps, renderProps) => {\n let values = getItemRenderProps(renderProps);\n let {children: rowChildren, ...domRest} = domProps;\n let dataProps = {\n 'data-focus-visible': values.isFocusVisible || undefined,\n 'data-current-ancestor': values.isCurrentAncestor || undefined\n };\n let content = (\n <NavigationTreeItemStateContext.Provider\n value={{isCurrentAncestor: values.isCurrentAncestor}}>\n {rowChildren}\n </NavigationTreeItemStateContext.Provider>\n );\n return typeof render === 'function' ? (\n render({...domRest, ...dataProps, children: content}, values)\n ) : (\n <dom.div {...domRest} {...dataProps}>\n {content}\n </dom.div>\n );\n }}\n />\n </NavigationTreeItemLinkContext.Provider>\n );\n }\n);\n\nexport interface NavigationTreeItemContentRenderProps extends NavigationTreeItemRenderProps {}\n\nexport interface NavigationTreeItemContentProps {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children: ChildrenOrFunction<NavigationTreeItemContentRenderProps>;\n}\n\n// The collection key of the item whose href matches `route`, or null.\nfunction findKeyForRoute(collection: Collection<Node<unknown>>, route: string): Key | null {\n for (let key of collection.getKeys()) {\n if (collection.getItem(key)?.props?.href === route) {\n return key;\n }\n }\n return null;\n}\n\n// Walks up from `key` to the closest ancestor that is actually rendered (all ancestors expanded).\n// Returns `key` unchanged when already visible. A collapsed ancestor hides everything beneath it,\n// so the highest collapsed ancestor is the closest visible row.\nfunction closestVisibleKey(\n collection: Collection<Node<unknown>>,\n expandedKeys: Set<Key>,\n key: Key\n): Key {\n let target = key;\n let node = collection.getItem(key);\n while (node?.parentKey != null) {\n let parent = collection.getItem(node.parentKey);\n if (parent?.type === 'item' && !expandedKeys.has(node.parentKey)) {\n target = node.parentKey;\n }\n node = parent;\n }\n return target;\n}\n\n// Moves the tree's focused key to the item matching selectedRoute. Runs when the route or the\n// collection changes; the shared syncedRouteRef dedupes across items so it fires once per change.\nfunction useRouteFocusSync({state}: {state: TreeState<unknown>}): void {\n let {selectedRoute, syncedRouteRef} = useContext(InternalNavigationTreeContext);\n let {collection, selectionManager, expandedKeys} = state;\n useEffect(() => {\n if (\n selectedRoute == null ||\n syncedRouteRef == null ||\n syncedRouteRef.current === selectedRoute\n ) {\n return;\n }\n let key = findKeyForRoute(collection, selectedRoute);\n if (key != null) {\n key = closestVisibleKey(collection, expandedKeys, key);\n syncedRouteRef.current = selectedRoute;\n selectionManager.setFocusedKey(key);\n }\n }, [selectedRoute, collection, expandedKeys, syncedRouteRef, selectionManager]);\n}\n\n// Cache so each row doesn't have to walk up the tree every time.\nlet selectedAncestorsCache = new WeakMap<\n Collection<Node<unknown>>,\n {selection: unknown; ancestors: Set<Key>}\n>();\n\n// The set of collection keys that are ancestors of the item matching `selectedRoute`.\nfunction getSelectedAncestors(state: TreeState<unknown>, selectedRoute: string): Set<Key> {\n let {collection} = state;\n let cached = selectedAncestorsCache.get(collection);\n if (cached && cached.selection === selectedRoute) {\n return cached.ancestors;\n }\n let matchKey = findKeyForRoute(collection, selectedRoute);\n let ancestors = new Set<Key>();\n let node = matchKey != null ? collection.getItem(matchKey) : null;\n while (node?.parentKey != null && !ancestors.has(node.parentKey)) {\n ancestors.add(node.parentKey);\n node = collection.getItem(node.parentKey);\n }\n selectedAncestorsCache.set(collection, {selection: selectedRoute, ancestors});\n return ancestors;\n}\n\n// Whether the row `id` is an ancestor of the item matching `selectedRoute`.\nfunction hasSelectedDescendant(\n id: Key | undefined,\n state: TreeState<unknown>,\n selectedRoute: string | undefined | null\n): boolean {\n if (id == null || selectedRoute == null || !state) {\n return false;\n }\n return getSelectedAncestors(state, selectedRoute).has(id);\n}\n\nexport function NavigationTreeItemContent(props: NavigationTreeItemContentProps): ReactNode {\n let linkCtx = useContext(NavigationTreeItemLinkContext);\n return (\n <TreeItemContent {...props}>\n {(treeRenderProps: TreeItemContentRenderProps & {defaultChildren: ReactNode | undefined}) => (\n <NavigationTreeItemContentInner\n treeRenderProps={treeRenderProps}\n linkCtx={linkCtx}\n children={props.children}\n />\n )}\n </TreeItemContent>\n );\n}\n\ninterface NavigationTreeItemContentInnerProps {\n treeRenderProps: TreeItemContentRenderProps & {defaultChildren: ReactNode | undefined};\n linkCtx: NavigationTreeItemLinkContextValue;\n children: ChildrenOrFunction<NavigationTreeItemContentRenderProps>;\n}\n\nfunction NavigationTreeItemContentInner(props: NavigationTreeItemContentInnerProps): ReactNode {\n let {treeRenderProps, linkCtx, children} = props;\n let {isCurrent, isLinkFocused, setLinkFocused, ...linkProps} = linkCtx;\n let {state, isFocusVisible, isFocusVisibleWithin, id, hasChildItems} = treeRenderProps;\n let {isCurrentAncestor} = useContext(NavigationTreeItemStateContext);\n\n useRouteFocusSync({state});\n\n // isFocusVisible follows the link: true when the row itself is keyboard focused, or when a child\n // is keyboard focused and that child is the link (not another button/action).\n let linkFocusVisible = isFocusVisible || (isFocusVisibleWithin && !!isLinkFocused);\n let values: NavigationTreeItemContentRenderProps & {defaultChildren: ReactNode | undefined} = {\n ...treeRenderProps,\n isCurrent: !!isCurrent,\n isCurrentAncestor,\n isFocusVisible: linkFocusVisible\n };\n let renderChildren = typeof children === 'function' ? children(values) : children;\n // Provide onFocusChange so the link reports its focus up to NavigationTreeItem.\n let linkContextValue = {\n ...linkProps,\n 'aria-current': isCurrent ? 'page' : undefined,\n onFocusChange: setLinkFocused,\n onPress: linkProps.href == null && hasChildItems ? () => state.toggleKey(id) : undefined\n };\n return <Provider values={[[LinkContext, linkContextValue]]}>{renderChildren}</Provider>;\n}\n\nexport interface NavigationTreeSectionProps<T> extends Omit<TreeSectionProps<T>, 'value'> {}\n\n/**\n * A NavigationTreeSection represents a section within a NavigationTree.\n */\nexport function NavigationTreeSection<T extends object>(\n props: NavigationTreeSectionProps<T>\n): ReactNode {\n return (\n <TreeSection className=\"react-aria-NavigationTreeSection\" {...props}>\n {props.children}\n </TreeSection>\n );\n}\n\nexport interface NavigationTreeHeaderProps extends TreeHeaderProps {}\n\n/**\n * A NavigationTreeHeader renders the header of a NavigationTreeSection.\n */\nexport function NavigationTreeHeader(props: NavigationTreeHeaderProps): ReactNode {\n return (\n <TreeHeader className=\"react-aria-NavigationTreeHeader\" {...props}>\n {props.children}\n </TreeHeader>\n );\n}\n"],"names":[],"version":3,"file":"NavigationTree.cjs.map"}
|