@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":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAgEM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,0BAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IAAI,QAAQ,CAAA,GAAA,0DAAkB,EAAE;IAEhC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,mDAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD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G,CAAC,QAAQ,KAAK,cAClC,QAAQ,IAAI,CACV;IAGN;IAEA,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,kBAAkB;QAClB,WAAW,MAAM,SAAS;QAC1B,OAAO,MAAM,KAAK;QAClB,UAAU,MAAM,QAAQ;QACxB,QAAQ;YACN,OAAO,OAAO,SAAU,CAAA,KAAO,CAAA;QACjC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,6CAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,OAAO;QACT,GAAG,CAAA,GAAA,qCAAS,EAAE,UAAU,aAAa,YAAY;QAClD,QAAQ,MAAM,MAAM;QACpB,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,wCAAa;gBACb;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aACD;YACD;gBACE,CAAA,GAAA,qCAAU;gBACV;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE,CAAC;wBACjB,aAAa;oBACf;gBACF;aACD;YACD;gBACE,CAAA,GAAA,uCAAY;gBACZ;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BACL,SAAS,IAAM,OAAO;wBACxB;oBACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 */\nimport {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {TextContext} from './Text';\nimport {useId} from 'react-aria/useId';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element | null {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n // oxlint-disable-next-line react/react-compiler\n triggerProps.id = useId();\n // oxlint-disable-next-line react/react-compiler\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n // If within a collection (e.g. Tabs), render nothing.\n // Not using createHideableComponent for this because that also creates a forwardRef.\n let isHidden = useIsHidden();\n if (isHidden) {\n return null;\n }\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n id: overlayProps.id,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps, contentProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n TextContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n description: contentProps\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.cjs.map"}
|
package/dist/private/Dialog.js
CHANGED
|
@@ -3,12 +3,14 @@ import {DEFAULT_SLOT as $b7b7a92703138c9b$export$c62b8e45d58ddad9, dom as $b7b7a
|
|
|
3
3
|
import {HeadingContext as $cd487658cd83358d$export$d688439359537581} from "./Heading.js";
|
|
4
4
|
import {PopoverContext as $03df2f2d3cffb62f$export$9b9a0cd73afb7ca4} from "./Popover.js";
|
|
5
5
|
import {RootMenuTriggerStateContext as $113aa0613e727c6c$export$795aec4671cbae19} from "./Menu.js";
|
|
6
|
+
import {TextContext as $20d769b1e2b13352$export$9afb8bc826b033ea} from "./Text.js";
|
|
6
7
|
import {useDialog as $bX1PO$useDialog} from "react-aria/useDialog";
|
|
7
8
|
import {filterDOMProps as $bX1PO$filterDOMProps} from "react-aria/filterDOMProps";
|
|
8
9
|
import {mergeProps as $bX1PO$mergeProps} from "react-aria/mergeProps";
|
|
9
10
|
import {PressResponder as $bX1PO$PressResponder} from "react-aria/private/interactions/PressResponder";
|
|
10
11
|
import $bX1PO$react, {createContext as $bX1PO$createContext, useRef as $bX1PO$useRef, forwardRef as $bX1PO$forwardRef, useContext as $bX1PO$useContext} from "react";
|
|
11
12
|
import {useId as $bX1PO$useId} from "react-aria/useId";
|
|
13
|
+
import {useIsHidden as $bX1PO$useIsHidden} from "react-aria/private/collections/Hidden";
|
|
12
14
|
import {useMenuTriggerState as $bX1PO$useMenuTriggerState} from "react-stately/useMenuTriggerState";
|
|
13
15
|
import {useOverlayTrigger as $bX1PO$useOverlayTrigger} from "react-aria/useOverlayTrigger";
|
|
14
16
|
|
|
@@ -35,6 +37,8 @@ import {useOverlayTrigger as $bX1PO$useOverlayTrigger} from "react-aria/useOverl
|
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
|
|
40
|
+
|
|
41
|
+
|
|
38
42
|
const $acf8e70c2f419f18$export$8b93a07348a7730c = /*#__PURE__*/ (0, $bX1PO$createContext)(null);
|
|
39
43
|
const $acf8e70c2f419f18$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $bX1PO$createContext)(null);
|
|
40
44
|
function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
@@ -49,8 +53,14 @@ function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
|
49
53
|
// This is done in RAC instead of hooks because otherwise we cannot distinguish
|
|
50
54
|
// between context and props. Normally aria-labelledby overrides the title
|
|
51
55
|
// but when sent by context we want the title to win.
|
|
56
|
+
// oxlint-disable-next-line react/react-compiler
|
|
52
57
|
triggerProps.id = (0, $bX1PO$useId)();
|
|
58
|
+
// oxlint-disable-next-line react/react-compiler
|
|
53
59
|
overlayProps['aria-labelledby'] = triggerProps.id;
|
|
60
|
+
// If within a collection (e.g. Tabs), render nothing.
|
|
61
|
+
// Not using createHideableComponent for this because that also creates a forwardRef.
|
|
62
|
+
let isHidden = (0, $bX1PO$useIsHidden)();
|
|
63
|
+
if (isHidden) return null;
|
|
54
64
|
return /*#__PURE__*/ (0, $bX1PO$react).createElement((0, $b7b7a92703138c9b$export$2881499e37b75b9a), {
|
|
55
65
|
values: [
|
|
56
66
|
[
|
|
@@ -70,6 +80,7 @@ function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
|
70
80
|
{
|
|
71
81
|
trigger: 'DialogTrigger',
|
|
72
82
|
triggerRef: buttonRef,
|
|
83
|
+
id: overlayProps.id,
|
|
73
84
|
'aria-labelledby': overlayProps['aria-labelledby']
|
|
74
85
|
}
|
|
75
86
|
]
|
|
@@ -83,7 +94,7 @@ function $acf8e70c2f419f18$export$2e1e1122cf0cba88(props) {
|
|
|
83
94
|
const $acf8e70c2f419f18$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $bX1PO$forwardRef)(function Dialog(props, ref) {
|
|
84
95
|
let originalAriaLabelledby = props['aria-labelledby'];
|
|
85
96
|
[props, ref] = (0, $b7b7a92703138c9b$export$29f1550f4b0d4415)(props, ref, $acf8e70c2f419f18$export$8b93a07348a7730c);
|
|
86
|
-
let { dialogProps: dialogProps, titleProps: titleProps } = (0, $bX1PO$useDialog)({
|
|
97
|
+
let { dialogProps: dialogProps, titleProps: titleProps, contentProps: contentProps } = (0, $bX1PO$useDialog)({
|
|
87
98
|
...props,
|
|
88
99
|
// Only pass aria-labelledby from props, not context.
|
|
89
100
|
// Context is used as a fallback below.
|
|
@@ -127,6 +138,15 @@ const $acf8e70c2f419f18$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $bX1PO$forwa
|
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
140
|
],
|
|
141
|
+
[
|
|
142
|
+
(0, $20d769b1e2b13352$export$9afb8bc826b033ea),
|
|
143
|
+
{
|
|
144
|
+
slots: {
|
|
145
|
+
[(0, $b7b7a92703138c9b$export$c62b8e45d58ddad9)]: {},
|
|
146
|
+
description: contentProps
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
],
|
|
130
150
|
[
|
|
131
151
|
(0, $fc203795b9b363cd$export$24d547caef80ccd1),
|
|
132
152
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAgEM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAEhC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD,gDAAgD;IAChD,aAAa,EAAE,GAAG,CAAA,GAAA,YAAI;IACtB,gDAAgD;IAChD,YAAY,CAAC,kBAAkB,GAAG,aAAa,EAAE;IAEjD,sDAAsD;IACtD,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU;IACzB,IAAI,UACF,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA4B;aAAM;YACnC;gBAAC,CAAA,GAAA,yCAA0B;gBAAG;aAAM;YACpC;gBAAC;gBAAe;aAAa;YAC7B;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;oBACT,YAAY;oBACZ,IAAI,aAAa,EAAE;oBACnB,mBAAmB,YAAY,CAAC,kBAAkB;gBACpD;aACD;SACF;qBACD,gCAAC,CAAA,GAAA,qB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B,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aACD;YACD;gBACE,CAAA,GAAA,yCAAU;gBACV;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,aAAa;oBACf;gBACF;aACD;YACD;gBACE,CAAA,GAAA,yCAAY;gBACZ;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BACL,SAAS,IAAM,kBAAA,4BAAA,MAAO,KAAK;wBAC7B;oBACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 */\nimport {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {TextContext} from './Text';\nimport {useId} from 'react-aria/useId';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element | null {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n // oxlint-disable-next-line react/react-compiler\n triggerProps.id = useId();\n // oxlint-disable-next-line react/react-compiler\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n // If within a collection (e.g. Tabs), render nothing.\n // Not using createHideableComponent for this because that also creates a forwardRef.\n let isHidden = useIsHidden();\n if (isHidden) {\n return null;\n }\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n id: overlayProps.id,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps, contentProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n TextContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n description: contentProps\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.js.map"}
|
package/dist/private/Dialog.mjs
CHANGED
|
@@ -3,12 +3,14 @@ import {DEFAULT_SLOT as $7230ffa83bc0c2cf$export$c62b8e45d58ddad9, dom as $7230f
|
|
|
3
3
|
import {HeadingContext as $2ec61d1d4f780267$export$d688439359537581} from "./Heading.mjs";
|
|
4
4
|
import {PopoverContext as $542a13ca2fa5b484$export$9b9a0cd73afb7ca4} from "./Popover.mjs";
|
|
5
5
|
import {RootMenuTriggerStateContext as $49319ee1285aa241$export$795aec4671cbae19} from "./Menu.mjs";
|
|
6
|
+
import {TextContext as $efe09c6d1c304b50$export$9afb8bc826b033ea} from "./Text.mjs";
|
|
6
7
|
import {useDialog as $gV8PY$useDialog} from "react-aria/useDialog";
|
|
7
8
|
import {filterDOMProps as $gV8PY$filterDOMProps} from "react-aria/filterDOMProps";
|
|
8
9
|
import {mergeProps as $gV8PY$mergeProps} from "react-aria/mergeProps";
|
|
9
10
|
import {PressResponder as $gV8PY$PressResponder} from "react-aria/private/interactions/PressResponder";
|
|
10
11
|
import $gV8PY$react, {createContext as $gV8PY$createContext, useRef as $gV8PY$useRef, forwardRef as $gV8PY$forwardRef, useContext as $gV8PY$useContext} from "react";
|
|
11
12
|
import {useId as $gV8PY$useId} from "react-aria/useId";
|
|
13
|
+
import {useIsHidden as $gV8PY$useIsHidden} from "react-aria/private/collections/Hidden";
|
|
12
14
|
import {useMenuTriggerState as $gV8PY$useMenuTriggerState} from "react-stately/useMenuTriggerState";
|
|
13
15
|
import {useOverlayTrigger as $gV8PY$useOverlayTrigger} from "react-aria/useOverlayTrigger";
|
|
14
16
|
|
|
@@ -35,6 +37,8 @@ import {useOverlayTrigger as $gV8PY$useOverlayTrigger} from "react-aria/useOverl
|
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
|
|
40
|
+
|
|
41
|
+
|
|
38
42
|
const $f2ff30fde7b014be$export$8b93a07348a7730c = /*#__PURE__*/ (0, $gV8PY$createContext)(null);
|
|
39
43
|
const $f2ff30fde7b014be$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $gV8PY$createContext)(null);
|
|
40
44
|
function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
@@ -49,8 +53,14 @@ function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
|
49
53
|
// This is done in RAC instead of hooks because otherwise we cannot distinguish
|
|
50
54
|
// between context and props. Normally aria-labelledby overrides the title
|
|
51
55
|
// but when sent by context we want the title to win.
|
|
56
|
+
// oxlint-disable-next-line react/react-compiler
|
|
52
57
|
triggerProps.id = (0, $gV8PY$useId)();
|
|
58
|
+
// oxlint-disable-next-line react/react-compiler
|
|
53
59
|
overlayProps['aria-labelledby'] = triggerProps.id;
|
|
60
|
+
// If within a collection (e.g. Tabs), render nothing.
|
|
61
|
+
// Not using createHideableComponent for this because that also creates a forwardRef.
|
|
62
|
+
let isHidden = (0, $gV8PY$useIsHidden)();
|
|
63
|
+
if (isHidden) return null;
|
|
54
64
|
return /*#__PURE__*/ (0, $gV8PY$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
|
|
55
65
|
values: [
|
|
56
66
|
[
|
|
@@ -70,6 +80,7 @@ function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
|
70
80
|
{
|
|
71
81
|
trigger: 'DialogTrigger',
|
|
72
82
|
triggerRef: buttonRef,
|
|
83
|
+
id: overlayProps.id,
|
|
73
84
|
'aria-labelledby': overlayProps['aria-labelledby']
|
|
74
85
|
}
|
|
75
86
|
]
|
|
@@ -83,7 +94,7 @@ function $f2ff30fde7b014be$export$2e1e1122cf0cba88(props) {
|
|
|
83
94
|
const $f2ff30fde7b014be$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $gV8PY$forwardRef)(function Dialog(props, ref) {
|
|
84
95
|
let originalAriaLabelledby = props['aria-labelledby'];
|
|
85
96
|
[props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(props, ref, $f2ff30fde7b014be$export$8b93a07348a7730c);
|
|
86
|
-
let { dialogProps: dialogProps, titleProps: titleProps } = (0, $gV8PY$useDialog)({
|
|
97
|
+
let { dialogProps: dialogProps, titleProps: titleProps, contentProps: contentProps } = (0, $gV8PY$useDialog)({
|
|
87
98
|
...props,
|
|
88
99
|
// Only pass aria-labelledby from props, not context.
|
|
89
100
|
// Context is used as a fallback below.
|
|
@@ -127,6 +138,15 @@ const $f2ff30fde7b014be$export$3ddf2d174ce01153 = /*#__PURE__*/ (0, $gV8PY$forwa
|
|
|
127
138
|
}
|
|
128
139
|
}
|
|
129
140
|
],
|
|
141
|
+
[
|
|
142
|
+
(0, $efe09c6d1c304b50$export$9afb8bc826b033ea),
|
|
143
|
+
{
|
|
144
|
+
slots: {
|
|
145
|
+
[(0, $7230ffa83bc0c2cf$export$c62b8e45d58ddad9)]: {},
|
|
146
|
+
description: contentProps
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
],
|
|
130
150
|
[
|
|
131
151
|
(0, $7705c033048f6da7$export$24d547caef80ccd1),
|
|
132
152
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAgEM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IA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BACF;gBACF;aACD;SACF;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Dialog.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 */\nimport {AriaDialogProps, useDialog} from 'react-aria/useDialog';\n\nimport {ButtonContext} from './Button';\nimport {\n ContextValue,\n DEFAULT_SLOT,\n dom,\n DOMRenderProps,\n Provider,\n SlotProps,\n StyleProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {HeadingContext} from './Heading';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayTriggerProps, OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useContext,\n useRef\n} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\nimport {TextContext} from './Text';\nimport {useId} from 'react-aria/useId';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useMenuTriggerState} from 'react-stately/useMenuTriggerState';\nimport {useOverlayTrigger} from 'react-aria/useOverlayTrigger';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode;\n}\n\nexport interface DialogRenderProps {\n close: () => void;\n}\n\nexport interface DialogProps\n extends\n AriaDialogProps,\n StyleProps,\n SlotProps,\n DOMRenderProps<'section', undefined>,\n GlobalDOMAttributes<HTMLElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n *\n * @default 'react-aria-Dialog'\n */\n className?: string;\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode);\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps): JSX.Element | null {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n // oxlint-disable-next-line react/react-compiler\n triggerProps.id = useId();\n // oxlint-disable-next-line react/react-compiler\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n // If within a collection (e.g. Tabs), render nothing.\n // Not using createHideableComponent for this because that also creates a forwardRef.\n let isHidden = useIsHidden();\n if (isHidden) {\n return null;\n }\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [\n PopoverContext,\n {\n trigger: 'DialogTrigger',\n triggerRef: buttonRef,\n id: overlayProps.id,\n 'aria-labelledby': overlayProps['aria-labelledby']\n }\n ]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nexport const Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(function Dialog(\n props: DialogProps,\n ref: ForwardedRef<HTMLElement>\n) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps, contentProps} = useDialog(\n {\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n },\n ref\n );\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.'\n );\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.section\n {...mergeProps(DOMProps, renderProps, dialogProps)}\n render={props.render}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [\n HeadingContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }\n ],\n [\n TextContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n description: contentProps\n }\n }\n ],\n [\n ButtonContext,\n {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }\n ]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.section>\n );\n});\n"],"names":[],"version":3,"file":"Dialog.mjs.map"}
|
|
@@ -36,6 +36,7 @@ function $d3d8871226fc64f2$export$971707d8a129a1f7(dragAndDropHooks, dropState)
|
|
|
36
36
|
let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();
|
|
37
37
|
let fn = (0, $9uD35$react.useCallback)((target)=>{
|
|
38
38
|
// Only show drop indicators when virtual dragging or this is the current drop target.
|
|
39
|
+
// oxlint-disable-next-line react/react-compiler
|
|
39
40
|
if (isVirtualDragging || dropState?.isDropTarget(target)) return renderDropIndicator ? renderDropIndicator(target) : /*#__PURE__*/ (0, ($parcel$interopDefault($9uD35$react))).createElement($d3d8871226fc64f2$export$62ed72bc21f6b8a6, {
|
|
40
41
|
target: target
|
|
41
42
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,uBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAC1B,qBAAO,sHAAG,OAAO,OAAO;AAC1B;AAIO,SAAS,0CACd,gBAAmC,EACnC,SAAoC;IAEpC,IAAI,sBAAsB,kBAAkB;IAC5C,IAAI,oBAAoB,kBAAkB;IAC1C,IAAI,KAAK,CAAA,GAAA,wBAAU,EACjB,CAAC;QACC,sFAAsF;QACtF,IAAI,qBAAqB,WAAW,aAAa,SAC/C,OAAO,sBACL,oBAAoB,wBAEpB,0DAAC;YAAc,QAAQ;;IAG7B,GACA,6CAA6C;IAC7C,uDAAuD;IACvD;QAAC,WAAW;QAAQ;QAAmB;KAAoB;IAE7D,OAAO,kBAAkB,mBAAmB,KAAK;AACnD;AAEO,SAAS,yCACd,gBAA0C,EAC1C,gBAAmC,EACnC,SAAoC;IAEpC,mDAAmD;IACnD,IAAI,aAAa,iBAAiB,UAAU;IAC5C,IAAI,gBAAwC;IAC5C,IAAI,kBAAkB,yBAAyB,WAAW,QAAQ,SAAS,QAAQ;QACjF,gBAAgB,UAAU,MAAM,CAAC,GAAG;QACpC,IAAI,UAAU,MAAM,CAAC,YAAY,KAAK,SAAS;YAC7C,iFAAiF;YACjF,IAAI,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;YAC/C,IAAI,oBAAgC;YACpC,IAAI,WAAW,MAAM;gBACnB,IAAI,cAAc,UAAU,UAAU,CAAC,OAAO,CAAC,gBAAgB,SAAS;gBACxE,wGAAwG;gBACxG,MAAO,WAAW,KAAM;oBACtB,IAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC;oBACxC,qCAAqC;oBACrC,IAAI,CAAC,MACH;oBAEF,6EAA6E;oBAC7E,qCAAqC;oBACrC,IAAI,KAAK,IAAI,KAAK,QAAQ;wBACxB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;wBAC3C;oBACF;oBAEA,wDAAwD;oBACxD,qCAAqC;oBACrC,IAAI,AAAC,CAAA,KAAK,KAAK,IAAI,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;YAEA,kEAAkE;YAClE,gBAAgB,WAAW,qBAAqB;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,uBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAC1B,qBAAO,sHAAG,OAAO,OAAO;AAC1B;AAIO,SAAS,0CACd,gBAAmC,EACnC,SAAoC;IAEpC,IAAI,sBAAsB,kBAAkB;IAC5C,IAAI,oBAAoB,kBAAkB;IAC1C,IAAI,KAAK,CAAA,GAAA,wBAAU,EACjB,CAAC;QACC,sFAAsF;QACtF,gDAAgD;QAChD,IAAI,qBAAqB,WAAW,aAAa,SAC/C,OAAO,sBACL,oBAAoB,wBAEpB,0DAAC;YAAc,QAAQ;;IAG7B,GACA,6CAA6C;IAC7C,uDAAuD;IACvD;QAAC,WAAW;QAAQ;QAAmB;KAAoB;IAE7D,OAAO,kBAAkB,mBAAmB,KAAK;AACnD;AAEO,SAAS,yCACd,gBAA0C,EAC1C,gBAAmC,EACnC,SAAoC;IAEpC,mDAAmD;IACnD,IAAI,aAAa,iBAAiB,UAAU;IAC5C,IAAI,gBAAwC;IAC5C,IAAI,kBAAkB,yBAAyB,WAAW,QAAQ,SAAS,QAAQ;QACjF,gBAAgB,UAAU,MAAM,CAAC,GAAG;QACpC,IAAI,UAAU,MAAM,CAAC,YAAY,KAAK,SAAS;YAC7C,iFAAiF;YACjF,IAAI,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;YAC/C,IAAI,oBAAgC;YACpC,IAAI,WAAW,MAAM;gBACnB,IAAI,cAAc,UAAU,UAAU,CAAC,OAAO,CAAC,gBAAgB,SAAS;gBACxE,wGAAwG;gBACxG,MAAO,WAAW,KAAM;oBACtB,IAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC;oBACxC,qCAAqC;oBACrC,IAAI,CAAC,MACH;oBAEF,6EAA6E;oBAC7E,qCAAqC;oBACrC,IAAI,KAAK,IAAI,KAAK,QAAQ;wBACxB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;wBAC3C;oBACF;oBAEA,wDAAwD;oBACxD,qCAAqC;oBACrC,IAAI,AAAC,CAAA,KAAK,KAAK,IAAI,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;YAEA,kEAAkE;YAClE,gBAAgB,WAAW,qBAAqB;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,oBAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n // oxlint-disable-next-line react/react-compiler\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.cjs.map"}
|
|
@@ -23,6 +23,7 @@ function $49776fcddfd94ccc$export$971707d8a129a1f7(dragAndDropHooks, dropState)
|
|
|
23
23
|
let isVirtualDragging = dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks);
|
|
24
24
|
let fn = (0, $a4UvK$useCallback)((target)=>{
|
|
25
25
|
// Only show drop indicators when virtual dragging or this is the current drop target.
|
|
26
|
+
// oxlint-disable-next-line react/react-compiler
|
|
26
27
|
if (isVirtualDragging || (dropState === null || dropState === void 0 ? void 0 : dropState.isDropTarget(target))) return renderDropIndicator ? renderDropIndicator(target) : /*#__PURE__*/ (0, $a4UvK$react).createElement($49776fcddfd94ccc$export$62ed72bc21f6b8a6, {
|
|
27
28
|
target: target
|
|
28
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAC1B,qBAAO,kEAAG,OAAO,OAAO;AAC1B;AAIO,SAAS,0CACd,gBAAmC,EACnC,SAAoC;QAGZ;IADxB,IAAI,sBAAsB,6BAAA,uCAAA,iBAAkB,mBAAmB;IAC/D,IAAI,oBAAoB,6BAAA,wCAAA,sCAAA,iBAAkB,iBAAiB,cAAnC,0DAAA,yCAAA;IACxB,IAAI,KAAK,CAAA,GAAA,kBAAU,EACjB,CAAC;QACC,sFAAsF;QACtF,IAAI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AA,cAAA,KAAK,KAAK,cAAV,yBAAA,cAAc,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;gBAGgB;YADhB,kEAAkE;YAClE,gBAAgB,CAAA,OAAA,oBAAA,qBAAA,UAAW,+BAAX,kBAAA,OAAgC;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.js.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAC1B,qBAAO,kEAA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KAAM;oBACtB,IAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC;oBACxC,qCAAqC;oBACrC,IAAI,CAAC,MACH;oBAEF,6EAA6E;oBAC7E,qCAAqC;oBACrC,IAAI,KAAK,IAAI,KAAK,QAAQ;wBACxB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;wBAC3C;oBACF;wBAIK;oBAFL,wDAAwD;oBACxD,qCAAqC;oBACrC,IAAI,AAAC,CAAA,CAAA,cAAA,KAAK,KAAK,cAAV,yBAAA,cAAc,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;gBAGgB;YADhB,kEAAkE;YAClE,gBAAgB,CAAA,OAAA,oBAAA,qBAAA,UAAW,+BAAX,kBAAA,OAAgC;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n // oxlint-disable-next-line react/react-compiler\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.js.map"}
|
|
@@ -22,6 +22,7 @@ function $f9554a667e4f0374$export$971707d8a129a1f7(dragAndDropHooks, dropState)
|
|
|
22
22
|
let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();
|
|
23
23
|
let fn = (0, $k30rM$useCallback)((target)=>{
|
|
24
24
|
// Only show drop indicators when virtual dragging or this is the current drop target.
|
|
25
|
+
// oxlint-disable-next-line react/react-compiler
|
|
25
26
|
if (isVirtualDragging || dropState?.isDropTarget(target)) return renderDropIndicator ? renderDropIndicator(target) : /*#__PURE__*/ (0, $k30rM$react).createElement($f9554a667e4f0374$export$62ed72bc21f6b8a6, {
|
|
26
27
|
target: target
|
|
27
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAC1B,qBAAO,kEAAG,OAAO,OAAO;AAC1B;AAIO,SAAS,0CACd,gBAAmC,EACnC,SAAoC;IAEpC,IAAI,sBAAsB,kBAAkB;IAC5C,IAAI,oBAAoB,kBAAkB;IAC1C,IAAI,KAAK,CAAA,GAAA,kBAAU,EACjB,CAAC;QACC,sFAAsF;QACtF,IAAI,qBAAqB,WAAW,aAAa,SAC/C,OAAO,sBACL,oBAAoB,wBAEpB,gCAAC;YAAc,QAAQ;;IAG7B,GACA,6CAA6C;IAC7C,uDAAuD;IACvD;QAAC,WAAW;QAAQ;QAAmB;KAAoB;IAE7D,OAAO,kBAAkB,mBAAmB,KAAK;AACnD;AAEO,SAAS,yCACd,gBAA0C,EAC1C,gBAAmC,EACnC,SAAoC;IAEpC,mDAAmD;IACnD,IAAI,aAAa,iBAAiB,UAAU;IAC5C,IAAI,gBAAwC;IAC5C,IAAI,kBAAkB,yBAAyB,WAAW,QAAQ,SAAS,QAAQ;QACjF,gBAAgB,UAAU,MAAM,CAAC,GAAG;QACpC,IAAI,UAAU,MAAM,CAAC,YAAY,KAAK,SAAS;YAC7C,iFAAiF;YACjF,IAAI,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;YAC/C,IAAI,oBAAgC;YACpC,IAAI,WAAW,MAAM;gBACnB,IAAI,cAAc,UAAU,UAAU,CAAC,OAAO,CAAC,gBAAgB,SAAS;gBACxE,wGAAwG;gBACxG,MAAO,WAAW,KAAM;oBACtB,IAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC;oBACxC,qCAAqC;oBACrC,IAAI,CAAC,MACH;oBAEF,6EAA6E;oBAC7E,qCAAqC;oBACrC,IAAI,KAAK,IAAI,KAAK,QAAQ;wBACxB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;wBAC3C;oBACF;oBAEA,wDAAwD;oBACxD,qCAAqC;oBACrC,IAAI,AAAC,CAAA,KAAK,KAAK,IAAI,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;YAEA,kEAAkE;YAClE,gBAAgB,WAAW,qBAAqB;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.mjs.map"}
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC;AA0BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA2B,CAAC;AACnE,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAAoC;AA6B7E,MAAM,0DAAgB,CAAA,GAAA,iBAAS,EAAE,SAAS,cAC/C,KAAyB,EACzB,GAA8B;IAE9B,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAC1B,qBAAO,kEAAG,OAAO,OAAO;AAC1B;AAIO,SAAS,0CACd,gBAAmC,EACnC,SAAoC;IAEpC,IAAI,sBAAsB,kBAAkB;IAC5C,IAAI,oBAAoB,kBAAkB;IAC1C,IAAI,KAAK,CAAA,GAAA,kBAAU,EACjB,CAAC;QACC,sFAAsF;QACtF,gDAAgD;QAChD,IAAI,qBAAqB,WAAW,aAAa,SAC/C,OAAO,sBACL,oBAAoB,wBAEpB,gCAAC;YAAc,QAAQ;;IAG7B,GACA,6CAA6C;IAC7C,uDAAuD;IACvD;QAAC,WAAW;QAAQ;QAAmB;KAAoB;IAE7D,OAAO,kBAAkB,mBAAmB,KAAK;AACnD;AAEO,SAAS,yCACd,gBAA0C,EAC1C,gBAAmC,EACnC,SAAoC;IAEpC,mDAAmD;IACnD,IAAI,aAAa,iBAAiB,UAAU;IAC5C,IAAI,gBAAwC;IAC5C,IAAI,kBAAkB,yBAAyB,WAAW,QAAQ,SAAS,QAAQ;QACjF,gBAAgB,UAAU,MAAM,CAAC,GAAG;QACpC,IAAI,UAAU,MAAM,CAAC,YAAY,KAAK,SAAS;YAC7C,iFAAiF;YACjF,IAAI,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;YAC/C,IAAI,oBAAgC;YACpC,IAAI,WAAW,MAAM;gBACnB,IAAI,cAAc,UAAU,UAAU,CAAC,OAAO,CAAC,gBAAgB,SAAS;gBACxE,wGAAwG;gBACxG,MAAO,WAAW,KAAM;oBACtB,IAAI,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC;oBACxC,qCAAqC;oBACrC,IAAI,CAAC,MACH;oBAEF,6EAA6E;oBAC7E,qCAAqC;oBACrC,IAAI,KAAK,IAAI,KAAK,QAAQ;wBACxB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;wBAC3C;oBACF;oBAEA,wDAAwD;oBACxD,qCAAqC;oBACrC,IAAI,AAAC,CAAA,KAAK,KAAK,IAAI,CAAA,KAAM,aACvB;oBAGF,oBAAoB;oBACpB,UAAU,UAAU,UAAU,CAAC,WAAW,CAAC;gBAC7C;YACF;YAEA,kEAAkE;YAClE,gBAAgB,WAAW,qBAAqB;QAClD;IACF;IAEA,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,OAAO,IAAI,IAAI;YAAC;YAAY;SAAc,CAAC,MAAM,CAAC,CAAA,IAAK,KAAK;IAC9D,GAAG;QAAC;QAAY;KAAc;AAChC","sources":["packages/react-aria-components/src/DragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport type {DropIndicatorProps as AriaDropIndicatorProps} from 'react-aria/useDroppableCollection';\n\nimport type {ClassNameOrFunction, RenderProps} from './utils';\nimport type {DragAndDropHooks} from './useDragAndDrop';\nimport type {DraggableCollectionState} from 'react-stately/useDraggableCollectionState';\nimport type {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport type {ItemDropTarget, Key} from '@react-types/shared';\nimport type {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactNode,\n useCallback,\n useContext,\n useMemo\n} from 'react';\n\nexport interface DragAndDropContextValue {\n dragAndDropHooks?: DragAndDropHooks;\n dragState?: DraggableCollectionState;\n dropState?: DroppableCollectionState;\n}\n\nexport const DragAndDropContext = createContext<DragAndDropContextValue>({});\nexport const DropIndicatorContext = createContext<DropIndicatorContextValue | null>(null);\n\nexport interface DropIndicatorRenderProps {\n /**\n * Whether the drop indicator is currently the active drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n}\n\nexport interface DropIndicatorProps\n extends Omit<AriaDropIndicatorProps, 'activateButtonRef'>, RenderProps<DropIndicatorRenderProps> {\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-DropIndicator'\n */\n className?: ClassNameOrFunction<DropIndicatorRenderProps>;\n}\ninterface DropIndicatorContextValue {\n render: (props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) => ReactNode;\n}\n\n/**\n * A DropIndicator is rendered between items in a collection to indicate where dropped data will be\n * inserted.\n */\nexport const DropIndicator = forwardRef(function DropIndicator(\n props: DropIndicatorProps,\n ref: ForwardedRef<HTMLElement>\n): JSX.Element {\n let {render} = useContext(DropIndicatorContext)!;\n return <>{render(props, ref)}</>;\n});\n\ntype RenderDropIndicatorRetValue = ((target: ItemDropTarget) => ReactNode | undefined) | undefined;\n\nexport function useRenderDropIndicator(\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): RenderDropIndicatorRetValue {\n let renderDropIndicator = dragAndDropHooks?.renderDropIndicator;\n let isVirtualDragging = dragAndDropHooks?.isVirtualDragging?.();\n let fn = useCallback(\n (target: ItemDropTarget) => {\n // Only show drop indicators when virtual dragging or this is the current drop target.\n // oxlint-disable-next-line react/react-compiler\n if (isVirtualDragging || dropState?.isDropTarget(target)) {\n return renderDropIndicator ? (\n renderDropIndicator(target)\n ) : (\n <DropIndicator target={target} />\n );\n }\n },\n // We invalidate whenever the target changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [dropState?.target, isVirtualDragging, renderDropIndicator]\n );\n return dragAndDropHooks?.useDropIndicator ? fn : undefined;\n}\n\nexport function useDndPersistedKeys(\n selectionManager: MultipleSelectionManager,\n dragAndDropHooks?: DragAndDropHooks,\n dropState?: DroppableCollectionState\n): Set<Key> {\n // Persist the focused key and the drop target key.\n let focusedKey = selectionManager.focusedKey;\n let dropTargetKey: Key | null | undefined = null;\n if (dragAndDropHooks?.isVirtualDragging?.() && dropState?.target?.type === 'item') {\n dropTargetKey = dropState.target.key;\n if (dropState.target.dropPosition === 'after') {\n // Normalize to the \"before\" drop position since we only render those to the DOM.\n let nextKey = dropState.collection.getKeyAfter(dropTargetKey);\n let lastDescendantKey: Key | null = null;\n if (nextKey != null) {\n let targetLevel = dropState.collection.getItem(dropTargetKey)?.level ?? 0;\n // Skip over any rows that are descendants of the target (\"after\" position should be after all children)\n while (nextKey != null) {\n let node = dropState.collection.getItem(nextKey);\n // eslint-disable-next-line max-depth\n if (!node) {\n break;\n }\n // Skip over non-item nodes (e.g., loaders) since they can't be drop targets.\n // eslint-disable-next-line max-depth\n if (node.type !== 'item') {\n nextKey = dropState.collection.getKeyAfter(nextKey);\n continue;\n }\n\n // Stop once we find an item at the same level or higher\n // eslint-disable-next-line max-depth\n if ((node.level ?? 0) <= targetLevel) {\n break;\n }\n\n lastDescendantKey = nextKey;\n nextKey = dropState.collection.getKeyAfter(nextKey);\n }\n }\n\n // If nextKey is null (end of collection), use the last descendant\n dropTargetKey = nextKey ?? lastDescendantKey ?? dropTargetKey;\n }\n }\n\n return useMemo(() => {\n return new Set([focusedKey, dropTargetKey].filter(k => k != null));\n }, [focusedKey, dropTargetKey]);\n}\n"],"names":[],"version":3,"file":"DragAndDrop.mjs.map"}
|
|
@@ -3,6 +3,7 @@ var $5724b511a2687756$exports = require("./intlStrings.cjs");
|
|
|
3
3
|
var $cab7d9a238d19c33$exports = require("./Text.cjs");
|
|
4
4
|
var $2uDYL$reactariauseDrop = require("react-aria/useDrop");
|
|
5
5
|
var $2uDYL$reactariafilterDOMProps = require("react-aria/filterDOMProps");
|
|
6
|
+
var $2uDYL$reactariaprivateutilsfocusWithoutScrolling = require("react-aria/private/utils/focusWithoutScrolling");
|
|
6
7
|
var $2uDYL$reactariaprivateutilsshadowdomDOMFunctions = require("react-aria/private/utils/shadowdom/DOMFunctions");
|
|
7
8
|
var $2uDYL$reactariaprivateutilsisFocusable = require("react-aria/private/utils/isFocusable");
|
|
8
9
|
var $2uDYL$reactariamergeProps = require("react-aria/mergeProps");
|
|
@@ -56,9 +57,11 @@ $parcel$export(module.exports, "DropZone", function () { return $2d794bb643c2812
|
|
|
56
57
|
|
|
57
58
|
|
|
58
59
|
|
|
60
|
+
|
|
59
61
|
const $2d794bb643c28122$export$14a72053295ff9a6 = /*#__PURE__*/ (0, $2uDYL$react.createContext)(null);
|
|
60
62
|
const $2d794bb643c28122$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $2uDYL$react.forwardRef)(function DropZone(props, ref) {
|
|
61
63
|
let { isDisabled: isDisabled = false } = props;
|
|
64
|
+
// oxlint-disable-next-line react/react-compiler
|
|
62
65
|
[props, ref] = (0, $048d76b84370f141$exports.useContextProps)(props, ref, $2d794bb643c28122$export$14a72053295ff9a6);
|
|
63
66
|
let dropzoneRef = (0, $2uDYL$reactariauseObjectRef.useObjectRef)(ref);
|
|
64
67
|
let buttonRef = (0, $2uDYL$react.useRef)(null);
|
|
@@ -125,8 +128,8 @@ const $2d794bb643c28122$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $2uDYL$react.
|
|
|
125
128
|
let target = (0, $2uDYL$reactariaprivateutilsshadowdomDOMFunctions.getEventTarget)(e);
|
|
126
129
|
while(target && (0, $2uDYL$reactariaprivateutilsshadowdomDOMFunctions.nodeContains)(dropzoneRef.current, target)){
|
|
127
130
|
if ((0, $2uDYL$reactariaprivateutilsisFocusable.isFocusable)(target)) break;
|
|
128
|
-
else if (target === dropzoneRef.current) {
|
|
129
|
-
buttonRef.current
|
|
131
|
+
else if (target === dropzoneRef.current && buttonRef.current) {
|
|
132
|
+
(0, $2uDYL$reactariaprivateutilsfocusWithoutScrolling.focusWithoutScrolling)(buttonRef.current);
|
|
130
133
|
break;
|
|
131
134
|
}
|
|
132
135
|
target = target.parentElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AAkFM,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAA+C;AAKnF,MAAM,yDAAW,CAAA,GAAA,uBAAS,EAAE,SAAS,SAC1C,KAAoB,EACpB,GAAiC;IAEjC,IAAI,cAAC,aAAa,OAAM,GAAG;IAC3B,gDAAgD;IAChD,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,cAAc,CAAA,GAAA,yCAAW,EAAE;IAC/B,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAqB;IAC1C,IAAI,aAAC,SAAS,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,+BAAM,EAAE;QACvD,GAAG,KAAK;QACR,KAAK;QACL,eAAe;IACjB;IACA,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,mCAAQ,EAAE,mBAAmB,CAAC,GAAG;IACrD,IAAI,cAAC,U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CAAA,GAAA,gEAAa,EAAE;YAC5B,MAAO,UAAU,CAAA,GAAA,8DAAW,EAAE,YAAY,OAAO,EAAE,QAAS;gBAC1D,IAAI,CAAA,GAAA,mDAAU,EAAE,SACd;qBACK,IAAI,WAAW,YAAY,OAAO,IAAI,UAAU,OAAO,EAAE;oBAC9D,CAAA,GAAA,uEAAoB,EAAE,UAAU,OAAO;oBACvC;gBACF;gBAEA,SAAS,OAAO,aAAa;YAC/B;QACF;QACA,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,oBAAkB,gBAAgB;QAClC,iBAAe,cAAc;qBAC7B,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC;QACE,GAAG,CAAA,GAAA,qCAAS,EAAE,aAAa,YAAY,gBAAgB,WAAW;QACnE,KAAK;SAGR,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {AriaLabelingProps, GlobalDOMAttributes, HoverEvents} from '@react-types/shared';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DropOptions, useDrop} from 'react-aria/useDrop';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusWithoutScrolling} from 'react-aria/private/utils/focusWithoutScrolling';\nimport {getEventTarget, nodeContains} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport intlMessages from '../intl/*.json';\nimport {isFocusable} from 'react-aria/private/utils/isFocusable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\nimport {useButton} from 'react-aria/useButton';\nimport {useClipboard} from 'react-aria/useClipboard';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useLabels} from 'react-aria/private/utils/useLabels';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useSlotId} from 'react-aria/private/utils/useId';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface DropZoneRenderProps {\n /**\n * Whether the dropzone is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the dropzone is focused, either via a mouse or keyboard.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the dropzone is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the dropzone is the drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n /**\n * Whether the dropzone is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, 'getDropOperationForPoint' | 'ref' | 'hasDropButton'>,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\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-DropZone'\n */\n className?: ClassNameOrFunction<DropZoneRenderProps>;\n}\n\nexport const DropZoneContext = createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nexport const DropZone = forwardRef(function DropZone(\n props: DropZoneProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let {isDisabled = false} = props;\n // oxlint-disable-next-line react/react-compiler\n [props, ref] = useContextProps(props, ref, DropZoneContext);\n let dropzoneRef = useObjectRef(ref);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {dropProps, dropButtonProps, isDropTarget} = useDrop({\n ...props,\n ref: buttonRef,\n hasDropButton: true\n });\n let {buttonProps} = useButton(dropButtonProps || {}, buttonRef);\n let {hoverProps, isHovered} = useHover(props);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let textId = useSlotId();\n let ariaLabel = props['aria-label'] || stringFormatter.format('dropzoneLabel');\n let messageId = props['aria-labelledby'];\n let ariaLabelledby = [textId, messageId].filter(Boolean).join(' ');\n let labelProps = useLabels({'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby});\n\n let {clipboardProps} = useClipboard({\n isDisabled,\n onPaste: items =>\n props.onDrop?.({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy'\n })\n });\n\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isFocused, isFocusVisible, isDropTarget, isDisabled},\n defaultClassName: 'react-aria-DropZone'\n });\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider values={[[TextContext, {id: textId, slot: 'label'}]]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, dropProps, hoverProps)}\n slot={props.slot || undefined}\n ref={dropzoneRef}\n onClick={e => {\n let target = getEventTarget(e) as HTMLElement | null;\n while (target && nodeContains(dropzoneRef.current, target)) {\n if (isFocusable(target)) {\n break;\n } else if (target === dropzoneRef.current && buttonRef.current) {\n focusWithoutScrolling(buttonRef.current);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-drop-target={isDropTarget || undefined}\n data-disabled={isDisabled || undefined}>\n <VisuallyHidden>\n <button\n {...mergeProps(buttonProps, focusProps, clipboardProps, labelProps)}\n ref={buttonRef}\n />\n </VisuallyHidden>\n {renderProps.children}\n </dom.div>\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DropZone.cjs.map"}
|
package/dist/private/DropZone.js
CHANGED
|
@@ -3,6 +3,7 @@ import $jX5VW$intlStringsjs from "./intlStrings.js";
|
|
|
3
3
|
import {TextContext as $20d769b1e2b13352$export$9afb8bc826b033ea} from "./Text.js";
|
|
4
4
|
import {useDrop as $jX5VW$useDrop} from "react-aria/useDrop";
|
|
5
5
|
import {filterDOMProps as $jX5VW$filterDOMProps} from "react-aria/filterDOMProps";
|
|
6
|
+
import {focusWithoutScrolling as $jX5VW$focusWithoutScrolling} from "react-aria/private/utils/focusWithoutScrolling";
|
|
6
7
|
import {getEventTarget as $jX5VW$getEventTarget, nodeContains as $jX5VW$nodeContains} from "react-aria/private/utils/shadowdom/DOMFunctions";
|
|
7
8
|
import {isFocusable as $jX5VW$isFocusable} from "react-aria/private/utils/isFocusable";
|
|
8
9
|
import {mergeProps as $jX5VW$mergeProps} from "react-aria/mergeProps";
|
|
@@ -49,9 +50,11 @@ function $parcel$interopDefault(a) {
|
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
|
|
53
|
+
|
|
52
54
|
const $ceb97195dd95fbc4$export$14a72053295ff9a6 = /*#__PURE__*/ (0, $jX5VW$createContext)(null);
|
|
53
55
|
const $ceb97195dd95fbc4$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $jX5VW$forwardRef)(function DropZone(props, ref) {
|
|
54
56
|
let { isDisabled: isDisabled = false } = props;
|
|
57
|
+
// oxlint-disable-next-line react/react-compiler
|
|
55
58
|
[props, ref] = (0, $b7b7a92703138c9b$export$29f1550f4b0d4415)(props, ref, $ceb97195dd95fbc4$export$14a72053295ff9a6);
|
|
56
59
|
let dropzoneRef = (0, $jX5VW$useObjectRef)(ref);
|
|
57
60
|
let buttonRef = (0, $jX5VW$useRef)(null);
|
|
@@ -121,9 +124,8 @@ const $ceb97195dd95fbc4$export$3c6489d84dc98b6 = /*#__PURE__*/ (0, $jX5VW$forwar
|
|
|
121
124
|
let target = (0, $jX5VW$getEventTarget)(e);
|
|
122
125
|
while(target && (0, $jX5VW$nodeContains)(dropzoneRef.current, target)){
|
|
123
126
|
if ((0, $jX5VW$isFocusable)(target)) break;
|
|
124
|
-
else if (target === dropzoneRef.current) {
|
|
125
|
-
|
|
126
|
-
(_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
|
|
127
|
+
else if (target === dropzoneRef.current && buttonRef.current) {
|
|
128
|
+
(0, $jX5VW$focusWithoutScrolling)(buttonRef.current);
|
|
127
129
|
break;
|
|
128
130
|
}
|
|
129
131
|
target = target.parentElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;AAkFM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAA+C;AAKnF,MAAM,yDAAW,CAAA,GAAA,iBAAS,EAAE,SAAS,SAC1C,KAAoB,EACpB,GAAiC;IAEjC,IAAI,cAAC,aAAa,OAAM,GAAG;IAC3B,gDAAgD;IAChD,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,cAAc,CAAA,GAAA,mBAAW,EAAE;IAC/B,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,aAAC,SAAS,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QACvD,GAAG,KAAK;QACR,KAAK;QACL,eAAe;IACjB;IACA,IAAI,eAAC,WAAW,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,mBAAmB,CAAC,GAAG;IACrD,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC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ACP,IAAI,SAAS,CAAA,GAAA,qBAAa,EAAE;YAC5B,MAAO,UAAU,CAAA,GAAA,mBAAW,EAAE,YAAY,OAAO,EAAE,QAAS;gBAC1D,IAAI,CAAA,GAAA,kBAAU,EAAE,SACd;qBACK,IAAI,WAAW,YAAY,OAAO,IAAI,UAAU,OAAO,EAAE;oBAC9D,CAAA,GAAA,4BAAoB,EAAE,UAAU,OAAO;oBACvC;gBACF;gBAEA,SAAS,OAAO,aAAa;YAC/B;QACF;QACA,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,oBAAkB,gBAAgB;QAClC,iBAAe,cAAc;qBAC7B,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,YAAY,gBAAgB,WAAW;QACnE,KAAK;SAGR,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/DropZone.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {AriaLabelingProps, GlobalDOMAttributes, HoverEvents} from '@react-types/shared';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DropOptions, useDrop} from 'react-aria/useDrop';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusWithoutScrolling} from 'react-aria/private/utils/focusWithoutScrolling';\nimport {getEventTarget, nodeContains} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport intlMessages from '../intl/*.json';\nimport {isFocusable} from 'react-aria/private/utils/isFocusable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\nimport {useButton} from 'react-aria/useButton';\nimport {useClipboard} from 'react-aria/useClipboard';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useLabels} from 'react-aria/private/utils/useLabels';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useSlotId} from 'react-aria/private/utils/useId';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface DropZoneRenderProps {\n /**\n * Whether the dropzone is currently hovered with a mouse.\n *\n * @selector [data-hovered]\n */\n isHovered: boolean;\n /**\n * Whether the dropzone is focused, either via a mouse or keyboard.\n *\n * @selector [data-focused]\n */\n isFocused: boolean;\n /**\n * Whether the dropzone is keyboard focused.\n *\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean;\n /**\n * Whether the dropzone is the drop target.\n *\n * @selector [data-drop-target]\n */\n isDropTarget: boolean;\n /**\n * Whether the dropzone is disabled.\n *\n * @selector [data-disabled]\n */\n isDisabled: boolean;\n}\n\nexport interface DropZoneProps\n extends\n Omit<DropOptions, 'getDropOperationForPoint' | 'ref' | 'hasDropButton'>,\n HoverEvents,\n RenderProps<DropZoneRenderProps>,\n SlotProps,\n AriaLabelingProps,\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-DropZone'\n */\n className?: ClassNameOrFunction<DropZoneRenderProps>;\n}\n\nexport const DropZoneContext = createContext<ContextValue<DropZoneProps, HTMLDivElement>>(null);\n\n/**\n * A drop zone is an area into which one or multiple objects can be dragged and dropped.\n */\nexport const DropZone = forwardRef(function DropZone(\n props: DropZoneProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let {isDisabled = false} = props;\n // oxlint-disable-next-line react/react-compiler\n [props, ref] = useContextProps(props, ref, DropZoneContext);\n let dropzoneRef = useObjectRef(ref);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {dropProps, dropButtonProps, isDropTarget} = useDrop({\n ...props,\n ref: buttonRef,\n hasDropButton: true\n });\n let {buttonProps} = useButton(dropButtonProps || {}, buttonRef);\n let {hoverProps, isHovered} = useHover(props);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let textId = useSlotId();\n let ariaLabel = props['aria-label'] || stringFormatter.format('dropzoneLabel');\n let messageId = props['aria-labelledby'];\n let ariaLabelledby = [textId, messageId].filter(Boolean).join(' ');\n let labelProps = useLabels({'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby});\n\n let {clipboardProps} = useClipboard({\n isDisabled,\n onPaste: items =>\n props.onDrop?.({\n type: 'drop',\n items,\n x: 0,\n y: 0,\n dropOperation: 'copy'\n })\n });\n\n let renderProps = useRenderProps({\n ...props,\n values: {isHovered, isFocused, isFocusVisible, isDropTarget, isDisabled},\n defaultClassName: 'react-aria-DropZone'\n });\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider values={[[TextContext, {id: textId, slot: 'label'}]]}>\n <dom.div\n {...mergeProps(DOMProps, renderProps, dropProps, hoverProps)}\n slot={props.slot || undefined}\n ref={dropzoneRef}\n onClick={e => {\n let target = getEventTarget(e) as HTMLElement | null;\n while (target && nodeContains(dropzoneRef.current, target)) {\n if (isFocusable(target)) {\n break;\n } else if (target === dropzoneRef.current && buttonRef.current) {\n focusWithoutScrolling(buttonRef.current);\n break;\n }\n\n target = target.parentElement;\n }\n }}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-drop-target={isDropTarget || undefined}\n data-disabled={isDisabled || undefined}>\n <VisuallyHidden>\n <button\n {...mergeProps(buttonProps, focusProps, clipboardProps, labelProps)}\n ref={buttonRef}\n />\n </VisuallyHidden>\n {renderProps.children}\n </dom.div>\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"DropZone.js.map"}
|