@huin-core/react-menu 1.0.5 → 1.0.6
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/index.js +179 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +179 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,7 +89,6 @@ var import_react_slot = require("@huin-core/react-slot");
|
|
|
89
89
|
var import_react_use_callback_ref = require("@huin-core/react-use-callback-ref");
|
|
90
90
|
var import_aria_hidden = require("aria-hidden");
|
|
91
91
|
var import_react_remove_scroll = require("react-remove-scroll");
|
|
92
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
93
92
|
var SELECTION_KEYS = ["Enter", " "];
|
|
94
93
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
95
94
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -134,27 +133,27 @@ var Menu = (props) => {
|
|
|
134
133
|
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
135
134
|
};
|
|
136
135
|
}, []);
|
|
137
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ React.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React.createElement(
|
|
138
137
|
MenuProvider,
|
|
139
138
|
{
|
|
140
139
|
scope: __scopeMenu,
|
|
141
140
|
open,
|
|
142
141
|
onOpenChange: handleOpenChange,
|
|
143
142
|
content,
|
|
144
|
-
onContentChange: setContent
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
)
|
|
143
|
+
onContentChange: setContent
|
|
144
|
+
},
|
|
145
|
+
/* @__PURE__ */ React.createElement(
|
|
146
|
+
MenuRootProvider,
|
|
147
|
+
{
|
|
148
|
+
scope: __scopeMenu,
|
|
149
|
+
onClose: React.useCallback(() => handleOpenChange(false), [handleOpenChange]),
|
|
150
|
+
isUsingKeyboardRef,
|
|
151
|
+
dir: direction,
|
|
152
|
+
modal
|
|
153
|
+
},
|
|
154
|
+
children
|
|
155
|
+
)
|
|
156
|
+
));
|
|
158
157
|
};
|
|
159
158
|
Menu.displayName = MENU_NAME;
|
|
160
159
|
var ANCHOR_NAME = "MenuAnchor";
|
|
@@ -162,7 +161,7 @@ var MenuAnchor = React.forwardRef(
|
|
|
162
161
|
(props, forwardedRef) => {
|
|
163
162
|
const { __scopeMenu, ...anchorProps } = props;
|
|
164
163
|
const popperScope = usePopperScope(__scopeMenu);
|
|
165
|
-
return /* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ React.createElement(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
166
165
|
}
|
|
167
166
|
);
|
|
168
167
|
MenuAnchor.displayName = ANCHOR_NAME;
|
|
@@ -173,7 +172,7 @@ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {
|
|
|
173
172
|
var MenuPortal = (props) => {
|
|
174
173
|
const { __scopeMenu, forceMount, children, container } = props;
|
|
175
174
|
const context = useMenuContext(PORTAL_NAME, __scopeMenu);
|
|
176
|
-
return /* @__PURE__ */
|
|
175
|
+
return /* @__PURE__ */ React.createElement(PortalProvider, { scope: __scopeMenu, forceMount }, /* @__PURE__ */ React.createElement(import_react_presence.Presence, { present: forceMount || context.open }, /* @__PURE__ */ React.createElement(import_react_portal.Portal, { asChild: true, container }, children)));
|
|
177
176
|
};
|
|
178
177
|
MenuPortal.displayName = PORTAL_NAME;
|
|
179
178
|
var CONTENT_NAME = "MenuContent";
|
|
@@ -184,7 +183,7 @@ var MenuContent = React.forwardRef(
|
|
|
184
183
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
185
184
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
186
185
|
const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);
|
|
187
|
-
return /* @__PURE__ */
|
|
186
|
+
return /* @__PURE__ */ React.createElement(Collection.Provider, { scope: props.__scopeMenu }, /* @__PURE__ */ React.createElement(import_react_presence.Presence, { present: forceMount || context.open }, /* @__PURE__ */ React.createElement(Collection.Slot, { scope: props.__scopeMenu }, rootContext.modal ? /* @__PURE__ */ React.createElement(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ React.createElement(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }))));
|
|
188
187
|
}
|
|
189
188
|
);
|
|
190
189
|
var MenuRootContentModal = React.forwardRef(
|
|
@@ -196,7 +195,7 @@ var MenuRootContentModal = React.forwardRef(
|
|
|
196
195
|
const content = ref.current;
|
|
197
196
|
if (content) return (0, import_aria_hidden.hideOthers)(content);
|
|
198
197
|
}, []);
|
|
199
|
-
return /* @__PURE__ */
|
|
198
|
+
return /* @__PURE__ */ React.createElement(
|
|
200
199
|
MenuContentImpl,
|
|
201
200
|
{
|
|
202
201
|
...props,
|
|
@@ -216,7 +215,7 @@ var MenuRootContentModal = React.forwardRef(
|
|
|
216
215
|
);
|
|
217
216
|
var MenuRootContentNonModal = React.forwardRef((props, forwardedRef) => {
|
|
218
217
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
219
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ React.createElement(
|
|
220
219
|
MenuContentImpl,
|
|
221
220
|
{
|
|
222
221
|
...props,
|
|
@@ -287,7 +286,7 @@ var MenuContentImpl = React.forwardRef(
|
|
|
287
286
|
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
288
287
|
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
289
288
|
}, []);
|
|
290
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ React.createElement(
|
|
291
290
|
MenuContentProvider,
|
|
292
291
|
{
|
|
293
292
|
scope: __scopeMenu,
|
|
@@ -315,98 +314,98 @@ var MenuContentImpl = React.forwardRef(
|
|
|
315
314
|
pointerGraceTimerRef,
|
|
316
315
|
onPointerGraceIntentChange: React.useCallback((intent) => {
|
|
317
316
|
pointerGraceIntentRef.current = intent;
|
|
318
|
-
}, [])
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
}, [])
|
|
318
|
+
},
|
|
319
|
+
/* @__PURE__ */ React.createElement(ScrollLockWrapper, { ...scrollLockWrapperProps }, /* @__PURE__ */ React.createElement(
|
|
320
|
+
import_react_focus_scope.FocusScope,
|
|
321
|
+
{
|
|
322
|
+
asChild: true,
|
|
323
|
+
trapped: trapFocus,
|
|
324
|
+
onMountAutoFocus: (0, import_primitive.composeEventHandlers)(onOpenAutoFocus, (event) => {
|
|
325
|
+
event.preventDefault();
|
|
326
|
+
contentRef.current?.focus({ preventScroll: true });
|
|
327
|
+
}),
|
|
328
|
+
onUnmountAutoFocus: onCloseAutoFocus
|
|
329
|
+
},
|
|
330
|
+
/* @__PURE__ */ React.createElement(
|
|
331
|
+
import_react_dismissable_layer.DismissableLayer,
|
|
321
332
|
{
|
|
322
333
|
asChild: true,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
334
|
+
disableOutsidePointerEvents,
|
|
335
|
+
onEscapeKeyDown,
|
|
336
|
+
onPointerDownOutside,
|
|
337
|
+
onFocusOutside,
|
|
338
|
+
onInteractOutside,
|
|
339
|
+
onDismiss
|
|
340
|
+
},
|
|
341
|
+
/* @__PURE__ */ React.createElement(
|
|
342
|
+
RovingFocusGroup.Root,
|
|
343
|
+
{
|
|
344
|
+
asChild: true,
|
|
345
|
+
...rovingFocusGroupScope,
|
|
346
|
+
dir: rootContext.dir,
|
|
347
|
+
orientation: "vertical",
|
|
348
|
+
loop,
|
|
349
|
+
currentTabStopId: currentItemId,
|
|
350
|
+
onCurrentTabStopIdChange: setCurrentItemId,
|
|
351
|
+
onEntryFocus: (0, import_primitive.composeEventHandlers)(onEntryFocus, (event) => {
|
|
352
|
+
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
353
|
+
}),
|
|
354
|
+
preventScrollOnEntryFocus: true
|
|
355
|
+
},
|
|
356
|
+
/* @__PURE__ */ React.createElement(
|
|
357
|
+
PopperPrimitive.Content,
|
|
331
358
|
{
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
ref: composedRefs,
|
|
364
|
-
style: { outline: "none", ...contentProps.style },
|
|
365
|
-
onKeyDown: (0, import_primitive.composeEventHandlers)(contentProps.onKeyDown, (event) => {
|
|
366
|
-
const target = event.target;
|
|
367
|
-
const isKeyDownInside = target.closest("[data-huin-core-menu-content]") === event.currentTarget;
|
|
368
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
369
|
-
const isCharacterKey = event.key.length === 1;
|
|
370
|
-
if (isKeyDownInside) {
|
|
371
|
-
if (event.key === "Tab") event.preventDefault();
|
|
372
|
-
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
373
|
-
}
|
|
374
|
-
const content = contentRef.current;
|
|
375
|
-
if (event.target !== content) return;
|
|
376
|
-
if (!FIRST_LAST_KEYS.includes(event.key)) return;
|
|
377
|
-
event.preventDefault();
|
|
378
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
379
|
-
const candidateNodes = items.map((item) => item.ref.current);
|
|
380
|
-
if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();
|
|
381
|
-
focusFirst(candidateNodes);
|
|
382
|
-
}),
|
|
383
|
-
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, (event) => {
|
|
384
|
-
if (!event.currentTarget.contains(event.target)) {
|
|
385
|
-
window.clearTimeout(timerRef.current);
|
|
386
|
-
searchRef.current = "";
|
|
387
|
-
}
|
|
388
|
-
}),
|
|
389
|
-
onPointerMove: (0, import_primitive.composeEventHandlers)(
|
|
390
|
-
props.onPointerMove,
|
|
391
|
-
whenMouse((event) => {
|
|
392
|
-
const target = event.target;
|
|
393
|
-
const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
|
|
394
|
-
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
395
|
-
const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
|
|
396
|
-
pointerDirRef.current = newDir;
|
|
397
|
-
lastPointerXRef.current = event.clientX;
|
|
398
|
-
}
|
|
399
|
-
})
|
|
400
|
-
)
|
|
401
|
-
}
|
|
402
|
-
)
|
|
359
|
+
role: "menu",
|
|
360
|
+
"aria-orientation": "vertical",
|
|
361
|
+
"data-state": getOpenState(context.open),
|
|
362
|
+
"data-huin-core-menu-content": "",
|
|
363
|
+
dir: rootContext.dir,
|
|
364
|
+
...popperScope,
|
|
365
|
+
...contentProps,
|
|
366
|
+
ref: composedRefs,
|
|
367
|
+
style: { outline: "none", ...contentProps.style },
|
|
368
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(contentProps.onKeyDown, (event) => {
|
|
369
|
+
const target = event.target;
|
|
370
|
+
const isKeyDownInside = target.closest("[data-huin-core-menu-content]") === event.currentTarget;
|
|
371
|
+
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
372
|
+
const isCharacterKey = event.key.length === 1;
|
|
373
|
+
if (isKeyDownInside) {
|
|
374
|
+
if (event.key === "Tab") event.preventDefault();
|
|
375
|
+
if (!isModifierKey && isCharacterKey) handleTypeaheadSearch(event.key);
|
|
376
|
+
}
|
|
377
|
+
const content = contentRef.current;
|
|
378
|
+
if (event.target !== content) return;
|
|
379
|
+
if (!FIRST_LAST_KEYS.includes(event.key)) return;
|
|
380
|
+
event.preventDefault();
|
|
381
|
+
const items = getItems().filter((item) => !item.disabled);
|
|
382
|
+
const candidateNodes = items.map((item) => item.ref.current);
|
|
383
|
+
if (LAST_KEYS.includes(event.key)) candidateNodes.reverse();
|
|
384
|
+
focusFirst(candidateNodes);
|
|
385
|
+
}),
|
|
386
|
+
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, (event) => {
|
|
387
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
388
|
+
window.clearTimeout(timerRef.current);
|
|
389
|
+
searchRef.current = "";
|
|
403
390
|
}
|
|
391
|
+
}),
|
|
392
|
+
onPointerMove: (0, import_primitive.composeEventHandlers)(
|
|
393
|
+
props.onPointerMove,
|
|
394
|
+
whenMouse((event) => {
|
|
395
|
+
const target = event.target;
|
|
396
|
+
const pointerXHasChanged = lastPointerXRef.current !== event.clientX;
|
|
397
|
+
if (event.currentTarget.contains(target) && pointerXHasChanged) {
|
|
398
|
+
const newDir = event.clientX > lastPointerXRef.current ? "right" : "left";
|
|
399
|
+
pointerDirRef.current = newDir;
|
|
400
|
+
lastPointerXRef.current = event.clientX;
|
|
401
|
+
}
|
|
402
|
+
})
|
|
404
403
|
)
|
|
405
404
|
}
|
|
406
405
|
)
|
|
407
|
-
|
|
408
|
-
)
|
|
409
|
-
|
|
406
|
+
)
|
|
407
|
+
)
|
|
408
|
+
))
|
|
410
409
|
);
|
|
411
410
|
}
|
|
412
411
|
);
|
|
@@ -415,7 +414,7 @@ var GROUP_NAME = "MenuGroup";
|
|
|
415
414
|
var MenuGroup = React.forwardRef(
|
|
416
415
|
(props, forwardedRef) => {
|
|
417
416
|
const { __scopeMenu, ...groupProps } = props;
|
|
418
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ React.createElement(import_react_primitive.Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
419
418
|
}
|
|
420
419
|
);
|
|
421
420
|
MenuGroup.displayName = GROUP_NAME;
|
|
@@ -423,7 +422,7 @@ var LABEL_NAME = "MenuLabel";
|
|
|
423
422
|
var MenuLabel = React.forwardRef(
|
|
424
423
|
(props, forwardedRef) => {
|
|
425
424
|
const { __scopeMenu, ...labelProps } = props;
|
|
426
|
-
return /* @__PURE__ */
|
|
425
|
+
return /* @__PURE__ */ React.createElement(import_react_primitive.Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
427
426
|
}
|
|
428
427
|
);
|
|
429
428
|
MenuLabel.displayName = LABEL_NAME;
|
|
@@ -450,7 +449,7 @@ var MenuItem = React.forwardRef(
|
|
|
450
449
|
}
|
|
451
450
|
}
|
|
452
451
|
};
|
|
453
|
-
return /* @__PURE__ */
|
|
452
|
+
return /* @__PURE__ */ React.createElement(
|
|
454
453
|
MenuItemImpl,
|
|
455
454
|
{
|
|
456
455
|
...itemProps,
|
|
@@ -492,44 +491,44 @@ var MenuItemImpl = React.forwardRef(
|
|
|
492
491
|
setTextContent((menuItem.textContent ?? "").trim());
|
|
493
492
|
}
|
|
494
493
|
}, [itemProps.children]);
|
|
495
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ React.createElement(
|
|
496
495
|
Collection.ItemSlot,
|
|
497
496
|
{
|
|
498
497
|
scope: __scopeMenu,
|
|
499
498
|
disabled,
|
|
500
|
-
textValue: textValue ?? textContent
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
499
|
+
textValue: textValue ?? textContent
|
|
500
|
+
},
|
|
501
|
+
/* @__PURE__ */ React.createElement(RovingFocusGroup.Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled }, /* @__PURE__ */ React.createElement(
|
|
502
|
+
import_react_primitive.Primitive.div,
|
|
503
|
+
{
|
|
504
|
+
role: "menuitem",
|
|
505
|
+
"data-highlighted": isFocused ? "" : void 0,
|
|
506
|
+
"aria-disabled": disabled || void 0,
|
|
507
|
+
"data-disabled": disabled ? "" : void 0,
|
|
508
|
+
...itemProps,
|
|
509
|
+
ref: composedRefs,
|
|
510
|
+
onPointerMove: (0, import_primitive.composeEventHandlers)(
|
|
511
|
+
props.onPointerMove,
|
|
512
|
+
whenMouse((event) => {
|
|
513
|
+
if (disabled) {
|
|
514
|
+
contentContext.onItemLeave(event);
|
|
515
|
+
} else {
|
|
516
|
+
contentContext.onItemEnter(event);
|
|
517
|
+
if (!event.defaultPrevented) {
|
|
518
|
+
const item = event.currentTarget;
|
|
519
|
+
item.focus({ preventScroll: true });
|
|
521
520
|
}
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
)
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
521
|
+
}
|
|
522
|
+
})
|
|
523
|
+
),
|
|
524
|
+
onPointerLeave: (0, import_primitive.composeEventHandlers)(
|
|
525
|
+
props.onPointerLeave,
|
|
526
|
+
whenMouse((event) => contentContext.onItemLeave(event))
|
|
527
|
+
),
|
|
528
|
+
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => setIsFocused(true)),
|
|
529
|
+
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, () => setIsFocused(false))
|
|
530
|
+
}
|
|
531
|
+
))
|
|
533
532
|
);
|
|
534
533
|
}
|
|
535
534
|
);
|
|
@@ -537,7 +536,7 @@ var CHECKBOX_ITEM_NAME = "MenuCheckboxItem";
|
|
|
537
536
|
var MenuCheckboxItem = React.forwardRef(
|
|
538
537
|
(props, forwardedRef) => {
|
|
539
538
|
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
540
|
-
return /* @__PURE__ */
|
|
539
|
+
return /* @__PURE__ */ React.createElement(ItemIndicatorProvider, { scope: props.__scopeMenu, checked }, /* @__PURE__ */ React.createElement(
|
|
541
540
|
MenuItem,
|
|
542
541
|
{
|
|
543
542
|
role: "menuitemcheckbox",
|
|
@@ -551,7 +550,7 @@ var MenuCheckboxItem = React.forwardRef(
|
|
|
551
550
|
{ checkForDefaultPrevented: false }
|
|
552
551
|
)
|
|
553
552
|
}
|
|
554
|
-
)
|
|
553
|
+
));
|
|
555
554
|
}
|
|
556
555
|
);
|
|
557
556
|
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
@@ -565,7 +564,7 @@ var MenuRadioGroup = React.forwardRef(
|
|
|
565
564
|
(props, forwardedRef) => {
|
|
566
565
|
const { value, onValueChange, ...groupProps } = props;
|
|
567
566
|
const handleValueChange = (0, import_react_use_callback_ref.useCallbackRef)(onValueChange);
|
|
568
|
-
return /* @__PURE__ */
|
|
567
|
+
return /* @__PURE__ */ React.createElement(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange }, /* @__PURE__ */ React.createElement(MenuGroup, { ...groupProps, ref: forwardedRef }));
|
|
569
568
|
}
|
|
570
569
|
);
|
|
571
570
|
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
@@ -575,7 +574,7 @@ var MenuRadioItem = React.forwardRef(
|
|
|
575
574
|
const { value, ...radioItemProps } = props;
|
|
576
575
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
577
576
|
const checked = value === context.value;
|
|
578
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ React.createElement(ItemIndicatorProvider, { scope: props.__scopeMenu, checked }, /* @__PURE__ */ React.createElement(
|
|
579
578
|
MenuItem,
|
|
580
579
|
{
|
|
581
580
|
role: "menuitemradio",
|
|
@@ -589,7 +588,7 @@ var MenuRadioItem = React.forwardRef(
|
|
|
589
588
|
{ checkForDefaultPrevented: false }
|
|
590
589
|
)
|
|
591
590
|
}
|
|
592
|
-
)
|
|
591
|
+
));
|
|
593
592
|
}
|
|
594
593
|
);
|
|
595
594
|
MenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
@@ -602,19 +601,19 @@ var MenuItemIndicator = React.forwardRef(
|
|
|
602
601
|
(props, forwardedRef) => {
|
|
603
602
|
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
604
603
|
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
605
|
-
return /* @__PURE__ */
|
|
604
|
+
return /* @__PURE__ */ React.createElement(
|
|
606
605
|
import_react_presence.Presence,
|
|
607
606
|
{
|
|
608
|
-
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
607
|
+
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true
|
|
608
|
+
},
|
|
609
|
+
/* @__PURE__ */ React.createElement(
|
|
610
|
+
import_react_primitive.Primitive.span,
|
|
611
|
+
{
|
|
612
|
+
...itemIndicatorProps,
|
|
613
|
+
ref: forwardedRef,
|
|
614
|
+
"data-state": getCheckedState(indicatorContext.checked)
|
|
615
|
+
}
|
|
616
|
+
)
|
|
618
617
|
);
|
|
619
618
|
}
|
|
620
619
|
);
|
|
@@ -623,7 +622,7 @@ var SEPARATOR_NAME = "MenuSeparator";
|
|
|
623
622
|
var MenuSeparator = React.forwardRef(
|
|
624
623
|
(props, forwardedRef) => {
|
|
625
624
|
const { __scopeMenu, ...separatorProps } = props;
|
|
626
|
-
return /* @__PURE__ */
|
|
625
|
+
return /* @__PURE__ */ React.createElement(
|
|
627
626
|
import_react_primitive.Primitive.div,
|
|
628
627
|
{
|
|
629
628
|
role: "separator",
|
|
@@ -640,7 +639,7 @@ var MenuArrow = React.forwardRef(
|
|
|
640
639
|
(props, forwardedRef) => {
|
|
641
640
|
const { __scopeMenu, ...arrowProps } = props;
|
|
642
641
|
const popperScope = usePopperScope(__scopeMenu);
|
|
643
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ React.createElement(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
644
643
|
}
|
|
645
644
|
);
|
|
646
645
|
MenuArrow.displayName = ARROW_NAME;
|
|
@@ -657,27 +656,27 @@ var MenuSub = (props) => {
|
|
|
657
656
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
658
657
|
return () => handleOpenChange(false);
|
|
659
658
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
660
|
-
return /* @__PURE__ */
|
|
659
|
+
return /* @__PURE__ */ React.createElement(PopperPrimitive.Root, { ...popperScope }, /* @__PURE__ */ React.createElement(
|
|
661
660
|
MenuProvider,
|
|
662
661
|
{
|
|
663
662
|
scope: __scopeMenu,
|
|
664
663
|
open,
|
|
665
664
|
onOpenChange: handleOpenChange,
|
|
666
665
|
content,
|
|
667
|
-
onContentChange: setContent
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
)
|
|
666
|
+
onContentChange: setContent
|
|
667
|
+
},
|
|
668
|
+
/* @__PURE__ */ React.createElement(
|
|
669
|
+
MenuSubProvider,
|
|
670
|
+
{
|
|
671
|
+
scope: __scopeMenu,
|
|
672
|
+
contentId: (0, import_react_id.useId)(),
|
|
673
|
+
triggerId: (0, import_react_id.useId)(),
|
|
674
|
+
trigger,
|
|
675
|
+
onTriggerChange: setTrigger
|
|
676
|
+
},
|
|
677
|
+
children
|
|
678
|
+
)
|
|
679
|
+
));
|
|
681
680
|
};
|
|
682
681
|
MenuSub.displayName = SUB_NAME;
|
|
683
682
|
var SUB_TRIGGER_NAME = "MenuSubTrigger";
|
|
@@ -702,7 +701,7 @@ var MenuSubTrigger = React.forwardRef(
|
|
|
702
701
|
onPointerGraceIntentChange(null);
|
|
703
702
|
};
|
|
704
703
|
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
705
|
-
return /* @__PURE__ */
|
|
704
|
+
return /* @__PURE__ */ React.createElement(MenuAnchor, { asChild: true, ...scope }, /* @__PURE__ */ React.createElement(
|
|
706
705
|
MenuItemImpl,
|
|
707
706
|
{
|
|
708
707
|
id: subContext.triggerId,
|
|
@@ -777,7 +776,7 @@ var MenuSubTrigger = React.forwardRef(
|
|
|
777
776
|
}
|
|
778
777
|
})
|
|
779
778
|
}
|
|
780
|
-
)
|
|
779
|
+
));
|
|
781
780
|
}
|
|
782
781
|
);
|
|
783
782
|
MenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
@@ -791,7 +790,7 @@ var MenuSubContent = React.forwardRef(
|
|
|
791
790
|
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
792
791
|
const ref = React.useRef(null);
|
|
793
792
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
794
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ React.createElement(Collection.Provider, { scope: props.__scopeMenu }, /* @__PURE__ */ React.createElement(import_react_presence.Presence, { present: forceMount || context.open }, /* @__PURE__ */ React.createElement(Collection.Slot, { scope: props.__scopeMenu }, /* @__PURE__ */ React.createElement(
|
|
795
794
|
MenuContentImpl,
|
|
796
795
|
{
|
|
797
796
|
id: subContext.contentId,
|
|
@@ -825,7 +824,7 @@ var MenuSubContent = React.forwardRef(
|
|
|
825
824
|
}
|
|
826
825
|
})
|
|
827
826
|
}
|
|
828
|
-
)
|
|
827
|
+
))));
|
|
829
828
|
}
|
|
830
829
|
);
|
|
831
830
|
MenuSubContent.displayName = SUB_CONTENT_NAME;
|