@radix-ui/react-menu 0.1.7-rc.8 → 1.0.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/index.d.ts +43 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +328 -296
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +293 -281
- package/dist/index.module.js.map +1 -1
- package/package.json +19 -19
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { RemoveScroll } from "react-remove-scroll";
|
|
3
2
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
4
3
|
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
4
|
+
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
5
|
+
import { Portal as _Portal1 } from "@radix-ui/react-portal";
|
|
5
6
|
import * as Radix from "@radix-ui/react-primitive";
|
|
6
7
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
|
-
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
8
8
|
import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
|
|
9
9
|
type Direction = 'ltr' | 'rtl';
|
|
10
10
|
export const createMenuScope: import("@radix-ui/react-context").CreateScope;
|
|
@@ -16,22 +16,26 @@ export interface MenuProps {
|
|
|
16
16
|
modal?: boolean;
|
|
17
17
|
}
|
|
18
18
|
export const Menu: React.FC<MenuProps>;
|
|
19
|
-
export interface MenuSubProps {
|
|
20
|
-
children?: React.ReactNode;
|
|
21
|
-
open?: boolean;
|
|
22
|
-
onOpenChange?(open: boolean): void;
|
|
23
|
-
}
|
|
24
|
-
export const MenuSub: React.FC<MenuSubProps>;
|
|
25
19
|
type PopperAnchorProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
|
|
26
20
|
export interface MenuAnchorProps extends PopperAnchorProps {
|
|
27
21
|
}
|
|
28
22
|
export const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof _Portal1>;
|
|
24
|
+
export interface MenuPortalProps extends Omit<PortalProps, 'asChild'> {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Used to force mounting when more control is needed. Useful when
|
|
28
|
+
* controlling animation with React animation libraries.
|
|
29
|
+
*/
|
|
30
|
+
forceMount?: true;
|
|
31
|
+
}
|
|
32
|
+
export const MenuPortal: React.FC<MenuPortalProps>;
|
|
29
33
|
/**
|
|
30
34
|
* We purposefully don't union MenuRootContent and MenuSubContent props here because
|
|
31
35
|
* they have conflicting prop types. We agreed that we would allow MenuSubContent to
|
|
32
36
|
* accept props that it would just ignore.
|
|
33
37
|
*/
|
|
34
|
-
export interface MenuContentProps extends
|
|
38
|
+
export interface MenuContentProps extends MenuRootContentTypeProps {
|
|
35
39
|
/**
|
|
36
40
|
* Used to force mounting when more control is needed. Useful when
|
|
37
41
|
* controlling animation with React animation libraries.
|
|
@@ -39,11 +43,8 @@ export interface MenuContentProps extends MenuRootContentProps {
|
|
|
39
43
|
forceMount?: true;
|
|
40
44
|
}
|
|
41
45
|
export const MenuContent: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
-
interface
|
|
46
|
+
interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps> {
|
|
43
47
|
}
|
|
44
|
-
interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents' | 'disableOutsideScroll'> {
|
|
45
|
-
}
|
|
46
|
-
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
47
48
|
type FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;
|
|
48
49
|
type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
|
49
50
|
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
@@ -51,38 +52,29 @@ type PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.
|
|
|
51
52
|
type MenuContentImplPrivateProps = {
|
|
52
53
|
onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
|
|
53
54
|
onDismiss?: DismissableLayerProps['onDismiss'];
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
|
|
56
|
+
/**
|
|
57
|
+
* Whether scrolling outside the `MenuContent` should be prevented
|
|
58
|
+
* (default: `false`)
|
|
59
|
+
*/
|
|
60
|
+
disableOutsideScroll?: boolean;
|
|
56
61
|
/**
|
|
57
62
|
* Whether focus should be trapped within the `MenuContent`
|
|
58
63
|
* (default: false)
|
|
59
64
|
*/
|
|
60
65
|
trapFocus?: FocusScopeProps['trapped'];
|
|
66
|
+
};
|
|
67
|
+
interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit<PopperContentProps, 'dir'> {
|
|
61
68
|
/**
|
|
62
69
|
* Event handler called when auto-focusing on close.
|
|
63
70
|
* Can be prevented.
|
|
64
71
|
*/
|
|
65
72
|
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
|
|
66
|
-
/**
|
|
67
|
-
* @see https://github.com/theKashey/react-remove-scroll#usage
|
|
68
|
-
*/
|
|
69
|
-
allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
|
|
70
|
-
/**
|
|
71
|
-
* Whether scrolling outside the `MenuContent` should be prevented
|
|
72
|
-
* (default: `false`)
|
|
73
|
-
*/
|
|
74
|
-
disableOutsideScroll?: boolean;
|
|
75
73
|
/**
|
|
76
74
|
* Whether keyboard navigation should loop around
|
|
77
75
|
* @defaultValue false
|
|
78
76
|
*/
|
|
79
77
|
loop?: RovingFocusGroupProps['loop'];
|
|
80
|
-
/**
|
|
81
|
-
* Whether the `MenuContent` should render in a `Portal`
|
|
82
|
-
* (default: `true`)
|
|
83
|
-
*/
|
|
84
|
-
portalled?: boolean;
|
|
85
|
-
disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
|
|
86
78
|
onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
|
|
87
79
|
onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
|
|
88
80
|
onFocusOutside?: DismissableLayerProps['onFocusOutside'];
|
|
@@ -99,9 +91,6 @@ export interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
|
|
|
99
91
|
onSelect?: (event: Event) => void;
|
|
100
92
|
}
|
|
101
93
|
export const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
102
|
-
export interface MenuSubTriggerProps extends MenuItemImplProps {
|
|
103
|
-
}
|
|
104
|
-
export const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
105
94
|
interface MenuItemImplProps extends PrimitiveDivProps {
|
|
106
95
|
disabled?: boolean;
|
|
107
96
|
textValue?: string;
|
|
@@ -136,10 +125,26 @@ type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Ar
|
|
|
136
125
|
export interface MenuArrowProps extends PopperArrowProps {
|
|
137
126
|
}
|
|
138
127
|
export const MenuArrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
128
|
+
export interface MenuSubProps {
|
|
129
|
+
children?: React.ReactNode;
|
|
130
|
+
open?: boolean;
|
|
131
|
+
onOpenChange?(open: boolean): void;
|
|
132
|
+
}
|
|
133
|
+
export const MenuSub: React.FC<MenuSubProps>;
|
|
134
|
+
export interface MenuSubTriggerProps extends MenuItemImplProps {
|
|
135
|
+
}
|
|
136
|
+
export const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
+
export interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'side' | 'align'> {
|
|
138
|
+
/**
|
|
139
|
+
* Used to force mounting when more control is needed. Useful when
|
|
140
|
+
* controlling animation with React animation libraries.
|
|
141
|
+
*/
|
|
142
|
+
forceMount?: true;
|
|
143
|
+
}
|
|
144
|
+
export const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
139
145
|
export const Root: React.FC<MenuProps>;
|
|
140
|
-
export const Sub: React.FC<MenuSubProps>;
|
|
141
146
|
export const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
142
|
-
export const
|
|
147
|
+
export const Portal: React.FC<MenuPortalProps>;
|
|
143
148
|
export const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
144
149
|
export const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
145
150
|
export const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -150,5 +155,8 @@ export const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & Rea
|
|
|
150
155
|
export const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
151
156
|
export const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
152
157
|
export const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
158
|
+
export const Sub: React.FC<MenuSubProps>;
|
|
159
|
+
export const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
export const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
153
161
|
|
|
154
162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L,CAAC;AAWF,oCACE,SAAQ,IAAI,CACV,oBAAoB,EACpB,MAAM,2BAA2B,GAAG,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAC1E;IACD;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,OAAA,MAAM,0GAuDL,CAAC;AAgGF,OAAA,MAAM,yBAAW,CAAC;AAClB,OAAA,MAAM,8FAAmB,CAAC;AAC1B,OAAA,MAAM,iCAAmB,CAAC;AAC1B,OAAA,MAAM,gGAAqB,CAAC;AAC5B,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,0FAAe,CAAC;AACtB,OAAA,MAAM,0GAA+B,CAAC;AACtC,OAAA,MAAM,sGAA2B,CAAC;AAClC,OAAA,MAAM,oGAAyB,CAAC;AAChC,OAAA,MAAM,6GAAiC,CAAC;AACxC,OAAA,MAAM,oGAAyB,CAAC;AAChC,OAAA,MAAM,2FAAiB,CAAC;AACxB,OAAA,MAAM,2BAAa,CAAC;AACpB,OAAA,MAAM,sGAA2B,CAAC;AAClC,OAAA,MAAM,sGAA2B,CAAC","sources":["packages/react/menu/src/packages/react/menu/src/Menu.tsx","packages/react/menu/src/packages/react/menu/src/index.ts","packages/react/menu/src/index.ts"],"sourcesContent":[null,null,"export {\n createMenuScope,\n //\n Menu,\n MenuAnchor,\n MenuPortal,\n MenuContent,\n MenuGroup,\n MenuLabel,\n MenuItem,\n MenuCheckboxItem,\n MenuRadioGroup,\n MenuRadioItem,\n MenuItemIndicator,\n MenuSeparator,\n MenuArrow,\n MenuSub,\n MenuSubTrigger,\n MenuSubContent,\n //\n Root,\n Anchor,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n} from './Menu';\nexport type {\n MenuProps,\n MenuAnchorProps,\n MenuPortalProps,\n MenuContentProps,\n MenuGroupProps,\n MenuLabelProps,\n MenuItemProps,\n MenuCheckboxItemProps,\n MenuRadioGroupProps,\n MenuRadioItemProps,\n MenuItemIndicatorProps,\n MenuSeparatorProps,\n MenuArrowProps,\n MenuSubProps,\n MenuSubTriggerProps,\n MenuSubContentProps,\n} from './Menu';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|