@wix/site-ui 1.30.0 → 1.31.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/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Menu/index.js
CHANGED
|
@@ -1,7 +1,346 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Menu } from "@base-ui/react/menu";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { MenuBackdrop_MenuBackdrop, MenuGroupLabel_MenuGroupLabel, MenuLinkItem_MenuLinkItem, MenuArrow_MenuArrow, MenuItem_MenuItem, MenuPopup_MenuPopup, MenuPositioner_MenuPositioner, MenuRadioItem_MenuRadioItem, MenuSubmenuTrigger_MenuSubmenuTrigger, MenuSubmenuRoot, MenuGroup_MenuGroup, findRootOwnerId, useMenuRootContext, MenuStore, MenuPortal_MenuPortal, useContextMenuRootContext, MenuCheckboxItemIndicator_MenuCheckboxItemIndicator, MenuCheckboxItem_MenuCheckboxItem, useMenuPositionerContext, MenuRadioItemIndicator_MenuRadioItemIndicator, MenuRadioGroup_MenuRadioGroup, MenuRoot_MenuRoot } from "../6882.js";
|
|
4
|
+
import { usePopupViewport } from "../8171.js";
|
|
5
|
+
import { EMPTY_OBJECT, mergeProps, useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
6
|
+
import { ownerDocument } from "../9829.js";
|
|
7
|
+
import { fastComponentRef } from "../5992.js";
|
|
8
|
+
import { useBaseUiId } from "../6046.js";
|
|
9
|
+
import { useCompositeRootContext } from "../8724.js";
|
|
10
|
+
import { useFloatingParentNodeId, useFloatingTree, useFloatingNodeId, FloatingTreeStore } from "../285.js";
|
|
11
|
+
import { useTriggerDataForwarding } from "../8106.js";
|
|
12
|
+
import { useButton } from "../9189.js";
|
|
13
|
+
import { useTimeout } from "../42.js";
|
|
14
|
+
import { useStableCallback } from "../7541.js";
|
|
15
|
+
import { contains } from "../4549.js";
|
|
16
|
+
import { getPseudoElementBounds } from "../7373.js";
|
|
17
|
+
import { triggerHover, cancelOpen } from "../2418.js";
|
|
18
|
+
import { safePolygon, useHoverReferenceInteraction } from "../3670.js";
|
|
19
|
+
import { useClick } from "../5864.js";
|
|
20
|
+
import { useFocus } from "../904.js";
|
|
21
|
+
import { useTriggerFocusGuards } from "../7871.js";
|
|
22
|
+
import { FocusGuard_FocusGuard, pressableTriggerOpenStateMapping } from "../4388.js";
|
|
23
|
+
import { CompositeItem } from "../951.js";
|
|
24
|
+
import { useIsoLayoutEffect } from "../6499.js";
|
|
25
|
+
import { useMenubarContext } from "../7564.js";
|
|
26
|
+
import { createChangeEventDetails } from "../4768.js";
|
|
27
|
+
import { Separator } from "../9635.js";
|
|
4
28
|
import * as __rspack_external_react from "react";
|
|
29
|
+
let MenuViewportCssVars_MenuViewportCssVars = /*#__PURE__*/ function(MenuViewportCssVars) {
|
|
30
|
+
MenuViewportCssVars["popupWidth"] = "--popup-width";
|
|
31
|
+
MenuViewportCssVars["popupHeight"] = "--popup-height";
|
|
32
|
+
return MenuViewportCssVars;
|
|
33
|
+
}({});
|
|
34
|
+
const stateAttributesMapping = {
|
|
35
|
+
activationDirection: (value)=>value ? {
|
|
36
|
+
'data-activation-direction': value
|
|
37
|
+
} : null
|
|
38
|
+
};
|
|
39
|
+
const MenuViewport_MenuViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
40
|
+
const { render, className, style, children, ...elementProps } = componentProps;
|
|
41
|
+
const { store } = useMenuRootContext();
|
|
42
|
+
const { side } = useMenuPositionerContext();
|
|
43
|
+
const instantType = store.useState('instantType');
|
|
44
|
+
const { children: childrenToRender, state: viewportState } = usePopupViewport({
|
|
45
|
+
store,
|
|
46
|
+
side,
|
|
47
|
+
cssVars: MenuViewportCssVars_MenuViewportCssVars,
|
|
48
|
+
children
|
|
49
|
+
});
|
|
50
|
+
const state = {
|
|
51
|
+
activationDirection: viewportState.activationDirection,
|
|
52
|
+
transitioning: viewportState.transitioning,
|
|
53
|
+
instant: instantType
|
|
54
|
+
};
|
|
55
|
+
return useRenderElement('div', componentProps, {
|
|
56
|
+
state,
|
|
57
|
+
ref: forwardedRef,
|
|
58
|
+
props: [
|
|
59
|
+
elementProps,
|
|
60
|
+
{
|
|
61
|
+
children: childrenToRender
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
stateAttributesMapping: stateAttributesMapping
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
if ("production" !== process.env.NODE_ENV) MenuViewport_MenuViewport.displayName = "MenuViewport";
|
|
68
|
+
function useMixedToggleClickHandler(params) {
|
|
69
|
+
const { enabled = true, mouseDownAction, open } = params;
|
|
70
|
+
const ignoreClickRef = __rspack_external_react.useRef(false);
|
|
71
|
+
return __rspack_external_react.useMemo(()=>{
|
|
72
|
+
if (!enabled) return EMPTY_OBJECT;
|
|
73
|
+
return {
|
|
74
|
+
onMouseDown: (event)=>{
|
|
75
|
+
if ('open' === mouseDownAction && !open || 'close' === mouseDownAction && open) {
|
|
76
|
+
ignoreClickRef.current = true;
|
|
77
|
+
ownerDocument(event.currentTarget).addEventListener('click', ()=>{
|
|
78
|
+
ignoreClickRef.current = false;
|
|
79
|
+
}, {
|
|
80
|
+
once: true
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
onClick: (event)=>{
|
|
85
|
+
if (ignoreClickRef.current) {
|
|
86
|
+
ignoreClickRef.current = false;
|
|
87
|
+
event.preventBaseUIHandler();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}, [
|
|
92
|
+
enabled,
|
|
93
|
+
mouseDownAction,
|
|
94
|
+
open
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
const BOUNDARY_OFFSET = 2;
|
|
98
|
+
const MenuTrigger_MenuTrigger = fastComponentRef(function(componentProps, forwardedRef) {
|
|
99
|
+
const { render, className, style, disabled: disabledProp = false, nativeButton = true, id: idProp, openOnHover: openOnHoverProp, delay = 100, closeDelay = 0, handle, payload, ...elementProps } = componentProps;
|
|
100
|
+
const rootContext = useMenuRootContext(true);
|
|
101
|
+
const store = handle?.store ?? rootContext?.store;
|
|
102
|
+
if (!store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle.' : esm_formatErrorMessage(85));
|
|
103
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
104
|
+
const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
|
|
105
|
+
const floatingRootContext = store.useState('floatingRootContext');
|
|
106
|
+
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
107
|
+
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
108
|
+
const triggerElementRef = __rspack_external_react.useRef(null);
|
|
109
|
+
const parent = useMenuParent();
|
|
110
|
+
const compositeRootContext = useCompositeRootContext(true);
|
|
111
|
+
const floatingTreeRootFromContext = useFloatingTree();
|
|
112
|
+
const floatingTreeRoot = __rspack_external_react.useMemo(()=>floatingTreeRootFromContext ?? new FloatingTreeStore(), [
|
|
113
|
+
floatingTreeRootFromContext
|
|
114
|
+
]);
|
|
115
|
+
const floatingNodeId = useFloatingNodeId(floatingTreeRoot);
|
|
116
|
+
const floatingParentNodeId = useFloatingParentNodeId();
|
|
117
|
+
const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
118
|
+
payload,
|
|
119
|
+
closeDelay,
|
|
120
|
+
parent,
|
|
121
|
+
floatingTreeRoot,
|
|
122
|
+
floatingNodeId,
|
|
123
|
+
floatingParentNodeId,
|
|
124
|
+
keyboardEventRelay: compositeRootContext?.relayKeyboardEvent
|
|
125
|
+
});
|
|
126
|
+
const isInMenubar = 'menubar' === parent.type;
|
|
127
|
+
const rootDisabled = store.useState('disabled');
|
|
128
|
+
const disabled = disabledProp || rootDisabled || isInMenubar && parent.context.disabled;
|
|
129
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
130
|
+
disabled,
|
|
131
|
+
native: nativeButton
|
|
132
|
+
});
|
|
133
|
+
__rspack_external_react.useEffect(()=>{
|
|
134
|
+
if (!isOpenedByThisTrigger && void 0 === parent.type) store.context.allowMouseUpTriggerRef.current = false;
|
|
135
|
+
}, [
|
|
136
|
+
store,
|
|
137
|
+
isOpenedByThisTrigger,
|
|
138
|
+
parent.type
|
|
139
|
+
]);
|
|
140
|
+
const triggerRef = __rspack_external_react.useRef(null);
|
|
141
|
+
const allowMouseUpTriggerTimeout = useTimeout();
|
|
142
|
+
const handleDocumentMouseUp = useStableCallback((mouseEvent)=>{
|
|
143
|
+
if (!triggerRef.current) return;
|
|
144
|
+
allowMouseUpTriggerTimeout.clear();
|
|
145
|
+
store.context.allowMouseUpTriggerRef.current = false;
|
|
146
|
+
const mouseUpTarget = mouseEvent.target;
|
|
147
|
+
if (contains(triggerRef.current, mouseUpTarget) || contains(store.select('positionerElement'), mouseUpTarget) || mouseUpTarget === triggerRef.current) return;
|
|
148
|
+
if (null != mouseUpTarget && findRootOwnerId(mouseUpTarget) === store.select('rootId')) return;
|
|
149
|
+
const bounds = getPseudoElementBounds(triggerRef.current);
|
|
150
|
+
if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) return;
|
|
151
|
+
floatingTreeRoot.events.emit('close', {
|
|
152
|
+
domEvent: mouseEvent,
|
|
153
|
+
reason: cancelOpen
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
__rspack_external_react.useEffect(()=>{
|
|
157
|
+
if (isOpenedByThisTrigger && store.select('lastOpenChangeReason') === triggerHover) {
|
|
158
|
+
const doc = ownerDocument(triggerRef.current);
|
|
159
|
+
doc.addEventListener('mouseup', handleDocumentMouseUp, {
|
|
160
|
+
once: true
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}, [
|
|
164
|
+
isOpenedByThisTrigger,
|
|
165
|
+
handleDocumentMouseUp,
|
|
166
|
+
store
|
|
167
|
+
]);
|
|
168
|
+
const parentMenubarHasSubmenuOpen = isInMenubar && parent.context.hasSubmenuOpen;
|
|
169
|
+
const openOnHover = openOnHoverProp ?? parentMenubarHasSubmenuOpen;
|
|
170
|
+
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
171
|
+
enabled: openOnHover && !disabled && 'context-menu' !== parent.type && (!isInMenubar || parentMenubarHasSubmenuOpen && !isMountedByThisTrigger),
|
|
172
|
+
handleClose: safePolygon({
|
|
173
|
+
blockPointerEvents: !isInMenubar
|
|
174
|
+
}),
|
|
175
|
+
mouseOnly: true,
|
|
176
|
+
move: false,
|
|
177
|
+
restMs: void 0 === parent.type ? delay : void 0,
|
|
178
|
+
delay: {
|
|
179
|
+
close: closeDelay
|
|
180
|
+
},
|
|
181
|
+
triggerElementRef,
|
|
182
|
+
externalTree: floatingTreeRoot,
|
|
183
|
+
isActiveTrigger: isTriggerActive,
|
|
184
|
+
isClosing: ()=>'ending' === store.select('transitionStatus')
|
|
185
|
+
});
|
|
186
|
+
const stickIfOpen = useStickIfOpen(isOpenedByThisTrigger, store.select('lastOpenChangeReason'));
|
|
187
|
+
const click = useClick(floatingRootContext, {
|
|
188
|
+
enabled: !disabled && 'context-menu' !== parent.type,
|
|
189
|
+
event: isOpenedByThisTrigger && isInMenubar ? 'click' : 'mousedown',
|
|
190
|
+
toggle: true,
|
|
191
|
+
ignoreMouse: false,
|
|
192
|
+
stickIfOpen: void 0 === parent.type ? stickIfOpen : false
|
|
193
|
+
});
|
|
194
|
+
const focus = useFocus(floatingRootContext, {
|
|
195
|
+
enabled: !disabled && parentMenubarHasSubmenuOpen
|
|
196
|
+
});
|
|
197
|
+
const mixedToggleHandlers = useMixedToggleClickHandler({
|
|
198
|
+
open: isOpenedByThisTrigger,
|
|
199
|
+
enabled: isInMenubar,
|
|
200
|
+
mouseDownAction: 'open'
|
|
201
|
+
});
|
|
202
|
+
const localInteractionProps = __rspack_external_react.useMemo(()=>mergeProps(focus.reference, click.reference), [
|
|
203
|
+
focus.reference,
|
|
204
|
+
click.reference
|
|
205
|
+
]);
|
|
206
|
+
const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);
|
|
207
|
+
const { preFocusGuardRef, handlePreFocusGuardFocus, handleFocusTargetFocus } = useTriggerFocusGuards(store, triggerElementRef);
|
|
208
|
+
const state = {
|
|
209
|
+
disabled,
|
|
210
|
+
open: isOpenedByThisTrigger
|
|
211
|
+
};
|
|
212
|
+
const ref = [
|
|
213
|
+
triggerRef,
|
|
214
|
+
forwardedRef,
|
|
215
|
+
buttonRef,
|
|
216
|
+
registerTrigger,
|
|
217
|
+
triggerElementRef
|
|
218
|
+
];
|
|
219
|
+
const props = [
|
|
220
|
+
localInteractionProps,
|
|
221
|
+
hoverProps ?? EMPTY_OBJECT,
|
|
222
|
+
rootTriggerProps,
|
|
223
|
+
{
|
|
224
|
+
'aria-haspopup': 'menu',
|
|
225
|
+
'aria-controls': popupId,
|
|
226
|
+
id: thisTriggerId,
|
|
227
|
+
onMouseDown: (event)=>{
|
|
228
|
+
if (store.select('open')) return;
|
|
229
|
+
allowMouseUpTriggerTimeout.start(200, ()=>{
|
|
230
|
+
store.context.allowMouseUpTriggerRef.current = true;
|
|
231
|
+
});
|
|
232
|
+
const doc = ownerDocument(event.currentTarget);
|
|
233
|
+
doc.addEventListener('mouseup', handleDocumentMouseUp, {
|
|
234
|
+
once: true
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
isInMenubar ? {
|
|
239
|
+
role: 'menuitem'
|
|
240
|
+
} : {},
|
|
241
|
+
mixedToggleHandlers,
|
|
242
|
+
elementProps,
|
|
243
|
+
getButtonProps
|
|
244
|
+
];
|
|
245
|
+
const element = useRenderElement('button', componentProps, {
|
|
246
|
+
enabled: !isInMenubar,
|
|
247
|
+
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
248
|
+
state,
|
|
249
|
+
ref,
|
|
250
|
+
props
|
|
251
|
+
});
|
|
252
|
+
if (isInMenubar) return /*#__PURE__*/ jsx(CompositeItem, {
|
|
253
|
+
tag: "button",
|
|
254
|
+
render: render,
|
|
255
|
+
className: className,
|
|
256
|
+
style: style,
|
|
257
|
+
state: state,
|
|
258
|
+
refs: ref,
|
|
259
|
+
props: props,
|
|
260
|
+
stateAttributesMapping: pressableTriggerOpenStateMapping
|
|
261
|
+
});
|
|
262
|
+
if (isOpenedByThisTrigger) return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
263
|
+
children: [
|
|
264
|
+
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
265
|
+
ref: preFocusGuardRef,
|
|
266
|
+
onFocus: handlePreFocusGuardFocus
|
|
267
|
+
}, `${thisTriggerId}-pre-focus-guard`),
|
|
268
|
+
/*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
269
|
+
children: element
|
|
270
|
+
}, thisTriggerId),
|
|
271
|
+
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
272
|
+
ref: store.context.triggerFocusTargetRef,
|
|
273
|
+
onFocus: handleFocusTargetFocus
|
|
274
|
+
}, `${thisTriggerId}-post-focus-guard`)
|
|
275
|
+
]
|
|
276
|
+
});
|
|
277
|
+
return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
278
|
+
children: element
|
|
279
|
+
}, thisTriggerId);
|
|
280
|
+
});
|
|
281
|
+
if ("production" !== process.env.NODE_ENV) MenuTrigger_MenuTrigger.displayName = "MenuTrigger";
|
|
282
|
+
function useStickIfOpen(open, openReason) {
|
|
283
|
+
const stickIfOpenTimeout = useTimeout();
|
|
284
|
+
const [stickIfOpen, setStickIfOpen] = __rspack_external_react.useState(false);
|
|
285
|
+
useIsoLayoutEffect(()=>{
|
|
286
|
+
if (open && 'trigger-hover' === openReason) {
|
|
287
|
+
setStickIfOpen(true);
|
|
288
|
+
stickIfOpenTimeout.start(500, ()=>{
|
|
289
|
+
setStickIfOpen(false);
|
|
290
|
+
});
|
|
291
|
+
} else if (!open) {
|
|
292
|
+
stickIfOpenTimeout.clear();
|
|
293
|
+
setStickIfOpen(false);
|
|
294
|
+
}
|
|
295
|
+
}, [
|
|
296
|
+
open,
|
|
297
|
+
openReason,
|
|
298
|
+
stickIfOpenTimeout
|
|
299
|
+
]);
|
|
300
|
+
return stickIfOpen;
|
|
301
|
+
}
|
|
302
|
+
function useMenuParent() {
|
|
303
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
304
|
+
const parentContext = useMenuRootContext(true);
|
|
305
|
+
const menubarContext = useMenubarContext(true);
|
|
306
|
+
const parent = __rspack_external_react.useMemo(()=>{
|
|
307
|
+
if (menubarContext) return {
|
|
308
|
+
type: 'menubar',
|
|
309
|
+
context: menubarContext
|
|
310
|
+
};
|
|
311
|
+
if (contextMenuContext && !parentContext) return {
|
|
312
|
+
type: 'context-menu',
|
|
313
|
+
context: contextMenuContext
|
|
314
|
+
};
|
|
315
|
+
return {
|
|
316
|
+
type: void 0
|
|
317
|
+
};
|
|
318
|
+
}, [
|
|
319
|
+
contextMenuContext,
|
|
320
|
+
parentContext,
|
|
321
|
+
menubarContext
|
|
322
|
+
]);
|
|
323
|
+
return parent;
|
|
324
|
+
}
|
|
325
|
+
class MenuHandle {
|
|
326
|
+
constructor(){
|
|
327
|
+
this.store = new MenuStore();
|
|
328
|
+
}
|
|
329
|
+
open(triggerId) {
|
|
330
|
+
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
|
|
331
|
+
if (triggerId && !triggerElement) throw new Error("production" !== process.env.NODE_ENV ? `Base UI: MenuHandle.open: No trigger found with id "${triggerId}".` : esm_formatErrorMessage(83, triggerId));
|
|
332
|
+
this.store.setOpen(true, createChangeEventDetails('imperative-action', void 0, triggerElement));
|
|
333
|
+
}
|
|
334
|
+
close() {
|
|
335
|
+
this.store.setOpen(false, createChangeEventDetails('imperative-action', void 0, void 0));
|
|
336
|
+
}
|
|
337
|
+
get isOpen() {
|
|
338
|
+
return this.store.select('open');
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function createMenuHandle() {
|
|
342
|
+
return new MenuHandle();
|
|
343
|
+
}
|
|
5
344
|
const Menu_module = {
|
|
6
345
|
trigger: "trigger-OltV1Y",
|
|
7
346
|
groupLabel: "groupLabel-_L41zu",
|
|
@@ -9,88 +348,88 @@ const Menu_module = {
|
|
|
9
348
|
item: "item-toMw6N",
|
|
10
349
|
linkItem: "linkItem-UZphBs"
|
|
11
350
|
};
|
|
12
|
-
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
351
|
+
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuArrow_MenuArrow, {
|
|
13
352
|
ref: ref,
|
|
14
353
|
className: clsx(Menu_module.arrow, className),
|
|
15
354
|
...props
|
|
16
355
|
}));
|
|
17
|
-
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
356
|
+
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuBackdrop_MenuBackdrop, {
|
|
18
357
|
ref: ref,
|
|
19
358
|
className: clsx(Menu_module.backdrop, className),
|
|
20
359
|
...props
|
|
21
360
|
}));
|
|
22
|
-
const CheckboxItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
361
|
+
const CheckboxItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuCheckboxItem_MenuCheckboxItem, {
|
|
23
362
|
ref: ref,
|
|
24
363
|
className: clsx(Menu_module.checkboxItem, className),
|
|
25
364
|
...props
|
|
26
365
|
}));
|
|
27
|
-
const CheckboxItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
366
|
+
const CheckboxItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuCheckboxItemIndicator_MenuCheckboxItemIndicator, {
|
|
28
367
|
ref: ref,
|
|
29
368
|
className: clsx(Menu_module.checkboxItemIndicator, className),
|
|
30
369
|
...props
|
|
31
370
|
}));
|
|
32
|
-
const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
371
|
+
const Group = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuGroup_MenuGroup, {
|
|
33
372
|
ref: ref,
|
|
34
373
|
className: clsx(Menu_module.group, className),
|
|
35
374
|
...props
|
|
36
375
|
}));
|
|
37
|
-
const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
376
|
+
const GroupLabel = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuGroupLabel_MenuGroupLabel, {
|
|
38
377
|
ref: ref,
|
|
39
378
|
className: clsx(Menu_module.groupLabel, className),
|
|
40
379
|
...props
|
|
41
380
|
}));
|
|
42
|
-
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
381
|
+
const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuItem_MenuItem, {
|
|
43
382
|
ref: ref,
|
|
44
383
|
className: clsx(Menu_module.item, className),
|
|
45
384
|
...props
|
|
46
385
|
}));
|
|
47
|
-
const LinkItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
386
|
+
const LinkItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuLinkItem_MenuLinkItem, {
|
|
48
387
|
ref: ref,
|
|
49
388
|
className: clsx(Menu_module.linkItem, className),
|
|
50
389
|
...props
|
|
51
390
|
}));
|
|
52
|
-
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
391
|
+
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuPopup_MenuPopup, {
|
|
53
392
|
ref: ref,
|
|
54
393
|
className: clsx(Menu_module.popup, className),
|
|
55
394
|
...props
|
|
56
395
|
}));
|
|
57
|
-
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
396
|
+
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuPositioner_MenuPositioner, {
|
|
58
397
|
ref: ref,
|
|
59
398
|
className: clsx(Menu_module.positioner, className),
|
|
60
399
|
...props
|
|
61
400
|
}));
|
|
62
|
-
const RadioGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
401
|
+
const RadioGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuRadioGroup_MenuRadioGroup, {
|
|
63
402
|
ref: ref,
|
|
64
403
|
className: clsx(Menu_module.radioGroup, className),
|
|
65
404
|
...props
|
|
66
405
|
}));
|
|
67
|
-
const RadioItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
406
|
+
const RadioItem = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuRadioItem_MenuRadioItem, {
|
|
68
407
|
ref: ref,
|
|
69
408
|
className: clsx(Menu_module.radioItem, className),
|
|
70
409
|
...props
|
|
71
410
|
}));
|
|
72
|
-
const RadioItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
411
|
+
const RadioItemIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuRadioItemIndicator_MenuRadioItemIndicator, {
|
|
73
412
|
ref: ref,
|
|
74
413
|
className: clsx(Menu_module.radioItemIndicator, className),
|
|
75
414
|
...props
|
|
76
415
|
}));
|
|
77
|
-
const SubmenuTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
416
|
+
const SubmenuTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuSubmenuTrigger_MenuSubmenuTrigger, {
|
|
78
417
|
ref: ref,
|
|
79
418
|
className: clsx(Menu_module.submenuTrigger, className),
|
|
80
419
|
...props
|
|
81
420
|
}));
|
|
82
|
-
const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
421
|
+
const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(MenuViewport_MenuViewport, {
|
|
83
422
|
ref: ref,
|
|
84
423
|
className: clsx(Menu_module.viewport, className),
|
|
85
424
|
...props
|
|
86
425
|
}));
|
|
87
426
|
function Trigger({ className, ...props }) {
|
|
88
|
-
return /*#__PURE__*/ jsx(
|
|
427
|
+
return /*#__PURE__*/ jsx(MenuTrigger_MenuTrigger, {
|
|
89
428
|
...props,
|
|
90
429
|
className: clsx(Menu_module.trigger, className)
|
|
91
430
|
});
|
|
92
431
|
}
|
|
93
|
-
const
|
|
432
|
+
const Menu = {
|
|
94
433
|
Arrow: Arrow,
|
|
95
434
|
Backdrop: Backdrop,
|
|
96
435
|
CheckboxItem: CheckboxItem,
|
|
@@ -106,12 +445,12 @@ const Menu_Menu = {
|
|
|
106
445
|
RadioItemIndicator: RadioItemIndicator,
|
|
107
446
|
SubmenuTrigger: SubmenuTrigger,
|
|
108
447
|
Viewport: Viewport,
|
|
109
|
-
Root:
|
|
448
|
+
Root: MenuRoot_MenuRoot,
|
|
110
449
|
Trigger: Trigger,
|
|
111
|
-
SubmenuRoot:
|
|
112
|
-
Portal:
|
|
113
|
-
Separator:
|
|
114
|
-
Handle:
|
|
115
|
-
createHandle:
|
|
450
|
+
SubmenuRoot: MenuSubmenuRoot,
|
|
451
|
+
Portal: MenuPortal_MenuPortal,
|
|
452
|
+
Separator: Separator,
|
|
453
|
+
Handle: MenuHandle,
|
|
454
|
+
createHandle: createMenuHandle
|
|
116
455
|
};
|
|
117
|
-
export {
|
|
456
|
+
export { Menu };
|