@radix-ui/react-menu 0.1.7-rc.4 → 0.1.7-rc.40
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 +49 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1040 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1021 -1
- package/dist/index.module.js.map +1 -1
- package/package.json +17 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,47 @@
|
|
|
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
|
+
import { RemoveScroll } from "react-remove-scroll";
|
|
9
10
|
type Direction = 'ltr' | 'rtl';
|
|
10
11
|
export const createMenuScope: import("@radix-ui/react-context").CreateScope;
|
|
12
|
+
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
11
13
|
export interface MenuProps {
|
|
12
14
|
children?: React.ReactNode;
|
|
13
15
|
open?: boolean;
|
|
14
16
|
onOpenChange?(open: boolean): void;
|
|
15
17
|
dir?: Direction;
|
|
16
18
|
modal?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @see https://github.com/theKashey/react-remove-scroll#usage
|
|
21
|
+
*/
|
|
22
|
+
allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
|
|
17
23
|
}
|
|
18
24
|
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
25
|
type PopperAnchorProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;
|
|
26
26
|
export interface MenuAnchorProps extends PopperAnchorProps {
|
|
27
27
|
}
|
|
28
28
|
export const MenuAnchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof _Portal1>;
|
|
30
|
+
export interface MenuPortalProps extends Omit<PortalProps, 'asChild'> {
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Used to force mounting when more control is needed. Useful when
|
|
34
|
+
* controlling animation with React animation libraries.
|
|
35
|
+
*/
|
|
36
|
+
forceMount?: true;
|
|
37
|
+
}
|
|
38
|
+
export const MenuPortal: React.FC<MenuPortalProps>;
|
|
29
39
|
/**
|
|
30
40
|
* We purposefully don't union MenuRootContent and MenuSubContent props here because
|
|
31
41
|
* they have conflicting prop types. We agreed that we would allow MenuSubContent to
|
|
32
42
|
* accept props that it would just ignore.
|
|
33
43
|
*/
|
|
34
|
-
export interface MenuContentProps extends
|
|
44
|
+
export interface MenuContentProps extends MenuRootContentTypeProps {
|
|
35
45
|
/**
|
|
36
46
|
* Used to force mounting when more control is needed. Useful when
|
|
37
47
|
* controlling animation with React animation libraries.
|
|
@@ -39,11 +49,8 @@ export interface MenuContentProps extends MenuRootContentProps {
|
|
|
39
49
|
forceMount?: true;
|
|
40
50
|
}
|
|
41
51
|
export const MenuContent: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
-
interface
|
|
52
|
+
interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps> {
|
|
43
53
|
}
|
|
44
|
-
interface MenuRootContentTypeProps extends Omit<MenuContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents' | 'disableOutsideScroll'> {
|
|
45
|
-
}
|
|
46
|
-
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
47
54
|
type FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;
|
|
48
55
|
type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
|
49
56
|
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
|
|
@@ -51,38 +58,29 @@ type PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.
|
|
|
51
58
|
type MenuContentImplPrivateProps = {
|
|
52
59
|
onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
|
|
53
60
|
onDismiss?: DismissableLayerProps['onDismiss'];
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
disableOutsidePointerEvents?: DismissableLayerProps['disableOutsidePointerEvents'];
|
|
62
|
+
/**
|
|
63
|
+
* Whether scrolling outside the `MenuContent` should be prevented
|
|
64
|
+
* (default: `false`)
|
|
65
|
+
*/
|
|
66
|
+
disableOutsideScroll?: boolean;
|
|
56
67
|
/**
|
|
57
68
|
* Whether focus should be trapped within the `MenuContent`
|
|
58
69
|
* (default: false)
|
|
59
70
|
*/
|
|
60
71
|
trapFocus?: FocusScopeProps['trapped'];
|
|
72
|
+
};
|
|
73
|
+
interface MenuContentImplProps extends MenuContentImplPrivateProps, Omit<PopperContentProps, 'dir'> {
|
|
61
74
|
/**
|
|
62
75
|
* Event handler called when auto-focusing on close.
|
|
63
76
|
* Can be prevented.
|
|
64
77
|
*/
|
|
65
78
|
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
79
|
/**
|
|
76
80
|
* Whether keyboard navigation should loop around
|
|
77
81
|
* @defaultValue false
|
|
78
82
|
*/
|
|
79
83
|
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
84
|
onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
|
|
87
85
|
onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
|
|
88
86
|
onFocusOutside?: DismissableLayerProps['onFocusOutside'];
|
|
@@ -99,9 +97,6 @@ export interface MenuItemProps extends Omit<MenuItemImplProps, 'onSelect'> {
|
|
|
99
97
|
onSelect?: (event: Event) => void;
|
|
100
98
|
}
|
|
101
99
|
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
100
|
interface MenuItemImplProps extends PrimitiveDivProps {
|
|
106
101
|
disabled?: boolean;
|
|
107
102
|
textValue?: string;
|
|
@@ -136,10 +131,26 @@ type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Ar
|
|
|
136
131
|
export interface MenuArrowProps extends PopperArrowProps {
|
|
137
132
|
}
|
|
138
133
|
export const MenuArrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
134
|
+
export interface MenuSubProps {
|
|
135
|
+
children?: React.ReactNode;
|
|
136
|
+
open?: boolean;
|
|
137
|
+
onOpenChange?(open: boolean): void;
|
|
138
|
+
}
|
|
139
|
+
export const MenuSub: React.FC<MenuSubProps>;
|
|
140
|
+
export interface MenuSubTriggerProps extends MenuItemImplProps {
|
|
141
|
+
}
|
|
142
|
+
export const MenuSubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
143
|
+
export interface MenuSubContentProps extends Omit<MenuContentImplProps, keyof MenuContentImplPrivateProps | 'onCloseAutoFocus' | 'side' | 'align'> {
|
|
144
|
+
/**
|
|
145
|
+
* Used to force mounting when more control is needed. Useful when
|
|
146
|
+
* controlling animation with React animation libraries.
|
|
147
|
+
*/
|
|
148
|
+
forceMount?: true;
|
|
149
|
+
}
|
|
150
|
+
export const MenuSubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
139
151
|
export const Root: React.FC<MenuProps>;
|
|
140
|
-
export const Sub: React.FC<MenuSubProps>;
|
|
141
152
|
export const Anchor: React.ForwardRefExoticComponent<MenuAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
142
|
-
export const
|
|
153
|
+
export const Portal: React.FC<MenuPortalProps>;
|
|
143
154
|
export const Content: React.ForwardRefExoticComponent<MenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
144
155
|
export const Group: React.ForwardRefExoticComponent<MenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
145
156
|
export const Label: React.ForwardRefExoticComponent<MenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -150,5 +161,8 @@ export const RadioItem: React.ForwardRefExoticComponent<MenuRadioItemProps & Rea
|
|
|
150
161
|
export const ItemIndicator: React.ForwardRefExoticComponent<MenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
151
162
|
export const Separator: React.ForwardRefExoticComponent<MenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
152
163
|
export const Arrow: React.ForwardRefExoticComponent<MenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
164
|
+
export const Sub: React.FC<MenuSubProps>;
|
|
165
|
+
export const SubTrigger: React.ForwardRefExoticComponent<MenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
166
|
+
export const SubContent: React.ForwardRefExoticComponent<MenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
153
167
|
|
|
154
168
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAyBA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AA4B/B,OAAA,sFAIE,CAAC;AAuBH,yBAAyB,MAAM,cAAc,CAAC,mBAAmB,CAAC,CAAC;AACnE;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CACtD;AAED,OAAA,MAAM,MAAM,MAAM,EAAE,CAAC,SAAS,CAuD7B,CAAC;AAWF,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,MAAM,CAAC,CAAC;AACvF,gCAA0B,SAAQ,iBAAiB;CAAG;AAEtD,OAAA,MAAM,kGAML,CAAC;AAeF,mBAAmB,MAAM,wBAAwB,CAAC,eAAsB,CAAC,CAAC;AAC1E,gCAA0B,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IAC5D,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B;;;OAGG;IACH,UAAU,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MAAM,wGAYL,CAAC;AAWF,wBAAwB,MAAM,wBAAwB,CAAC,OAAO,gBAAgB,KAAK,CAAC,CAAC;AACrF,+BAAyB,SAAQ,gBAAgB;CAAG;AAEpD,OAAA,MAAM,+FAML,CAAC;AAmBF;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CACpC;AAED,OAAA,MAAM,SAAS,MAAM,EAAE,CAAC,YAAY,CAmCnC,CAAC;AAWF,oCAA8B,SAAQ,iBAAiB;CAAG;AAE1D,OAAA,MAAM,0GAuHL,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 * from './Menu';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|