@radix-ui/react-menu 0.0.0-20250116175529

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/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # `react-menu`
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ $ yarn add @radix-ui/react-menu
7
+ # or
8
+ $ npm install @radix-ui/react-menu
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ This is an internal utility, not intended for public usage.
@@ -0,0 +1,169 @@
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
4
+ import { FocusScope } from '@radix-ui/react-focus-scope';
5
+ import * as PopperPrimitive from '@radix-ui/react-popper';
6
+ import { Portal as Portal$1 } from '@radix-ui/react-portal';
7
+ import { Primitive } from '@radix-ui/react-primitive';
8
+ import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
9
+
10
+ type Direction = 'ltr' | 'rtl';
11
+ declare const createMenuScope: _radix_ui_react_context.CreateScope;
12
+ interface MenuProps {
13
+ children?: React.ReactNode;
14
+ open?: boolean;
15
+ onOpenChange?(open: boolean): void;
16
+ dir?: Direction;
17
+ modal?: boolean;
18
+ }
19
+ declare const Menu: React.FC<MenuProps>;
20
+ type PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
21
+ interface MenuAnchorProps extends PopperAnchorProps {
22
+ }
23
+ declare const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
24
+ type PortalProps = React.ComponentPropsWithoutRef<typeof Portal$1>;
25
+ interface MenuPortalProps {
26
+ children?: React.ReactNode;
27
+ /**
28
+ * Specify a container element to portal the content into.
29
+ */
30
+ container?: PortalProps['container'];
31
+ /**
32
+ * Used to force mounting when more control is needed. Useful when
33
+ * controlling animation with React animation libraries.
34
+ */
35
+ forceMount?: true;
36
+ }
37
+ declare const MenuPortal: React.FC<MenuPortalProps>;
38
+ /**
39
+ * We purposefully don't union MenuRootContent and MenuSubContent props here because
40
+ * they have conflicting prop types. We agreed that we would allow MenuSubContent to
41
+ * accept props that it would just ignore.
42
+ */
43
+ interface MenuContentProps extends MenuRootContentTypeProps {
44
+ /**
45
+ * Used to force mounting when more control is needed. Useful when
46
+ * controlling animation with React animation libraries.
47
+ */
48
+ forceMount?: true;
49
+ }
50
+ declare const MenuContent: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
51
+ interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps> {
52
+ }
53
+ type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
54
+ type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
55
+ type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
56
+ type PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
57
+ type MenuContentImplPrivateProps = {
58
+ onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
59
+ onDismiss?: DismissableLayerProps['onDismiss'];
60
+ disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
61
+ /**
62
+ * Whether scrolling outside the `MenuContent` should be prevented
63
+ * (default: `false`)
64
+ */
65
+ disableOutsideScroll?: boolean;
66
+ /**
67
+ * Whether focus should be trapped within the `MenuContent`
68
+ * (default: false)
69
+ */
70
+ trapFocus?: FocusScopeProps['trapped'];
71
+ };
72
+ interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit<PopperContentProps, 'dir' | 'onPlaced'> {
73
+ /**
74
+ * Event handler called when auto-focusing on close.
75
+ * Can be prevented.
76
+ */
77
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
78
+ /**
79
+ * Whether keyboard navigation should loop around
80
+ * @defaultValue false
81
+ */
82
+ loop?: RovingFocusGroupProps['loop'];
83
+ onEntryFocus?: RovingFocusGroupProps['onEntryFocus'];
84
+ onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
85
+ onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
86
+ onFocusOutside?: DismissableLayerProps['onFocusOutside'];
87
+ onInteractOutside?: DismissableLayerProps['onInteractOutside'];
88
+ }
89
+ type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
90
+ interface MenuGroupProps extends PrimitiveDivProps {
91
+ }
92
+ declare const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
93
+ interface MenuLabelProps extends PrimitiveDivProps {
94
+ }
95
+ declare const MenuLabel: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
96
+ interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
97
+ onSelect?: (event: Event) => void;
98
+ }
99
+ declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
100
+ interface MenuItemImplProps extends PrimitiveDivProps {
101
+ disabled?: boolean;
102
+ textValue?: string;
103
+ }
104
+ type CheckedState = boolean | 'indeterminate';
105
+ interface MenuCheckboxItemProps extends MenuItemProps {
106
+ checked?: CheckedState;
107
+ onCheckedChange?: (checked: boolean) => void;
108
+ }
109
+ declare const MenuCheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
110
+ interface MenuRadioGroupProps extends MenuGroupProps {
111
+ value?: string;
112
+ onValueChange?: (value: string) => void;
113
+ }
114
+ declare const MenuRadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
115
+ interface MenuRadioItemProps extends MenuItemProps {
116
+ value: string;
117
+ }
118
+ declare const MenuRadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
119
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
120
+ interface MenuItemIndicatorProps extends PrimitiveSpanProps {
121
+ /**
122
+ * Used to force mounting when more control is needed. Useful when
123
+ * controlling animation with React animation libraries.
124
+ */
125
+ forceMount?: true;
126
+ }
127
+ declare const MenuItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
128
+ interface MenuSeparatorProps extends PrimitiveDivProps {
129
+ }
130
+ declare const MenuSeparator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
131
+ type PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
132
+ interface MenuArrowProps extends PopperArrowProps {
133
+ }
134
+ declare const MenuArrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
135
+ interface MenuSubProps {
136
+ children?: React.ReactNode;
137
+ open?: boolean;
138
+ onOpenChange?(open: boolean): void;
139
+ }
140
+ declare const MenuSub: React.FC<MenuSubProps>;
141
+ interface MenuSubTriggerProps extends MenuItemImplProps {
142
+ }
143
+ declare const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
144
+ interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'onEntryFocus' | 'side' | 'align'> {
145
+ /**
146
+ * Used to force mounting when more control is needed. Useful when
147
+ * controlling animation with React animation libraries.
148
+ */
149
+ forceMount?: true;
150
+ }
151
+ declare const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
152
+ declare const Root: React.FC<MenuProps>;
153
+ declare const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
154
+ declare const Portal: React.FC<MenuPortalProps>;
155
+ declare const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
156
+ declare const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
157
+ declare const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
158
+ declare const Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
159
+ declare const CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
160
+ declare const RadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
161
+ declare const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
162
+ declare const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
163
+ declare const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
164
+ declare const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
165
+ declare const Sub: React.FC<MenuSubProps>;
166
+ declare const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
167
+ declare const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
168
+
169
+ 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 };
@@ -0,0 +1,169 @@
1
+ import * as _radix_ui_react_context from '@radix-ui/react-context';
2
+ import * as React from 'react';
3
+ import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
4
+ import { FocusScope } from '@radix-ui/react-focus-scope';
5
+ import * as PopperPrimitive from '@radix-ui/react-popper';
6
+ import { Portal as Portal$1 } from '@radix-ui/react-portal';
7
+ import { Primitive } from '@radix-ui/react-primitive';
8
+ import * as RovingFocusGroup from '@radix-ui/react-roving-focus';
9
+
10
+ type Direction = 'ltr' | 'rtl';
11
+ declare const createMenuScope: _radix_ui_react_context.CreateScope;
12
+ interface MenuProps {
13
+ children?: React.ReactNode;
14
+ open?: boolean;
15
+ onOpenChange?(open: boolean): void;
16
+ dir?: Direction;
17
+ modal?: boolean;
18
+ }
19
+ declare const Menu: React.FC<MenuProps>;
20
+ type PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
21
+ interface MenuAnchorProps extends PopperAnchorProps {
22
+ }
23
+ declare const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
24
+ type PortalProps = React.ComponentPropsWithoutRef<typeof Portal$1>;
25
+ interface MenuPortalProps {
26
+ children?: React.ReactNode;
27
+ /**
28
+ * Specify a container element to portal the content into.
29
+ */
30
+ container?: PortalProps['container'];
31
+ /**
32
+ * Used to force mounting when more control is needed. Useful when
33
+ * controlling animation with React animation libraries.
34
+ */
35
+ forceMount?: true;
36
+ }
37
+ declare const MenuPortal: React.FC<MenuPortalProps>;
38
+ /**
39
+ * We purposefully don't union MenuRootContent and MenuSubContent props here because
40
+ * they have conflicting prop types. We agreed that we would allow MenuSubContent to
41
+ * accept props that it would just ignore.
42
+ */
43
+ interface MenuContentProps extends MenuRootContentTypeProps {
44
+ /**
45
+ * Used to force mounting when more control is needed. Useful when
46
+ * controlling animation with React animation libraries.
47
+ */
48
+ forceMount?: true;
49
+ }
50
+ declare const MenuContent: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
51
+ interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps> {
52
+ }
53
+ type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
54
+ type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
55
+ type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
56
+ type PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
57
+ type MenuContentImplPrivateProps = {
58
+ onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
59
+ onDismiss?: DismissableLayerProps['onDismiss'];
60
+ disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
61
+ /**
62
+ * Whether scrolling outside the `MenuContent` should be prevented
63
+ * (default: `false`)
64
+ */
65
+ disableOutsideScroll?: boolean;
66
+ /**
67
+ * Whether focus should be trapped within the `MenuContent`
68
+ * (default: false)
69
+ */
70
+ trapFocus?: FocusScopeProps['trapped'];
71
+ };
72
+ interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit<PopperContentProps, 'dir' | 'onPlaced'> {
73
+ /**
74
+ * Event handler called when auto-focusing on close.
75
+ * Can be prevented.
76
+ */
77
+ onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
78
+ /**
79
+ * Whether keyboard navigation should loop around
80
+ * @defaultValue false
81
+ */
82
+ loop?: RovingFocusGroupProps['loop'];
83
+ onEntryFocus?: RovingFocusGroupProps['onEntryFocus'];
84
+ onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
85
+ onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
86
+ onFocusOutside?: DismissableLayerProps['onFocusOutside'];
87
+ onInteractOutside?: DismissableLayerProps['onInteractOutside'];
88
+ }
89
+ type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
90
+ interface MenuGroupProps extends PrimitiveDivProps {
91
+ }
92
+ declare const MenuGroup: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
93
+ interface MenuLabelProps extends PrimitiveDivProps {
94
+ }
95
+ declare const MenuLabel: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
96
+ interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
97
+ onSelect?: (event: Event) => void;
98
+ }
99
+ declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
100
+ interface MenuItemImplProps extends PrimitiveDivProps {
101
+ disabled?: boolean;
102
+ textValue?: string;
103
+ }
104
+ type CheckedState = boolean | 'indeterminate';
105
+ interface MenuCheckboxItemProps extends MenuItemProps {
106
+ checked?: CheckedState;
107
+ onCheckedChange?: (checked: boolean) => void;
108
+ }
109
+ declare const MenuCheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
110
+ interface MenuRadioGroupProps extends MenuGroupProps {
111
+ value?: string;
112
+ onValueChange?: (value: string) => void;
113
+ }
114
+ declare const MenuRadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
115
+ interface MenuRadioItemProps extends MenuItemProps {
116
+ value: string;
117
+ }
118
+ declare const MenuRadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
119
+ type PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;
120
+ interface MenuItemIndicatorProps extends PrimitiveSpanProps {
121
+ /**
122
+ * Used to force mounting when more control is needed. Useful when
123
+ * controlling animation with React animation libraries.
124
+ */
125
+ forceMount?: true;
126
+ }
127
+ declare const MenuItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
128
+ interface MenuSeparatorProps extends PrimitiveDivProps {
129
+ }
130
+ declare const MenuSeparator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
131
+ type PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
132
+ interface MenuArrowProps extends PopperArrowProps {
133
+ }
134
+ declare const MenuArrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
135
+ interface MenuSubProps {
136
+ children?: React.ReactNode;
137
+ open?: boolean;
138
+ onOpenChange?(open: boolean): void;
139
+ }
140
+ declare const MenuSub: React.FC<MenuSubProps>;
141
+ interface MenuSubTriggerProps extends MenuItemImplProps {
142
+ }
143
+ declare const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
144
+ interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'onEntryFocus' | 'side' | 'align'> {
145
+ /**
146
+ * Used to force mounting when more control is needed. Useful when
147
+ * controlling animation with React animation libraries.
148
+ */
149
+ forceMount?: true;
150
+ }
151
+ declare const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
152
+ declare const Root: React.FC<MenuProps>;
153
+ declare const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
154
+ declare const Portal: React.FC<MenuPortalProps>;
155
+ declare const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
156
+ declare const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
157
+ declare const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
158
+ declare const Item: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
159
+ declare const CheckboxItem: React.ForwardRefExoticComponent<MenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
160
+ declare const RadioGroup: React.ForwardRefExoticComponent<MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
161
+ declare const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
162
+ declare const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
163
+ declare const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
164
+ declare const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
165
+ declare const Sub: React.FC<MenuSubProps>;
166
+ declare const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
167
+ declare const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
168
+
169
+ 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 };