react-aria-components 3.0.0-nightly-3f44370de-241118 → 3.0.0-nightly-b3a4d6c11-241119
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/Breadcrumbs.main.js +2 -2
- package/dist/Breadcrumbs.main.js.map +1 -1
- package/dist/Breadcrumbs.mjs +2 -2
- package/dist/Breadcrumbs.module.js +2 -2
- package/dist/Breadcrumbs.module.js.map +1 -1
- package/dist/Button.main.js.map +1 -1
- package/dist/Button.module.js.map +1 -1
- package/dist/Collection.main.js.map +1 -1
- package/dist/Collection.module.js.map +1 -1
- package/dist/ComboBox.main.js +2 -2
- package/dist/ComboBox.main.js.map +1 -1
- package/dist/ComboBox.mjs +2 -2
- package/dist/ComboBox.module.js +2 -2
- package/dist/ComboBox.module.js.map +1 -1
- package/dist/Dialog.main.js +22 -1
- package/dist/Dialog.main.js.map +1 -1
- package/dist/Dialog.mjs +23 -2
- package/dist/Dialog.module.js +23 -2
- package/dist/Dialog.module.js.map +1 -1
- package/dist/Disclosure.main.js +1 -1
- package/dist/Disclosure.main.js.map +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/Disclosure.module.js +1 -1
- package/dist/Disclosure.module.js.map +1 -1
- package/dist/Heading.main.js.map +1 -1
- package/dist/Heading.module.js.map +1 -1
- package/dist/Menu.main.js +7 -45
- package/dist/Menu.main.js.map +1 -1
- package/dist/Menu.mjs +9 -47
- package/dist/Menu.module.js +9 -47
- package/dist/Menu.module.js.map +1 -1
- package/dist/OverlayArrow.main.js +1 -1
- package/dist/OverlayArrow.main.js.map +1 -1
- package/dist/OverlayArrow.mjs +1 -1
- package/dist/OverlayArrow.module.js +1 -1
- package/dist/OverlayArrow.module.js.map +1 -1
- package/dist/Popover.main.js +1 -0
- package/dist/Popover.main.js.map +1 -1
- package/dist/Popover.mjs +1 -0
- package/dist/Popover.module.js +1 -0
- package/dist/Popover.module.js.map +1 -1
- package/dist/Table.main.js +2 -10
- package/dist/Table.main.js.map +1 -1
- package/dist/Table.mjs +2 -10
- package/dist/Table.module.js +2 -10
- package/dist/Table.module.js.map +1 -1
- package/dist/Tooltip.main.js +1 -1
- package/dist/Tooltip.main.js.map +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/Tooltip.module.js +1 -1
- package/dist/Tooltip.module.js.map +1 -1
- package/dist/Virtualizer.main.js.map +1 -1
- package/dist/Virtualizer.module.js.map +1 -1
- package/dist/types.d.ts +107 -107
- package/dist/types.d.ts.map +1 -1
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +32 -33
- package/src/Collection.tsx +1 -1
- package/src/Dialog.tsx +15 -2
- package/src/Disclosure.tsx +1 -1
- package/src/Menu.tsx +7 -33
- package/src/OverlayArrow.tsx +5 -3
- package/src/Popover.tsx +2 -2
- package/src/Table.tsx +1 -2
- package/src/Tooltip.tsx +2 -2
- package/src/Virtualizer.tsx +2 -2
package/dist/Menu.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {useMenuTriggerState as $kM2ZM$useMenuTriggerState, useTreeState as $kM2Z
|
|
|
11
11
|
import {createBranchComponent as $kM2ZM$createBranchComponent, CollectionBuilder as $kM2ZM$CollectionBuilder, Collection as $kM2ZM$Collection, createLeafComponent as $kM2ZM$createLeafComponent} from "@react-aria/collections";
|
|
12
12
|
import {useResizeObserver as $kM2ZM$useResizeObserver, useObjectRef as $kM2ZM$useObjectRef, filterDOMProps as $kM2ZM$filterDOMProps} from "@react-aria/utils";
|
|
13
13
|
import {SelectionManager as $kM2ZM$SelectionManager, useMultipleSelectionState as $kM2ZM$useMultipleSelectionState} from "@react-stately/selection";
|
|
14
|
-
import {PressResponder as $kM2ZM$PressResponder,
|
|
15
|
-
import $kM2ZM$react, {createContext as $kM2ZM$createContext, useRef as $kM2ZM$useRef, useState as $kM2ZM$useState, useCallback as $kM2ZM$useCallback, useContext as $kM2ZM$useContext,
|
|
14
|
+
import {PressResponder as $kM2ZM$PressResponder, useHover as $kM2ZM$useHover} from "@react-aria/interactions";
|
|
15
|
+
import $kM2ZM$react, {createContext as $kM2ZM$createContext, useRef as $kM2ZM$useRef, useState as $kM2ZM$useState, useCallback as $kM2ZM$useCallback, useContext as $kM2ZM$useContext, forwardRef as $kM2ZM$forwardRef} from "react";
|
|
16
16
|
import {useSubmenuTriggerState as $kM2ZM$useSubmenuTriggerState} from "@react-stately/menu";
|
|
17
17
|
import {useSubmenuTrigger as $kM2ZM$useSubmenuTrigger} from "@react-aria/menu";
|
|
18
18
|
|
|
@@ -112,7 +112,6 @@ const $3674c52c6b3c5bce$export$ecabc99eeffab7ca = /*#__PURE__*/ (0, $kM2ZM$creat
|
|
|
112
112
|
}, rootMenuTriggerState);
|
|
113
113
|
let submenuRef = (0, $kM2ZM$useRef)(null);
|
|
114
114
|
let itemRef = (0, $kM2ZM$useObjectRef)(ref);
|
|
115
|
-
let popoverContext = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $07b14b47974efb58$export$9b9a0cd73afb7ca4));
|
|
116
115
|
let { parentMenuRef: parentMenuRef } = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$var$SubmenuTriggerContext);
|
|
117
116
|
let { submenuTriggerProps: submenuTriggerProps, submenuProps: submenuProps, popoverProps: popoverProps } = (0, $kM2ZM$useSubmenuTrigger)({
|
|
118
117
|
parentMenuRef: parentMenuRef,
|
|
@@ -144,7 +143,9 @@ const $3674c52c6b3c5bce$export$ecabc99eeffab7ca = /*#__PURE__*/ (0, $kM2ZM$creat
|
|
|
144
143
|
trigger: 'SubmenuTrigger',
|
|
145
144
|
triggerRef: itemRef,
|
|
146
145
|
placement: 'end top',
|
|
147
|
-
|
|
146
|
+
// Prevent parent popover from hiding submenu.
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
'data-react-aria-top-layer': true,
|
|
148
149
|
...popoverProps
|
|
149
150
|
}
|
|
150
151
|
]
|
|
@@ -171,38 +172,13 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
171
172
|
collection: collection,
|
|
172
173
|
children: undefined
|
|
173
174
|
});
|
|
174
|
-
let
|
|
175
|
+
let triggerState = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$export$795aec4671cbae19);
|
|
175
176
|
let { isVirtualized: isVirtualized, CollectionRoot: CollectionRoot } = (0, $kM2ZM$useContext)((0, $7135fc7d473fd974$export$4feb769f8ddf26c5));
|
|
176
177
|
let { menuProps: menuProps } = (0, $kM2ZM$useMenu)({
|
|
177
178
|
...props,
|
|
178
|
-
isVirtualized: isVirtualized
|
|
179
|
+
isVirtualized: isVirtualized,
|
|
180
|
+
onClose: props.onClose || (triggerState === null || triggerState === void 0 ? void 0 : triggerState.close)
|
|
179
181
|
}, state, ref);
|
|
180
|
-
let rootMenuTriggerState = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$export$795aec4671cbae19);
|
|
181
|
-
let popoverContext = (0, $kM2ZM$useContext)((0, $07b14b47974efb58$export$9b9a0cd73afb7ca4));
|
|
182
|
-
let isSubmenu = (popoverContext === null || popoverContext === void 0 ? void 0 : popoverContext.trigger) === 'SubmenuTrigger';
|
|
183
|
-
(0, $kM2ZM$useInteractOutside)({
|
|
184
|
-
ref: ref,
|
|
185
|
-
onInteractOutside: (e)=>{
|
|
186
|
-
if (rootMenuTriggerState && !(popoverContainer === null || popoverContainer === void 0 ? void 0 : popoverContainer.contains(e.target))) rootMenuTriggerState.close();
|
|
187
|
-
},
|
|
188
|
-
isDisabled: isSubmenu || (rootMenuTriggerState === null || rootMenuTriggerState === void 0 ? void 0 : rootMenuTriggerState.expandedKeysStack.length) === 0
|
|
189
|
-
});
|
|
190
|
-
let prevPopoverContainer = (0, $kM2ZM$useRef)(null);
|
|
191
|
-
let [leftOffset, setLeftOffset] = (0, $kM2ZM$useState)({
|
|
192
|
-
left: 0
|
|
193
|
-
});
|
|
194
|
-
(0, $kM2ZM$useEffect)(()=>{
|
|
195
|
-
if (popoverContainer && prevPopoverContainer.current !== popoverContainer && leftOffset.left === 0) {
|
|
196
|
-
prevPopoverContainer.current = popoverContainer;
|
|
197
|
-
let { left: left } = popoverContainer.getBoundingClientRect();
|
|
198
|
-
setLeftOffset({
|
|
199
|
-
left: -1 * left
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}, [
|
|
203
|
-
leftOffset,
|
|
204
|
-
popoverContainer
|
|
205
|
-
]);
|
|
206
182
|
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
207
183
|
defaultClassName: 'react-aria-Menu',
|
|
208
184
|
className: props.className,
|
|
@@ -228,12 +204,6 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
228
204
|
elementType: 'div'
|
|
229
205
|
}
|
|
230
206
|
],
|
|
231
|
-
[
|
|
232
|
-
(0, $07b14b47974efb58$export$9b9a0cd73afb7ca4),
|
|
233
|
-
{
|
|
234
|
-
UNSTABLE_portalContainer: popoverContainer || undefined
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
207
|
[
|
|
238
208
|
(0, $7135fc7d473fd974$export$d40e14dec8b060a8),
|
|
239
209
|
{
|
|
@@ -260,15 +230,7 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
260
230
|
collection: collection,
|
|
261
231
|
persistedKeys: (0, $7135fc7d473fd974$export$90e00781bc59d8f9)(state.selectionManager.focusedKey),
|
|
262
232
|
scrollRef: ref
|
|
263
|
-
})))
|
|
264
|
-
ref: setPopoverContainer,
|
|
265
|
-
style: {
|
|
266
|
-
width: '100vw',
|
|
267
|
-
position: 'absolute',
|
|
268
|
-
top: 0,
|
|
269
|
-
...leftOffset
|
|
270
|
-
}
|
|
271
|
-
}));
|
|
233
|
+
}))));
|
|
272
234
|
}
|
|
273
235
|
/**
|
|
274
236
|
* A menu displays a list of actions or options that a user can choose.
|
package/dist/Menu.module.js
CHANGED
|
@@ -11,8 +11,8 @@ import {useMenuTriggerState as $kM2ZM$useMenuTriggerState, useTreeState as $kM2Z
|
|
|
11
11
|
import {createBranchComponent as $kM2ZM$createBranchComponent, CollectionBuilder as $kM2ZM$CollectionBuilder, Collection as $kM2ZM$Collection, createLeafComponent as $kM2ZM$createLeafComponent} from "@react-aria/collections";
|
|
12
12
|
import {useResizeObserver as $kM2ZM$useResizeObserver, useObjectRef as $kM2ZM$useObjectRef, filterDOMProps as $kM2ZM$filterDOMProps} from "@react-aria/utils";
|
|
13
13
|
import {SelectionManager as $kM2ZM$SelectionManager, useMultipleSelectionState as $kM2ZM$useMultipleSelectionState} from "@react-stately/selection";
|
|
14
|
-
import {PressResponder as $kM2ZM$PressResponder,
|
|
15
|
-
import $kM2ZM$react, {createContext as $kM2ZM$createContext, useRef as $kM2ZM$useRef, useState as $kM2ZM$useState, useCallback as $kM2ZM$useCallback, useContext as $kM2ZM$useContext,
|
|
14
|
+
import {PressResponder as $kM2ZM$PressResponder, useHover as $kM2ZM$useHover} from "@react-aria/interactions";
|
|
15
|
+
import $kM2ZM$react, {createContext as $kM2ZM$createContext, useRef as $kM2ZM$useRef, useState as $kM2ZM$useState, useCallback as $kM2ZM$useCallback, useContext as $kM2ZM$useContext, forwardRef as $kM2ZM$forwardRef} from "react";
|
|
16
16
|
import {useSubmenuTriggerState as $kM2ZM$useSubmenuTriggerState} from "@react-stately/menu";
|
|
17
17
|
import {useSubmenuTrigger as $kM2ZM$useSubmenuTrigger} from "@react-aria/menu";
|
|
18
18
|
|
|
@@ -112,7 +112,6 @@ const $3674c52c6b3c5bce$export$ecabc99eeffab7ca = /*#__PURE__*/ (0, $kM2ZM$creat
|
|
|
112
112
|
}, rootMenuTriggerState);
|
|
113
113
|
let submenuRef = (0, $kM2ZM$useRef)(null);
|
|
114
114
|
let itemRef = (0, $kM2ZM$useObjectRef)(ref);
|
|
115
|
-
let popoverContext = (0, $64fa3d84918910a7$export$fabf2dc03a41866e)((0, $07b14b47974efb58$export$9b9a0cd73afb7ca4));
|
|
116
115
|
let { parentMenuRef: parentMenuRef } = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$var$SubmenuTriggerContext);
|
|
117
116
|
let { submenuTriggerProps: submenuTriggerProps, submenuProps: submenuProps, popoverProps: popoverProps } = (0, $kM2ZM$useSubmenuTrigger)({
|
|
118
117
|
parentMenuRef: parentMenuRef,
|
|
@@ -144,7 +143,9 @@ const $3674c52c6b3c5bce$export$ecabc99eeffab7ca = /*#__PURE__*/ (0, $kM2ZM$creat
|
|
|
144
143
|
trigger: 'SubmenuTrigger',
|
|
145
144
|
triggerRef: itemRef,
|
|
146
145
|
placement: 'end top',
|
|
147
|
-
|
|
146
|
+
// Prevent parent popover from hiding submenu.
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
'data-react-aria-top-layer': true,
|
|
148
149
|
...popoverProps
|
|
149
150
|
}
|
|
150
151
|
]
|
|
@@ -171,38 +172,13 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
171
172
|
collection: collection,
|
|
172
173
|
children: undefined
|
|
173
174
|
});
|
|
174
|
-
let
|
|
175
|
+
let triggerState = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$export$795aec4671cbae19);
|
|
175
176
|
let { isVirtualized: isVirtualized, CollectionRoot: CollectionRoot } = (0, $kM2ZM$useContext)((0, $7135fc7d473fd974$export$4feb769f8ddf26c5));
|
|
176
177
|
let { menuProps: menuProps } = (0, $kM2ZM$useMenu)({
|
|
177
178
|
...props,
|
|
178
|
-
isVirtualized: isVirtualized
|
|
179
|
+
isVirtualized: isVirtualized,
|
|
180
|
+
onClose: props.onClose || (triggerState === null || triggerState === void 0 ? void 0 : triggerState.close)
|
|
179
181
|
}, state, ref);
|
|
180
|
-
let rootMenuTriggerState = (0, $kM2ZM$useContext)($3674c52c6b3c5bce$export$795aec4671cbae19);
|
|
181
|
-
let popoverContext = (0, $kM2ZM$useContext)((0, $07b14b47974efb58$export$9b9a0cd73afb7ca4));
|
|
182
|
-
let isSubmenu = (popoverContext === null || popoverContext === void 0 ? void 0 : popoverContext.trigger) === 'SubmenuTrigger';
|
|
183
|
-
(0, $kM2ZM$useInteractOutside)({
|
|
184
|
-
ref: ref,
|
|
185
|
-
onInteractOutside: (e)=>{
|
|
186
|
-
if (rootMenuTriggerState && !(popoverContainer === null || popoverContainer === void 0 ? void 0 : popoverContainer.contains(e.target))) rootMenuTriggerState.close();
|
|
187
|
-
},
|
|
188
|
-
isDisabled: isSubmenu || (rootMenuTriggerState === null || rootMenuTriggerState === void 0 ? void 0 : rootMenuTriggerState.expandedKeysStack.length) === 0
|
|
189
|
-
});
|
|
190
|
-
let prevPopoverContainer = (0, $kM2ZM$useRef)(null);
|
|
191
|
-
let [leftOffset, setLeftOffset] = (0, $kM2ZM$useState)({
|
|
192
|
-
left: 0
|
|
193
|
-
});
|
|
194
|
-
(0, $kM2ZM$useEffect)(()=>{
|
|
195
|
-
if (popoverContainer && prevPopoverContainer.current !== popoverContainer && leftOffset.left === 0) {
|
|
196
|
-
prevPopoverContainer.current = popoverContainer;
|
|
197
|
-
let { left: left } = popoverContainer.getBoundingClientRect();
|
|
198
|
-
setLeftOffset({
|
|
199
|
-
left: -1 * left
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}, [
|
|
203
|
-
leftOffset,
|
|
204
|
-
popoverContainer
|
|
205
|
-
]);
|
|
206
182
|
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
207
183
|
defaultClassName: 'react-aria-Menu',
|
|
208
184
|
className: props.className,
|
|
@@ -228,12 +204,6 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
228
204
|
elementType: 'div'
|
|
229
205
|
}
|
|
230
206
|
],
|
|
231
|
-
[
|
|
232
|
-
(0, $07b14b47974efb58$export$9b9a0cd73afb7ca4),
|
|
233
|
-
{
|
|
234
|
-
UNSTABLE_portalContainer: popoverContainer || undefined
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
207
|
[
|
|
238
208
|
(0, $7135fc7d473fd974$export$d40e14dec8b060a8),
|
|
239
209
|
{
|
|
@@ -260,15 +230,7 @@ function $3674c52c6b3c5bce$var$MenuInner({ props: props, collection: collection,
|
|
|
260
230
|
collection: collection,
|
|
261
231
|
persistedKeys: (0, $7135fc7d473fd974$export$90e00781bc59d8f9)(state.selectionManager.focusedKey),
|
|
262
232
|
scrollRef: ref
|
|
263
|
-
})))
|
|
264
|
-
ref: setPopoverContainer,
|
|
265
|
-
style: {
|
|
266
|
-
width: '100vw',
|
|
267
|
-
position: 'absolute',
|
|
268
|
-
top: 0,
|
|
269
|
-
...leftOffset
|
|
270
|
-
}
|
|
271
|
-
}));
|
|
233
|
+
}))));
|
|
272
234
|
}
|
|
273
235
|
/**
|
|
274
236
|
* A menu displays a list of actions or options that a user can choose.
|
package/dist/Menu.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AAkCM,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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,GAAA,eAAO,EAAE;QACrC,YAAY,OAAO,UAAU;IAC/B;IACA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,IAAI;QACJ,UAAU,KAAK,QAAQ;QACvB,kBAAkB;QAClB,QAAQ;YACN,GAAG,MAAM;uBACT;4BACA;YACA,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;IAExD,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,eAAe,YAAY,WAAW;QACpD,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,kBAAkB;QACtC,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,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\n\nimport {AriaMenuProps, FocusScope, mergeProps, useFocusRing, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, Provider, RenderProps, ScrollableProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {filterDOMProps, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} 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, PopoverProps} from './Popover';\nimport {PressResponder, useHover, useInteractOutside} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {useSubmenuTrigger} from '@react-aria/menu';\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) {\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\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 }]\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>} | null>(null);\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('submenutrigger', (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 popoverContext = useSlottedContext(PopoverContext)!;\n let {parentMenuRef} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n UNSTABLE_portalContainer: popoverContext.UNSTABLE_portalContainer || undefined,\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 MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleProps, SlotProps, ScrollableProps<HTMLDivElement> {}\n\nfunction 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 => collection.size > 0 && <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: ICollection<Node<object>>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let state = useTreeState({\n ...props,\n collection,\n children: undefined\n });\n let [popoverContainer, setPopoverContainer] = useState<HTMLDivElement | null>(null);\n let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n let {menuProps} = useMenu({...props, isVirtualized}, state, ref);\n let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n let popoverContext = useContext(PopoverContext)!;\n\n let isSubmenu = (popoverContext as PopoverProps)?.trigger === 'SubmenuTrigger';\n useInteractOutside({\n ref,\n onInteractOutside: (e) => {\n if (rootMenuTriggerState && !popoverContainer?.contains(e.target as HTMLElement)) {\n rootMenuTriggerState.close();\n }\n },\n isDisabled: isSubmenu || rootMenuTriggerState?.expandedKeysStack.length === 0\n });\n\n let prevPopoverContainer = useRef<HTMLDivElement | null>(null) ;\n let [leftOffset, setLeftOffset] = useState({left: 0});\n useEffect(() => {\n if (popoverContainer && prevPopoverContainer.current !== popoverContainer && leftOffset.left === 0) {\n prevPopoverContainer.current = popoverContainer;\n let {left} = popoverContainer.getBoundingClientRect();\n setLeftOffset({left: -1 * left});\n }\n }, [leftOffset, popoverContainer]);\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Menu',\n className: props.className,\n style: props.style,\n values: {}\n });\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [PopoverContext, {UNSTABLE_portalContainer: popoverContainer || undefined}],\n [SectionContext, {name: 'MenuSection', render: MenuSection}],\n [SubmenuTriggerContext, {parentMenuRef: ref}],\n [MenuItemContext, null],\n [SelectionManagerContext, state.selectionManager]\n ]}>\n <CollectionRoot\n collection={collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n </div>\n <div ref={setPopoverContainer} style={{width: '100vw', position: 'absolute', top: 0, ...leftOffset}} />\n </FocusScope>\n );\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nconst _Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(Menu);\nexport {_Menu as Menu};\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 MenuSection<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 return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\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 */\nconst _MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSection);\nexport {_MenuSection as MenuSection};\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 {\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('item', 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 {isFocusVisible, focusProps} = useFocusRing();\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,\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\n return (\n <ElementType\n {...mergeProps(menuItemProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={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 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;;;;;;;;;;;;;;;;;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,IAAI,OAAO,CAAC,WAAW,GAAG;IAE7C,GAAG;QAAC;KAAI;IAER,CAAA,GAAA,wBAAgB,EAAE;QAChB,KAAK;QACL,UAAU;IACZ;IAEA,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAa;oBAAC,GA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D,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,eAAe,YAAY,WAAW;QACpD,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,kBAAkB;QACtC,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,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\n\nimport {AriaMenuProps, FocusScope, mergeProps, useFocusRing, useMenu, useMenuItem, useMenuSection, useMenuTrigger} from 'react-aria';\nimport {MenuTriggerProps as BaseMenuTriggerProps, Collection as ICollection, Node, TreeState, useMenuTriggerState, useTreeState} from 'react-stately';\nimport {Collection, CollectionBuilder, createBranchComponent, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, ItemRenderProps, SectionContext, SectionProps, usePersistedKeys} from './Collection';\nimport {ContextValue, Provider, RenderProps, ScrollableProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {filterDOMProps, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {FocusStrategy, forwardRefType, HoverEvents, Key, LinkDOMProps, MultipleSelection} 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, useHover} from '@react-aria/interactions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useContext,\n useRef,\n useState\n} from 'react';\nimport {RootMenuTriggerState, useSubmenuTriggerState} from '@react-stately/menu';\nimport {SeparatorContext} from './Separator';\nimport {TextContext} from './Text';\nimport {useSubmenuTrigger} from '@react-aria/menu';\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) {\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\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 }]\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>} | null>(null);\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('submenutrigger', (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} = useContext(SubmenuTriggerContext)!;\n let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger({\n parentMenuRef,\n submenuRef,\n delay: props.delay\n }, submenuTriggerState, itemRef);\n\n return (\n <Provider\n values={[\n [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n [MenuContext, submenuProps],\n [OverlayTriggerStateContext, submenuTriggerState],\n [PopoverContext, {\n ref: submenuRef,\n trigger: 'SubmenuTrigger',\n triggerRef: itemRef,\n placement: 'end top',\n // Prevent parent popover from hiding submenu.\n // @ts-ignore\n 'data-react-aria-top-layer': true,\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 MenuProps<T> extends Omit<AriaMenuProps<T>, 'children'>, CollectionProps<T>, StyleProps, SlotProps, ScrollableProps<HTMLDivElement> {}\n\nfunction 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 => collection.size > 0 && <MenuInner props={props} collection={collection} menuRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface MenuInnerProps<T> {\n props: MenuProps<T>,\n collection: ICollection<Node<object>>,\n menuRef: RefObject<HTMLDivElement | null>\n}\n\nfunction MenuInner<T extends object>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n let state = useTreeState({\n ...props,\n collection,\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 });\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...menuProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}>\n <Provider\n values={[\n [MenuStateContext, state],\n [SeparatorContext, {elementType: 'div'}],\n [SectionContext, {name: 'MenuSection', render: MenuSection}],\n [SubmenuTriggerContext, {parentMenuRef: ref}],\n [MenuItemContext, null],\n [SelectionManagerContext, state.selectionManager]\n ]}>\n <CollectionRoot\n collection={collection}\n persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n scrollRef={ref} />\n </Provider>\n </div>\n </FocusScope>\n );\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nconst _Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(Menu);\nexport {_Menu as Menu};\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 MenuSection<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 return (\n <section\n {...filterDOMProps(props as any)}\n {...groupProps}\n {...renderProps}\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 */\nconst _MenuSection = /*#__PURE__*/ createBranchComponent('section', MenuSection);\nexport {_MenuSection as MenuSection};\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 {\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('item', 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 {isFocusVisible, focusProps} = useFocusRing();\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,\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\n return (\n <ElementType\n {...mergeProps(menuItemProps, focusProps, hoverProps)}\n {...renderProps}\n ref={ref}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={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 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"}
|
|
@@ -32,9 +32,9 @@ function $ee5958cbdc6becc1$var$OverlayArrow(props, ref) {
|
|
|
32
32
|
let placement = props.placement;
|
|
33
33
|
let style = {
|
|
34
34
|
position: 'absolute',
|
|
35
|
-
[placement]: '100%',
|
|
36
35
|
transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'
|
|
37
36
|
};
|
|
37
|
+
if (placement != null) style[placement] = '100%';
|
|
38
38
|
let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
|
|
39
39
|
...props,
|
|
40
40
|
defaultClassName: 'react-aria-OverlayArrow',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAA0D;IACvG,WAAW;AACb;AAYA,SAAS,mCAAa,KAAwB,EAAE,GAAiC;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM,0DAAsB,CAAA,GAAA,0BAAY,EAA0D;IACvG,WAAW;AACb;AAYA,SAAS,mCAAa,KAAwB,EAAE,GAAiC;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,WAAW,cAAc,SAAS,cAAc,WAAW,qBAAqB;IAClF;IACA,IAAI,aAAa,MACf,KAAK,CAAC,UAAU,GAAG;IAGrB,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;uBACN;QACF;IACF;IACA,0EAA0E;IAC1E,4CAA4C;IAC5C,IAAI,YAAY,KAAK,EACnB,OAAO,IAAI,CAAC,YAAY,KAAK,EAAE,OAAO,CAAC,CAAA,MAAO,YAAY,KAAK,AAAC,CAAC,IAAI,KAAK,aAAa,OAAO,YAAY,KAAK,AAAC,CAAC,IAAI;IAGvH,qBACE,0DAAC;QACE,GAAG,KAAK;QACR,GAAG,WAAW;QACf,OAAO;YACL,GAAG,KAAK;YACR,GAAG,YAAY,KAAK;QACtB;QACA,KAAK;QACL,kBAAgB;;AAEtB;AAEA;;;CAGC,GACD,MAAM,2CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/OverlayArrow.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 {ContextValue, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {forwardRefType} from '@react-types/shared';\nimport {PlacementAxis} from 'react-aria';\nimport React, {createContext, CSSProperties, ForwardedRef, forwardRef, HTMLAttributes} from 'react';\n\ninterface OverlayArrowContextValue extends OverlayArrowProps {\n placement: PlacementAxis | null\n}\n\nexport const OverlayArrowContext = createContext<ContextValue<OverlayArrowContextValue, HTMLDivElement>>({\n placement: 'bottom'\n});\n\nexport interface OverlayArrowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'children'>, RenderProps<OverlayArrowRenderProps> {}\n\nexport interface OverlayArrowRenderProps {\n /**\n * The placement of the overlay relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null\n}\n\nfunction OverlayArrow(props: OverlayArrowProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, OverlayArrowContext);\n let placement = (props as OverlayArrowContextValue).placement;\n let style: CSSProperties = {\n position: 'absolute',\n transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'\n };\n if (placement != null) {\n style[placement] = '100%';\n }\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-OverlayArrow',\n values: {\n placement\n }\n });\n // remove undefined values from renderProps.style object so that it can be\n // spread merged with the other style object\n if (renderProps.style) {\n Object.keys(renderProps.style).forEach(key => renderProps.style![key] === undefined && delete renderProps.style![key]);\n }\n\n return (\n <div\n {...props}\n {...renderProps}\n style={{\n ...style,\n ...renderProps.style\n }}\n ref={ref}\n data-placement={placement} />\n );\n}\n\n/**\n * An OverlayArrow renders a custom arrow element relative to an overlay element\n * such as a popover or tooltip such that it aligns with a trigger element.\n */\nconst _OverlayArrow = /*#__PURE__*/ (forwardRef as forwardRefType)(OverlayArrow);\nexport {_OverlayArrow as OverlayArrow};\n"],"names":[],"version":3,"file":"OverlayArrow.main.js.map"}
|
package/dist/OverlayArrow.mjs
CHANGED
|
@@ -21,9 +21,9 @@ function $44f671af83e7d9e0$var$OverlayArrow(props, ref) {
|
|
|
21
21
|
let placement = props.placement;
|
|
22
22
|
let style = {
|
|
23
23
|
position: 'absolute',
|
|
24
|
-
[placement]: '100%',
|
|
25
24
|
transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'
|
|
26
25
|
};
|
|
26
|
+
if (placement != null) style[placement] = '100%';
|
|
27
27
|
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
28
28
|
...props,
|
|
29
29
|
defaultClassName: 'react-aria-OverlayArrow',
|
|
@@ -21,9 +21,9 @@ function $44f671af83e7d9e0$var$OverlayArrow(props, ref) {
|
|
|
21
21
|
let placement = props.placement;
|
|
22
22
|
let style = {
|
|
23
23
|
position: 'absolute',
|
|
24
|
-
[placement]: '100%',
|
|
25
24
|
transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'
|
|
26
25
|
};
|
|
26
|
+
if (placement != null) style[placement] = '100%';
|
|
27
27
|
let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
|
|
28
28
|
...props,
|
|
29
29
|
defaultClassName: 'react-aria-OverlayArrow',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA0D;IACvG,WAAW;AACb;AAYA,SAAS,mCAAa,KAAwB,EAAE,GAAiC;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAA0D;IACvG,WAAW;AACb;AAYA,SAAS,mCAAa,KAAwB,EAAE,GAAiC;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAY,AAAC,MAAmC,SAAS;IAC7D,IAAI,QAAuB;QACzB,UAAU;QACV,WAAW,cAAc,SAAS,cAAc,WAAW,qBAAqB;IAClF;IACA,IAAI,aAAa,MACf,KAAK,CAAC,UAAU,GAAG;IAGrB,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;uBACN;QACF;IACF;IACA,0EAA0E;IAC1E,4CAA4C;IAC5C,IAAI,YAAY,KAAK,EACnB,OAAO,IAAI,CAAC,YAAY,KAAK,EAAE,OAAO,CAAC,CAAA,MAAO,YAAY,KAAK,AAAC,CAAC,IAAI,KAAK,aAAa,OAAO,YAAY,KAAK,AAAC,CAAC,IAAI;IAGvH,qBACE,gCAAC;QACE,GAAG,KAAK;QACR,GAAG,WAAW;QACf,OAAO;YACL,GAAG,KAAK;YACR,GAAG,YAAY,KAAK;QACtB;QACA,KAAK;QACL,kBAAgB;;AAEtB;AAEA;;;CAGC,GACD,MAAM,2CAA8B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB","sources":["packages/react-aria-components/src/OverlayArrow.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 {ContextValue, RenderProps, useContextProps, useRenderProps} from './utils';\nimport {forwardRefType} from '@react-types/shared';\nimport {PlacementAxis} from 'react-aria';\nimport React, {createContext, CSSProperties, ForwardedRef, forwardRef, HTMLAttributes} from 'react';\n\ninterface OverlayArrowContextValue extends OverlayArrowProps {\n placement: PlacementAxis | null\n}\n\nexport const OverlayArrowContext = createContext<ContextValue<OverlayArrowContextValue, HTMLDivElement>>({\n placement: 'bottom'\n});\n\nexport interface OverlayArrowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style' | 'children'>, RenderProps<OverlayArrowRenderProps> {}\n\nexport interface OverlayArrowRenderProps {\n /**\n * The placement of the overlay relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null\n}\n\nfunction OverlayArrow(props: OverlayArrowProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, OverlayArrowContext);\n let placement = (props as OverlayArrowContextValue).placement;\n let style: CSSProperties = {\n position: 'absolute',\n transform: placement === 'top' || placement === 'bottom' ? 'translateX(-50%)' : 'translateY(-50%)'\n };\n if (placement != null) {\n style[placement] = '100%';\n }\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-OverlayArrow',\n values: {\n placement\n }\n });\n // remove undefined values from renderProps.style object so that it can be\n // spread merged with the other style object\n if (renderProps.style) {\n Object.keys(renderProps.style).forEach(key => renderProps.style![key] === undefined && delete renderProps.style![key]);\n }\n\n return (\n <div\n {...props}\n {...renderProps}\n style={{\n ...style,\n ...renderProps.style\n }}\n ref={ref}\n data-placement={placement} />\n );\n}\n\n/**\n * An OverlayArrow renders a custom arrow element relative to an overlay element\n * such as a popover or tooltip such that it aligns with a trigger element.\n */\nconst _OverlayArrow = /*#__PURE__*/ (forwardRef as forwardRefType)(OverlayArrow);\nexport {_OverlayArrow as OverlayArrow};\n"],"names":[],"version":3,"file":"OverlayArrow.module.js.map"}
|
package/dist/Popover.main.js
CHANGED
|
@@ -102,6 +102,7 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
102
102
|
...renderProps.style
|
|
103
103
|
};
|
|
104
104
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
|
|
105
|
+
...props,
|
|
105
106
|
isExiting: isExiting,
|
|
106
107
|
portalContainer: UNSTABLE_portalContainer
|
|
107
108
|
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
|
package/dist/Popover.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAErF,SAAS,8BAAQ,KAAmB,EAAE,GAA8B;IAClE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,0CAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,0CAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,uCAAU;IAEzB,sEAAsE;IACtE,IAAI,UAAU;QACZ,IAAI,WAAW,MAAM,QAAQ;QAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;YAClB,SAAS,MAAM,OAAO,IAAI;YAC1B,WAAW;YACX,YAAY;YACZ,WAAW;YACX,iBAAiB;QACnB;QAGF,qBAAO,sHAAG;IACZ;IAEA,IAAI,SAAS,CAAC,MAAM,MAAM,IAAI,CAAC,WAC7B,OAAO;IAGT,qBACE,0DAAC;QACE,GAAG,KAAK;QACT,YAAY,MAAM,UAAU;QAC5B,OAAO;QACP,YAAY;QACZ,WAAW;;AAEjB;AAEA;;CAEC,GACD,MAAM,4CAAyB,AAAd,WAAW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;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useEnterAnimation, useExitAnimation, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\nfunction Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n}\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nconst _Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(Popover);\nexport {_Popover as Popover};\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
|
package/dist/Popover.mjs
CHANGED
|
@@ -91,6 +91,7 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
91
91
|
...renderProps.style
|
|
92
92
|
};
|
|
93
93
|
return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
94
|
+
...props,
|
|
94
95
|
isExiting: isExiting,
|
|
95
96
|
portalContainer: UNSTABLE_portalContainer
|
|
96
97
|
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
package/dist/Popover.module.js
CHANGED
|
@@ -91,6 +91,7 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
91
91
|
...renderProps.style
|
|
92
92
|
};
|
|
93
93
|
return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
|
|
94
|
+
...props,
|
|
94
95
|
isExiting: isExiting,
|
|
95
96
|
portalContainer: UNSTABLE_portalContainer
|
|
96
97
|
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAErF,SAAS,8BAAQ,KAAmB,EAAE,GAA8B;IAClE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,yCAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,kBAAU;IAEzB,sEAAsE;IACtE,IAAI,UAAU;QACZ,IAAI,WAAW,MAAM,QAAQ;QAC7B,I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MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.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 {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useEnterAnimation, useExitAnimation, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover 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 */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\nfunction Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n}\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nconst _Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(Popover);\nexport {_Popover as Popover};\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
|
package/dist/Table.main.js
CHANGED
|
@@ -148,14 +148,7 @@ class $37b9a5d4bd0d4ded$var$TableCollection extends (0, $5VUTk$reactariacollecti
|
|
|
148
148
|
return text.join(' ');
|
|
149
149
|
}
|
|
150
150
|
constructor(...args){
|
|
151
|
-
super(...args);
|
|
152
|
-
this.headerRows = [];
|
|
153
|
-
this.columns = [];
|
|
154
|
-
this.rows = [];
|
|
155
|
-
this.rowHeaderColumnKeys = new Set();
|
|
156
|
-
this.head = new (0, $5VUTk$reactariacollections.CollectionNode)('tableheader', -1);
|
|
157
|
-
this.body = new (0, $5VUTk$reactariacollections.CollectionNode)('tablebody', -2);
|
|
158
|
-
this.columnsDirty = true;
|
|
151
|
+
super(...args), this.headerRows = [], this.columns = [], this.rows = [], this.rowHeaderColumnKeys = new Set(), this.head = new (0, $5VUTk$reactariacollections.CollectionNode)('tableheader', -1), this.body = new (0, $5VUTk$reactariacollections.CollectionNode)('tablebody', -2), this.columnsDirty = true;
|
|
159
152
|
}
|
|
160
153
|
}
|
|
161
154
|
const $37b9a5d4bd0d4ded$var$ResizableTableContainerContext = /*#__PURE__*/ (0, $5VUTk$react.createContext)(null);
|
|
@@ -819,7 +812,7 @@ const $37b9a5d4bd0d4ded$export$b59bdbef9ce70de2 = /*#__PURE__*/ (0, $5VUTk$react
|
|
|
819
812
|
parent: item
|
|
820
813
|
}))));
|
|
821
814
|
}, (props)=>{
|
|
822
|
-
if (props.id == null && typeof props.children === 'function')
|
|
815
|
+
if (props.id == null && typeof props.children === 'function') throw new Error('No id detected for the Row element. The Row element requires a id to be provided to it when the cells are rendered dynamically.');
|
|
823
816
|
let dependencies = [
|
|
824
817
|
props.value
|
|
825
818
|
].concat(props.dependencies);
|
|
@@ -834,7 +827,6 @@ const $37b9a5d4bd0d4ded$export$f6f0c3fe4ec306ea = /*#__PURE__*/ (0, $5VUTk$react
|
|
|
834
827
|
let state = (0, $5VUTk$react.useContext)($37b9a5d4bd0d4ded$export$38de1cb0526c21fb);
|
|
835
828
|
let { dragState: dragState } = (0, $5VUTk$react.useContext)((0, $0c2289d253cb4544$exports.DragAndDropContext));
|
|
836
829
|
let { isVirtualized: isVirtualized } = (0, $5VUTk$react.useContext)((0, $3114c2382242bdc0$exports.CollectionRendererContext));
|
|
837
|
-
// @ts-ignore
|
|
838
830
|
cell.column = state.collection.columns[cell.index];
|
|
839
831
|
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $5VUTk$reactaria.useTableCell)({
|
|
840
832
|
node: cell,
|