@radix-ui/react-menu 2.1.23-rc.1784938226983 → 2.1.24
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.d.mts +20 -8
- package/dist/index.d.ts +20 -8
- package/dist/index.js +36 -44
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +37 -50
- package/dist/index.mjs.map +3 -3
- package/package.json +22 -22
package/dist/index.d.mts
CHANGED
|
@@ -3,15 +3,11 @@ import * as React from 'react';
|
|
|
3
3
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
4
4
|
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
5
5
|
import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
6
|
-
import { Portal } from '@radix-ui/react-portal';
|
|
6
|
+
import { Portal as Portal$1 } from '@radix-ui/react-portal';
|
|
7
7
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
8
8
|
import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
readonly LTR: "ltr";
|
|
12
|
-
readonly RTL: "rtl";
|
|
13
|
-
};
|
|
14
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
10
|
+
type Direction = 'ltr' | 'rtl';
|
|
15
11
|
declare const createMenuScope: _radix_ui_react_context.CreateScope;
|
|
16
12
|
interface MenuProps {
|
|
17
13
|
children?: React.ReactNode;
|
|
@@ -25,7 +21,7 @@ type PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.A
|
|
|
25
21
|
interface MenuAnchorProps extends PopperAnchorProps {
|
|
26
22
|
}
|
|
27
23
|
declare const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
type PortalProps = React.ComponentPropsWithoutRef<typeof Portal>;
|
|
24
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof Portal$1>;
|
|
29
25
|
interface MenuPortalProps {
|
|
30
26
|
children?: React.ReactNode;
|
|
31
27
|
/**
|
|
@@ -159,5 +155,21 @@ interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuConte
|
|
|
159
155
|
align?: AlignSubContent;
|
|
160
156
|
}
|
|
161
157
|
declare const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
158
|
+
declare const Root: React.FC<MenuProps>;
|
|
159
|
+
declare const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
declare const Portal: React.FC<MenuPortalProps>;
|
|
161
|
+
declare const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
162
|
+
declare const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
163
|
+
declare const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
164
|
+
declare const Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
165
|
+
declare const CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
166
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
167
|
+
declare const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
168
|
+
declare const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
169
|
+
declare const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
170
|
+
declare const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
171
|
+
declare const Sub: React.FC<MenuSubProps>;
|
|
172
|
+
declare const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
173
|
+
declare const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
162
174
|
|
|
163
|
-
export {
|
|
175
|
+
export { Anchor, Arrow, CheckboxItem, Content, Group, Item, ItemIndicator, Label, Menu, MenuAnchor, type MenuAnchorProps, MenuArrow, type MenuArrowProps, MenuCheckboxItem, type MenuCheckboxItemProps, MenuContent, type MenuContentProps, MenuGroup, type MenuGroupProps, MenuItem, MenuItemIndicator, type MenuItemIndicatorProps, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuPortal, type MenuPortalProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MenuSub, MenuSubContent, type MenuSubContentProps, type MenuSubProps, MenuSubTrigger, type MenuSubTriggerProps, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, createMenuScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,11 @@ import * as React from 'react';
|
|
|
3
3
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
4
4
|
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
5
5
|
import * as PopperPrimitive from '@radix-ui/react-popper';
|
|
6
|
-
import { Portal } from '@radix-ui/react-portal';
|
|
6
|
+
import { Portal as Portal$1 } from '@radix-ui/react-portal';
|
|
7
7
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
8
8
|
import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
readonly LTR: "ltr";
|
|
12
|
-
readonly RTL: "rtl";
|
|
13
|
-
};
|
|
14
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
10
|
+
type Direction = 'ltr' | 'rtl';
|
|
15
11
|
declare const createMenuScope: _radix_ui_react_context.CreateScope;
|
|
16
12
|
interface MenuProps {
|
|
17
13
|
children?: React.ReactNode;
|
|
@@ -25,7 +21,7 @@ type PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.A
|
|
|
25
21
|
interface MenuAnchorProps extends PopperAnchorProps {
|
|
26
22
|
}
|
|
27
23
|
declare const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
-
type PortalProps = React.ComponentPropsWithoutRef<typeof Portal>;
|
|
24
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof Portal$1>;
|
|
29
25
|
interface MenuPortalProps {
|
|
30
26
|
children?: React.ReactNode;
|
|
31
27
|
/**
|
|
@@ -159,5 +155,21 @@ interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuConte
|
|
|
159
155
|
align?: AlignSubContent;
|
|
160
156
|
}
|
|
161
157
|
declare const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
158
|
+
declare const Root: React.FC<MenuProps>;
|
|
159
|
+
declare const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
declare const Portal: React.FC<MenuPortalProps>;
|
|
161
|
+
declare const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
162
|
+
declare const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
163
|
+
declare const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
164
|
+
declare const Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
165
|
+
declare const CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
166
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
167
|
+
declare const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
168
|
+
declare const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
169
|
+
declare const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
170
|
+
declare const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
171
|
+
declare const Sub: React.FC<MenuSubProps>;
|
|
172
|
+
declare const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
173
|
+
declare const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
162
174
|
|
|
163
|
-
export {
|
|
175
|
+
export { Anchor, Arrow, CheckboxItem, Content, Group, Item, ItemIndicator, Label, Menu, MenuAnchor, type MenuAnchorProps, MenuArrow, type MenuArrowProps, MenuCheckboxItem, type MenuCheckboxItemProps, MenuContent, type MenuContentProps, MenuGroup, type MenuGroupProps, MenuItem, MenuItemIndicator, type MenuItemIndicatorProps, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuPortal, type MenuPortalProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MenuSub, MenuSubContent, type MenuSubContentProps, type MenuSubProps, MenuSubTrigger, type MenuSubTriggerProps, Portal, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, createMenuScope };
|
package/dist/index.js
CHANGED
|
@@ -32,14 +32,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
var index_exports = {};
|
|
34
34
|
__export(index_exports, {
|
|
35
|
-
Anchor: () =>
|
|
36
|
-
Arrow: () =>
|
|
37
|
-
CheckboxItem: () =>
|
|
38
|
-
Content: () =>
|
|
39
|
-
Group: () =>
|
|
40
|
-
Item: () =>
|
|
41
|
-
ItemIndicator: () =>
|
|
42
|
-
Label: () =>
|
|
35
|
+
Anchor: () => Anchor2,
|
|
36
|
+
Arrow: () => Arrow2,
|
|
37
|
+
CheckboxItem: () => CheckboxItem,
|
|
38
|
+
Content: () => Content2,
|
|
39
|
+
Group: () => Group,
|
|
40
|
+
Item: () => Item2,
|
|
41
|
+
ItemIndicator: () => ItemIndicator,
|
|
42
|
+
Label: () => Label,
|
|
43
43
|
Menu: () => Menu,
|
|
44
44
|
MenuAnchor: () => MenuAnchor,
|
|
45
45
|
MenuArrow: () => MenuArrow,
|
|
@@ -56,14 +56,14 @@ __export(index_exports, {
|
|
|
56
56
|
MenuSub: () => MenuSub,
|
|
57
57
|
MenuSubContent: () => MenuSubContent,
|
|
58
58
|
MenuSubTrigger: () => MenuSubTrigger,
|
|
59
|
-
Portal: () =>
|
|
60
|
-
RadioGroup: () =>
|
|
61
|
-
RadioItem: () =>
|
|
62
|
-
Root: () =>
|
|
63
|
-
Separator: () =>
|
|
64
|
-
Sub: () =>
|
|
65
|
-
SubContent: () =>
|
|
66
|
-
SubTrigger: () =>
|
|
59
|
+
Portal: () => Portal,
|
|
60
|
+
RadioGroup: () => RadioGroup,
|
|
61
|
+
RadioItem: () => RadioItem,
|
|
62
|
+
Root: () => Root3,
|
|
63
|
+
Separator: () => Separator,
|
|
64
|
+
Sub: () => Sub,
|
|
65
|
+
SubContent: () => SubContent,
|
|
66
|
+
SubTrigger: () => SubTrigger,
|
|
67
67
|
createMenuScope: () => createMenuScope
|
|
68
68
|
});
|
|
69
69
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -91,10 +91,6 @@ var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
|
91
91
|
var import_aria_hidden = require("aria-hidden");
|
|
92
92
|
var import_react_remove_scroll = require("react-remove-scroll");
|
|
93
93
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
94
|
-
var Direction = {
|
|
95
|
-
LTR: "ltr",
|
|
96
|
-
RTL: "rtl"
|
|
97
|
-
};
|
|
98
94
|
var SELECTION_KEYS = ["Enter", " "];
|
|
99
95
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
100
96
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -256,7 +252,6 @@ var MenuContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
256
252
|
onInteractOutside,
|
|
257
253
|
onDismiss,
|
|
258
254
|
disableOutsideScroll,
|
|
259
|
-
children,
|
|
260
255
|
...contentProps
|
|
261
256
|
} = props;
|
|
262
257
|
const context = useMenuContext(CONTENT_NAME, __scopeMenu);
|
|
@@ -266,32 +261,15 @@ var MenuContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
266
261
|
const getItems = useCollection(__scopeMenu);
|
|
267
262
|
const [currentItemId, setCurrentItemId] = React.useState(null);
|
|
268
263
|
const contentRef = React.useRef(null);
|
|
269
|
-
const
|
|
270
|
-
(0, import_react_focus_scope.useFocusScopeBranch)(branchNode);
|
|
271
|
-
const { nodes: branchNodes, registry: branchRegistry } = (0, import_react_focus_scope.useFocusScopeBranchRegistry)();
|
|
272
|
-
const isModal = Boolean(trapFocus || disableOutsideScroll);
|
|
273
|
-
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(
|
|
274
|
-
forwardedRef,
|
|
275
|
-
contentRef,
|
|
276
|
-
context.onContentChange,
|
|
277
|
-
setBranchNode
|
|
278
|
-
);
|
|
264
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef, context.onContentChange);
|
|
279
265
|
const timerRef = React.useRef(0);
|
|
280
266
|
const searchRef = React.useRef("");
|
|
281
267
|
const pointerGraceTimerRef = React.useRef(0);
|
|
282
268
|
const pointerGraceIntentRef = React.useRef(null);
|
|
283
269
|
const pointerDirRef = React.useRef("right");
|
|
284
270
|
const lastPointerXRef = React.useRef(0);
|
|
285
|
-
const shards = React.useMemo(
|
|
286
|
-
() => disableOutsideScroll ? [contentRef, ...branchNodes.map((node) => ({ current: node }))] : [],
|
|
287
|
-
[contentRef, branchNodes, disableOutsideScroll]
|
|
288
|
-
);
|
|
289
271
|
const ScrollLockWrapper = disableOutsideScroll ? import_react_remove_scroll.RemoveScroll : React.Fragment;
|
|
290
|
-
const scrollLockWrapperProps = disableOutsideScroll ? {
|
|
291
|
-
as: Slot,
|
|
292
|
-
allowPinchZoom: true,
|
|
293
|
-
shards
|
|
294
|
-
} : void 0;
|
|
272
|
+
const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;
|
|
295
273
|
const handleTypeaheadSearch = /* @__PURE__ */ __name((key) => {
|
|
296
274
|
const search = searchRef.current + key;
|
|
297
275
|
const items = getItems().filter((item) => !item.disabled);
|
|
@@ -351,7 +329,6 @@ var MenuContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
351
329
|
{
|
|
352
330
|
asChild: true,
|
|
353
331
|
trapped: trapFocus,
|
|
354
|
-
branches: branchNodes,
|
|
355
332
|
onMountAutoFocus: (0, import_primitive.composeEventHandlers)(onOpenAutoFocus, (event) => {
|
|
356
333
|
event.preventDefault();
|
|
357
334
|
contentRef.current?.focus({ preventScroll: true });
|
|
@@ -428,8 +405,7 @@ var MenuContentImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
428
405
|
lastPointerXRef.current = event.clientX;
|
|
429
406
|
}
|
|
430
407
|
})
|
|
431
|
-
)
|
|
432
|
-
children: isModal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_focus_scope.FocusScopeBranchProvider, { value: branchRegistry, children }) : children
|
|
408
|
+
)
|
|
433
409
|
}
|
|
434
410
|
)
|
|
435
411
|
}
|
|
@@ -828,7 +804,7 @@ var MenuSubContent = /* @__PURE__ */ React.forwardRef(
|
|
|
828
804
|
...subContentProps,
|
|
829
805
|
ref: composedRefs,
|
|
830
806
|
align,
|
|
831
|
-
side: rootContext.dir ===
|
|
807
|
+
side: rootContext.dir === "rtl" ? "left" : "right",
|
|
832
808
|
disableOutsidePointerEvents: false,
|
|
833
809
|
disableOutsideScroll: false,
|
|
834
810
|
trapFocus: false,
|
|
@@ -921,4 +897,20 @@ function whenMouse(handler) {
|
|
|
921
897
|
return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
|
|
922
898
|
}
|
|
923
899
|
__name(whenMouse, "whenMouse");
|
|
900
|
+
var Root3 = Menu;
|
|
901
|
+
var Anchor2 = MenuAnchor;
|
|
902
|
+
var Portal = MenuPortal;
|
|
903
|
+
var Content2 = MenuContent;
|
|
904
|
+
var Group = MenuGroup;
|
|
905
|
+
var Label = MenuLabel;
|
|
906
|
+
var Item2 = MenuItem;
|
|
907
|
+
var CheckboxItem = MenuCheckboxItem;
|
|
908
|
+
var RadioGroup = MenuRadioGroup;
|
|
909
|
+
var RadioItem = MenuRadioItem;
|
|
910
|
+
var ItemIndicator = MenuItemIndicator;
|
|
911
|
+
var Separator = MenuSeparator;
|
|
912
|
+
var Arrow2 = MenuArrow;
|
|
913
|
+
var Sub = MenuSub;
|
|
914
|
+
var SubTrigger = MenuSubTrigger;
|
|
915
|
+
var SubContent = MenuSubContent;
|
|
924
916
|
//# sourceMappingURL=index.js.map
|