@radix-ui/react-menu 2.1.20 → 2.1.21-rc.1784074599772
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 +83 -90
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +84 -90
- package/dist/index.mjs.map +3 -3
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
10
|
var __export = (target, all) => {
|
|
10
11
|
for (var name in all)
|
|
11
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -113,7 +114,7 @@ var usePopperScope = (0, import_react_popper.createPopperScope)();
|
|
|
113
114
|
var useRovingFocusGroupScope = (0, import_react_roving_focus.createRovingFocusGroupScope)();
|
|
114
115
|
var [MenuProvider, useMenuContext] = createMenuContext(MENU_NAME);
|
|
115
116
|
var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
|
|
116
|
-
var Menu = (props) => {
|
|
117
|
+
var Menu = /* @__PURE__ */ __name((props) => {
|
|
117
118
|
const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
|
|
118
119
|
const popperScope = usePopperScope(__scopeMenu);
|
|
119
120
|
const [content, setContent] = React.useState(null);
|
|
@@ -121,12 +122,12 @@ var Menu = (props) => {
|
|
|
121
122
|
const handleOpenChange = (0, import_react_use_callback_ref.useCallbackRef)(onOpenChange);
|
|
122
123
|
const direction = (0, import_react_direction.useDirection)(dir);
|
|
123
124
|
React.useEffect(() => {
|
|
124
|
-
const handleKeyDown = () => {
|
|
125
|
+
const handleKeyDown = /* @__PURE__ */ __name(() => {
|
|
125
126
|
isUsingKeyboardRef.current = true;
|
|
126
127
|
document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
|
|
127
128
|
document.addEventListener("pointermove", handlePointer, { capture: true, once: true });
|
|
128
|
-
};
|
|
129
|
-
const handlePointer = () => isUsingKeyboardRef.current = false;
|
|
129
|
+
}, "handleKeyDown");
|
|
130
|
+
const handlePointer = /* @__PURE__ */ __name(() => isUsingKeyboardRef.current = false, "handlePointer");
|
|
130
131
|
document.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
131
132
|
return () => {
|
|
132
133
|
document.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
@@ -138,7 +139,7 @@ var Menu = (props) => {
|
|
|
138
139
|
if (!open) {
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
|
-
const handleBlur = () => handleOpenChange(false);
|
|
142
|
+
const handleBlur = /* @__PURE__ */ __name(() => handleOpenChange(false), "handleBlur");
|
|
142
143
|
window.addEventListener("blur", handleBlur);
|
|
143
144
|
return () => window.removeEventListener("blur", handleBlur);
|
|
144
145
|
}, [open, handleOpenChange]);
|
|
@@ -163,40 +164,37 @@ var Menu = (props) => {
|
|
|
163
164
|
)
|
|
164
165
|
}
|
|
165
166
|
) });
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
var MenuAnchor = React.forwardRef(
|
|
170
|
-
(props, forwardedRef) => {
|
|
167
|
+
}, "Menu");
|
|
168
|
+
var MenuAnchor = /* @__PURE__ */ React.forwardRef(
|
|
169
|
+
/* @__PURE__ */ __name(function MenuAnchor2(props, forwardedRef) {
|
|
171
170
|
const { __scopeMenu, ...anchorProps } = props;
|
|
172
171
|
const popperScope = usePopperScope(__scopeMenu);
|
|
173
172
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
174
|
-
}
|
|
173
|
+
}, "MenuAnchor")
|
|
175
174
|
);
|
|
176
|
-
MenuAnchor.displayName = ANCHOR_NAME;
|
|
177
175
|
var PORTAL_NAME = "MenuPortal";
|
|
178
176
|
var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {
|
|
179
177
|
forceMount: void 0
|
|
180
178
|
});
|
|
181
|
-
var MenuPortal = (props) => {
|
|
179
|
+
var MenuPortal = /* @__PURE__ */ __name((props) => {
|
|
182
180
|
const { __scopeMenu, forceMount, children, container } = props;
|
|
183
181
|
const context = useMenuContext(PORTAL_NAME, __scopeMenu);
|
|
184
182
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { asChild: true, container, children }) }) });
|
|
185
|
-
};
|
|
186
|
-
MenuPortal.displayName = PORTAL_NAME;
|
|
183
|
+
}, "MenuPortal");
|
|
187
184
|
var CONTENT_NAME = "MenuContent";
|
|
188
185
|
var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME);
|
|
189
|
-
var MenuContent = React.forwardRef(
|
|
190
|
-
(props, forwardedRef)
|
|
186
|
+
var MenuContent = /* @__PURE__ */ React.forwardRef(
|
|
187
|
+
/* @__PURE__ */ __name(function MenuContent2(props, forwardedRef) {
|
|
191
188
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);
|
|
192
189
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
193
190
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
194
191
|
const rootContext = useMenuRootContext(CONTENT_NAME, props.__scopeMenu);
|
|
195
192
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_presence.Presence, { present: forceMount || context.open, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
196
|
-
}
|
|
193
|
+
}, "MenuContent")
|
|
197
194
|
);
|
|
198
|
-
var MenuRootContentModal = React.forwardRef(
|
|
199
|
-
|
|
195
|
+
var MenuRootContentModal = /* @__PURE__ */ React.forwardRef(
|
|
196
|
+
// blank line to reduce diff noise
|
|
197
|
+
/* @__PURE__ */ __name(function MenuRootContentModal2(props, forwardedRef) {
|
|
200
198
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
201
199
|
const ref = React.useRef(null);
|
|
202
200
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
@@ -220,9 +218,9 @@ var MenuRootContentModal = React.forwardRef(
|
|
|
220
218
|
onDismiss: () => context.onOpenChange(false)
|
|
221
219
|
}
|
|
222
220
|
);
|
|
223
|
-
}
|
|
221
|
+
}, "MenuRootContentModal")
|
|
224
222
|
);
|
|
225
|
-
var MenuRootContentNonModal = React.forwardRef((props, forwardedRef)
|
|
223
|
+
var MenuRootContentNonModal = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __name(function MenuRootContentNonModal2(props, forwardedRef) {
|
|
226
224
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
227
225
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
226
|
MenuContentImpl,
|
|
@@ -235,10 +233,11 @@ var MenuRootContentNonModal = React.forwardRef((props, forwardedRef) => {
|
|
|
235
233
|
onDismiss: () => context.onOpenChange(false)
|
|
236
234
|
}
|
|
237
235
|
);
|
|
238
|
-
});
|
|
236
|
+
}, "MenuRootContentNonModal"));
|
|
239
237
|
var Slot = (0, import_react_slot.createSlot)("MenuContent.ScrollLock");
|
|
240
|
-
var MenuContentImpl = React.forwardRef(
|
|
241
|
-
|
|
238
|
+
var MenuContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
239
|
+
// blank line to reduce diff noise
|
|
240
|
+
/* @__PURE__ */ __name(function MenuContentImpl2(props, forwardedRef) {
|
|
242
241
|
const {
|
|
243
242
|
__scopeMenu,
|
|
244
243
|
loop = false,
|
|
@@ -271,7 +270,7 @@ var MenuContentImpl = React.forwardRef(
|
|
|
271
270
|
const lastPointerXRef = React.useRef(0);
|
|
272
271
|
const ScrollLockWrapper = disableOutsideScroll ? import_react_remove_scroll.RemoveScroll : React.Fragment;
|
|
273
272
|
const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;
|
|
274
|
-
const handleTypeaheadSearch = (key) => {
|
|
273
|
+
const handleTypeaheadSearch = /* @__PURE__ */ __name((key) => {
|
|
275
274
|
const search = searchRef.current + key;
|
|
276
275
|
const items = getItems().filter((item) => !item.disabled);
|
|
277
276
|
const currentItem = document.activeElement;
|
|
@@ -279,15 +278,15 @@ var MenuContentImpl = React.forwardRef(
|
|
|
279
278
|
const values = items.map((item) => item.textValue);
|
|
280
279
|
const nextMatch = getNextMatch(values, search, currentMatch);
|
|
281
280
|
const newItem = items.find((item) => item.textValue === nextMatch)?.ref.current;
|
|
282
|
-
(function updateSearch(value) {
|
|
281
|
+
(/* @__PURE__ */ __name((function updateSearch(value) {
|
|
283
282
|
searchRef.current = value;
|
|
284
283
|
window.clearTimeout(timerRef.current);
|
|
285
284
|
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
286
|
-
})(search);
|
|
285
|
+
}), "updateSearch"))(search);
|
|
287
286
|
if (newItem) {
|
|
288
287
|
setTimeout(() => newItem.focus());
|
|
289
288
|
}
|
|
290
|
-
};
|
|
289
|
+
}, "handleTypeaheadSearch");
|
|
291
290
|
React.useEffect(() => {
|
|
292
291
|
return () => window.clearTimeout(timerRef.current);
|
|
293
292
|
}, []);
|
|
@@ -417,36 +416,32 @@ var MenuContentImpl = React.forwardRef(
|
|
|
417
416
|
) })
|
|
418
417
|
}
|
|
419
418
|
);
|
|
420
|
-
}
|
|
419
|
+
}, "MenuContentImpl")
|
|
421
420
|
);
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
var MenuGroup = React.forwardRef(
|
|
425
|
-
(props, forwardedRef) => {
|
|
421
|
+
var MenuGroup = /* @__PURE__ */ React.forwardRef(
|
|
422
|
+
/* @__PURE__ */ __name(function MenuGroup2(props, forwardedRef) {
|
|
426
423
|
const { __scopeMenu, ...groupProps } = props;
|
|
427
424
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
428
|
-
}
|
|
425
|
+
}, "MenuGroup")
|
|
429
426
|
);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
var MenuLabel = React.forwardRef(
|
|
433
|
-
(props, forwardedRef) => {
|
|
427
|
+
var MenuLabel = /* @__PURE__ */ React.forwardRef(
|
|
428
|
+
/* @__PURE__ */ __name(function MenuLabel2(props, forwardedRef) {
|
|
434
429
|
const { __scopeMenu, ...labelProps } = props;
|
|
435
430
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
436
|
-
}
|
|
431
|
+
}, "MenuLabel")
|
|
437
432
|
);
|
|
438
|
-
MenuLabel.displayName = LABEL_NAME;
|
|
439
433
|
var ITEM_NAME = "MenuItem";
|
|
440
434
|
var ITEM_SELECT = "menu.itemSelect";
|
|
441
|
-
var MenuItem = React.forwardRef(
|
|
442
|
-
|
|
435
|
+
var MenuItem = /* @__PURE__ */ React.forwardRef(
|
|
436
|
+
// blank line to reduce diff noise
|
|
437
|
+
/* @__PURE__ */ __name(function MenuItem2(props, forwardedRef) {
|
|
443
438
|
const { disabled = false, onSelect, ...itemProps } = props;
|
|
444
439
|
const ref = React.useRef(null);
|
|
445
440
|
const rootContext = useMenuRootContext(ITEM_NAME, props.__scopeMenu);
|
|
446
441
|
const contentContext = useMenuContentContext(ITEM_NAME, props.__scopeMenu);
|
|
447
442
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref);
|
|
448
443
|
const isPointerDownRef = React.useRef(false);
|
|
449
|
-
const handleSelect = () => {
|
|
444
|
+
const handleSelect = /* @__PURE__ */ __name(() => {
|
|
450
445
|
const menuItem = ref.current;
|
|
451
446
|
if (!disabled && menuItem) {
|
|
452
447
|
const itemSelectEvent = new CustomEvent(ITEM_SELECT, { bubbles: true, cancelable: true });
|
|
@@ -458,7 +453,7 @@ var MenuItem = React.forwardRef(
|
|
|
458
453
|
rootContext.onClose();
|
|
459
454
|
}
|
|
460
455
|
}
|
|
461
|
-
};
|
|
456
|
+
}, "handleSelect");
|
|
462
457
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
463
458
|
MenuItemImpl,
|
|
464
459
|
{
|
|
@@ -488,11 +483,10 @@ var MenuItem = React.forwardRef(
|
|
|
488
483
|
})
|
|
489
484
|
}
|
|
490
485
|
);
|
|
491
|
-
}
|
|
486
|
+
}, "MenuItem")
|
|
492
487
|
);
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
(props, forwardedRef) => {
|
|
488
|
+
var MenuItemImpl = /* @__PURE__ */ React.forwardRef(
|
|
489
|
+
/* @__PURE__ */ __name(function MenuItemImpl2(props, forwardedRef) {
|
|
496
490
|
const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
|
|
497
491
|
const contentContext = useMenuContentContext(ITEM_NAME, __scopeMenu);
|
|
498
492
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
@@ -545,11 +539,11 @@ var MenuItemImpl = React.forwardRef(
|
|
|
545
539
|
) })
|
|
546
540
|
}
|
|
547
541
|
);
|
|
548
|
-
}
|
|
542
|
+
}, "MenuItemImpl")
|
|
549
543
|
);
|
|
550
|
-
var
|
|
551
|
-
|
|
552
|
-
(props, forwardedRef)
|
|
544
|
+
var MenuCheckboxItem = /* @__PURE__ */ React.forwardRef(
|
|
545
|
+
// blank line to reduce diff noise
|
|
546
|
+
/* @__PURE__ */ __name(function MenuCheckboxItem2(props, forwardedRef) {
|
|
553
547
|
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
554
548
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
555
549
|
MenuItem,
|
|
@@ -566,26 +560,24 @@ var MenuCheckboxItem = React.forwardRef(
|
|
|
566
560
|
)
|
|
567
561
|
}
|
|
568
562
|
) });
|
|
569
|
-
}
|
|
563
|
+
}, "MenuCheckboxItem")
|
|
570
564
|
);
|
|
571
|
-
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
572
565
|
var RADIO_GROUP_NAME = "MenuRadioGroup";
|
|
573
566
|
var [RadioGroupProvider, useRadioGroupContext] = createMenuContext(
|
|
574
567
|
RADIO_GROUP_NAME,
|
|
575
|
-
{ value: void 0, onValueChange: () => {
|
|
576
|
-
} }
|
|
568
|
+
{ value: void 0, onValueChange: /* @__PURE__ */ __name(() => {
|
|
569
|
+
}, "onValueChange") }
|
|
577
570
|
);
|
|
578
|
-
var MenuRadioGroup = React.forwardRef(
|
|
579
|
-
(props, forwardedRef)
|
|
571
|
+
var MenuRadioGroup = /* @__PURE__ */ React.forwardRef(
|
|
572
|
+
/* @__PURE__ */ __name(function MenuRadioGroup2(props, forwardedRef) {
|
|
580
573
|
const { value, onValueChange, ...groupProps } = props;
|
|
581
574
|
const handleValueChange = (0, import_react_use_callback_ref.useCallbackRef)(onValueChange);
|
|
582
575
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
583
|
-
}
|
|
576
|
+
}, "MenuRadioGroup")
|
|
584
577
|
);
|
|
585
|
-
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
586
578
|
var RADIO_ITEM_NAME = "MenuRadioItem";
|
|
587
|
-
var MenuRadioItem = React.forwardRef(
|
|
588
|
-
(props, forwardedRef)
|
|
579
|
+
var MenuRadioItem = /* @__PURE__ */ React.forwardRef(
|
|
580
|
+
/* @__PURE__ */ __name(function MenuRadioItem2(props, forwardedRef) {
|
|
589
581
|
const { value, ...radioItemProps } = props;
|
|
590
582
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
591
583
|
const checked = value === context.value;
|
|
@@ -604,16 +596,16 @@ var MenuRadioItem = React.forwardRef(
|
|
|
604
596
|
)
|
|
605
597
|
}
|
|
606
598
|
) });
|
|
607
|
-
}
|
|
599
|
+
}, "MenuRadioItem")
|
|
608
600
|
);
|
|
609
|
-
MenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
610
601
|
var ITEM_INDICATOR_NAME = "MenuItemIndicator";
|
|
611
602
|
var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
|
|
612
603
|
ITEM_INDICATOR_NAME,
|
|
613
604
|
{ checked: false }
|
|
614
605
|
);
|
|
615
|
-
var MenuItemIndicator = React.forwardRef(
|
|
616
|
-
|
|
606
|
+
var MenuItemIndicator = /* @__PURE__ */ React.forwardRef(
|
|
607
|
+
// blank line to reduce diff noise
|
|
608
|
+
/* @__PURE__ */ __name(function MenuItemIndicator2(props, forwardedRef) {
|
|
617
609
|
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
618
610
|
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
619
611
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -630,12 +622,10 @@ var MenuItemIndicator = React.forwardRef(
|
|
|
630
622
|
)
|
|
631
623
|
}
|
|
632
624
|
);
|
|
633
|
-
}
|
|
625
|
+
}, "MenuItemIndicator")
|
|
634
626
|
);
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
var MenuSeparator = React.forwardRef(
|
|
638
|
-
(props, forwardedRef) => {
|
|
627
|
+
var MenuSeparator = /* @__PURE__ */ React.forwardRef(
|
|
628
|
+
/* @__PURE__ */ __name(function MenuSeparator2(props, forwardedRef) {
|
|
639
629
|
const { __scopeMenu, ...separatorProps } = props;
|
|
640
630
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
641
631
|
import_react_primitive.Primitive.div,
|
|
@@ -646,21 +636,18 @@ var MenuSeparator = React.forwardRef(
|
|
|
646
636
|
ref: forwardedRef
|
|
647
637
|
}
|
|
648
638
|
);
|
|
649
|
-
}
|
|
639
|
+
}, "MenuSeparator")
|
|
650
640
|
);
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
var MenuArrow = React.forwardRef(
|
|
654
|
-
(props, forwardedRef) => {
|
|
641
|
+
var MenuArrow = /* @__PURE__ */ React.forwardRef(
|
|
642
|
+
/* @__PURE__ */ __name(function MenuArrow2(props, forwardedRef) {
|
|
655
643
|
const { __scopeMenu, ...arrowProps } = props;
|
|
656
644
|
const popperScope = usePopperScope(__scopeMenu);
|
|
657
645
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
658
|
-
}
|
|
646
|
+
}, "MenuArrow")
|
|
659
647
|
);
|
|
660
|
-
MenuArrow.displayName = ARROW_NAME;
|
|
661
648
|
var SUB_NAME = "MenuSub";
|
|
662
649
|
var [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME);
|
|
663
|
-
var MenuSub = (props) => {
|
|
650
|
+
var MenuSub = /* @__PURE__ */ __name((props) => {
|
|
664
651
|
const { __scopeMenu, children, open = false, onOpenChange } = props;
|
|
665
652
|
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
666
653
|
const popperScope = usePopperScope(__scopeMenu);
|
|
@@ -692,11 +679,10 @@ var MenuSub = (props) => {
|
|
|
692
679
|
)
|
|
693
680
|
}
|
|
694
681
|
) });
|
|
695
|
-
};
|
|
696
|
-
MenuSub.displayName = SUB_NAME;
|
|
682
|
+
}, "MenuSub");
|
|
697
683
|
var SUB_TRIGGER_NAME = "MenuSubTrigger";
|
|
698
|
-
var MenuSubTrigger = React.forwardRef(
|
|
699
|
-
(props, forwardedRef)
|
|
684
|
+
var MenuSubTrigger = /* @__PURE__ */ React.forwardRef(
|
|
685
|
+
/* @__PURE__ */ __name(function MenuSubTrigger2(props, forwardedRef) {
|
|
700
686
|
const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
701
687
|
const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
702
688
|
const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
@@ -798,12 +784,11 @@ var MenuSubTrigger = React.forwardRef(
|
|
|
798
784
|
})
|
|
799
785
|
}
|
|
800
786
|
) });
|
|
801
|
-
}
|
|
787
|
+
}, "MenuSubTrigger")
|
|
802
788
|
);
|
|
803
|
-
MenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
804
789
|
var SUB_CONTENT_NAME = "MenuSubContent";
|
|
805
|
-
var MenuSubContent = React.forwardRef(
|
|
806
|
-
(props, forwardedRef)
|
|
790
|
+
var MenuSubContent = /* @__PURE__ */ React.forwardRef(
|
|
791
|
+
/* @__PURE__ */ __name(function MenuSubContent2(props, forwardedRef) {
|
|
807
792
|
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeMenu);
|
|
808
793
|
const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
|
|
809
794
|
const context = useMenuContext(CONTENT_NAME, props.__scopeMenu);
|
|
@@ -846,18 +831,20 @@ var MenuSubContent = React.forwardRef(
|
|
|
846
831
|
})
|
|
847
832
|
}
|
|
848
833
|
) }) }) });
|
|
849
|
-
}
|
|
834
|
+
}, "MenuSubContent")
|
|
850
835
|
);
|
|
851
|
-
MenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
852
836
|
function getOpenState(open) {
|
|
853
837
|
return open ? "open" : "closed";
|
|
854
838
|
}
|
|
839
|
+
__name(getOpenState, "getOpenState");
|
|
855
840
|
function isIndeterminate(checked) {
|
|
856
841
|
return checked === "indeterminate";
|
|
857
842
|
}
|
|
843
|
+
__name(isIndeterminate, "isIndeterminate");
|
|
858
844
|
function getCheckedState(checked) {
|
|
859
845
|
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
860
846
|
}
|
|
847
|
+
__name(getCheckedState, "getCheckedState");
|
|
861
848
|
function focusFirst(candidates) {
|
|
862
849
|
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
863
850
|
for (const candidate of candidates) {
|
|
@@ -866,9 +853,11 @@ function focusFirst(candidates) {
|
|
|
866
853
|
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
867
854
|
}
|
|
868
855
|
}
|
|
856
|
+
__name(focusFirst, "focusFirst");
|
|
869
857
|
function wrapArray(array, startIndex) {
|
|
870
858
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
871
859
|
}
|
|
860
|
+
__name(wrapArray, "wrapArray");
|
|
872
861
|
function getNextMatch(values, search, currentMatch) {
|
|
873
862
|
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
874
863
|
const normalizedSearch = isRepeated ? search[0] : search;
|
|
@@ -881,6 +870,7 @@ function getNextMatch(values, search, currentMatch) {
|
|
|
881
870
|
);
|
|
882
871
|
return nextMatch !== currentMatch ? nextMatch : void 0;
|
|
883
872
|
}
|
|
873
|
+
__name(getNextMatch, "getNextMatch");
|
|
884
874
|
function isPointInPolygon(point, polygon) {
|
|
885
875
|
const { x, y } = point;
|
|
886
876
|
let inside = false;
|
|
@@ -896,14 +886,17 @@ function isPointInPolygon(point, polygon) {
|
|
|
896
886
|
}
|
|
897
887
|
return inside;
|
|
898
888
|
}
|
|
889
|
+
__name(isPointInPolygon, "isPointInPolygon");
|
|
899
890
|
function isPointerInGraceArea(event, area) {
|
|
900
891
|
if (!area) return false;
|
|
901
892
|
const cursorPos = { x: event.clientX, y: event.clientY };
|
|
902
893
|
return isPointInPolygon(cursorPos, area);
|
|
903
894
|
}
|
|
895
|
+
__name(isPointerInGraceArea, "isPointerInGraceArea");
|
|
904
896
|
function whenMouse(handler) {
|
|
905
897
|
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
906
898
|
}
|
|
899
|
+
__name(whenMouse, "whenMouse");
|
|
907
900
|
var Root3 = Menu;
|
|
908
901
|
var Anchor2 = MenuAnchor;
|
|
909
902
|
var Portal = MenuPortal;
|