react-aria-components 1.12.1 → 1.13.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/dist/Autocomplete.main.js +3 -3
- package/dist/Autocomplete.main.js.map +1 -1
- package/dist/Autocomplete.mjs +3 -3
- package/dist/Autocomplete.module.js +3 -3
- package/dist/Autocomplete.module.js.map +1 -1
- package/dist/Button.main.js +5 -11
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.mjs +5 -11
- package/dist/Button.module.js +5 -11
- package/dist/Button.module.js.map +1 -1
- package/dist/DateField.main.js +12 -8
- package/dist/DateField.main.js.map +1 -1
- package/dist/DateField.mjs +12 -8
- package/dist/DateField.module.js +12 -8
- package/dist/DateField.module.js.map +1 -1
- package/dist/DatePicker.main.js +6 -2
- package/dist/DatePicker.main.js.map +1 -1
- package/dist/DatePicker.mjs +6 -2
- package/dist/DatePicker.module.js +6 -2
- package/dist/DatePicker.module.js.map +1 -1
- package/dist/GridList.main.js +24 -21
- package/dist/GridList.main.js.map +1 -1
- package/dist/GridList.mjs +25 -23
- package/dist/GridList.module.js +25 -23
- package/dist/GridList.module.js.map +1 -1
- package/dist/Group.main.js +3 -2
- package/dist/Group.main.js.map +1 -1
- package/dist/Group.mjs +3 -2
- package/dist/Group.module.js +3 -2
- package/dist/Group.module.js.map +1 -1
- package/dist/Input.main.js.map +1 -1
- package/dist/Input.module.js.map +1 -1
- package/dist/ListBox.main.js +14 -4
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +14 -4
- package/dist/ListBox.module.js +14 -4
- package/dist/ListBox.module.js.map +1 -1
- package/dist/Menu.main.js +16 -6
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +16 -6
- package/dist/Menu.module.js +16 -6
- package/dist/Menu.module.js.map +1 -1
- package/dist/Modal.main.js +9 -1
- package/dist/Modal.main.js.map +1 -1
- package/dist/Modal.mjs +10 -2
- package/dist/Modal.module.js +10 -2
- package/dist/Modal.module.js.map +1 -1
- package/dist/NumberField.main.js +2 -1
- package/dist/NumberField.main.js.map +1 -1
- package/dist/NumberField.mjs +2 -1
- package/dist/NumberField.module.js +2 -1
- package/dist/NumberField.module.js.map +1 -1
- package/dist/ProgressBar.main.js.map +1 -1
- package/dist/ProgressBar.module.js.map +1 -1
- package/dist/RSPContexts.main.js +4 -0
- package/dist/RSPContexts.main.js.map +1 -1
- package/dist/RSPContexts.mjs +3 -1
- package/dist/RSPContexts.module.js +3 -1
- package/dist/RSPContexts.module.js.map +1 -1
- package/dist/RadioGroup.main.js +10 -2
- package/dist/RadioGroup.main.js.map +1 -1
- package/dist/RadioGroup.mjs +10 -2
- package/dist/RadioGroup.module.js +10 -2
- package/dist/RadioGroup.module.js.map +1 -1
- package/dist/SearchField.main.js +2 -2
- package/dist/SearchField.main.js.map +1 -1
- package/dist/SearchField.mjs +2 -2
- package/dist/SearchField.module.js +2 -2
- package/dist/SearchField.module.js.map +1 -1
- package/dist/Select.main.js +62 -22
- package/dist/Select.main.js.map +1 -1
- package/dist/Select.mjs +65 -25
- package/dist/Select.module.js +65 -25
- package/dist/Select.module.js.map +1 -1
- package/dist/SelectionIndicator.main.js +45 -0
- package/dist/SelectionIndicator.main.js.map +1 -0
- package/dist/SelectionIndicator.mjs +35 -0
- package/dist/SelectionIndicator.module.js +35 -0
- package/dist/SelectionIndicator.module.js.map +1 -0
- package/dist/SharedElementTransition.main.js +139 -0
- package/dist/SharedElementTransition.main.js.map +1 -0
- package/dist/SharedElementTransition.mjs +129 -0
- package/dist/SharedElementTransition.module.js +129 -0
- package/dist/SharedElementTransition.module.js.map +1 -0
- package/dist/Table.main.js +16 -11
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +17 -12
- package/dist/Table.module.js +17 -12
- package/dist/Table.module.js.map +1 -1
- package/dist/Tabs.main.js +11 -3
- package/dist/Tabs.main.js.map +1 -1
- package/dist/Tabs.mjs +11 -3
- package/dist/Tabs.module.js +11 -3
- package/dist/Tabs.module.js.map +1 -1
- package/dist/TagGroup.main.js +28 -16
- package/dist/TagGroup.main.js.map +1 -1
- package/dist/TagGroup.mjs +28 -16
- package/dist/TagGroup.module.js +28 -16
- package/dist/TagGroup.module.js.map +1 -1
- package/dist/TextField.main.js +2 -2
- package/dist/TextField.main.js.map +1 -1
- package/dist/TextField.mjs +2 -2
- package/dist/TextField.module.js +2 -2
- package/dist/TextField.module.js.map +1 -1
- package/dist/ToggleButton.main.js +7 -1
- package/dist/ToggleButton.main.js.map +1 -1
- package/dist/ToggleButton.mjs +7 -1
- package/dist/ToggleButton.module.js +7 -1
- package/dist/ToggleButton.module.js.map +1 -1
- package/dist/ToggleButtonGroup.main.js +3 -1
- package/dist/ToggleButtonGroup.main.js.map +1 -1
- package/dist/ToggleButtonGroup.mjs +3 -1
- package/dist/ToggleButtonGroup.module.js +3 -1
- package/dist/ToggleButtonGroup.module.js.map +1 -1
- package/dist/Tree.main.js +16 -4
- package/dist/Tree.main.js.map +1 -1
- package/dist/Tree.mjs +16 -4
- package/dist/Tree.module.js +16 -4
- package/dist/Tree.module.js.map +1 -1
- package/dist/import.mjs +10 -4
- package/dist/main.js +18 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +10 -4
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +99 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.module.js.map +1 -1
- package/package.json +23 -23
- package/src/Autocomplete.tsx +1 -1
- package/src/Button.tsx +9 -11
- package/src/DateField.tsx +21 -12
- package/src/DatePicker.tsx +11 -2
- package/src/GridList.tsx +32 -33
- package/src/Group.tsx +5 -2
- package/src/Input.tsx +7 -1
- package/src/ListBox.tsx +12 -7
- package/src/Menu.tsx +11 -6
- package/src/Modal.tsx +11 -2
- package/src/NumberField.tsx +1 -1
- package/src/ProgressBar.tsx +1 -1
- package/src/RSPContexts.ts +19 -0
- package/src/RadioGroup.tsx +8 -2
- package/src/SearchField.tsx +1 -1
- package/src/Select.tsx +75 -34
- package/src/SelectionIndicator.tsx +40 -0
- package/src/SharedElementTransition.tsx +185 -0
- package/src/Table.tsx +17 -16
- package/src/Tabs.tsx +8 -2
- package/src/TagGroup.tsx +31 -24
- package/src/TextField.tsx +1 -1
- package/src/ToggleButton.tsx +6 -1
- package/src/ToggleButtonGroup.tsx +4 -1
- package/src/Tree.tsx +16 -9
- package/src/index.ts +10 -3
- package/src/utils.tsx +1 -1
- package/dist/context.main.js +0 -25
- package/dist/context.main.js.map +0 -1
- package/dist/context.mjs +0 -19
- package/dist/context.module.js +0 -19
- package/dist/context.module.js.map +0 -1
- package/src/context.tsx +0 -34
package/dist/Menu.module.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {CollectionRendererContext as $7135fc7d473fd974$export$4feb769f8ddf26c5, SectionContext as $7135fc7d473fd974$export$d40e14dec8b060a8, usePersistedKeys as $7135fc7d473fd974$export$90e00781bc59d8f9} from "./Collection.module.js";
|
|
2
2
|
import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3, useSlot as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, useSlottedContext as $64fa3d84918910a7$export$fabf2dc03a41866e} from "./utils.module.js";
|
|
3
|
-
import {FieldInputContext as $
|
|
3
|
+
import {FieldInputContext as $4e85f108e88277b8$export$698f465ec27e93df, SelectableCollectionContext as $4e85f108e88277b8$export$b0d3ecf7112093a7} from "./RSPContexts.module.js";
|
|
4
4
|
import {HeaderContext as $72a5793c14baf454$export$e0e4026c12a8bdbb} from "./Header.module.js";
|
|
5
5
|
import {KeyboardContext as $63df2425e2108aa8$export$744d98a3b8a94e1c} from "./Keyboard.module.js";
|
|
6
6
|
import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.module.js";
|
|
7
7
|
import {PopoverContext as $07b14b47974efb58$export$9b9a0cd73afb7ca4} from "./Popover.module.js";
|
|
8
|
+
import {SelectionIndicatorContext as $1d5b8b8664671ef2$export$c9549807523555e0} from "./SelectionIndicator.module.js";
|
|
8
9
|
import {SeparatorContext as $431f98aba6844401$export$6615d83f6de245ce} from "./Separator.module.js";
|
|
10
|
+
import {SharedElementTransition as $c8a5a149f625efcf$export$758399f318e6385a} from "./SharedElementTransition.module.js";
|
|
9
11
|
import {TextContext as $514c0188e459b4c0$export$9afb8bc826b033ea} from "./Text.module.js";
|
|
10
12
|
import {useMenuTrigger as $kM2ZM$useMenuTrigger, useSubmenuTrigger as $kM2ZM$useSubmenuTrigger, useMenu as $kM2ZM$useMenu, FocusScope as $kM2ZM$FocusScope, mergeProps as $kM2ZM$mergeProps, useMenuSection as $kM2ZM$useMenuSection, useMenuItem as $kM2ZM$useMenuItem, useHover as $kM2ZM$useHover} from "react-aria";
|
|
11
13
|
import {CollectionNode as $kM2ZM$CollectionNode, createBranchComponent as $kM2ZM$createBranchComponent, CollectionBuilder as $kM2ZM$CollectionBuilder, Collection as $kM2ZM$Collection, SectionNode as $kM2ZM$SectionNode, createLeafComponent as $kM2ZM$createLeafComponent, ItemNode as $kM2ZM$ItemNode} from "@react-aria/collections";
|
|
@@ -41,6 +43,8 @@ import $kM2ZM$react, {createContext as $kM2ZM$createContext, useRef as $kM2ZM$us
|
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
|
|
46
|
+
|
|
47
|
+
|
|
44
48
|
const $3674c52c6b3c5bce$export$c7e742effb1c51e2 = /*#__PURE__*/ (0, $kM2ZM$createContext)(null);
|
|
45
49
|
const $3674c52c6b3c5bce$export$24aad8519b95b41b = /*#__PURE__*/ (0, $kM2ZM$createContext)(null);
|
|
46
50
|
const $3674c52c6b3c5bce$export$795aec4671cbae19 = /*#__PURE__*/ (0, $kM2ZM$createContext)(null);
|
|
@@ -179,7 +183,7 @@ const $3674c52c6b3c5bce$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $kM2ZM$forwa
|
|
|
179
183
|
}));
|
|
180
184
|
});
|
|
181
185
|
function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection, menuRef: ref }) {
|
|
182
|
-
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, (0, $
|
|
186
|
+
[props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, (0, $4e85f108e88277b8$export$b0d3ecf7112093a7));
|
|
183
187
|
let { filter: filter, ...autocompleteMenuProps } = props;
|
|
184
188
|
let filteredCollection = (0, $kM2ZM$useMemo)(()=>filter ? collection.filter(filter) : collection, [
|
|
185
189
|
collection,
|
|
@@ -252,11 +256,11 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
252
256
|
null
|
|
253
257
|
],
|
|
254
258
|
[
|
|
255
|
-
(0, $
|
|
259
|
+
(0, $4e85f108e88277b8$export$b0d3ecf7112093a7),
|
|
256
260
|
null
|
|
257
261
|
],
|
|
258
262
|
[
|
|
259
|
-
(0, $
|
|
263
|
+
(0, $4e85f108e88277b8$export$698f465ec27e93df),
|
|
260
264
|
null
|
|
261
265
|
],
|
|
262
266
|
[
|
|
@@ -268,11 +272,11 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
268
272
|
triggerState !== null && triggerState !== void 0 ? triggerState : (0, $kM2ZM$useMenuTriggerState)({})
|
|
269
273
|
]
|
|
270
274
|
]
|
|
271
|
-
}, /*#__PURE__*/ (0, $kM2ZM$react).createElement(CollectionRoot, {
|
|
275
|
+
}, /*#__PURE__*/ (0, $kM2ZM$react).createElement((0, $c8a5a149f625efcf$export$758399f318e6385a), null, /*#__PURE__*/ (0, $kM2ZM$react).createElement(CollectionRoot, {
|
|
272
276
|
collection: state.collection,
|
|
273
277
|
persistedKeys: (0, $7135fc7d473fd974$export$90e00781bc59d8f9)(state.selectionManager.focusedKey),
|
|
274
278
|
scrollRef: ref
|
|
275
|
-
})), emptyState));
|
|
279
|
+
}))), emptyState));
|
|
276
280
|
}
|
|
277
281
|
// A subclass of SelectionManager that forwards focus-related properties to the parent,
|
|
278
282
|
// but has its own local selection state.
|
|
@@ -408,6 +412,12 @@ const $3674c52c6b3c5bce$export$2ce376c2cc3355c8 = /*#__PURE__*/ (0, $kM2ZM$creat
|
|
|
408
412
|
[
|
|
409
413
|
(0, $63df2425e2108aa8$export$744d98a3b8a94e1c),
|
|
410
414
|
keyboardShortcutProps
|
|
415
|
+
],
|
|
416
|
+
[
|
|
417
|
+
(0, $1d5b8b8664671ef2$export$c9549807523555e0),
|
|
418
|
+
{
|
|
419
|
+
isSelected: states.isSelected
|
|
420
|
+
}
|
|
411
421
|
]
|
|
412
422
|
]
|
|
413
423
|
}, renderProps.children));
|
package/dist/Menu.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AAiCM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AACtF,MAAM,8DAA0B,CAAA,GAAA,oBAAY,EAA2B;AAMhE,SAAS,0CAAY,KAAuB;IACjD,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAChC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAqB;IACpC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;QACjD,GAAG,KAAK;QACR,MAAM;IACR,GAAG,OAAO;IACV,oCAAoC;IACpC,IAAI,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,eAAO,EAAiB;IAC5D,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QACzB,IAAI,IAAI,OAAO,EACb,eAAe,I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N,GAAG,MAAM;uBACT;YACA,gBAAgB,OAAO,cAAc;YACrC,eAAe,iBAAiB,aAAa;YAC7C,mBAAmB,iBAAiB,iBAAiB;YACrD,YAAY,CAAC,CAAC,KAAK,CAAC,gBAAgB;YACpC,QAAQ,KAAK,CAAC,gBAAgB,KAAK;QACrC;IACF;IAEA,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IACxD,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAc;QAAC,QAAQ;IAAI;IACzD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,eAAe,WAAW;QAChE,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,OAAO,cAAc,IAAI;QAC7C,gBAAc,OAAO,SAAS,IAAI;QAClC,iBAAe,OAAO,UAAU,IAAI;QACpC,uBAAqB,iBAAiB,aAAa,KAAK,SAAS,YAAY,iBAAiB,aAAa;QAC3G,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;SACzC;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useHover, useMenu, useMenuItem, useMenuSection, useMenuTrigger, useSubmenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, ItemNode, SectionNode} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, RootMenuTriggerState, TreeState, useMenuTriggerState, useSubmenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldInputContext, SelectableCollectionContext, SelectableCollectionContextValue} from './context';\nimport {filterDOMProps, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps): JSX.Element {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties,\n 'aria-labelledby': menuProps['aria-labelledby']\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\nclass SubmenuTriggerNode<T> extends CollectionNode<T> {\n static readonly type = 'submenutrigger';\n\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: (textValue: string, node: Node<T>) => boolean): CollectionNode<T> | null {\n let triggerNode = collection.getItem(this.firstChildKey!);\n if (triggerNode && filterFn(triggerNode.textValue, this)) {\n let clone = this.clone();\n newCollection.addDescendants(clone, collection);\n return clone;\n }\n\n return null;\n }\n}\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent(SubmenuTriggerNode, (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, {\n ref: submenuRef,\n ...submenuProps\n }],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n 'aria-labelledby': submenuProps['aria-labelledby'],\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuRenderProps {\n /**\n * Whether the menu has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<MenuRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: () => ReactNode\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n // For now we append filter and other autocomplete context props here for typescript, but eventually we can consider exposing these\n // as top level props for users to use with standalone Menus\n props: MenuProps<T> & {filter?: SelectableCollectionContextValue<object>['filter'], shouldUseVirtualFocus?: boolean},\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n [props, ref] = useContextProps(props, ref, SelectableCollectionContext);\n let {filter, ...autocompleteMenuProps} = props;\n let filteredCollection = useMemo(() => filter ? collection.filter(filter) : collection, [collection, filter]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {\n isEmpty: state.collection.size === 0\n }\n });\n\n let emptyState: ReactElement | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n emptyState = (\n <div\n role=\"menuitem\"\n style={{display: 'contents'}}>\n {props.renderEmptyState()}\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, menuProps)}\n ref={ref as RefObject<HTMLDivElement>}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [SelectableCollectionContext, null],\n [FieldInputContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n\n return (\n <section\n {...mergeProps(DOMProps, renderProps, groupProps)}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent(SectionNode, MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent(ItemNode, function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <ElementType\n {...mergeProps(DOMProps, renderProps, menuItemProps, hoverProps)}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps]\n ]}>\n {renderProps.children}\n </Provider>\n </ElementType>\n );\n});\n"],"names":[],"version":3,"file":"Menu.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;AAmCM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0D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AY,iBAAiB,aAAa;QAC3G,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;YACxC;gBAAC,CAAA,GAAA,yCAAwB;gBAAG;oBAAC,YAAY,OAAO,UAAU;gBAAA;aAAE;SAC7D;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps, FocusScope, mergeProps, useHover, useMenu, useMenuItem, useMenuSection, useMenuTrigger, useSubmenuTrigger} from 'react-aria';\nimport {BaseCollection, Collection, CollectionBuilder, CollectionNode, createBranchComponent, createLeafComponent, ItemNode, SectionNode} from '@react-aria/collections';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, RootMenuTriggerState, TreeState, useMenuTriggerState, useSubmenuTriggerState, useTreeState} from 'react-stately';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldInputContext, SelectableCollectionContext, SelectableCollectionContextValue} from './RSPContexts';\nimport {filterDOMProps, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, GlobalDOMAttributes, HoverEvents, Key, LinkDOMProps, MultipleSelection, PressEvents} from '@react-types/shared';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {MultipleSelectionState, SelectionManager, useMultipleSelectionState} from '@react-stately/selection';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SeparatorContext} from './Separator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TextContext} from './Text';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n children: ReactNode\n}\n\nexport function MenuTrigger(props: MenuTriggerProps): JSX.Element {\n let state = useMenuTriggerState(props);\n let ref = useRef<HTMLButtonElement>(null);\n let {menuTriggerProps, menuProps} = useMenuTrigger({\n ...props,\n type: 'menu'\n }, state, ref);\n // Allows menu width to match button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (ref.current) {\n setButtonWidth(ref.current.offsetWidth + 'px');\n }\n }, [ref]);\n\n useResizeObserver({\n ref: ref,\n onResize: onResize\n });\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [MenuContext, {...menuProps, ref: scrollRef}],\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'MenuTrigger',\n triggerRef: ref,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties,\n 'aria-labelledby': menuProps['aria-labelledby']\n }]\n ]}>\n <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nexport interface SubmenuTriggerProps {\n /**\n * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the second child should be the Popover (for the submenu).\n */\n children: ReactElement[],\n /**\n * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n * @default 200\n */\n delay?: number\n}\n\nconst SubmenuTriggerContext = createContext<{parentMenuRef: RefObject<HTMLElement | null>, shouldUseVirtualFocus?: boolean} | null>(null);\n\nclass SubmenuTriggerNode<T> extends CollectionNode<T> {\n static readonly type = 'submenutrigger';\n\n filter(collection: BaseCollection<T>, newCollection: BaseCollection<T>, filterFn: (textValue: string, node: Node<T>) => boolean): CollectionNode<T> | null {\n let triggerNode = collection.getItem(this.firstChildKey!);\n if (triggerNode && filterFn(triggerNode.textValue, this)) {\n let clone = this.clone();\n newCollection.addDescendants(clone, collection);\n return clone;\n }\n\n return null;\n }\n}\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent(SubmenuTriggerNode, (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let state = useContext(MenuStateContext)!;\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n let submenuRef = useRef<HTMLDivElement>(null);\n let itemRef = useObjectRef(ref);\n let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay,\n shouldUseVirtualFocus\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, {\n ref: submenuRef,\n ...submenuProps\n }],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n 'aria-labelledby': submenuProps['aria-labelledby'],\n ...popoverProps\n }]\n ]}>\n <CollectionBranch collection={state.collection} parent={item} />\n {props.children[1]}\n </Provider>\n );\n}, props => props.children[0]);\n\nexport interface MenuRenderProps {\n /**\n * Whether the menu has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean\n}\n\nexport interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<MenuRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: () => ReactNode\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T extends object>(props: MenuProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, MenuContext);\n\n // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n});\n\ninterface MenuInnerProps<T> {\n // For now we append filter and other autocomplete context props here for typescript, but eventually we can consider exposing these\n // as top level props for users to use with standalone Menus\n props: MenuProps<T> & {filter?: SelectableCollectionContextValue<object>['filter'], shouldUseVirtualFocus?: boolean},\n collection: BaseCollection<object>,\n menuRef: RefObject<HTMLElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n [props, ref] = useContextProps(props, ref, SelectableCollectionContext);\n let {filter, ...autocompleteMenuProps} = props;\n let filteredCollection = useMemo(() => filter ? collection.filter(filter) : collection, [collection, filter]);\n let state = useTreeState({\n ...props,\n collection: filteredCollection as ICollection<Node<object>>,\n children: undefined\n });\n let triggerState = useContext(RootMenuTriggerStateContext);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, isVirtualized, onClose: props.onClose || triggerState?.close}, state, ref);\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {\n isEmpty: state.collection.size === 0\n }\n });\n\n let emptyState: ReactElement | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n emptyState = (\n <div\n role=\"menuitem\"\n style={{display: 'contents'}}>\n {props.renderEmptyState()}\n </div>\n );\n }\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <FocusScope>\n <div\n {...mergeProps(DOMProps, renderProps, menuProps)}\n ref={ref as RefObject<HTMLDivElement>}\n slot={props.slot || undefined}\n data-empty={state.collection.size === 0 || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n [SubmenuTriggerContext, {parentMenuRef: ref, shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus}],\n [MenuItemContext, null],\n [SelectableCollectionContext, null],\n [FieldInputContext, null],\n [SelectionManagerContext, state.selectionManager],\n /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n /* We assume the context can never change between defined and undefined. */\n /* eslint-disable-next-line react-hooks/rules-of-hooks */\n [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n ]}>\n <SharedElementTransition>\n <CollectionRoot\n collection={state.collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </SharedElementTransition>\n </Provider>\n {emptyState}\n </div>\n </FocusScope>\n );\n}\n\nexport interface MenuSectionProps<T> extends SectionProps<T>, MultipleSelection {}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n private parent: SelectionManager;\n\n constructor(parent: SelectionManager, state: MultipleSelectionState) {\n super(parent.collection, state);\n this.parent = parent;\n }\n\n get focusedKey() {\n return this.parent.focusedKey;\n }\n\n get isFocused() {\n return this.parent.isFocused;\n }\n\n setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n return this.parent.setFocusedKey(key, childFocusStrategy);\n }\n\n setFocused(isFocused: boolean): void {\n this.parent.setFocused(isFocused);\n }\n\n get childFocusStrategy() {\n return this.parent.childFocusStrategy;\n }\n}\n\nfunction MenuSectionInner<T extends object>(props: MenuSectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>, className = 'react-aria-MenuSection') {\n let state = useContext(MenuStateContext)!;\n let {CollectionBranch} = useContext(CollectionRendererContext);\n let [headingRef, heading] = useSlot();\n let {headingProps, groupProps} = useMenuSection({\n heading,\n 'aria-label': section.props['aria-label'] ?? undefined\n });\n let renderProps = useRenderProps({\n defaultClassName: className,\n className: section.props?.className,\n style: section.props?.style,\n values: {}\n });\n\n let parent = useContext(SelectionManagerContext)!;\n let selectionState = useMultipleSelectionState(props);\n let manager = props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n\n return (\n <section\n {...mergeProps(DOMProps, renderProps, groupProps)}\n ref={ref}>\n <Provider\n values={[\n [HeaderContext, {...headingProps, ref: headingRef}],\n [SelectionManagerContext, manager]\n ]}>\n <CollectionBranch collection={state.collection} parent={section} />\n </Provider>\n </section>\n );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent(SectionNode, MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n /**\n * Whether the item has a submenu.\n *\n * @selector [data-has-submenu]\n */\n hasSubmenu: boolean,\n /**\n * Whether the item's submenu is open.\n *\n * @selector [data-open]\n */\n isOpen: boolean\n}\n\nexport interface MenuItemProps<T = object> extends RenderProps<MenuItemRenderProps>, LinkDOMProps, HoverEvents, PressEvents, Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** An accessibility label for this item. */\n 'aria-label'?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /** Handler that is called when the item is selected. */\n onAction?: () => void\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent(ItemNode, function MenuItem<T extends object>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n let id = useSlottedContext(MenuItemContext)?.id as string;\n let state = useContext(MenuStateContext)!;\n let ref = useObjectRef<any>(forwardedRef);\n let selectionManager = useContext(SelectionManagerContext)!;\n\n let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem({\n ...props,\n id,\n key: item.key,\n selectionManager\n }, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: states.isDisabled\n });\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible: states.isFocusVisible,\n selectionMode: selectionManager.selectionMode,\n selectionBehavior: selectionManager.selectionBehavior,\n hasSubmenu: !!props['aria-haspopup'],\n isOpen: props['aria-expanded'] === 'true'\n }\n });\n\n let ElementType: React.ElementType = props.href ? 'a' : 'div';\n let DOMProps = filterDOMProps(props as any, {global: true});\n delete DOMProps.id;\n delete DOMProps.onClick;\n\n return (\n <ElementType\n {...mergeProps(DOMProps, renderProps, menuItemProps, hoverProps)}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={states.isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-selected={states.isSelected || undefined}\n data-selection-mode={selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode}\n data-has-submenu={!!props['aria-haspopup'] || undefined}\n data-open={props['aria-expanded'] === 'true' || undefined}>\n <Provider\n values={[\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: labelProps,\n label: labelProps,\n description: descriptionProps\n }\n }],\n [KeyboardContext, keyboardShortcutProps],\n [SelectionIndicatorContext, {isSelected: states.isSelected}]\n ]}>\n {renderProps.children}\n </Provider>\n </ElementType>\n );\n});\n"],"names":[],"version":3,"file":"Menu.module.js.map"}
|
package/dist/Modal.main.js
CHANGED
|
@@ -114,9 +114,17 @@ function $71899cff63e14b82$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
let viewport = (0, $cIZLj$reactariautils.useViewportSize)();
|
|
117
|
+
let pageHeight = undefined;
|
|
118
|
+
if (typeof document !== 'undefined') {
|
|
119
|
+
let scrollingElement = (0, $cIZLj$reactariautils.isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
|
|
120
|
+
// Prevent Firefox from adding scrollbars when the page has a fractional height.
|
|
121
|
+
let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
|
|
122
|
+
pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
|
|
123
|
+
}
|
|
117
124
|
let style = {
|
|
118
125
|
...renderProps.style,
|
|
119
|
-
'--visual-viewport-height': viewport.height + 'px'
|
|
126
|
+
'--visual-viewport-height': viewport.height + 'px',
|
|
127
|
+
'--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
|
|
120
128
|
};
|
|
121
129
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($cIZLj$react))).createElement((0, $cIZLj$reactaria.Overlay), {
|
|
122
130
|
isExiting: props.isExiting,
|
package/dist/Modal.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAkCM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,0BAAY,EAAoC;AAsBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MAAM,KAAwB,EAAE,GAAiC;IAC1I,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAiB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GAAI;YAClI,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBAAC;gBAAiB;gBAA6B;gBAAU;gBAAe;gBAAgB;gBAAc;gBAAa;gBAA4B;aAA+B;YACzM,MAAM,eAAe,OAAO,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA,MAAO,WAAW,GAAG,CAAC;YACrE,QAAQ,IAAI,CAAC,CAAC,wDAAwD,EAAE,aAAa,IAAI,CAAC,MAAM,+CAA+C,CAAC;QAClJ;QACA,qBAAO,0DAAC;YAAc,GAAG,KAAK;YAAE,UAAU;WAAM,MAAM,QAAQ;IAChE;IAEA,IAAI,iBACF,aAAa,6BACb,yBAAyB,UACzB,MAAM,eACN,WAAW,gBACX,YAAY,YACZ,QAAQ,cACR,UAAU,aACV,SAAS,4BACT,wBAAwB,gCACxB,4BAA4B,EAC5B,GAAG,YACJ,GAAG;IAEJ,qBACE,0DA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IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,+BAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,kCAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,uCAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,CAAA,GAAA,oCAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BACC,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;QAEtC,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, Overlay, useIsSSR, useModalOverlay} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, mergeRefs, useEnterAnimation, useExitAnimation, useObjectRef, useViewportSize} from '@react-aria/utils';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\n\nexport interface ModalOverlayProps extends AriaModalOverlayProps, OverlayTriggerProps, RenderProps<ModalRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes,\n modalRef: RefObject<HTMLDivElement | null>,\n isExiting: boolean,\n isDismissable?: boolean\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the modal.\n */\n state: OverlayTriggerState\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set(['isDismissable', 'isKeyboardDismissDisabled', 'isOpen', 'defaultOpen', 'onOpenChange', 'isEntering', 'isExiting', 'UNSTABLE_portalContainer', 'shouldCloseOnInteractOutside']);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(`This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`);\n }\n return <ModalContent {...props} modalRef={ref}>{props.children}</ModalContent>;\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>,\n modalRef: RefObject<HTMLDivElement | null>,\n state: OverlayTriggerState,\n isExiting: boolean\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n console.warn('This modals state is controlled by a trigger, place onOpenChange on the trigger instead.');\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef} />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(ModalOverlayWithForwardRef);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let style = {\n ...renderProps.style,\n '--visual-viewport-height': viewport.height + 'px'\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [InternalModalContext, {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n modalRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable &&\n <DismissButton onDismiss={state.close} />\n }\n {renderProps.children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAkCM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,0BAAY,EAAoC;AAsBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MAAM,KAAwB,EAAE,GAAiC;IAC1I,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAiB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GAAI;YAClI,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBAAC;gBAAiB;gBAA6B;gBAAU;gBAAe;gBAAgB;gBAAc;gBAAa;gBAA4B;aAA+B;YACzM,MAAM,eAAe,OAAO,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA,MAAO,WAAW,GAAG,CAAC;YACrE,QAAQ,IAAI,CAAC,CAAC,wDAAwD,EAAE,aAAa,IAAI,CAAC,MAAM,+CAA+C,CAAC;QAClJ;QACA,qBAAO,0DAAC;YAAc,GAAG,KAAK;YAAE,UAAU;WAAM,MAAM,QAAQ;IAChE;IAEA,IAAI,iBACF,aAAa,6BACb,yBAAyB,UACzB,MAAM,eACN,WAAW,gBACX,YAAY,YACZ,QAAQ,cACR,UAAU,aACV,SAAS,4B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QAAQ;YACN;gBAAC;gBAAsB;gCAAC;8BAAY;oBAAU,WAAW,MAAM,SAAS;oBAAE,eAAe,MAAM,aAAa;gBAAA;aAAE;YAC9G;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK/B;AAMA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,+BAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,kCAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,uCAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,CAAA,GAAA,oCAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BACC,0DAAC,CAAA,GAAA,8BAAY;QAAE,WAAW,MAAM,KAAK;QAEtC,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, Overlay, useIsSSR, useModalOverlay} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps, isScrollable, mergeProps, mergeRefs, useEnterAnimation, useExitAnimation, useObjectRef, useViewportSize} from '@react-aria/utils';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\n\nexport interface ModalOverlayProps extends AriaModalOverlayProps, OverlayTriggerProps, RenderProps<ModalRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes,\n modalRef: RefObject<HTMLDivElement | null>,\n isExiting: boolean,\n isDismissable?: boolean\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the modal.\n */\n state: OverlayTriggerState\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set(['isDismissable', 'isKeyboardDismissDisabled', 'isOpen', 'defaultOpen', 'onOpenChange', 'isEntering', 'isExiting', 'UNSTABLE_portalContainer', 'shouldCloseOnInteractOutside']);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(`This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`);\n }\n return <ModalContent {...props} modalRef={ref}>{props.children}</ModalContent>;\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>,\n modalRef: RefObject<HTMLDivElement | null>,\n state: OverlayTriggerState,\n isExiting: boolean\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n console.warn('This modals state is controlled by a trigger, place onOpenChange on the trigger instead.');\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef} />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(ModalOverlayWithForwardRef);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body) ? document.body : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional height.\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-height': viewport.height + 'px',\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [InternalModalContext, {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n modalRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable &&\n <DismissButton onDismiss={state.close} />\n }\n {renderProps.children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.main.js.map"}
|
package/dist/Modal.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
|
|
2
2
|
import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.mjs";
|
|
3
3
|
import {useIsSSR as $daTMi$useIsSSR, useModalOverlay as $daTMi$useModalOverlay, Overlay as $daTMi$Overlay, DismissButton as $daTMi$DismissButton} from "react-aria";
|
|
4
|
-
import {useObjectRef as $daTMi$useObjectRef, useExitAnimation as $daTMi$useExitAnimation, useEnterAnimation as $daTMi$useEnterAnimation, useViewportSize as $daTMi$useViewportSize, mergeProps as $daTMi$mergeProps, filterDOMProps as $daTMi$filterDOMProps, mergeRefs as $daTMi$mergeRefs} from "@react-aria/utils";
|
|
4
|
+
import {useObjectRef as $daTMi$useObjectRef, useExitAnimation as $daTMi$useExitAnimation, useEnterAnimation as $daTMi$useEnterAnimation, useViewportSize as $daTMi$useViewportSize, isScrollable as $daTMi$isScrollable, mergeProps as $daTMi$mergeProps, filterDOMProps as $daTMi$filterDOMProps, mergeRefs as $daTMi$mergeRefs} from "@react-aria/utils";
|
|
5
5
|
import {useOverlayTriggerState as $daTMi$useOverlayTriggerState} from "react-stately";
|
|
6
6
|
import $daTMi$react, {createContext as $daTMi$createContext, forwardRef as $daTMi$forwardRef, useContext as $daTMi$useContext, useRef as $daTMi$useRef, useMemo as $daTMi$useMemo} from "react";
|
|
7
7
|
|
|
@@ -102,9 +102,17 @@ function $f3f84453ead64de5$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
let viewport = (0, $daTMi$useViewportSize)();
|
|
105
|
+
let pageHeight = undefined;
|
|
106
|
+
if (typeof document !== 'undefined') {
|
|
107
|
+
let scrollingElement = (0, $daTMi$isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
|
|
108
|
+
// Prevent Firefox from adding scrollbars when the page has a fractional height.
|
|
109
|
+
let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
|
|
110
|
+
pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
|
|
111
|
+
}
|
|
105
112
|
let style = {
|
|
106
113
|
...renderProps.style,
|
|
107
|
-
'--visual-viewport-height': viewport.height + 'px'
|
|
114
|
+
'--visual-viewport-height': viewport.height + 'px',
|
|
115
|
+
'--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
|
|
108
116
|
};
|
|
109
117
|
return /*#__PURE__*/ (0, $daTMi$react).createElement((0, $daTMi$Overlay), {
|
|
110
118
|
isExiting: props.isExiting,
|
package/dist/Modal.module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
|
|
2
2
|
import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.module.js";
|
|
3
3
|
import {useIsSSR as $daTMi$useIsSSR, useModalOverlay as $daTMi$useModalOverlay, Overlay as $daTMi$Overlay, DismissButton as $daTMi$DismissButton} from "react-aria";
|
|
4
|
-
import {useObjectRef as $daTMi$useObjectRef, useExitAnimation as $daTMi$useExitAnimation, useEnterAnimation as $daTMi$useEnterAnimation, useViewportSize as $daTMi$useViewportSize, mergeProps as $daTMi$mergeProps, filterDOMProps as $daTMi$filterDOMProps, mergeRefs as $daTMi$mergeRefs} from "@react-aria/utils";
|
|
4
|
+
import {useObjectRef as $daTMi$useObjectRef, useExitAnimation as $daTMi$useExitAnimation, useEnterAnimation as $daTMi$useEnterAnimation, useViewportSize as $daTMi$useViewportSize, isScrollable as $daTMi$isScrollable, mergeProps as $daTMi$mergeProps, filterDOMProps as $daTMi$filterDOMProps, mergeRefs as $daTMi$mergeRefs} from "@react-aria/utils";
|
|
5
5
|
import {useOverlayTriggerState as $daTMi$useOverlayTriggerState} from "react-stately";
|
|
6
6
|
import $daTMi$react, {createContext as $daTMi$createContext, forwardRef as $daTMi$forwardRef, useContext as $daTMi$useContext, useRef as $daTMi$useRef, useMemo as $daTMi$useMemo} from "react";
|
|
7
7
|
|
|
@@ -102,9 +102,17 @@ function $f3f84453ead64de5$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
let viewport = (0, $daTMi$useViewportSize)();
|
|
105
|
+
let pageHeight = undefined;
|
|
106
|
+
if (typeof document !== 'undefined') {
|
|
107
|
+
let scrollingElement = (0, $daTMi$isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
|
|
108
|
+
// Prevent Firefox from adding scrollbars when the page has a fractional height.
|
|
109
|
+
let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
|
|
110
|
+
pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
|
|
111
|
+
}
|
|
105
112
|
let style = {
|
|
106
113
|
...renderProps.style,
|
|
107
|
-
'--visual-viewport-height': viewport.height + 'px'
|
|
114
|
+
'--visual-viewport-height': viewport.height + 'px',
|
|
115
|
+
'--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
|
|
108
116
|
};
|
|
109
117
|
return /*#__PURE__*/ (0, $daTMi$react).createElement((0, $daTMi$Overlay), {
|
|
110
118
|
isExiting: props.isExiting,
|
package/dist/Modal.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAkCM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,oBAAY,EAAoC;AAsBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MAAM,KAAwB,EAAE,GAAiC;IAC1I,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAiB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GAAI;YAClI,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBAAC;g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ACP,KAAK,MAAM,UAAU;QACrB,iBAAe,YAAY;QAC3B,gBAAc,MAAM,SAAS,IAAI;qBACjC,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAsB;gCAAC;8BAAY;oBAAU,WAAW,MAAM,SAAS;oBAAE,eAAe,MAAM,aAAa;gBAAA;aAAE;YAC9G;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK/B;AAMA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,mBAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,wBAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BACC,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QAEtC,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, Overlay, useIsSSR, useModalOverlay} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, mergeRefs, useEnterAnimation, useExitAnimation, useObjectRef, useViewportSize} from '@react-aria/utils';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\n\nexport interface ModalOverlayProps extends AriaModalOverlayProps, OverlayTriggerProps, RenderProps<ModalRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes,\n modalRef: RefObject<HTMLDivElement | null>,\n isExiting: boolean,\n isDismissable?: boolean\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the modal.\n */\n state: OverlayTriggerState\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set(['isDismissable', 'isKeyboardDismissDisabled', 'isOpen', 'defaultOpen', 'onOpenChange', 'isEntering', 'isExiting', 'UNSTABLE_portalContainer', 'shouldCloseOnInteractOutside']);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(`This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`);\n }\n return <ModalContent {...props} modalRef={ref}>{props.children}</ModalContent>;\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>,\n modalRef: RefObject<HTMLDivElement | null>,\n state: OverlayTriggerState,\n isExiting: boolean\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n console.warn('This modals state is controlled by a trigger, place onOpenChange on the trigger instead.');\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef} />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(ModalOverlayWithForwardRef);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let style = {\n ...renderProps.style,\n '--visual-viewport-height': viewport.height + 'px'\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [InternalModalContext, {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n modalRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable &&\n <DismissButton onDismiss={state.close} />\n }\n {renderProps.children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAkCM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,oBAAY,EAAoC;AAsBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MAAM,KAAwB,EAAE,GAAiC;IAC1I,IAAI,MAAM,CAAA,GAAA,iBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAiB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GAAI;YA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,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BACC,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;QAEtC,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaModalOverlayProps, DismissButton, Overlay, useIsSSR, useModalOverlay} from 'react-aria';\nimport {ContextValue, Provider, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps, isScrollable, mergeProps, mergeRefs, useEnterAnimation, useExitAnimation, useObjectRef, useViewportSize} from '@react-aria/utils';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\n\nexport interface ModalOverlayProps extends AriaModalOverlayProps, OverlayTriggerProps, RenderProps<ModalRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n */\n UNSTABLE_portalContainer?: Element\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes,\n modalRef: RefObject<HTMLDivElement | null>,\n isExiting: boolean,\n isDismissable?: boolean\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean,\n /**\n * State of the modal.\n */\n state: OverlayTriggerState\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set(['isDismissable', 'isKeyboardDismissDisabled', 'isOpen', 'defaultOpen', 'onOpenChange', 'isEntering', 'isExiting', 'UNSTABLE_portalContainer', 'shouldCloseOnInteractOutside']);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(`This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`);\n }\n return <ModalContent {...props} modalRef={ref}>{props.children}</ModalContent>;\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>,\n modalRef: RefObject<HTMLDivElement | null>,\n state: OverlayTriggerState,\n isExiting: boolean\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (process.env.NODE_ENV !== 'production' && (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)) {\n console.warn('This modals state is controlled by a trigger, place onOpenChange on the trigger instead.');\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef} />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(ModalOverlayWithForwardRef);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body) ? document.body : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional height.\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-height': viewport.height + 'px',\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [InternalModalContext, {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps extends RenderProps<ModalRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n modalRef: ForwardedRef<HTMLDivElement>\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable &&\n <DismissButton onDismiss={state.close} />\n }\n {renderProps.children}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.module.js.map"}
|
package/dist/NumberField.main.js
CHANGED
|
@@ -138,7 +138,8 @@ const $177b28eee7968d58$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $3iM7b$react
|
|
|
138
138
|
type: "hidden",
|
|
139
139
|
name: props.name,
|
|
140
140
|
form: props.form,
|
|
141
|
-
value: isNaN(state.numberValue) ? '' : state.numberValue
|
|
141
|
+
value: isNaN(state.numberValue) ? '' : state.numberValue,
|
|
142
|
+
disabled: props.isDisabled || undefined
|
|
142
143
|
}));
|
|
143
144
|
});
|
|
144
145
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AACzF,MAAM,0DAA0B,CAAA,GAAA,0BAAY,EAA2B;AAKvE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACrJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OAAsD;IAC/E,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,0BAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,uCAAkB,EAAE;QAC9B,GAAG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QACvC,MAAM,IAAI,kBAAI,0DAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;QAAE,UAAU,MAAM,UAAU,IAAI;;AAGtK","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the number field is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} form={props.form} value={isNaN(state.numberValue) ? '' : state.numberValue} disabled={props.isDisabled || undefined} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.main.js.map"}
|
package/dist/NumberField.mjs
CHANGED
|
@@ -126,7 +126,8 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
|
|
|
126
126
|
type: "hidden",
|
|
127
127
|
name: props.name,
|
|
128
128
|
form: props.form,
|
|
129
|
-
value: isNaN(state.numberValue) ? '' : state.numberValue
|
|
129
|
+
value: isNaN(state.numberValue) ? '' : state.numberValue,
|
|
130
|
+
disabled: props.isDisabled || undefined
|
|
130
131
|
}));
|
|
131
132
|
});
|
|
132
133
|
|
|
@@ -126,7 +126,8 @@ const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /*#__PURE__*/ (0, $a4EfP$forwa
|
|
|
126
126
|
type: "hidden",
|
|
127
127
|
name: props.name,
|
|
128
128
|
form: props.form,
|
|
129
|
-
value: isNaN(state.numberValue) ? '' : state.numberValue
|
|
129
|
+
value: isNaN(state.numberValue) ? '' : state.numberValue,
|
|
130
|
+
disabled: props.isDisabled || undefined
|
|
130
131
|
}));
|
|
131
132
|
});
|
|
132
133
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AAwCM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAkD;AACzF,MAAM,0DAA0B,CAAA,GAAA,oBAAY,EAA2B;AAKvE,MAAM,4CAA4B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACrJ,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;I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;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACvC,MAAM,IAAI,kBAAI,gCAAC;QAAM,MAAK;QAAS,MAAM,MAAM,IAAI;QAAE,MAAM,MAAM,IAAI;QAAE,OAAO,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW;QAAE,UAAU,MAAM,UAAU,IAAI;;AAGtK","sources":["packages/react-aria-components/src/NumberField.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaNumberFieldProps, useLocale, useNumberField} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes, InputDOMProps} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {NumberFieldState, useNumberFieldState} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface NumberFieldRenderProps {\n /**\n * Whether the number field is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the number field is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the number field is required.\n * @selector [data-required]\n */\n isRequired: boolean,\n /**\n * State of the number field.\n */\n state: NumberFieldState\n}\n\nexport interface NumberFieldProps extends Omit<AriaNumberFieldProps, 'label' | 'placeholder' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, InputDOMProps, RenderProps<NumberFieldRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport const NumberFieldContext = createContext<ContextValue<NumberFieldProps, HTMLDivElement>>(null);\nexport const NumberFieldStateContext = createContext<NumberFieldState | null>(null);\n\n/**\n * A number field allows a user to enter a number, and increment or decrement the value using stepper buttons.\n */\nexport const NumberField = /*#__PURE__*/ (forwardRef as forwardRefType)(function NumberField(props: NumberFieldProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NumberFieldContext);\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {locale} = useLocale();\n let state = useNumberFieldState({\n ...props,\n locale,\n validationBehavior\n });\n\n let inputRef = useRef<HTMLInputElement>(null);\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n labelProps,\n groupProps,\n inputProps,\n incrementButtonProps,\n decrementButtonProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useNumberField({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, inputRef);\n\n let renderProps = useRenderProps({\n ...props,\n values: {\n state,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n },\n defaultClassName: 'react-aria-NumberField'\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [NumberFieldStateContext, state],\n [GroupContext, groupProps],\n [InputContext, {...inputProps, ref: inputRef}],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {\n slots: {\n increment: incrementButtonProps,\n decrement: decrementButtonProps\n }\n }],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-required={props.isRequired || undefined}\n data-invalid={validation.isInvalid || undefined} />\n {props.name && <input type=\"hidden\" name={props.name} form={props.form} value={isNaN(state.numberValue) ? '' : state.numberValue} disabled={props.isDisabled || undefined} />}\n </Provider>\n );\n});\n"],"names":[],"version":3,"file":"NumberField.module.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AA6BM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAkD;AAMzF,MAAM,0DAAc,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACnH,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,sBACX,kBAAkB,OACnB,GAAG;IACJ,QAAQ,CAAA,GAAA,8BAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACX,GAAG,CAAA,GAAA,+BAAa,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAEnC,0DAA0D;IAC1D,IAAI,aAAa,kBAAkB,YAAY,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAK;IAE5F,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,gBAAgB,CAAC,iBAAiB;6BAC7C;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,0DAAC;QAAK,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,aAAa,iBAAiB;QAAE,KAAK;QAAK,MAAM,MAAM,IAAI,IAAI;qBAC1F,0DAAC,CAAA,GAAA,sCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The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ria-components/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number | undefined,\n /**\n * A formatted version of the value.\n * @selector [aria-valuetext]\n */\n valueText: string | undefined,\n /**\n * Whether the progress bar is indeterminate.\n * @selector :not([aria-valuenow])\n */\n isIndeterminate: boolean\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, HTMLDivElement>>(null);\n\n/**\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ProgressBarContext);\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n isIndeterminate = false\n } = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n progressBarProps,\n labelProps\n } = useProgressBar({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ProgressBar',\n values: {\n percentage,\n valueText: progressBarProps['aria-valuetext'],\n isIndeterminate\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <div {...mergeProps(DOMProps, renderProps, progressBarProps)} ref={ref} slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ProgressBar.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AA6BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAkD;AAMzF,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACnH,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,sBACX,kBAAkB,OACnB,GAAG;IACJ,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,yCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACX,GAAG,CAAA,GAAA,qBAAa,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAEnC,0DAA0D;IAC1D,IAAI,aAAa,kBAAkB,YAAY,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAK;IAE5F,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,gBAAgB,CAAC,iBAAiB;6BAC7C;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC;QAAK,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,iBAAiB;QAAE,KAAK;QAAK,MAAM,MAAM,IAAI,IAAI;qBAC1F,gCAAC,CAAA,GAAA,yCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AA6BM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAkD;AAMzF,MAAM,0DAAc,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAAiC;IACnH,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,sBACX,kBAAkB,OACnB,GAAG;IACJ,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,yCAAM,EAC5B,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IAEnD,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACX,GAAG,CAAA,GAAA,qBAAa,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAEnC,0DAA0D;IAC1D,IAAI,aAAa,kBAAkB,YAAY,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAK;IAE5F,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,gBAAgB,CAAC,iBAAiB;6BAC7C;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC;QAAK,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,iBAAiB;QAAE,KAAK;QAAK,MAAM,MAAM,IAAI,IAAI;qBAC1F,gCAAC,CAAA,GAAA,yCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaProgressBarProps, useProgressBar} from 'react-aria';\nimport {clamp} from '@react-stately/utils';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot} from './utils';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'label'>, RenderProps<ProgressBarRenderProps>, SlotProps, GlobalDOMAttributes<HTMLDivElement> {}\n\nexport interface ProgressBarRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number | undefined,\n /**\n * A formatted version of the value.\n * @selector [aria-valuetext]\n */\n valueText: string | undefined,\n /**\n * Whether the progress bar is indeterminate.\n * @selector :not([aria-valuenow])\n */\n isIndeterminate: boolean\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, HTMLDivElement>>(null);\n\n/**\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport const ProgressBar = forwardRef(function ProgressBar(props: ProgressBarProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ProgressBarContext);\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n isIndeterminate = false\n } = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(\n !props['aria-label'] && !props['aria-labelledby']\n );\n let {\n progressBarProps,\n labelProps\n } = useProgressBar({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = isIndeterminate ? undefined : (value - minValue) / (maxValue - minValue) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ProgressBar',\n values: {\n percentage,\n valueText: progressBarProps['aria-valuetext'],\n isIndeterminate\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <div {...mergeProps(DOMProps, renderProps, progressBarProps)} ref={ref} slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </div>\n );\n});\n"],"names":[],"version":3,"file":"ProgressBar.module.js.map"}
|
package/dist/RSPContexts.main.js
CHANGED
|
@@ -11,6 +11,8 @@ $parcel$export(module.exports, "ColorFieldContext", () => $525402dfec7da5bc$expo
|
|
|
11
11
|
$parcel$export(module.exports, "ColorSliderContext", () => $525402dfec7da5bc$export$717b2c0a523a0b53);
|
|
12
12
|
$parcel$export(module.exports, "ColorWheelContext", () => $525402dfec7da5bc$export$265015d6dc85bf21);
|
|
13
13
|
$parcel$export(module.exports, "HeadingContext", () => $525402dfec7da5bc$export$d688439359537581);
|
|
14
|
+
$parcel$export(module.exports, "SelectableCollectionContext", () => $525402dfec7da5bc$export$b0d3ecf7112093a7);
|
|
15
|
+
$parcel$export(module.exports, "FieldInputContext", () => $525402dfec7da5bc$export$698f465ec27e93df);
|
|
14
16
|
/*
|
|
15
17
|
* Copyright 2024 Adobe. All rights reserved.
|
|
16
18
|
* This file is licensed to you under the Apache License, Version 2.0 (the 'License');
|
|
@@ -28,6 +30,8 @@ const $525402dfec7da5bc$export$44644b8a16031b5b = (0, $6nrYp$react.createContext
|
|
|
28
30
|
const $525402dfec7da5bc$export$717b2c0a523a0b53 = (0, $6nrYp$react.createContext)(null);
|
|
29
31
|
const $525402dfec7da5bc$export$265015d6dc85bf21 = (0, $6nrYp$react.createContext)(null);
|
|
30
32
|
const $525402dfec7da5bc$export$d688439359537581 = (0, $6nrYp$react.createContext)({});
|
|
33
|
+
const $525402dfec7da5bc$export$b0d3ecf7112093a7 = (0, $6nrYp$react.createContext)(null);
|
|
34
|
+
const $525402dfec7da5bc$export$698f465ec27e93df = (0, $6nrYp$react.createContext)(null);
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
//# sourceMappingURL=RSPContexts.main.js.map
|