@wix/site-ui 1.347.0 → 1.348.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/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
package/dist/{6882.js → 721.js}
RENAMED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { utils_formatErrorMessage } from "./5473.js";
|
|
3
3
|
import { isLastTraversableNode, getParentNode, isHTMLElement } from "./3829.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { itemPress, siblingOpen, outsidePress,
|
|
7
|
-
import {
|
|
8
|
-
import { usePositioner,
|
|
9
|
-
import { createChangeEventDetails } from "./
|
|
10
|
-
import { useTimeout } from "./
|
|
11
|
-
import {
|
|
12
|
-
import { useAnchoredPopupScrollLock } from "./
|
|
13
|
-
import { useOpenInteractionType, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "./
|
|
14
|
-
import { inertValue } from "./
|
|
15
|
-
import { useFloatingParentNodeId, FloatingNode, FloatingTree, useFloatingNodeId, FloatingTreeStore } from "./
|
|
16
|
-
import { CompositeList } from "./
|
|
17
|
-
import { useToolbarRootContext } from "./
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
4
|
+
import { EMPTY_OBJECT, EMPTY_ARRAY, useMergedRefs, useRefWithInit, warn, unwrapLazyRenderProp, mergeProps, useRenderElement, NOOP } from "./9591.js";
|
|
5
|
+
import { popupTransitionStateMapping, popupStateMapping, triggerOpenStateMapping } from "./6904.js";
|
|
6
|
+
import { itemPress, siblingOpen, outsidePress, pointer, keyboard, imperativeAction, focusOut, triggerFocus, listNavigation as reason_parts_listNavigation, triggerHover, triggerPress, escapeKey } from "./9837.js";
|
|
7
|
+
import { DROPDOWN_COLLISION_AVOIDANCE, voiceOver, FloatingPortal_FloatingPortal, POPUP_COLLISION_AVOIDANCE } from "./3398.js";
|
|
8
|
+
import { usePositioner, useAnchorPositioning, getDisabledMountTransitionStyles } from "./497.js";
|
|
9
|
+
import { createGenericEventDetails, createChangeEventDetails } from "./8495.js";
|
|
10
|
+
import { useTimeout } from "./9197.js";
|
|
11
|
+
import { useTriggerSwitchTransition } from "./7024.js";
|
|
12
|
+
import { useAnchoredPopupScrollLock } from "./3054.js";
|
|
13
|
+
import { useOpenInteractionType, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "./7323.js";
|
|
14
|
+
import { inertValue } from "./9374.js";
|
|
15
|
+
import { useFloatingParentNodeId, FloatingNode, FloatingTree, useFloatingNodeId, FloatingTreeStore } from "./4472.js";
|
|
16
|
+
import { CompositeList } from "./3014.js";
|
|
17
|
+
import { useToolbarRootContext } from "./9770.js";
|
|
18
|
+
import { useAnimationsFinished, useOpenChangeComplete } from "./6620.js";
|
|
19
|
+
import { useHoverFloatingInteraction } from "./1607.js";
|
|
20
|
+
import { COMPOSITE_KEYS } from "./2859.js";
|
|
21
|
+
import { useBaseUiId } from "./5969.js";
|
|
22
|
+
import { useIsoLayoutEffect, SafeReact } from "./3357.js";
|
|
23
|
+
import { mac } from "./2221.js";
|
|
24
|
+
import { dispatchClickWithModifiers, useButton } from "./9248.js";
|
|
25
|
+
import { useCompositeListItem } from "./9576.js";
|
|
26
|
+
import { transitionStatusMapping } from "./8488.js";
|
|
27
|
+
import { useControlled } from "./6006.js";
|
|
28
|
+
import { useTransitionStatus } from "./7542.js";
|
|
29
|
+
import { useStableCallback } from "./7488.js";
|
|
30
|
+
import { useDismiss, useTriggerRegistration, usePopupInteractionProps, PopupTriggerMap, PopupHandleAttachment, useImplicitActiveTrigger, useSyncedFloatingRootContext, useOpenStateTransitions, createPopupOpenState, FOCUSABLE_POPUP_PROPS, attachPreventUnmountOnClose } from "./4346.js";
|
|
31
|
+
import { getTarget } from "./4155.js";
|
|
32
|
+
import { isElementDisabled } from "./6499.js";
|
|
33
|
+
import { safePolygon, useHoverReferenceInteraction } from "./3910.js";
|
|
34
|
+
import { useClick } from "./8407.js";
|
|
35
|
+
import { NullStore, popupStoreSelectors, createInitialPopupStoreState } from "./1669.js";
|
|
36
|
+
import { webkit } from "./3189.js";
|
|
37
|
+
import { fastComponent, ReactStore } from "./226.js";
|
|
38
|
+
import { useMenubarContext } from "./331.js";
|
|
39
|
+
import { useDirection } from "./6534.js";
|
|
40
|
+
import { useListNavigation, useTypeahead } from "./1381.js";
|
|
41
|
+
import { getHighlightReason } from "./9303.js";
|
|
38
42
|
import * as __rspack_external_react from "react";
|
|
39
43
|
const ContextMenuRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
40
44
|
if ("production" !== process.env.NODE_ENV) ContextMenuRootContext.displayName = "ContextMenuRootContext";
|
|
41
45
|
function useContextMenuRootContext(optional = true) {
|
|
42
46
|
const context = __rspack_external_react.useContext(ContextMenuRootContext);
|
|
43
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.' :
|
|
47
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.' : utils_formatErrorMessage(25));
|
|
44
48
|
return context;
|
|
45
49
|
}
|
|
46
50
|
const MenuRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
47
51
|
if ("production" !== process.env.NODE_ENV) MenuRootContext.displayName = "MenuRootContext";
|
|
48
52
|
function useMenuRootContext(optional) {
|
|
49
53
|
const context = __rspack_external_react.useContext(MenuRootContext);
|
|
50
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.' :
|
|
54
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.' : utils_formatErrorMessage(36));
|
|
51
55
|
return context;
|
|
52
56
|
}
|
|
53
57
|
function findRootOwnerId(node) {
|
|
54
|
-
if (isHTMLElement(node) && node.hasAttribute('data-rootownerid')) return node.getAttribute('data-rootownerid')
|
|
58
|
+
if (isHTMLElement(node) && node.hasAttribute('data-rootownerid')) return node.getAttribute('data-rootownerid');
|
|
55
59
|
if (isLastTraversableNode(node)) return;
|
|
56
60
|
return findRootOwnerId(getParentNode(node));
|
|
57
61
|
}
|
|
58
|
-
const stateAttributesMapping = {
|
|
59
|
-
...popupStateMapping,
|
|
60
|
-
...transitionStatusMapping
|
|
61
|
-
};
|
|
62
62
|
const MenuBackdrop_MenuBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
63
63
|
const { render, className, style, ...elementProps } = componentProps;
|
|
64
64
|
const { store } = useMenuRootContext();
|
|
@@ -77,7 +77,7 @@ const MenuBackdrop_MenuBackdrop = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
77
77
|
contextMenuContext.backdropRef
|
|
78
78
|
] : forwardedRef,
|
|
79
79
|
state,
|
|
80
|
-
stateAttributesMapping:
|
|
80
|
+
stateAttributesMapping: popupTransitionStateMapping,
|
|
81
81
|
props: [
|
|
82
82
|
{
|
|
83
83
|
role: 'presentation',
|
|
@@ -97,19 +97,19 @@ const MenuPositionerContext = /*#__PURE__*/ __rspack_external_react.createContex
|
|
|
97
97
|
if ("production" !== process.env.NODE_ENV) MenuPositionerContext.displayName = "MenuPositionerContext";
|
|
98
98
|
function useMenuPositionerContext(optional) {
|
|
99
99
|
const context = __rspack_external_react.useContext(MenuPositionerContext);
|
|
100
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.' :
|
|
100
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.' : utils_formatErrorMessage(33));
|
|
101
101
|
return context;
|
|
102
102
|
}
|
|
103
103
|
const MenuPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
104
104
|
if ("production" !== process.env.NODE_ENV) MenuPortalContext.displayName = "MenuPortalContext";
|
|
105
105
|
function useMenuPortalContext() {
|
|
106
106
|
const value = __rspack_external_react.useContext(MenuPortalContext);
|
|
107
|
-
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Menu.Portal> is missing.' :
|
|
107
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Menu.Portal> is missing.' : utils_formatErrorMessage(32));
|
|
108
108
|
return value;
|
|
109
109
|
}
|
|
110
110
|
const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
111
111
|
const { anchor: anchorProp, positionMethod: positionMethodProp = 'absolute', className, render, side, align: alignProp, sideOffset: sideOffsetProp = 0, alignOffset: alignOffsetProp = 0, collisionBoundary = 'clipping-ancestors', collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance: collisionAvoidanceProp = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
|
|
112
|
-
const { store } = useMenuRootContext();
|
|
112
|
+
const { store, virtualFocus, syncHighlightedItem } = useMenuRootContext();
|
|
113
113
|
const keepMounted = useMenuPortalContext();
|
|
114
114
|
const contextMenuContext = useContextMenuRootContext(true);
|
|
115
115
|
const parent = store.useState('parent');
|
|
@@ -123,13 +123,11 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
123
123
|
const transitionStatus = store.useState('transitionStatus');
|
|
124
124
|
const positionerElement = store.useState('positionerElement');
|
|
125
125
|
const instantType = store.useState('instantType');
|
|
126
|
-
const
|
|
126
|
+
const adaptiveOrigin = store.useState('adaptiveOrigin');
|
|
127
127
|
const lastOpenChangeReason = store.useState('lastOpenChangeReason');
|
|
128
128
|
const floatingNodeId = store.useState('floatingNodeId');
|
|
129
129
|
const floatingParentNodeId = store.useState('floatingParentNodeId');
|
|
130
130
|
const domReference = floatingRootContext.useState('domReferenceElement');
|
|
131
|
-
const previousTriggerRef = __rspack_external_react.useRef(null);
|
|
132
|
-
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement, false, false);
|
|
133
131
|
let anchor = anchorProp;
|
|
134
132
|
let sideOffset = sideOffsetProp;
|
|
135
133
|
let alignOffset = alignOffsetProp;
|
|
@@ -150,7 +148,7 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
150
148
|
computedAlign = computedAlign ?? 'start';
|
|
151
149
|
collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE;
|
|
152
150
|
} else if ('menubar' === parent.type) {
|
|
153
|
-
computedSide = computedSide ?? 'bottom';
|
|
151
|
+
computedSide = computedSide ?? ('vertical' === parent.context.orientation ? 'inline-end' : 'bottom');
|
|
154
152
|
computedAlign = computedAlign ?? 'start';
|
|
155
153
|
}
|
|
156
154
|
const contextMenu = 'context-menu' === parent.type;
|
|
@@ -171,9 +169,13 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
171
169
|
keepMounted,
|
|
172
170
|
disableAnchorTracking,
|
|
173
171
|
collisionAvoidance,
|
|
174
|
-
|
|
172
|
+
shift: contextMenu ? {
|
|
173
|
+
crossAxis: !('side' in collisionAvoidance && 'flip' === collisionAvoidance.side),
|
|
174
|
+
rootBoundary: 'layoutViewport'
|
|
175
|
+
} : void 0,
|
|
175
176
|
externalTree: floatingTreeRoot,
|
|
176
|
-
adaptiveOrigin
|
|
177
|
+
adaptiveOrigin,
|
|
178
|
+
lazyFlip: virtualFocus ? 'placement' : false
|
|
177
179
|
});
|
|
178
180
|
__rspack_external_react.useEffect(()=>{
|
|
179
181
|
function onMenuOpenChange(details) {
|
|
@@ -251,25 +253,12 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
251
253
|
floatingNodeId,
|
|
252
254
|
floatingParentNodeId
|
|
253
255
|
]);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const previousTrigger = previousTriggerRef.current;
|
|
257
|
-
if (currentTrigger) previousTriggerRef.current = currentTrigger;
|
|
258
|
-
if (previousTrigger && currentTrigger && currentTrigger !== previousTrigger) {
|
|
259
|
-
store.set('instantType', void 0);
|
|
260
|
-
const abortController = new AbortController();
|
|
261
|
-
runOnceAnimationsFinish(()=>{
|
|
262
|
-
store.set('instantType', 'trigger-change');
|
|
263
|
-
}, abortController.signal);
|
|
264
|
-
return ()=>{
|
|
265
|
-
abortController.abort();
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}, [
|
|
256
|
+
useTriggerSwitchTransition({
|
|
257
|
+
store,
|
|
269
258
|
domReference,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
259
|
+
positionerElement,
|
|
260
|
+
open
|
|
261
|
+
});
|
|
273
262
|
const state = {
|
|
274
263
|
open,
|
|
275
264
|
side: positioner.side,
|
|
@@ -309,6 +298,7 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
309
298
|
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
310
299
|
elementsRef: store.context.itemDomElements,
|
|
311
300
|
labelsRef: store.context.itemLabels,
|
|
301
|
+
onMapChange: syncHighlightedItem,
|
|
312
302
|
children: element
|
|
313
303
|
})
|
|
314
304
|
})
|
|
@@ -316,13 +306,74 @@ const MenuPositioner_MenuPositioner = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
316
306
|
});
|
|
317
307
|
});
|
|
318
308
|
if ("production" !== process.env.NODE_ENV) MenuPositioner_MenuPositioner.displayName = "MenuPositioner";
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
309
|
+
const MenuSubmenuRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
310
|
+
if ("production" !== process.env.NODE_ENV) MenuSubmenuRootContext.displayName = "MenuSubmenuRootContext";
|
|
311
|
+
function useMenuSubmenuRootContext() {
|
|
312
|
+
return __rspack_external_react.useContext(MenuSubmenuRootContext);
|
|
313
|
+
}
|
|
314
|
+
function resolveRenderedId(props, fallbackId) {
|
|
315
|
+
const render = unwrapLazyRenderProp(props.render);
|
|
316
|
+
if (/*#__PURE__*/ __rspack_external_react.isValidElement(render)) {
|
|
317
|
+
const renderProps = render.props;
|
|
318
|
+
if (Object.hasOwn(renderProps, 'id')) return renderProps.id ?? '';
|
|
319
|
+
}
|
|
320
|
+
return props.id ?? fallbackId;
|
|
321
|
+
}
|
|
322
|
+
function useRenderedId(props, defaultId, setId) {
|
|
323
|
+
const id = resolveRenderedId(props, defaultId);
|
|
324
|
+
const registeredId = id === defaultId ? void 0 : id;
|
|
325
|
+
const ref = __rspack_external_react.useCallback((element)=>setId?.(element ? registeredId : void 0), [
|
|
326
|
+
registeredId,
|
|
327
|
+
setId
|
|
328
|
+
]);
|
|
329
|
+
return [
|
|
330
|
+
id,
|
|
331
|
+
ref
|
|
332
|
+
];
|
|
333
|
+
}
|
|
334
|
+
function resolvePopupLabel(props, activeTriggerElement, activeTriggerId) {
|
|
335
|
+
const render = unwrapLazyRenderProp(props.render);
|
|
336
|
+
const renderedElementProps = /*#__PURE__*/ __rspack_external_react.isValidElement(render) ? render.props : void 0;
|
|
337
|
+
const ariaLabel = props['aria-label'] ?? renderedElementProps?.['aria-label'];
|
|
338
|
+
let ariaLabelledBy = props['aria-labelledby'] ?? renderedElementProps?.['aria-labelledby'];
|
|
339
|
+
if (null == ariaLabelledBy && !ariaLabel) ariaLabelledBy = activeTriggerElement ? activeTriggerElement.id || void 0 : activeTriggerId || void 0;
|
|
340
|
+
return ariaLabelledBy;
|
|
341
|
+
}
|
|
342
|
+
const MenuFilterImplContext = /*#__PURE__*/ __rspack_external_react.createContext(null);
|
|
343
|
+
if ("production" !== process.env.NODE_ENV) MenuFilterImplContext.displayName = "MenuFilterImplContext";
|
|
344
|
+
function useMenuFilterImpl(scope = 'root') {
|
|
345
|
+
const impl = __rspack_external_react.useContext(MenuFilterImplContext);
|
|
346
|
+
const root = __rspack_external_react.useContext(MenuRootContext);
|
|
347
|
+
if (null === impl || void 0 === root) return null;
|
|
348
|
+
const filterable = 'submenu-trigger' === scope ? root.virtualFocus || root.parentVirtualFocus : root.virtualFocus;
|
|
349
|
+
return filterable ? impl : null;
|
|
350
|
+
}
|
|
351
|
+
const UNFILTERED = {
|
|
352
|
+
visible: true,
|
|
353
|
+
ref: null
|
|
322
354
|
};
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
355
|
+
function useUnfilteredItem() {
|
|
356
|
+
return UNFILTERED;
|
|
357
|
+
}
|
|
358
|
+
function useMenuFilterItem(props, forwardedRef, scope = 'root') {
|
|
359
|
+
const impl = useMenuFilterImpl(scope);
|
|
360
|
+
const useItem = ('submenu-trigger' === scope ? impl?.useSubmenuTrigger : impl?.useItem) ?? useUnfilteredItem;
|
|
361
|
+
const item = useItem({
|
|
362
|
+
label: props.label,
|
|
363
|
+
children: props.children,
|
|
364
|
+
render: props.render
|
|
365
|
+
});
|
|
366
|
+
const ref = useMergedRefs(forwardedRef, item.ref);
|
|
367
|
+
return {
|
|
368
|
+
visible: item.visible,
|
|
369
|
+
ref,
|
|
370
|
+
props: item.props
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
const MenuPopup_MenuPopupPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
374
|
+
const { render, className, style, finalFocus, id: idProp, initialFocus: initialFocusProp, ...elementProps } = componentProps;
|
|
375
|
+
const { store, defaultFloatingId, setRenderedFloatingId, virtualFocus, orientation } = useMenuRootContext();
|
|
376
|
+
const inheritedSubmenuRootContext = useMenuSubmenuRootContext();
|
|
326
377
|
const { side, align } = useMenuPositionerContext();
|
|
327
378
|
const insideToolbar = null != useToolbarRootContext(true);
|
|
328
379
|
const open = store.useState('open');
|
|
@@ -330,17 +381,27 @@ const MenuPopup_MenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
330
381
|
const popupProps = store.useState('popupProps');
|
|
331
382
|
const mounted = store.useState('mounted');
|
|
332
383
|
const instantType = store.useState('instantType');
|
|
333
|
-
const
|
|
384
|
+
const activeTriggerElement = store.useState('activeTriggerElement');
|
|
334
385
|
const parent = store.useState('parent');
|
|
335
386
|
const lastOpenChangeReason = store.useState('lastOpenChangeReason');
|
|
336
387
|
const rootId = store.useState('rootId');
|
|
337
388
|
const floatingContext = store.useState('floatingRootContext');
|
|
338
389
|
const floatingTreeRoot = store.useState('floatingTreeRoot');
|
|
339
390
|
const closeDelay = store.useState('closeDelay');
|
|
340
|
-
const activeTriggerElement = store.useState('activeTriggerElement');
|
|
341
391
|
const hoverEnabled = store.useState('hoverEnabled');
|
|
342
392
|
const disabled = store.useState('disabled');
|
|
393
|
+
const openMethod = store.useState('openMethod');
|
|
394
|
+
const activeTriggerId = store.useState('activeTriggerId');
|
|
395
|
+
const listElement = store.useState('listElement');
|
|
396
|
+
const [id, registerIdRef] = useRenderedId(componentProps, defaultFloatingId, setRenderedFloatingId);
|
|
397
|
+
const ariaLabelledBy = resolvePopupLabel(componentProps, activeTriggerElement, activeTriggerId);
|
|
398
|
+
const submenuRootContext = 'menu' === parent.type ? inheritedSubmenuRootContext : void 0;
|
|
343
399
|
const isContextMenu = 'context-menu' === parent.type;
|
|
400
|
+
let initialFocus = initialFocusProp ?? 'menu' !== parent.type;
|
|
401
|
+
if (void 0 === initialFocusProp && listElement && 'menu' !== parent.type) initialFocus = ()=>{
|
|
402
|
+
if (null !== store.state.activeIndex) return false;
|
|
403
|
+
return listElement;
|
|
404
|
+
};
|
|
344
405
|
useOpenChangeComplete({
|
|
345
406
|
open,
|
|
346
407
|
ref: store.context.popupRef,
|
|
@@ -364,11 +425,9 @@ const MenuPopup_MenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
364
425
|
enabled: hoverEnabled && !disabled && !isContextMenu && 'menubar' !== parent.type,
|
|
365
426
|
closeDelay
|
|
366
427
|
});
|
|
367
|
-
const setPopupElement =
|
|
368
|
-
|
|
369
|
-
},
|
|
370
|
-
store
|
|
371
|
-
]);
|
|
428
|
+
const setPopupElement = store.useStateSetter('popupElement');
|
|
429
|
+
const useParentHandoff = __rspack_external_react.useContext(MenuFilterImplContext)?.useParentHandoff ?? useNoParentHandoff;
|
|
430
|
+
const { parentVirtualFocusRef, handleFocus } = useParentHandoff(store, parent, open, virtualFocus);
|
|
372
431
|
const state = {
|
|
373
432
|
transitionStatus,
|
|
374
433
|
side,
|
|
@@ -382,15 +441,26 @@ const MenuPopup_MenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
382
441
|
ref: [
|
|
383
442
|
forwardedRef,
|
|
384
443
|
store.context.popupRef,
|
|
385
|
-
setPopupElement
|
|
444
|
+
setPopupElement,
|
|
445
|
+
registerIdRef
|
|
386
446
|
],
|
|
387
|
-
stateAttributesMapping:
|
|
447
|
+
stateAttributesMapping: popupTransitionStateMapping,
|
|
388
448
|
props: [
|
|
389
449
|
popupProps,
|
|
390
450
|
{
|
|
451
|
+
id,
|
|
452
|
+
...listElement ? {
|
|
453
|
+
role: 'presentation'
|
|
454
|
+
} : {
|
|
455
|
+
role: 'menu',
|
|
456
|
+
'aria-orientation': 'horizontal' === orientation ? 'horizontal' : void 0,
|
|
457
|
+
'aria-labelledby': ariaLabelledBy
|
|
458
|
+
},
|
|
391
459
|
onKeyDown (event) {
|
|
460
|
+
submenuRootContext?.onPopupKeyDown?.(event);
|
|
392
461
|
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
393
|
-
}
|
|
462
|
+
},
|
|
463
|
+
onFocus: handleFocus
|
|
394
464
|
},
|
|
395
465
|
getDisabledMountTransitionStyles(transitionStatus),
|
|
396
466
|
elementProps,
|
|
@@ -400,21 +470,42 @@ const MenuPopup_MenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
400
470
|
]
|
|
401
471
|
});
|
|
402
472
|
let returnFocus = void 0 === parent.type || isContextMenu;
|
|
403
|
-
if (
|
|
473
|
+
if (activeTriggerElement || 'menubar' === parent.type && lastOpenChangeReason !== outsidePress) returnFocus = true;
|
|
474
|
+
const dynamicReturnFocus = submenuRootContext?.getReturnElement ?? parentVirtualFocusRef;
|
|
404
475
|
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
405
476
|
context: floatingContext,
|
|
477
|
+
openInteractionType: openMethod,
|
|
406
478
|
modal: isContextMenu,
|
|
407
479
|
disabled: !mounted,
|
|
408
|
-
returnFocus:
|
|
409
|
-
|
|
480
|
+
returnFocus: finalFocus ?? dynamicReturnFocus ?? returnFocus,
|
|
481
|
+
explicitReturnFocus: void 0 === finalFocus && dynamicReturnFocus ? false : void 0,
|
|
482
|
+
initialFocus: initialFocus,
|
|
410
483
|
restoreFocus: true,
|
|
484
|
+
getInsideElements: void 0 === parent.type ? ()=>[
|
|
485
|
+
store.context.beforeTriggerFocusGuardRef.current
|
|
486
|
+
] : void 0,
|
|
411
487
|
externalTree: 'menubar' !== parent.type ? floatingTreeRoot : void 0,
|
|
412
488
|
previousFocusableElement: activeTriggerElement,
|
|
413
489
|
nextFocusableElement: void 0 === parent.type ? store.context.triggerFocusTargetRef : void 0,
|
|
414
|
-
beforeContentFocusGuardRef:
|
|
490
|
+
beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,
|
|
415
491
|
children: element
|
|
416
492
|
});
|
|
417
493
|
});
|
|
494
|
+
if ("production" !== process.env.NODE_ENV) MenuPopup_MenuPopupPlain.displayName = "MenuPopupPlain";
|
|
495
|
+
const NO_PARENT_HANDOFF = {
|
|
496
|
+
parentVirtualFocusRef: void 0,
|
|
497
|
+
handleFocus: void 0
|
|
498
|
+
};
|
|
499
|
+
function useNoParentHandoff() {
|
|
500
|
+
return NO_PARENT_HANDOFF;
|
|
501
|
+
}
|
|
502
|
+
const MenuPopup_MenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
503
|
+
const Popup = useMenuFilterImpl()?.Popup ?? MenuPopup_MenuPopupPlain;
|
|
504
|
+
return /*#__PURE__*/ jsx(Popup, {
|
|
505
|
+
...props,
|
|
506
|
+
ref: forwardedRef
|
|
507
|
+
});
|
|
508
|
+
});
|
|
418
509
|
if ("production" !== process.env.NODE_ENV) MenuPopup_MenuPopup.displayName = "MenuPopup";
|
|
419
510
|
const MenuArrow_MenuArrow = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
420
511
|
const { render, className, style, ...elementProps } = componentProps;
|
|
@@ -446,10 +537,10 @@ const MenuGroupContext = /*#__PURE__*/ __rspack_external_react.createContext(voi
|
|
|
446
537
|
if ("production" !== process.env.NODE_ENV) MenuGroupContext.displayName = "MenuGroupContext";
|
|
447
538
|
function useMenuGroupRootContext() {
|
|
448
539
|
const context = __rspack_external_react.useContext(MenuGroupContext);
|
|
449
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.' :
|
|
540
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.' : utils_formatErrorMessage(31));
|
|
450
541
|
return context;
|
|
451
542
|
}
|
|
452
|
-
const
|
|
543
|
+
const MenuGroup_MenuGroupPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
453
544
|
const { render, className, style, ...elementProps } = componentProps;
|
|
454
545
|
const [labelId, setLabelId] = __rspack_external_react.useState(void 0);
|
|
455
546
|
const element = useRenderElement('div', componentProps, {
|
|
@@ -465,6 +556,14 @@ const MenuGroup_MenuGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
465
556
|
children: element
|
|
466
557
|
});
|
|
467
558
|
});
|
|
559
|
+
if ("production" !== process.env.NODE_ENV) MenuGroup_MenuGroupPlain.displayName = "MenuGroupPlain";
|
|
560
|
+
const MenuGroup_MenuGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
561
|
+
const Group = useMenuFilterImpl()?.Group ?? MenuGroup_MenuGroupPlain;
|
|
562
|
+
return /*#__PURE__*/ jsx(Group, {
|
|
563
|
+
...props,
|
|
564
|
+
ref: forwardedRef
|
|
565
|
+
});
|
|
566
|
+
});
|
|
468
567
|
if ("production" !== process.env.NODE_ENV) MenuGroup_MenuGroup.displayName = "MenuGroup";
|
|
469
568
|
const MenuGroupLabel_MenuGroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
470
569
|
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
@@ -473,7 +572,7 @@ const MenuGroupLabel_MenuGroupLabel = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
473
572
|
useIsoLayoutEffect(()=>{
|
|
474
573
|
setLabelId(id);
|
|
475
574
|
return ()=>{
|
|
476
|
-
setLabelId(void 0);
|
|
575
|
+
setLabelId((currentId)=>currentId === id ? void 0 : currentId);
|
|
477
576
|
};
|
|
478
577
|
}, [
|
|
479
578
|
setLabelId,
|
|
@@ -483,21 +582,33 @@ const MenuGroupLabel_MenuGroupLabel = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
483
582
|
ref: forwardedRef,
|
|
484
583
|
props: {
|
|
485
584
|
id,
|
|
486
|
-
|
|
585
|
+
'aria-hidden': true,
|
|
487
586
|
...elementProps
|
|
488
587
|
}
|
|
489
588
|
});
|
|
490
589
|
});
|
|
491
590
|
if ("production" !== process.env.NODE_ENV) MenuGroupLabel_MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
591
|
+
function preventMouseDownDefault(event) {
|
|
592
|
+
event.preventDefault();
|
|
593
|
+
}
|
|
492
594
|
function useMenuItemCommonProps(params) {
|
|
493
595
|
const { closeOnClick, highlighted, id, nodeId, store, typingRef, itemRef, itemMetadata } = params;
|
|
494
|
-
const
|
|
596
|
+
const rootContext = useMenuRootContext();
|
|
495
597
|
const contextMenuContext = useContextMenuRootContext(true);
|
|
598
|
+
const isSubmenuTrigger = 'submenu-trigger' === itemMetadata.type;
|
|
599
|
+
const virtualFocus = isSubmenuTrigger ? rootContext.parentVirtualFocus : rootContext.virtualFocus;
|
|
600
|
+
const selectionStore = isSubmenuTrigger && 'menu' === rootContext.parent.type ? rootContext.parent.store : rootContext.store;
|
|
601
|
+
const ariaSelected = selectionStore.useState('webkitAriaSelected', highlighted);
|
|
602
|
+
const { events: menuEvents } = store.useState('floatingTreeRoot');
|
|
603
|
+
const open = store.useState('open');
|
|
496
604
|
const isContextMenu = void 0 !== contextMenuContext;
|
|
605
|
+
const tabIndex = !virtualFocus && open && highlighted ? 0 : -1;
|
|
497
606
|
return __rspack_external_react.useMemo(()=>({
|
|
498
607
|
id,
|
|
499
608
|
role: 'menuitem',
|
|
500
|
-
tabIndex
|
|
609
|
+
tabIndex,
|
|
610
|
+
'aria-selected': ariaSelected,
|
|
611
|
+
onMouseDown: virtualFocus ? preventMouseDownDefault : void 0,
|
|
501
612
|
onKeyDown (event) {
|
|
502
613
|
if (' ' === event.key && typingRef?.current) event.preventDefault();
|
|
503
614
|
},
|
|
@@ -510,7 +621,7 @@ function useMenuItemCommonProps(params) {
|
|
|
510
621
|
},
|
|
511
622
|
onClick (event) {
|
|
512
623
|
if (closeOnClick) menuEvents.emit('close', {
|
|
513
|
-
domEvent: event,
|
|
624
|
+
domEvent: event.nativeEvent,
|
|
514
625
|
reason: itemPress
|
|
515
626
|
});
|
|
516
627
|
},
|
|
@@ -519,31 +630,36 @@ function useMenuItemCommonProps(params) {
|
|
|
519
630
|
const initialCursorPoint = contextMenuContext.initialCursorPointRef.current;
|
|
520
631
|
contextMenuContext.initialCursorPointRef.current = null;
|
|
521
632
|
if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) return;
|
|
522
|
-
if (isContextMenu && !
|
|
633
|
+
if (isContextMenu && !mac && 2 === event.button) return;
|
|
523
634
|
}
|
|
524
635
|
if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || 2 === event.button)) {
|
|
525
|
-
if (
|
|
636
|
+
if ('regular-item' === itemMetadata.type) dispatchClickWithModifiers(itemRef.current, event, {
|
|
637
|
+
detail: 1,
|
|
638
|
+
pointerType: 'mouse'
|
|
639
|
+
});
|
|
526
640
|
}
|
|
527
641
|
}
|
|
528
642
|
}), [
|
|
529
643
|
closeOnClick,
|
|
530
|
-
|
|
644
|
+
tabIndex,
|
|
531
645
|
id,
|
|
532
646
|
menuEvents,
|
|
533
647
|
nodeId,
|
|
534
|
-
store,
|
|
648
|
+
store.context.allowMouseUpTriggerRef,
|
|
535
649
|
typingRef,
|
|
536
650
|
itemRef,
|
|
537
651
|
contextMenuContext,
|
|
538
652
|
isContextMenu,
|
|
539
|
-
itemMetadata
|
|
653
|
+
itemMetadata.type,
|
|
654
|
+
ariaSelected,
|
|
655
|
+
virtualFocus
|
|
540
656
|
]);
|
|
541
657
|
}
|
|
542
658
|
const REGULAR_ITEM = {
|
|
543
659
|
type: 'regular-item'
|
|
544
660
|
};
|
|
545
661
|
function useMenuItem(params) {
|
|
546
|
-
const { closeOnClick, disabled
|
|
662
|
+
const { closeOnClick, disabled, highlighted, id, store, typingRef = store.context.typingRef, nativeButton, itemMetadata, nodeId } = params;
|
|
547
663
|
const itemRef = __rspack_external_react.useRef(null);
|
|
548
664
|
const { getButtonProps, buttonRef } = useButton({
|
|
549
665
|
disabled,
|
|
@@ -562,9 +678,9 @@ function useMenuItem(params) {
|
|
|
562
678
|
itemMetadata
|
|
563
679
|
});
|
|
564
680
|
const getItemProps = __rspack_external_react.useCallback((externalProps)=>mergeProps(commonProps, {
|
|
565
|
-
onMouseEnter () {
|
|
681
|
+
onMouseEnter (event) {
|
|
566
682
|
if ('submenu-trigger' !== itemMetadata.type) return;
|
|
567
|
-
itemMetadata.setActive();
|
|
683
|
+
itemMetadata.setActive(event.nativeEvent);
|
|
568
684
|
}
|
|
569
685
|
}, externalProps, getButtonProps), [
|
|
570
686
|
commonProps,
|
|
@@ -580,16 +696,19 @@ function useMenuItem(params) {
|
|
|
580
696
|
mergedRef
|
|
581
697
|
]);
|
|
582
698
|
}
|
|
583
|
-
const
|
|
584
|
-
const { render, className, id: idProp, label, nativeButton = false, disabled = false, closeOnClick = true, style, ...elementProps } = componentProps;
|
|
699
|
+
const MenuItem_MenuItemPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
700
|
+
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = true, style, ...elementProps } = componentProps;
|
|
701
|
+
const { store } = useMenuRootContext();
|
|
585
702
|
const listItem = useCompositeListItem({
|
|
703
|
+
guess: true,
|
|
586
704
|
label
|
|
587
705
|
});
|
|
588
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
589
706
|
const id = useBaseUiId(idProp);
|
|
590
|
-
const
|
|
707
|
+
const rootDisabled = store.useState('disabled');
|
|
591
708
|
const highlighted = store.useState('isActive', listItem.index);
|
|
709
|
+
const nodeId = store.useState('floatingNodeId');
|
|
592
710
|
const itemProps = store.useState('itemProps');
|
|
711
|
+
const disabled = disabledProp || rootDisabled;
|
|
593
712
|
const { getItemProps, itemRef } = useMenuItem({
|
|
594
713
|
closeOnClick,
|
|
595
714
|
disabled,
|
|
@@ -597,7 +716,7 @@ const MenuItem_MenuItem = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
597
716
|
id,
|
|
598
717
|
store,
|
|
599
718
|
nativeButton,
|
|
600
|
-
nodeId
|
|
719
|
+
nodeId,
|
|
601
720
|
itemMetadata: REGULAR_ITEM
|
|
602
721
|
});
|
|
603
722
|
const state = {
|
|
@@ -618,48 +737,49 @@ const MenuItem_MenuItem = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
618
737
|
]
|
|
619
738
|
});
|
|
620
739
|
});
|
|
740
|
+
if ("production" !== process.env.NODE_ENV) MenuItem_MenuItemPlain.displayName = "MenuItemPlain";
|
|
741
|
+
const MenuItem_MenuItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
742
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
743
|
+
if (!filterItem.visible) return null;
|
|
744
|
+
return /*#__PURE__*/ jsx(MenuItem_MenuItemPlain, {
|
|
745
|
+
...props,
|
|
746
|
+
ref: filterItem.ref
|
|
747
|
+
});
|
|
748
|
+
});
|
|
621
749
|
if ("production" !== process.env.NODE_ENV) MenuItem_MenuItem.displayName = "MenuItem";
|
|
622
750
|
const MenuCheckboxItemContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
623
751
|
if ("production" !== process.env.NODE_ENV) MenuCheckboxItemContext.displayName = "MenuCheckboxItemContext";
|
|
624
752
|
function useMenuCheckboxItemContext() {
|
|
625
753
|
const context = __rspack_external_react.useContext(MenuCheckboxItemContext);
|
|
626
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.' :
|
|
754
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.' : utils_formatErrorMessage(30));
|
|
627
755
|
return context;
|
|
628
756
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
MenuCheckboxItemDataAttributes["unchecked"] = "data-unchecked";
|
|
632
|
-
MenuCheckboxItemDataAttributes["disabled"] = "data-disabled";
|
|
633
|
-
MenuCheckboxItemDataAttributes["highlighted"] = "data-highlighted";
|
|
634
|
-
return MenuCheckboxItemDataAttributes;
|
|
635
|
-
}({});
|
|
757
|
+
const MenuCheckboxItemDataAttributes_checked = 'data-checked';
|
|
758
|
+
const unchecked = 'data-unchecked';
|
|
636
759
|
const itemMapping = {
|
|
637
760
|
checked (value) {
|
|
638
761
|
if (value) return {
|
|
639
|
-
[
|
|
762
|
+
[MenuCheckboxItemDataAttributes_checked]: ''
|
|
640
763
|
};
|
|
641
764
|
return {
|
|
642
|
-
[
|
|
765
|
+
[unchecked]: ''
|
|
643
766
|
};
|
|
644
767
|
},
|
|
645
768
|
...transitionStatusMapping
|
|
646
769
|
};
|
|
647
|
-
const
|
|
648
|
-
const { render, className, id: idProp, label, nativeButton = false, disabled = false, closeOnClick = false, checked
|
|
770
|
+
const MenuCheckboxItem_MenuCheckboxItemPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
771
|
+
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = false, checked = false, onCheckedChange, style, ...elementProps } = componentProps;
|
|
772
|
+
const { store } = useMenuRootContext();
|
|
649
773
|
const listItem = useCompositeListItem({
|
|
774
|
+
guess: true,
|
|
650
775
|
label
|
|
651
776
|
});
|
|
652
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
653
777
|
const id = useBaseUiId(idProp);
|
|
654
|
-
const
|
|
778
|
+
const rootDisabled = store.useState('disabled');
|
|
655
779
|
const highlighted = store.useState('isActive', listItem.index);
|
|
780
|
+
const nodeId = store.useState('floatingNodeId');
|
|
656
781
|
const itemProps = store.useState('itemProps');
|
|
657
|
-
const
|
|
658
|
-
controlled: checkedProp,
|
|
659
|
-
default: defaultChecked ?? false,
|
|
660
|
-
name: 'MenuCheckboxItem',
|
|
661
|
-
state: 'checked'
|
|
662
|
-
});
|
|
782
|
+
const disabled = disabledProp || rootDisabled;
|
|
663
783
|
const { getItemProps, itemRef } = useMenuItem({
|
|
664
784
|
closeOnClick,
|
|
665
785
|
disabled,
|
|
@@ -667,7 +787,7 @@ const MenuCheckboxItem_MenuCheckboxItem = /*#__PURE__*/ __rspack_external_react.
|
|
|
667
787
|
id,
|
|
668
788
|
store,
|
|
669
789
|
nativeButton,
|
|
670
|
-
nodeId
|
|
790
|
+
nodeId,
|
|
671
791
|
itemMetadata: REGULAR_ITEM
|
|
672
792
|
});
|
|
673
793
|
const state = __rspack_external_react.useMemo(()=>({
|
|
@@ -681,11 +801,9 @@ const MenuCheckboxItem_MenuCheckboxItem = /*#__PURE__*/ __rspack_external_react.
|
|
|
681
801
|
]);
|
|
682
802
|
function handleClick(event) {
|
|
683
803
|
const details = createChangeEventDetails(itemPress, event.nativeEvent, void 0, {
|
|
684
|
-
preventUnmountOnClose
|
|
804
|
+
preventUnmountOnClose: NOOP
|
|
685
805
|
});
|
|
686
806
|
onCheckedChange?.(!checked, details);
|
|
687
|
-
if (details.isCanceled) return;
|
|
688
|
-
setChecked((currentlyChecked)=>!currentlyChecked);
|
|
689
807
|
}
|
|
690
808
|
const element = useRenderElement('div', componentProps, {
|
|
691
809
|
state,
|
|
@@ -711,13 +829,37 @@ const MenuCheckboxItem_MenuCheckboxItem = /*#__PURE__*/ __rspack_external_react.
|
|
|
711
829
|
children: element
|
|
712
830
|
});
|
|
713
831
|
});
|
|
832
|
+
if ("production" !== process.env.NODE_ENV) MenuCheckboxItem_MenuCheckboxItemPlain.displayName = "MenuCheckboxItemPlain";
|
|
833
|
+
const MenuCheckboxItem_MenuCheckboxItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
834
|
+
const { checked: checkedProp, defaultChecked, onCheckedChange, ...plainProps } = props;
|
|
835
|
+
const [checked, setChecked] = useControlled({
|
|
836
|
+
controlled: checkedProp,
|
|
837
|
+
default: defaultChecked ?? false,
|
|
838
|
+
name: 'MenuCheckboxItem',
|
|
839
|
+
state: 'checked'
|
|
840
|
+
});
|
|
841
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
842
|
+
function handleCheckedChange(nextChecked, eventDetails) {
|
|
843
|
+
onCheckedChange?.(nextChecked, eventDetails);
|
|
844
|
+
if (!eventDetails.isCanceled) setChecked(nextChecked);
|
|
845
|
+
}
|
|
846
|
+
if (!filterItem.visible) return null;
|
|
847
|
+
return /*#__PURE__*/ jsx(MenuCheckboxItem_MenuCheckboxItemPlain, {
|
|
848
|
+
...plainProps,
|
|
849
|
+
checked: checked,
|
|
850
|
+
onCheckedChange: handleCheckedChange,
|
|
851
|
+
ref: filterItem.ref
|
|
852
|
+
});
|
|
853
|
+
});
|
|
714
854
|
if ("production" !== process.env.NODE_ENV) MenuCheckboxItem_MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
715
855
|
const MenuCheckboxItemIndicator_MenuCheckboxItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
716
856
|
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
717
857
|
const item = useMenuCheckboxItemContext();
|
|
718
858
|
const indicatorRef = __rspack_external_react.useRef(null);
|
|
719
|
-
const { transitionStatus, setMounted } = useTransitionStatus(item.checked);
|
|
859
|
+
const { transitionStatus, mounted, setMounted } = useTransitionStatus(item.checked);
|
|
720
860
|
useOpenChangeComplete({
|
|
861
|
+
batch: true,
|
|
862
|
+
enabled: !item.checked,
|
|
721
863
|
open: item.checked,
|
|
722
864
|
ref: indicatorRef,
|
|
723
865
|
onComplete () {
|
|
@@ -741,22 +883,22 @@ const MenuCheckboxItemIndicator_MenuCheckboxItemIndicator = /*#__PURE__*/ __rspa
|
|
|
741
883
|
'aria-hidden': true,
|
|
742
884
|
...elementProps
|
|
743
885
|
},
|
|
744
|
-
enabled: keepMounted ||
|
|
886
|
+
enabled: keepMounted || mounted
|
|
745
887
|
});
|
|
746
888
|
return element;
|
|
747
889
|
});
|
|
748
890
|
if ("production" !== process.env.NODE_ENV) MenuCheckboxItemIndicator_MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
749
|
-
const
|
|
891
|
+
const MenuLinkItem_MenuLinkItemPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
750
892
|
const { render, className, id: idProp, label, closeOnClick = false, style, ...elementProps } = componentProps;
|
|
893
|
+
const { store } = useMenuRootContext();
|
|
751
894
|
const linkRef = __rspack_external_react.useRef(null);
|
|
752
895
|
const listItem = useCompositeListItem({
|
|
896
|
+
guess: true,
|
|
753
897
|
label
|
|
754
898
|
});
|
|
755
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
756
|
-
const nodeId = menuPositionerContext?.context.nodeId;
|
|
757
899
|
const id = useBaseUiId(idProp);
|
|
758
|
-
const { store } = useMenuRootContext();
|
|
759
900
|
const highlighted = store.useState('isActive', listItem.index);
|
|
901
|
+
const nodeId = store.useState('floatingNodeId');
|
|
760
902
|
const itemProps = store.useState('itemProps');
|
|
761
903
|
const typingRef = store.context.typingRef;
|
|
762
904
|
const { getButtonProps, buttonRef } = useButton({
|
|
@@ -770,7 +912,8 @@ const MenuLinkItem_MenuLinkItem = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
770
912
|
nodeId,
|
|
771
913
|
store,
|
|
772
914
|
typingRef,
|
|
773
|
-
itemRef: linkRef
|
|
915
|
+
itemRef: linkRef,
|
|
916
|
+
itemMetadata: REGULAR_ITEM
|
|
774
917
|
});
|
|
775
918
|
function getItemProps(externalProps) {
|
|
776
919
|
return mergeProps(commonProps, externalProps, getButtonProps);
|
|
@@ -793,15 +936,24 @@ const MenuLinkItem_MenuLinkItem = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
793
936
|
]
|
|
794
937
|
});
|
|
795
938
|
});
|
|
939
|
+
if ("production" !== process.env.NODE_ENV) MenuLinkItem_MenuLinkItemPlain.displayName = "MenuLinkItemPlain";
|
|
940
|
+
const MenuLinkItem_MenuLinkItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
941
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
942
|
+
if (!filterItem.visible) return null;
|
|
943
|
+
return /*#__PURE__*/ jsx(MenuLinkItem_MenuLinkItemPlain, {
|
|
944
|
+
...props,
|
|
945
|
+
ref: filterItem.ref
|
|
946
|
+
});
|
|
947
|
+
});
|
|
796
948
|
if ("production" !== process.env.NODE_ENV) MenuLinkItem_MenuLinkItem.displayName = "MenuLinkItem";
|
|
797
949
|
const MenuRadioGroupContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
798
950
|
if ("production" !== process.env.NODE_ENV) MenuRadioGroupContext.displayName = "MenuRadioGroupContext";
|
|
799
951
|
function useMenuRadioGroupContext() {
|
|
800
952
|
const context = __rspack_external_react.useContext(MenuRadioGroupContext);
|
|
801
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.' :
|
|
953
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.' : utils_formatErrorMessage(34));
|
|
802
954
|
return context;
|
|
803
955
|
}
|
|
804
|
-
const
|
|
956
|
+
const MenuRadioGroup_MenuRadioGroupPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
805
957
|
const { render, className, value: valueProp, defaultValue, onValueChange: onValueChangeProp, disabled = false, style, 'aria-labelledby': ariaLabelledByProp, ...elementProps } = componentProps;
|
|
806
958
|
const [labelId, setLabelId] = __rspack_external_react.useState(void 0);
|
|
807
959
|
const [value, setValueUnwrapped] = useControlled({
|
|
@@ -843,27 +995,37 @@ const MenuRadioGroup_MenuRadioGroup = /*#__PURE__*/ __rspack_external_react.memo
|
|
|
843
995
|
children: element
|
|
844
996
|
})
|
|
845
997
|
});
|
|
998
|
+
});
|
|
999
|
+
if ("production" !== process.env.NODE_ENV) MenuRadioGroup_MenuRadioGroupPlain.displayName = "MenuRadioGroupPlain";
|
|
1000
|
+
const MenuRadioGroup_MenuRadioGroup = /*#__PURE__*/ __rspack_external_react.memo(/*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
1001
|
+
const RadioGroup = useMenuFilterImpl()?.RadioGroup ?? MenuRadioGroup_MenuRadioGroupPlain;
|
|
1002
|
+
return /*#__PURE__*/ jsx(RadioGroup, {
|
|
1003
|
+
...props,
|
|
1004
|
+
ref: forwardedRef
|
|
1005
|
+
});
|
|
846
1006
|
}));
|
|
847
1007
|
if ("production" !== process.env.NODE_ENV) MenuRadioGroup_MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
848
1008
|
const MenuRadioItemContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
849
1009
|
if ("production" !== process.env.NODE_ENV) MenuRadioItemContext.displayName = "MenuRadioItemContext";
|
|
850
1010
|
function useMenuRadioItemContext() {
|
|
851
1011
|
const context = __rspack_external_react.useContext(MenuRadioItemContext);
|
|
852
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.' :
|
|
1012
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.' : utils_formatErrorMessage(35));
|
|
853
1013
|
return context;
|
|
854
1014
|
}
|
|
855
|
-
const
|
|
1015
|
+
const MenuRadioItem_MenuRadioItemPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
856
1016
|
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = false, value, style, ...elementProps } = componentProps;
|
|
1017
|
+
const { store } = useMenuRootContext();
|
|
1018
|
+
const { value: selectedValue, setValue: setSelectedValue, disabled: groupDisabled } = useMenuRadioGroupContext();
|
|
857
1019
|
const listItem = useCompositeListItem({
|
|
1020
|
+
guess: true,
|
|
858
1021
|
label
|
|
859
1022
|
});
|
|
860
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
861
1023
|
const id = useBaseUiId(idProp);
|
|
862
|
-
const { store } = useMenuRootContext();
|
|
863
1024
|
const highlighted = store.useState('isActive', listItem.index);
|
|
1025
|
+
const nodeId = store.useState('floatingNodeId');
|
|
864
1026
|
const itemProps = store.useState('itemProps');
|
|
865
|
-
const
|
|
866
|
-
const disabled = groupDisabled ||
|
|
1027
|
+
const rootDisabled = store.useState('disabled');
|
|
1028
|
+
const disabled = disabledProp || groupDisabled || rootDisabled;
|
|
867
1029
|
const checked = selectedValue === value;
|
|
868
1030
|
const { getItemProps, itemRef } = useMenuItem({
|
|
869
1031
|
closeOnClick,
|
|
@@ -872,7 +1034,7 @@ const MenuRadioItem_MenuRadioItem = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
872
1034
|
id,
|
|
873
1035
|
store,
|
|
874
1036
|
nativeButton,
|
|
875
|
-
nodeId
|
|
1037
|
+
nodeId,
|
|
876
1038
|
itemMetadata: REGULAR_ITEM
|
|
877
1039
|
});
|
|
878
1040
|
const state = __rspack_external_react.useMemo(()=>({
|
|
@@ -886,7 +1048,7 @@ const MenuRadioItem_MenuRadioItem = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
886
1048
|
]);
|
|
887
1049
|
function handleClick(event) {
|
|
888
1050
|
const details = createChangeEventDetails(itemPress, event.nativeEvent, void 0, {
|
|
889
|
-
preventUnmountOnClose
|
|
1051
|
+
preventUnmountOnClose: NOOP
|
|
890
1052
|
});
|
|
891
1053
|
setSelectedValue(value, details);
|
|
892
1054
|
}
|
|
@@ -914,13 +1076,24 @@ const MenuRadioItem_MenuRadioItem = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
914
1076
|
children: element
|
|
915
1077
|
});
|
|
916
1078
|
});
|
|
1079
|
+
if ("production" !== process.env.NODE_ENV) MenuRadioItem_MenuRadioItemPlain.displayName = "MenuRadioItemPlain";
|
|
1080
|
+
const MenuRadioItem_MenuRadioItem = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
1081
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
1082
|
+
if (!filterItem.visible) return null;
|
|
1083
|
+
return /*#__PURE__*/ jsx(MenuRadioItem_MenuRadioItemPlain, {
|
|
1084
|
+
...props,
|
|
1085
|
+
ref: filterItem.ref
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
917
1088
|
if ("production" !== process.env.NODE_ENV) MenuRadioItem_MenuRadioItem.displayName = "MenuRadioItem";
|
|
918
1089
|
const MenuRadioItemIndicator_MenuRadioItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
919
1090
|
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
920
1091
|
const item = useMenuRadioItemContext();
|
|
921
1092
|
const indicatorRef = __rspack_external_react.useRef(null);
|
|
922
|
-
const { transitionStatus, setMounted } = useTransitionStatus(item.checked);
|
|
1093
|
+
const { transitionStatus, mounted, setMounted } = useTransitionStatus(item.checked);
|
|
923
1094
|
useOpenChangeComplete({
|
|
1095
|
+
batch: true,
|
|
1096
|
+
enabled: !item.checked,
|
|
924
1097
|
open: item.checked,
|
|
925
1098
|
ref: indicatorRef,
|
|
926
1099
|
onComplete () {
|
|
@@ -944,41 +1117,43 @@ const MenuRadioItemIndicator_MenuRadioItemIndicator = /*#__PURE__*/ __rspack_ext
|
|
|
944
1117
|
'aria-hidden': true,
|
|
945
1118
|
...elementProps
|
|
946
1119
|
},
|
|
947
|
-
enabled: keepMounted ||
|
|
1120
|
+
enabled: keepMounted || mounted
|
|
948
1121
|
});
|
|
949
1122
|
return element;
|
|
950
1123
|
});
|
|
951
1124
|
if ("production" !== process.env.NODE_ENV) MenuRadioItemIndicator_MenuRadioItemIndicator.displayName = "MenuRadioItemIndicator";
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
1125
|
+
const VOICE_OVER_EXPANDED_PROPS = {
|
|
1126
|
+
'aria-expanded': void 0
|
|
1127
|
+
};
|
|
1128
|
+
const MenuSubmenuTrigger_MenuSubmenuTriggerPlain = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
958
1129
|
const { render, className, style, label, id: idProp, nativeButton = false, openOnHover = true, delay = 100, closeDelay = 0, disabled: disabledProp = false, ...elementProps } = componentProps;
|
|
959
|
-
const
|
|
1130
|
+
const context = useMenuRootContext(true);
|
|
1131
|
+
if (context?.parent.type !== 'menu') throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.' : utils_formatErrorMessage(37));
|
|
960
1132
|
const menuPositionerContext = useMenuPositionerContext();
|
|
961
|
-
const
|
|
1133
|
+
const submenuRootContext = useMenuSubmenuRootContext();
|
|
1134
|
+
const { store, parentVirtualFocus } = context;
|
|
1135
|
+
const parentMenuStore = context.parent.store;
|
|
1136
|
+
const listItem = useCompositeListItem({
|
|
1137
|
+
guess: true,
|
|
1138
|
+
label
|
|
1139
|
+
});
|
|
962
1140
|
const thisTriggerId = useBaseUiId(idProp);
|
|
963
1141
|
const open = store.useState('open');
|
|
1142
|
+
const focusReturnedThroughGuardRef = __rspack_external_react.useRef(false);
|
|
1143
|
+
const positionerElement = store.useState('positionerElement');
|
|
964
1144
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
965
1145
|
const floatingTreeRoot = store.useState('floatingTreeRoot');
|
|
966
1146
|
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
967
1147
|
const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store);
|
|
968
|
-
const registerTrigger =
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1148
|
+
const registerTrigger = useStableCallback((element)=>{
|
|
1149
|
+
baseRegisterTrigger(element);
|
|
1150
|
+
const activeTriggerElement = store.select('activeTriggerElement');
|
|
1151
|
+
if (null !== element && store.select('open') && (activeTriggerElement === element || null == store.select('activeTriggerId'))) store.update({
|
|
1152
|
+
activeTriggerId: thisTriggerId ?? null,
|
|
972
1153
|
activeTriggerElement: element,
|
|
973
1154
|
closeDelay
|
|
974
1155
|
});
|
|
975
|
-
|
|
976
|
-
}, [
|
|
977
|
-
baseRegisterTrigger,
|
|
978
|
-
closeDelay,
|
|
979
|
-
store,
|
|
980
|
-
thisTriggerId
|
|
981
|
-
]);
|
|
1156
|
+
});
|
|
982
1157
|
const triggerElementRef = __rspack_external_react.useRef(null);
|
|
983
1158
|
const handleTriggerElementRef = __rspack_external_react.useCallback((el)=>{
|
|
984
1159
|
triggerElementRef.current = el;
|
|
@@ -986,30 +1161,51 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
986
1161
|
}, [
|
|
987
1162
|
store
|
|
988
1163
|
]);
|
|
989
|
-
|
|
1164
|
+
useIsoLayoutEffect(()=>{
|
|
1165
|
+
registerTrigger(triggerElementRef.current);
|
|
1166
|
+
return ()=>registerTrigger(null);
|
|
1167
|
+
}, [
|
|
1168
|
+
registerTrigger,
|
|
1169
|
+
thisTriggerId,
|
|
1170
|
+
store
|
|
1171
|
+
]);
|
|
1172
|
+
useIsoLayoutEffect(()=>{
|
|
1173
|
+
if (!open || !positionerElement) return;
|
|
1174
|
+
function handleGuardFocusOut(event) {
|
|
1175
|
+
if (getTarget(event) === store.context.beforeContentFocusGuardRef.current) focusReturnedThroughGuardRef.current = event.relatedTarget === triggerElementRef.current;
|
|
1176
|
+
}
|
|
1177
|
+
positionerElement.addEventListener('focusout', handleGuardFocusOut, true);
|
|
1178
|
+
return ()=>{
|
|
1179
|
+
focusReturnedThroughGuardRef.current = false;
|
|
1180
|
+
positionerElement.removeEventListener('focusout', handleGuardFocusOut, true);
|
|
1181
|
+
};
|
|
1182
|
+
}, [
|
|
1183
|
+
open,
|
|
1184
|
+
positionerElement,
|
|
1185
|
+
store
|
|
1186
|
+
]);
|
|
1187
|
+
store.useSyncedValue('closeDelay', closeDelay);
|
|
1188
|
+
const rootDisabled = store.useState('disabled');
|
|
1189
|
+
const parentDisabled = parentMenuStore.useState('disabled');
|
|
1190
|
+
const disabled = disabledProp || rootDisabled || parentDisabled;
|
|
1191
|
+
if ('production' !== process.env.NODE_ENV) __rspack_external_react.useEffect(()=>{
|
|
990
1192
|
const element = triggerElementRef.current;
|
|
991
|
-
if (element && isElementDisabled(element) && !
|
|
1193
|
+
if (element && isElementDisabled(element) && !disabled) {
|
|
992
1194
|
const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';
|
|
993
1195
|
warn(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${ownerStackMessage}`);
|
|
994
1196
|
}
|
|
995
1197
|
});
|
|
996
|
-
const submenuRootContext = useMenuSubmenuRootContext();
|
|
997
|
-
if (!submenuRootContext?.parentMenu) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.' : esm_formatErrorMessage(37));
|
|
998
|
-
store.useSyncedValue('closeDelay', closeDelay);
|
|
999
|
-
const parentMenuStore = submenuRootContext.parentMenu;
|
|
1000
1198
|
const itemProps = parentMenuStore.useState('itemProps');
|
|
1001
1199
|
const highlighted = parentMenuStore.useState('isActive', listItem.index);
|
|
1002
1200
|
const itemMetadata = __rspack_external_react.useMemo(()=>({
|
|
1003
1201
|
type: 'submenu-trigger',
|
|
1004
|
-
setActive () {
|
|
1005
|
-
parentMenuStore.
|
|
1202
|
+
setActive (event) {
|
|
1203
|
+
if (parentMenuStore.select('highlightItemOnHover')) parentMenuStore.setActiveIndex(listItem.index, pointer, event);
|
|
1006
1204
|
}
|
|
1007
1205
|
}), [
|
|
1008
1206
|
parentMenuStore,
|
|
1009
1207
|
listItem.index
|
|
1010
1208
|
]);
|
|
1011
|
-
const rootDisabled = store.useState('disabled');
|
|
1012
|
-
const disabled = disabledProp || rootDisabled;
|
|
1013
1209
|
const { getItemProps, itemRef } = useMenuItem({
|
|
1014
1210
|
closeOnClick: false,
|
|
1015
1211
|
disabled,
|
|
@@ -1022,7 +1218,6 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
1022
1218
|
nodeId: menuPositionerContext?.context.nodeId
|
|
1023
1219
|
});
|
|
1024
1220
|
const hoverEnabled = store.useState('hoverEnabled');
|
|
1025
|
-
const allowMouseEnter = parentMenuStore.useState('allowMouseEnter');
|
|
1026
1221
|
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
1027
1222
|
enabled: hoverEnabled && openOnHover && !disabled,
|
|
1028
1223
|
handleClose: safePolygon({
|
|
@@ -1031,20 +1226,22 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
1031
1226
|
mouseOnly: true,
|
|
1032
1227
|
move: true,
|
|
1033
1228
|
restMs: delay,
|
|
1034
|
-
delay:
|
|
1229
|
+
delay: {
|
|
1035
1230
|
open: delay,
|
|
1036
1231
|
close: closeDelay
|
|
1037
|
-
}
|
|
1232
|
+
},
|
|
1233
|
+
shouldOpen: delay > 0 ? ()=>parentMenuStore.select('allowMouseEnter') : void 0,
|
|
1038
1234
|
triggerElementRef,
|
|
1039
1235
|
externalTree: floatingTreeRoot,
|
|
1040
|
-
isClosing: ()=>'ending' === store.select('transitionStatus')
|
|
1236
|
+
isClosing: ()=>'ending' === store.select('transitionStatus'),
|
|
1237
|
+
guardStaleOpen: true
|
|
1041
1238
|
});
|
|
1042
1239
|
const click = useClick(floatingRootContext, {
|
|
1043
1240
|
enabled: !disabled,
|
|
1044
1241
|
event: 'mousedown',
|
|
1045
|
-
toggle:
|
|
1242
|
+
toggle: true,
|
|
1046
1243
|
ignoreMouse: openOnHover,
|
|
1047
|
-
stickIfOpen:
|
|
1244
|
+
stickIfOpen: openOnHover
|
|
1048
1245
|
});
|
|
1049
1246
|
const localInteractionProps = click.reference ?? EMPTY_OBJECT;
|
|
1050
1247
|
const rootTriggerProps = store.useState('triggerProps', true);
|
|
@@ -1054,6 +1251,13 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
1054
1251
|
highlighted,
|
|
1055
1252
|
open
|
|
1056
1253
|
};
|
|
1254
|
+
const openMethod = store.useState('openMethod');
|
|
1255
|
+
const lastOpenChangeReason = store.useState('lastOpenChangeReason');
|
|
1256
|
+
const openedByKeyboard = lastOpenChangeReason === reason_parts_listNavigation || 'keyboard' === openMethod;
|
|
1257
|
+
const shouldOmitExpanded = open && openedByKeyboard && voiceOver;
|
|
1258
|
+
const submenuKeyDownProps = submenuRootContext?.onTriggerKeyDown ? {
|
|
1259
|
+
onKeyDown: submenuRootContext.onTriggerKeyDown
|
|
1260
|
+
} : void 0;
|
|
1057
1261
|
const element = useRenderElement('div', componentProps, {
|
|
1058
1262
|
state,
|
|
1059
1263
|
stateAttributesMapping: triggerOpenStateMapping,
|
|
@@ -1061,12 +1265,20 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
1061
1265
|
localInteractionProps,
|
|
1062
1266
|
hoverProps,
|
|
1063
1267
|
rootTriggerProps,
|
|
1268
|
+
submenuKeyDownProps,
|
|
1064
1269
|
itemProps,
|
|
1270
|
+
shouldOmitExpanded ? VOICE_OVER_EXPANDED_PROPS : void 0,
|
|
1065
1271
|
{
|
|
1066
1272
|
'aria-controls': popupId,
|
|
1067
|
-
tabIndex: open || highlighted ?
|
|
1273
|
+
tabIndex: parentVirtualFocus || !(open || highlighted) ? -1 : 0,
|
|
1274
|
+
onFocus (event) {
|
|
1275
|
+
if (store.select('open') && focusReturnedThroughGuardRef.current) {
|
|
1276
|
+
focusReturnedThroughGuardRef.current = false;
|
|
1277
|
+
store.setOpen(false, createChangeEventDetails(focusOut, event.nativeEvent));
|
|
1278
|
+
}
|
|
1279
|
+
},
|
|
1068
1280
|
onBlur () {
|
|
1069
|
-
if (highlighted) parentMenuStore.
|
|
1281
|
+
if (highlighted) parentMenuStore.setActiveIndex(null, "none");
|
|
1070
1282
|
}
|
|
1071
1283
|
},
|
|
1072
1284
|
elementProps,
|
|
@@ -1082,84 +1294,83 @@ const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_re
|
|
|
1082
1294
|
});
|
|
1083
1295
|
return element;
|
|
1084
1296
|
});
|
|
1297
|
+
if ("production" !== process.env.NODE_ENV) MenuSubmenuTrigger_MenuSubmenuTriggerPlain.displayName = "MenuSubmenuTriggerPlain";
|
|
1298
|
+
const MenuSubmenuTrigger_MenuSubmenuTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
1299
|
+
const filterItem = useMenuFilterItem(props, forwardedRef, 'submenu-trigger');
|
|
1300
|
+
if (!filterItem.visible) return null;
|
|
1301
|
+
const mergedProps = filterItem.props ? mergeProps(filterItem.props, props) : props;
|
|
1302
|
+
return /*#__PURE__*/ jsx(MenuSubmenuTrigger_MenuSubmenuTriggerPlain, {
|
|
1303
|
+
...mergedProps,
|
|
1304
|
+
ref: filterItem.ref
|
|
1305
|
+
});
|
|
1306
|
+
});
|
|
1085
1307
|
if ("production" !== process.env.NODE_ENV) MenuSubmenuTrigger_MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
|
|
1086
1308
|
const selectors = {
|
|
1087
1309
|
...popupStoreSelectors,
|
|
1088
|
-
disabled:
|
|
1089
|
-
modal:
|
|
1090
|
-
openMethod:
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1310
|
+
disabled: (state)=>'menubar' === state.parent.type ? state.parent.context.disabled || state.disabled : state.disabled,
|
|
1311
|
+
modal: (state)=>(void 0 === state.parent.type || 'context-menu' === state.parent.type) && (state.modal ?? true),
|
|
1312
|
+
openMethod: (state)=>state.openMethod,
|
|
1313
|
+
keyboardOpen: (state)=>state.keyboardOpen,
|
|
1314
|
+
allowMouseEnter: (state)=>state.allowMouseEnter,
|
|
1315
|
+
highlightItemOnHover: (state)=>state.highlightItemOnHover,
|
|
1316
|
+
parent: (state)=>state.parent,
|
|
1317
|
+
rootId: (state)=>{
|
|
1095
1318
|
if ('menu' === state.parent.type) return state.parent.store.select('rootId');
|
|
1096
1319
|
return void 0 !== state.parent.type ? state.parent.context.rootId : state.rootId;
|
|
1097
|
-
}
|
|
1098
|
-
activeIndex:
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1320
|
+
},
|
|
1321
|
+
activeIndex: (state)=>state.activeIndex,
|
|
1322
|
+
listElement: (state)=>state.listElement,
|
|
1323
|
+
triggerControlsId: (state, triggerId)=>{
|
|
1324
|
+
const popupId = popupStoreSelectors.triggerPopupId(state, triggerId);
|
|
1325
|
+
return popupId ? state.listElement?.id || popupId : void 0;
|
|
1326
|
+
},
|
|
1327
|
+
filterTriggerProps: (state)=>state.filterTriggerProps,
|
|
1328
|
+
inputProps: (state)=>state.inputProps,
|
|
1329
|
+
webkitAriaSelected: (state, highlighted)=>webkit && state.inputFocused && highlighted ? true : void 0,
|
|
1330
|
+
highlightedItemId: (state)=>state.highlightedItem?.id || void 0,
|
|
1331
|
+
isActive: (state, itemIndex)=>state.activeIndex === itemIndex,
|
|
1332
|
+
hoverEnabled: (state)=>state.hoverEnabled,
|
|
1333
|
+
instantType: (state)=>'trigger-change' !== state.instantType || popupStoreSelectors.open(state) ? state.instantType : void 0,
|
|
1334
|
+
lastOpenChangeReason: (state)=>state.openChangeReason,
|
|
1335
|
+
floatingTreeRoot: (state)=>{
|
|
1104
1336
|
if ('menu' === state.parent.type) return state.parent.store.select('floatingTreeRoot');
|
|
1105
1337
|
return state.floatingTreeRoot;
|
|
1106
|
-
}
|
|
1107
|
-
floatingNodeId:
|
|
1108
|
-
floatingParentNodeId:
|
|
1109
|
-
itemProps:
|
|
1110
|
-
closeDelay:
|
|
1111
|
-
|
|
1112
|
-
keyboardEventRelay:
|
|
1338
|
+
},
|
|
1339
|
+
floatingNodeId: (state)=>state.floatingNodeId,
|
|
1340
|
+
floatingParentNodeId: (state)=>state.floatingParentNodeId,
|
|
1341
|
+
itemProps: (state)=>state.itemProps,
|
|
1342
|
+
closeDelay: (state)=>state.closeDelay,
|
|
1343
|
+
adaptiveOrigin: (state)=>state.adaptiveOrigin,
|
|
1344
|
+
keyboardEventRelay: (state)=>{
|
|
1113
1345
|
if (state.keyboardEventRelay) return state.keyboardEventRelay;
|
|
1114
1346
|
if ('menu' === state.parent.type) return state.parent.store.select('keyboardEventRelay');
|
|
1115
|
-
}
|
|
1347
|
+
}
|
|
1116
1348
|
};
|
|
1117
1349
|
class MenuStore extends ReactStore {
|
|
1118
|
-
constructor(initialState){
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
this.unsubscribeParentListener = this.observe('parent', (parent)=>{
|
|
1143
|
-
this.unsubscribeParentListener?.();
|
|
1144
|
-
if ('menu' === parent.type) {
|
|
1145
|
-
let rootId = parent.store.select('rootId');
|
|
1146
|
-
let floatingTreeRoot = parent.store.select('floatingTreeRoot');
|
|
1147
|
-
let keyboardEventRelay = parent.store.select('keyboardEventRelay');
|
|
1148
|
-
this.unsubscribeParentListener = parent.store.subscribe(()=>{
|
|
1149
|
-
const nextRootId = parent.store.select('rootId');
|
|
1150
|
-
const nextFloatingTreeRoot = parent.store.select('floatingTreeRoot');
|
|
1151
|
-
const nextKeyboardEventRelay = parent.store.select('keyboardEventRelay');
|
|
1152
|
-
if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) return;
|
|
1153
|
-
rootId = nextRootId;
|
|
1154
|
-
floatingTreeRoot = nextFloatingTreeRoot;
|
|
1155
|
-
keyboardEventRelay = nextKeyboardEventRelay;
|
|
1156
|
-
this.notifyAll();
|
|
1157
|
-
});
|
|
1158
|
-
this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
if (void 0 !== parent.type) this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
|
|
1162
|
-
this.unsubscribeParentListener = null;
|
|
1350
|
+
constructor(initialState, floatingId, nested = false){
|
|
1351
|
+
const triggerElements = new PopupTriggerMap();
|
|
1352
|
+
const state = createInitialState(triggerElements, floatingId, nested, initialState);
|
|
1353
|
+
super(state, createInitialContext(triggerElements), selectors);
|
|
1354
|
+
this.observe('parent', (parent)=>{
|
|
1355
|
+
if ('menu' === parent.type) this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
|
|
1356
|
+
else if (void 0 !== parent.type) this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
subscribeToParentMenu() {
|
|
1360
|
+
const parent = this.state.parent;
|
|
1361
|
+
if ('menu' !== parent.type) return;
|
|
1362
|
+
let rootId = parent.store.select('rootId');
|
|
1363
|
+
let floatingTreeRoot = parent.store.select('floatingTreeRoot');
|
|
1364
|
+
let keyboardEventRelay = parent.store.select('keyboardEventRelay');
|
|
1365
|
+
return parent.store.subscribe(()=>{
|
|
1366
|
+
const nextRootId = parent.store.select('rootId');
|
|
1367
|
+
const nextFloatingTreeRoot = parent.store.select('floatingTreeRoot');
|
|
1368
|
+
const nextKeyboardEventRelay = parent.store.select('keyboardEventRelay');
|
|
1369
|
+
if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) return;
|
|
1370
|
+
rootId = nextRootId;
|
|
1371
|
+
floatingTreeRoot = nextFloatingTreeRoot;
|
|
1372
|
+
keyboardEventRelay = nextKeyboardEventRelay;
|
|
1373
|
+
this.notifyAll();
|
|
1163
1374
|
});
|
|
1164
1375
|
}
|
|
1165
1376
|
setOpen(open, eventDetails) {
|
|
@@ -1168,25 +1379,73 @@ class MenuStore extends ReactStore {
|
|
|
1168
1379
|
eventDetails
|
|
1169
1380
|
});
|
|
1170
1381
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1382
|
+
setActiveIndex(activeIndex, reason, event) {
|
|
1383
|
+
if (this.state.activeIndex !== activeIndex) {
|
|
1384
|
+
const item = null === activeIndex ? void 0 : this.context.itemDomElements.current[activeIndex];
|
|
1385
|
+
const isWriteBack = item === this.context.reportedItem;
|
|
1386
|
+
this.context.highlightReason = isWriteBack ? 'none' : reason;
|
|
1387
|
+
this.context.highlightEvent = isWriteBack ? void 0 : event;
|
|
1388
|
+
}
|
|
1389
|
+
this.set('activeIndex', activeIndex);
|
|
1390
|
+
}
|
|
1391
|
+
highlightItem(element, reason, event) {
|
|
1392
|
+
const index = this.context.itemDomElements.current.indexOf(element);
|
|
1393
|
+
if (index > -1) this.setActiveIndex(index, reason, event);
|
|
1174
1394
|
}
|
|
1175
|
-
unsubscribeParentListener = null;
|
|
1176
1395
|
}
|
|
1177
|
-
function
|
|
1396
|
+
function createNullMenuStore() {
|
|
1397
|
+
const triggerElements = new PopupTriggerMap();
|
|
1398
|
+
const store = new NullStore(Object.freeze(createInitialState(triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
1399
|
+
return Object.assign(store, {
|
|
1400
|
+
setOpen: NOOP
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
function createInitialContext(triggerElements) {
|
|
1404
|
+
return {
|
|
1405
|
+
positionerRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
1406
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
1407
|
+
typingRef: {
|
|
1408
|
+
current: false
|
|
1409
|
+
},
|
|
1410
|
+
itemDomElements: {
|
|
1411
|
+
current: []
|
|
1412
|
+
},
|
|
1413
|
+
itemLabels: {
|
|
1414
|
+
current: []
|
|
1415
|
+
},
|
|
1416
|
+
highlightReason: 'none',
|
|
1417
|
+
highlightEvent: void 0,
|
|
1418
|
+
reportedItem: void 0,
|
|
1419
|
+
allowMouseUpTriggerRef: {
|
|
1420
|
+
current: false
|
|
1421
|
+
},
|
|
1422
|
+
virtualFocusRef: void 0,
|
|
1423
|
+
triggerFocusTargetRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
1424
|
+
beforeTriggerFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
1425
|
+
beforeContentFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
1426
|
+
onOpenChangeComplete: void 0,
|
|
1427
|
+
triggerElements
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
function createInitialState(triggerElements, floatingId, nested = false, initialState) {
|
|
1178
1431
|
return {
|
|
1179
|
-
...createInitialPopupStoreState(),
|
|
1432
|
+
...createInitialPopupStoreState(triggerElements, floatingId, nested),
|
|
1180
1433
|
disabled: false,
|
|
1181
1434
|
modal: true,
|
|
1182
1435
|
openMethod: null,
|
|
1436
|
+
keyboardOpen: false,
|
|
1183
1437
|
allowMouseEnter: false,
|
|
1184
|
-
|
|
1438
|
+
highlightItemOnHover: true,
|
|
1185
1439
|
parent: {
|
|
1186
1440
|
type: void 0
|
|
1187
1441
|
},
|
|
1188
1442
|
rootId: void 0,
|
|
1189
1443
|
activeIndex: null,
|
|
1444
|
+
listElement: null,
|
|
1445
|
+
filterTriggerProps: EMPTY_OBJECT,
|
|
1446
|
+
inputProps: EMPTY_OBJECT,
|
|
1447
|
+
inputFocused: false,
|
|
1448
|
+
highlightedItem: void 0,
|
|
1190
1449
|
hoverEnabled: true,
|
|
1191
1450
|
instantType: void 0,
|
|
1192
1451
|
openChangeReason: null,
|
|
@@ -1196,25 +1455,35 @@ function createInitialState() {
|
|
|
1196
1455
|
itemProps: EMPTY_OBJECT,
|
|
1197
1456
|
keyboardEventRelay: void 0,
|
|
1198
1457
|
closeDelay: 0,
|
|
1199
|
-
|
|
1458
|
+
adaptiveOrigin: void 0,
|
|
1459
|
+
...initialState
|
|
1200
1460
|
};
|
|
1201
1461
|
}
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1462
|
+
const MenuFilterProviderContext = /*#__PURE__*/ __rspack_external_react.createContext(null);
|
|
1463
|
+
if ("production" !== process.env.NODE_ENV) MenuFilterProviderContext.displayName = "MenuFilterProviderContext";
|
|
1464
|
+
function isKeyboardClick(reason, event) {
|
|
1465
|
+
return (reason === triggerPress || reason === itemPress) && event?.detail === 0;
|
|
1466
|
+
}
|
|
1467
|
+
function isKeyboardOpen(reason, event) {
|
|
1468
|
+
return reason === reason_parts_listNavigation || isKeyboardClick(reason, event);
|
|
1469
|
+
}
|
|
1470
|
+
const MenuRoot_MenuRootInternal = fastComponent(function(props) {
|
|
1471
|
+
const { children, open: openProp, onOpenChange, onOpenChangeComplete, onItemHighlighted: onItemHighlightedProp, defaultOpen = false, disabled: disabledProp = false, modal: modalProp, loopFocus = true, orientation = 'vertical', actionsRef, closeParentOnEsc = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, highlightItemOnHover = true, isSubmenu = false, virtualFocus = false, virtualFocusRef, allowEscape = true, resetOnPointerLeave = true } = props;
|
|
1204
1472
|
const contextMenuContext = useContextMenuRootContext(true);
|
|
1205
1473
|
const parentMenuRootContext = useMenuRootContext(true);
|
|
1206
1474
|
const menubarContext = useMenubarContext(true);
|
|
1207
|
-
const
|
|
1475
|
+
const enclosingMenuStore = parentMenuRootContext?.store;
|
|
1476
|
+
const parentVirtualFocus = parentMenuRootContext?.virtualFocus ?? false;
|
|
1208
1477
|
const parentFromContext = __rspack_external_react.useMemo(()=>{
|
|
1209
|
-
if (isSubmenu &&
|
|
1478
|
+
if (isSubmenu && enclosingMenuStore) return {
|
|
1210
1479
|
type: 'menu',
|
|
1211
|
-
store:
|
|
1480
|
+
store: enclosingMenuStore
|
|
1212
1481
|
};
|
|
1213
1482
|
if (menubarContext) return {
|
|
1214
1483
|
type: 'menubar',
|
|
1215
1484
|
context: menubarContext
|
|
1216
1485
|
};
|
|
1217
|
-
if (contextMenuContext && !
|
|
1486
|
+
if (contextMenuContext && !enclosingMenuStore) return {
|
|
1218
1487
|
type: 'context-menu',
|
|
1219
1488
|
context: contextMenuContext
|
|
1220
1489
|
};
|
|
@@ -1223,31 +1492,39 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1223
1492
|
};
|
|
1224
1493
|
}, [
|
|
1225
1494
|
contextMenuContext,
|
|
1226
|
-
|
|
1495
|
+
enclosingMenuStore,
|
|
1227
1496
|
menubarContext,
|
|
1228
1497
|
isSubmenu
|
|
1229
1498
|
]);
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1499
|
+
const rootId = useBaseUiId();
|
|
1500
|
+
const defaultFloatingId = useBaseUiId();
|
|
1501
|
+
const [renderedFloatingId, setRenderedFloatingId] = __rspack_external_react.useState(void 0);
|
|
1502
|
+
const floatingId = (renderedFloatingId ?? defaultFloatingId) || void 0;
|
|
1503
|
+
const floatingParentNodeIdFromContext = useFloatingParentNodeId();
|
|
1504
|
+
const parentMenuStore = 'menu' === parentFromContext.type ? parentFromContext.store : void 0;
|
|
1505
|
+
const animateInitialOpen = (openProp ?? defaultOpen) && parentMenuStore?.state.transitionStatus === 'starting';
|
|
1506
|
+
const seededInstantType = useRefWithInit(()=>animateInitialOpen ? parentMenuStore?.state.instantType : void 0).current;
|
|
1507
|
+
const store = useRefWithInit(()=>{
|
|
1508
|
+
const menuStore = new MenuStore({
|
|
1509
|
+
open: defaultOpen,
|
|
1510
|
+
openProp,
|
|
1511
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
1512
|
+
triggerIdProp,
|
|
1513
|
+
parent: parentFromContext,
|
|
1514
|
+
disabled: disabledProp,
|
|
1515
|
+
highlightItemOnHover,
|
|
1516
|
+
modal: void 0 === parentFromContext.type ? modalProp : void 0,
|
|
1517
|
+
rootId,
|
|
1518
|
+
instantType: seededInstantType
|
|
1519
|
+
}, floatingId, null != floatingParentNodeIdFromContext);
|
|
1520
|
+
menuStore.context.virtualFocusRef = virtualFocusRef;
|
|
1521
|
+
return menuStore;
|
|
1522
|
+
}).current;
|
|
1243
1523
|
store.useControlledProp('openProp', openProp);
|
|
1244
1524
|
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
1245
1525
|
store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
|
|
1246
|
-
const rootId = useId();
|
|
1247
|
-
const floatingId = useId();
|
|
1248
1526
|
const floatingTreeRoot = store.useState('floatingTreeRoot');
|
|
1249
1527
|
const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot);
|
|
1250
|
-
const floatingParentNodeIdFromContext = useFloatingParentNodeId();
|
|
1251
1528
|
const open = store.useState('open');
|
|
1252
1529
|
const activeTriggerElement = store.useState('activeTriggerElement');
|
|
1253
1530
|
const positionerElement = store.useState('positionerElement');
|
|
@@ -1256,6 +1533,7 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1256
1533
|
const lastOpenChangeReason = store.useState('lastOpenChangeReason');
|
|
1257
1534
|
const parent = store.useState('parent');
|
|
1258
1535
|
const activeIndex = store.useState('activeIndex');
|
|
1536
|
+
const keyboardOpen = store.useState('keyboardOpen');
|
|
1259
1537
|
const payload = store.useState('payload');
|
|
1260
1538
|
const floatingParentNodeId = store.useState('floatingParentNodeId');
|
|
1261
1539
|
const openEventRef = __rspack_external_react.useRef(null);
|
|
@@ -1270,17 +1548,36 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1270
1548
|
const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
|
|
1271
1549
|
store.useSyncedValues({
|
|
1272
1550
|
disabled: disabledProp,
|
|
1551
|
+
highlightItemOnHover,
|
|
1273
1552
|
modal: void 0 === parent.type ? modalProp : void 0,
|
|
1274
1553
|
openMethod,
|
|
1275
1554
|
rootId
|
|
1276
1555
|
});
|
|
1277
1556
|
useImplicitActiveTrigger(store);
|
|
1278
|
-
const { forceUnmount } = useOpenStateTransitions(open, store, ()=>{
|
|
1279
|
-
store.
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1557
|
+
const { forceUnmount, transitionStatus } = useOpenStateTransitions(open, store, ()=>{
|
|
1558
|
+
store.set('allowMouseEnter', false);
|
|
1559
|
+
}, animateInitialOpen);
|
|
1560
|
+
const runOnceAnimationsFinish = useAnimationsFinished(store.context.popupRef);
|
|
1561
|
+
__rspack_external_react.useEffect(()=>{
|
|
1562
|
+
if (void 0 === seededInstantType) return;
|
|
1563
|
+
const clearSeededInstantType = ()=>{
|
|
1564
|
+
if (store.state.instantType === seededInstantType) store.set('instantType', void 0);
|
|
1565
|
+
};
|
|
1566
|
+
if (!open) return void clearSeededInstantType();
|
|
1567
|
+
if (void 0 !== transitionStatus) return;
|
|
1568
|
+
if (null == store.context.popupRef.current) return void clearSeededInstantType();
|
|
1569
|
+
const abortController = new AbortController();
|
|
1570
|
+
runOnceAnimationsFinish(clearSeededInstantType, abortController.signal);
|
|
1571
|
+
return ()=>{
|
|
1572
|
+
abortController.abort();
|
|
1573
|
+
};
|
|
1574
|
+
}, [
|
|
1575
|
+
seededInstantType,
|
|
1576
|
+
open,
|
|
1577
|
+
transitionStatus,
|
|
1578
|
+
runOnceAnimationsFinish,
|
|
1579
|
+
store
|
|
1580
|
+
]);
|
|
1284
1581
|
useIsoLayoutEffect(()=>{
|
|
1285
1582
|
if (contextMenuContext && !parentMenuRootContext) store.update({
|
|
1286
1583
|
parent: {
|
|
@@ -1290,7 +1587,7 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1290
1587
|
floatingNodeId: floatingNodeIdFromContext,
|
|
1291
1588
|
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1292
1589
|
});
|
|
1293
|
-
else if (parentMenuRootContext) store.update({
|
|
1590
|
+
else if (parentMenuRootContext || !store.select('activeTriggerElement')) store.update({
|
|
1294
1591
|
floatingNodeId: floatingNodeIdFromContext,
|
|
1295
1592
|
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1296
1593
|
});
|
|
@@ -1299,6 +1596,7 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1299
1596
|
parentMenuRootContext,
|
|
1300
1597
|
floatingNodeIdFromContext,
|
|
1301
1598
|
floatingParentNodeIdFromContext,
|
|
1599
|
+
activeTriggerElement,
|
|
1302
1600
|
store
|
|
1303
1601
|
]);
|
|
1304
1602
|
__rspack_external_react.useEffect(()=>{
|
|
@@ -1326,22 +1624,15 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1326
1624
|
]);
|
|
1327
1625
|
const setOpen = useStableCallback((nextOpen, eventDetails)=>{
|
|
1328
1626
|
const reason = eventDetails.reason;
|
|
1627
|
+
if (!nextOpen && !store.select('open')) return;
|
|
1329
1628
|
if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) return;
|
|
1330
|
-
|
|
1331
|
-
store.set('preventUnmountingOnClose', true);
|
|
1332
|
-
};
|
|
1629
|
+
const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
|
|
1333
1630
|
if (!nextOpen && null == eventDetails.trigger) eventDetails.trigger = activeTriggerElement ?? void 0;
|
|
1334
1631
|
onOpenChange?.(nextOpen, eventDetails);
|
|
1335
1632
|
if (eventDetails.isCanceled) return;
|
|
1336
1633
|
store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
1337
1634
|
const nativeEvent = eventDetails.event;
|
|
1338
|
-
if (false === nextOpen && nativeEvent?.type === 'click' && 'touch' === nativeEvent.pointerType && !allowTouchToCloseRef.current) return;
|
|
1339
|
-
if (!nextOpen && null !== activeIndex) {
|
|
1340
|
-
const activeOption = store.context.itemDomElements.current[activeIndex];
|
|
1341
|
-
queueMicrotask(()=>{
|
|
1342
|
-
activeOption?.setAttribute('tabindex', '-1');
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1635
|
+
if (false === nextOpen && reason !== itemPress && nativeEvent?.type === 'click' && 'touch' === nativeEvent.pointerType && !allowTouchToCloseRef.current) return;
|
|
1345
1636
|
if (nextOpen && reason === triggerFocus) {
|
|
1346
1637
|
allowTouchToCloseRef.current = false;
|
|
1347
1638
|
allowTouchToCloseTimeout.start(300, ()=>{
|
|
@@ -1351,31 +1642,26 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1351
1642
|
allowTouchToCloseRef.current = true;
|
|
1352
1643
|
allowTouchToCloseTimeout.clear();
|
|
1353
1644
|
}
|
|
1354
|
-
const isKeyboardClick = (reason === triggerPress || reason === itemPress) && 0 === nativeEvent.detail && nativeEvent?.isTrusted;
|
|
1355
1645
|
const isDismissClose = !nextOpen && (reason === escapeKey || null == reason);
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
if (
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
}
|
|
1366
|
-
store.update(updatedState);
|
|
1367
|
-
if ('menubar' === parent.type && (reason === triggerFocus || reason === focusOut || reason === triggerHover || reason === reason_parts_listNavigation || reason === siblingOpen)) store.set('instantType', 'group');
|
|
1368
|
-
else if (isKeyboardClick || isDismissClose) store.set('instantType', isKeyboardClick ? 'click' : 'dismiss');
|
|
1369
|
-
else store.set('instantType', void 0);
|
|
1646
|
+
openEventRef.current = eventDetails.event;
|
|
1647
|
+
const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
|
|
1648
|
+
popupOpenState.openChangeReason = reason;
|
|
1649
|
+
popupOpenState.keyboardOpen = nextOpen && isKeyboardOpen(reason, nativeEvent);
|
|
1650
|
+
if ('menubar' === parent.type && (reason === triggerFocus || reason === focusOut || reason === triggerHover || reason === reason_parts_listNavigation || reason === siblingOpen)) popupOpenState.instantType = 'group';
|
|
1651
|
+
else if (isKeyboardClick(reason, nativeEvent)) popupOpenState.instantType = 'click';
|
|
1652
|
+
else if (isDismissClose) popupOpenState.instantType = 'dismiss';
|
|
1653
|
+
else popupOpenState.instantType = void 0;
|
|
1654
|
+
store.update(popupOpenState);
|
|
1370
1655
|
});
|
|
1371
1656
|
const floatingRootContext = useSyncedFloatingRootContext({
|
|
1372
1657
|
popupStore: store,
|
|
1658
|
+
floatingRootContext: store.state.floatingRootContext,
|
|
1373
1659
|
floatingId,
|
|
1374
1660
|
nested: null != floatingParentNodeIdFromContext,
|
|
1375
1661
|
onOpenChange: setOpen
|
|
1376
1662
|
});
|
|
1377
1663
|
const floatingEvents = floatingRootContext.context.events;
|
|
1378
|
-
|
|
1664
|
+
useIsoLayoutEffect(()=>{
|
|
1379
1665
|
const handleSetOpenEvent = ({ open: nextOpen, eventDetails })=>setOpen(nextOpen, eventDetails);
|
|
1380
1666
|
floatingEvents.on('setOpen', handleSetOpenEvent);
|
|
1381
1667
|
return ()=>{
|
|
@@ -1385,6 +1671,9 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1385
1671
|
floatingEvents,
|
|
1386
1672
|
setOpen
|
|
1387
1673
|
]);
|
|
1674
|
+
useIsoLayoutEffect(()=>store.subscribeToParentMenu(), [
|
|
1675
|
+
store
|
|
1676
|
+
]);
|
|
1388
1677
|
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
1389
1678
|
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
1390
1679
|
}, [
|
|
@@ -1419,26 +1708,28 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1419
1708
|
externalTree: nested ? floatingTreeRoot : void 0
|
|
1420
1709
|
});
|
|
1421
1710
|
const direction = useDirection();
|
|
1422
|
-
const setActiveIndex = __rspack_external_react.useCallback((index)=>{
|
|
1423
|
-
if (store.select('activeIndex') === index) return;
|
|
1424
|
-
store.set('activeIndex', index);
|
|
1425
|
-
}, [
|
|
1426
|
-
store
|
|
1427
|
-
]);
|
|
1428
1711
|
const listNavigation = useListNavigation(floatingRootContext, {
|
|
1429
1712
|
enabled: !disabled,
|
|
1430
1713
|
listRef: store.context.itemDomElements,
|
|
1431
1714
|
activeIndex,
|
|
1432
|
-
|
|
1715
|
+
virtual: virtualFocus,
|
|
1716
|
+
nested: 'menubar' === parent.type || !virtualFocus && void 0 !== parent.type,
|
|
1717
|
+
parentOrientation: 'menubar' === parent.type ? parent.context.orientation : void 0,
|
|
1433
1718
|
loopFocus,
|
|
1719
|
+
focusItemOnOpen: virtualFocus ? keyboardOpen : void 0,
|
|
1720
|
+
allowEscape: virtualFocus && loopFocus && allowEscape,
|
|
1434
1721
|
orientation,
|
|
1435
|
-
|
|
1722
|
+
triggerOrientation: virtualFocus ? 'vertical' : orientation,
|
|
1436
1723
|
rtl: 'rtl' === direction,
|
|
1437
1724
|
disabledIndices: EMPTY_ARRAY,
|
|
1438
|
-
onNavigate
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1725
|
+
onNavigate (nextActiveIndex, event) {
|
|
1726
|
+
store.setActiveIndex(nextActiveIndex, getHighlightReason(event), event?.nativeEvent);
|
|
1727
|
+
},
|
|
1728
|
+
openOnArrowKeyDown: 'context-menu' !== parent.type && !(virtualFocus && isSubmenu),
|
|
1729
|
+
externalTree: !virtualFocus && nested ? floatingTreeRoot : void 0,
|
|
1730
|
+
nestedReturnFocusRef: parentMenuStore?.context.virtualFocusRef,
|
|
1731
|
+
focusItemOnHover: highlightItemOnHover,
|
|
1732
|
+
resetOnPointerLeave
|
|
1442
1733
|
});
|
|
1443
1734
|
const onTyping = __rspack_external_react.useCallback((nextTyping)=>{
|
|
1444
1735
|
store.context.typingRef.current = nextTyping;
|
|
@@ -1446,17 +1737,54 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1446
1737
|
store
|
|
1447
1738
|
]);
|
|
1448
1739
|
const typeahead = useTypeahead(floatingRootContext, {
|
|
1740
|
+
enabled: !disabled && !virtualFocus,
|
|
1449
1741
|
listRef: store.context.itemLabels,
|
|
1450
1742
|
elementsRef: store.context.itemDomElements,
|
|
1451
1743
|
activeIndex,
|
|
1452
1744
|
resetMs: 500,
|
|
1453
|
-
onMatch: (index)=>{
|
|
1454
|
-
if (open && index !== activeIndex) store.
|
|
1745
|
+
onMatch: (index, event)=>{
|
|
1746
|
+
if (open && index !== activeIndex) store.setActiveIndex(index, keyboard, event.nativeEvent);
|
|
1455
1747
|
},
|
|
1456
1748
|
onTyping
|
|
1457
1749
|
});
|
|
1750
|
+
const onItemHighlighted = useStableCallback(onItemHighlightedProp);
|
|
1751
|
+
const lastHighlightIndexRef = __rspack_external_react.useRef(-1);
|
|
1752
|
+
const syncHighlightedItem = useStableCallback(()=>{
|
|
1753
|
+
const index = store.state.activeIndex;
|
|
1754
|
+
const item = null === index ? void 0 : store.context.itemDomElements.current[index] ?? void 0;
|
|
1755
|
+
if (item?.isConnected === false) return;
|
|
1756
|
+
const itemIndex = void 0 === item ? -1 : index;
|
|
1757
|
+
if (lastHighlightIndexRef.current === itemIndex && store.context.reportedItem === item) return;
|
|
1758
|
+
lastHighlightIndexRef.current = itemIndex;
|
|
1759
|
+
store.context.reportedItem = item;
|
|
1760
|
+
if (virtualFocus) store.set('highlightedItem', item);
|
|
1761
|
+
const { highlightReason, highlightEvent } = store.context;
|
|
1762
|
+
store.context.highlightReason = "none";
|
|
1763
|
+
store.context.highlightEvent = void 0;
|
|
1764
|
+
if (!onItemHighlightedProp) return;
|
|
1765
|
+
onItemHighlighted(item, createGenericEventDetails(highlightReason, highlightEvent, {
|
|
1766
|
+
label: void 0 === item ? void 0 : store.context.itemLabels.current[itemIndex] ?? void 0
|
|
1767
|
+
}));
|
|
1768
|
+
});
|
|
1769
|
+
useIsoLayoutEffect(()=>{
|
|
1770
|
+
syncHighlightedItem();
|
|
1771
|
+
}, [
|
|
1772
|
+
activeIndex,
|
|
1773
|
+
syncHighlightedItem
|
|
1774
|
+
]);
|
|
1775
|
+
const openTriggerProps = __rspack_external_react.useMemo(()=>{
|
|
1776
|
+
if (!virtualFocus) return listNavigation.reference;
|
|
1777
|
+
if (!listNavigation.trigger) return EMPTY_OBJECT;
|
|
1778
|
+
const { onFocus, ...rest } = listNavigation.trigger;
|
|
1779
|
+
return rest;
|
|
1780
|
+
}, [
|
|
1781
|
+
virtualFocus,
|
|
1782
|
+
listNavigation.reference,
|
|
1783
|
+
listNavigation.trigger
|
|
1784
|
+
]);
|
|
1785
|
+
store.useSyncedValue('inputProps', virtualFocus ? listNavigation.reference ?? EMPTY_OBJECT : EMPTY_OBJECT);
|
|
1458
1786
|
const activeTriggerProps = __rspack_external_react.useMemo(()=>{
|
|
1459
|
-
const mergedProps = mergeProps(typeahead.reference,
|
|
1787
|
+
const mergedProps = mergeProps(typeahead.reference, openTriggerProps, dismiss.reference, {
|
|
1460
1788
|
onMouseMove () {
|
|
1461
1789
|
store.set('allowMouseEnter', true);
|
|
1462
1790
|
}
|
|
@@ -1467,7 +1795,7 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1467
1795
|
}, [
|
|
1468
1796
|
store,
|
|
1469
1797
|
typeahead.reference,
|
|
1470
|
-
|
|
1798
|
+
openTriggerProps,
|
|
1471
1799
|
dismiss.reference,
|
|
1472
1800
|
interactionTypeProps,
|
|
1473
1801
|
open
|
|
@@ -1482,10 +1810,13 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1482
1810
|
dismiss.trigger,
|
|
1483
1811
|
interactionTypeProps
|
|
1484
1812
|
]);
|
|
1813
|
+
useRefWithInit(()=>{
|
|
1814
|
+
store.update({
|
|
1815
|
+
inactiveTriggerProps
|
|
1816
|
+
});
|
|
1817
|
+
return null;
|
|
1818
|
+
});
|
|
1485
1819
|
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, {
|
|
1486
|
-
id: floatingId,
|
|
1487
|
-
role: 'menu',
|
|
1488
|
-
'aria-labelledby': activeTriggerElement?.id,
|
|
1489
1820
|
onMouseMove () {
|
|
1490
1821
|
store.set('allowMouseEnter', true);
|
|
1491
1822
|
if ('menu' === parent.type) store.set('hoverEnabled', false);
|
|
@@ -1498,8 +1829,6 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1498
1829
|
if (relay && !event.isPropagationStopped()) relay(event);
|
|
1499
1830
|
}
|
|
1500
1831
|
}, typeahead.floating, listNavigation.floating, dismiss.floating), [
|
|
1501
|
-
activeTriggerElement,
|
|
1502
|
-
floatingId,
|
|
1503
1832
|
parent.type,
|
|
1504
1833
|
store,
|
|
1505
1834
|
typeahead.floating,
|
|
@@ -1516,51 +1845,97 @@ const MenuRoot_MenuRoot = fastComponent(function(props) {
|
|
|
1516
1845
|
});
|
|
1517
1846
|
const context = __rspack_external_react.useMemo(()=>({
|
|
1518
1847
|
store,
|
|
1519
|
-
parent: parentFromContext
|
|
1848
|
+
parent: parentFromContext,
|
|
1849
|
+
orientation,
|
|
1850
|
+
loopFocus,
|
|
1851
|
+
allowEscape,
|
|
1852
|
+
defaultFloatingId,
|
|
1853
|
+
setRenderedFloatingId,
|
|
1854
|
+
virtualFocus,
|
|
1855
|
+
parentVirtualFocus,
|
|
1856
|
+
syncHighlightedItem
|
|
1520
1857
|
}), [
|
|
1521
1858
|
store,
|
|
1522
|
-
parentFromContext
|
|
1859
|
+
parentFromContext,
|
|
1860
|
+
orientation,
|
|
1861
|
+
loopFocus,
|
|
1862
|
+
allowEscape,
|
|
1863
|
+
defaultFloatingId,
|
|
1864
|
+
virtualFocus,
|
|
1865
|
+
parentVirtualFocus,
|
|
1866
|
+
syncHighlightedItem
|
|
1523
1867
|
]);
|
|
1524
|
-
const
|
|
1868
|
+
const renderedChildren = 'function' == typeof children ? children({
|
|
1869
|
+
payload
|
|
1870
|
+
}) : children;
|
|
1871
|
+
let content = /*#__PURE__*/ jsxs(MenuRootContext.Provider, {
|
|
1525
1872
|
value: context,
|
|
1526
|
-
children:
|
|
1527
|
-
|
|
1528
|
-
|
|
1873
|
+
children: [
|
|
1874
|
+
handle && /*#__PURE__*/ jsx(PopupHandleAttachment, {
|
|
1875
|
+
handle: handle,
|
|
1876
|
+
store: store
|
|
1877
|
+
}),
|
|
1878
|
+
renderedChildren
|
|
1879
|
+
]
|
|
1529
1880
|
});
|
|
1530
|
-
if (void 0 === parent.type || 'context-menu' === parent.type)
|
|
1881
|
+
if (void 0 === parent.type || 'context-menu' === parent.type) content = /*#__PURE__*/ jsx(FloatingTree, {
|
|
1531
1882
|
externalTree: floatingTreeRoot,
|
|
1532
1883
|
children: content
|
|
1533
1884
|
});
|
|
1534
1885
|
return content;
|
|
1535
1886
|
});
|
|
1536
|
-
if ("production" !== process.env.NODE_ENV)
|
|
1887
|
+
if ("production" !== process.env.NODE_ENV) MenuRoot_MenuRootInternal.displayName = "MenuRootInternal";
|
|
1888
|
+
function MenuRoot(props) {
|
|
1889
|
+
const filterProvider = __rspack_external_react.useContext(MenuFilterProviderContext);
|
|
1890
|
+
if (null === filterProvider) return /*#__PURE__*/ jsx(MenuRoot_MenuRootInternal, {
|
|
1891
|
+
...props
|
|
1892
|
+
});
|
|
1893
|
+
const FilterRoot = filterProvider.Root;
|
|
1894
|
+
return /*#__PURE__*/ jsx(MenuFilterProviderContext.Provider, {
|
|
1895
|
+
value: null,
|
|
1896
|
+
children: /*#__PURE__*/ jsx(FilterRoot, {
|
|
1897
|
+
...filterProvider.options,
|
|
1898
|
+
...props
|
|
1899
|
+
})
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
const EMPTY_SUBMENU_ROOT_CONTEXT = {};
|
|
1537
1903
|
function MenuSubmenuRoot(props) {
|
|
1538
|
-
|
|
1539
|
-
const
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1904
|
+
useMenuRootContext();
|
|
1905
|
+
const filterProvider = __rspack_external_react.useContext(MenuFilterProviderContext);
|
|
1906
|
+
if (null !== filterProvider) {
|
|
1907
|
+
const FilterSubmenuRoot = filterProvider.SubmenuRoot;
|
|
1908
|
+
return /*#__PURE__*/ jsx(MenuFilterProviderContext.Provider, {
|
|
1909
|
+
value: null,
|
|
1910
|
+
children: /*#__PURE__*/ jsx(FilterSubmenuRoot, {
|
|
1911
|
+
...filterProvider.options,
|
|
1912
|
+
...props
|
|
1913
|
+
})
|
|
1914
|
+
});
|
|
1915
|
+
}
|
|
1544
1916
|
return /*#__PURE__*/ jsx(MenuSubmenuRootContext.Provider, {
|
|
1545
|
-
value:
|
|
1546
|
-
children: /*#__PURE__*/ jsx(
|
|
1547
|
-
...props
|
|
1917
|
+
value: EMPTY_SUBMENU_ROOT_CONTEXT,
|
|
1918
|
+
children: /*#__PURE__*/ jsx(MenuRoot_MenuRootInternal, {
|
|
1919
|
+
...props,
|
|
1920
|
+
isSubmenu: true
|
|
1548
1921
|
})
|
|
1549
1922
|
});
|
|
1550
1923
|
}
|
|
1551
1924
|
const MenuPortal_MenuPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
1552
1925
|
const { keepMounted = false, ...portalProps } = props;
|
|
1553
|
-
const { store } = useMenuRootContext();
|
|
1926
|
+
const { store, parent } = useMenuRootContext();
|
|
1554
1927
|
const mounted = store.useState('mounted');
|
|
1555
1928
|
const shouldRender = mounted || keepMounted;
|
|
1556
1929
|
if (!shouldRender) return null;
|
|
1930
|
+
const portalOwnerRole = 'menu' === parent.type || 'menubar' === parent.type ? 'group' : void 0;
|
|
1557
1931
|
return /*#__PURE__*/ jsx(MenuPortalContext.Provider, {
|
|
1558
1932
|
value: keepMounted,
|
|
1559
1933
|
children: /*#__PURE__*/ jsx(FloatingPortal_FloatingPortal, {
|
|
1560
1934
|
ref: forwardedRef,
|
|
1561
|
-
...portalProps
|
|
1935
|
+
...portalProps,
|
|
1936
|
+
portalOwnerRole: portalOwnerRole
|
|
1562
1937
|
})
|
|
1563
1938
|
});
|
|
1564
1939
|
});
|
|
1565
1940
|
if ("production" !== process.env.NODE_ENV) MenuPortal_MenuPortal.displayName = "MenuPortal";
|
|
1566
|
-
export { ContextMenuRootContext, MenuArrow_MenuArrow, MenuBackdrop_MenuBackdrop, MenuCheckboxItemIndicator_MenuCheckboxItemIndicator, MenuCheckboxItem_MenuCheckboxItem, MenuGroupLabel_MenuGroupLabel, MenuGroup_MenuGroup, MenuItem_MenuItem, MenuLinkItem_MenuLinkItem, MenuPopup_MenuPopup, MenuPortal_MenuPortal, MenuPositioner_MenuPositioner, MenuRadioGroup_MenuRadioGroup, MenuRadioItemIndicator_MenuRadioItemIndicator, MenuRadioItem_MenuRadioItem,
|
|
1941
|
+
export { ContextMenuRootContext, MenuArrow_MenuArrow, MenuBackdrop_MenuBackdrop, MenuCheckboxItemIndicator_MenuCheckboxItemIndicator, MenuCheckboxItem_MenuCheckboxItem, MenuGroupLabel_MenuGroupLabel, MenuGroup_MenuGroup, MenuItem_MenuItem, MenuLinkItem_MenuLinkItem, MenuPopup_MenuPopup, MenuPortal_MenuPortal, MenuPositioner_MenuPositioner, MenuRadioGroup_MenuRadioGroup, MenuRadioItemIndicator_MenuRadioItemIndicator, MenuRadioItem_MenuRadioItem, MenuRoot, MenuRootContext, MenuSubmenuRoot, MenuSubmenuTrigger_MenuSubmenuTrigger, createNullMenuStore, findRootOwnerId, useContextMenuRootContext, useMenuPositionerContext, useMenuRootContext };
|