@radix-ui/react-dropdown-menu 2.1.0-rc.2 → 2.1.0-rc.4
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 +17 -18
- package/dist/index.d.ts +17 -18
- package/dist/index.js +307 -271
- package/dist/index.js.map +4 -4
- package/dist/index.mjs.map +2 -2
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as Radix from '@radix-ui/react-primitive';
|
|
3
2
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
3
|
import * as MenuPrimitive from '@radix-ui/react-menu';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
type Scope<C = any> = {
|
|
7
6
|
[scopeName: string]: React.Context<C>[];
|
|
8
7
|
} | undefined;
|
|
9
|
-
|
|
8
|
+
type ScopeHook = (scope: Scope) => {
|
|
10
9
|
[__scopeProp: string]: Scope;
|
|
11
10
|
};
|
|
12
11
|
interface CreateScope {
|
|
@@ -14,7 +13,7 @@ interface CreateScope {
|
|
|
14
13
|
(): ScopeHook;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
type Direction = 'ltr' | 'rtl';
|
|
18
17
|
declare const createDropdownMenuScope: CreateScope;
|
|
19
18
|
interface DropdownMenuProps {
|
|
20
19
|
children?: React.ReactNode;
|
|
@@ -25,51 +24,51 @@ interface DropdownMenuProps {
|
|
|
25
24
|
modal?: boolean;
|
|
26
25
|
}
|
|
27
26
|
declare const DropdownMenu: React.FC<DropdownMenuProps>;
|
|
28
|
-
|
|
27
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
29
28
|
interface DropdownMenuTriggerProps extends PrimitiveButtonProps {
|
|
30
29
|
}
|
|
31
30
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
-
|
|
31
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
|
33
32
|
interface DropdownMenuPortalProps extends MenuPortalProps {
|
|
34
33
|
}
|
|
35
34
|
declare const DropdownMenuPortal: React.FC<DropdownMenuPortalProps>;
|
|
36
|
-
|
|
35
|
+
type MenuContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
|
37
36
|
interface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {
|
|
38
37
|
}
|
|
39
38
|
declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
-
|
|
39
|
+
type MenuGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
|
41
40
|
interface DropdownMenuGroupProps extends MenuGroupProps {
|
|
42
41
|
}
|
|
43
42
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
-
|
|
43
|
+
type MenuLabelProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
|
45
44
|
interface DropdownMenuLabelProps extends MenuLabelProps {
|
|
46
45
|
}
|
|
47
46
|
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
|
-
|
|
47
|
+
type MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
|
49
48
|
interface DropdownMenuItemProps extends MenuItemProps {
|
|
50
49
|
}
|
|
51
50
|
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
52
|
-
|
|
51
|
+
type MenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
|
53
52
|
interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
|
54
53
|
}
|
|
55
54
|
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
-
|
|
55
|
+
type MenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
|
57
56
|
interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {
|
|
58
57
|
}
|
|
59
58
|
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
-
|
|
59
|
+
type MenuRadioItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
|
61
60
|
interface DropdownMenuRadioItemProps extends MenuRadioItemProps {
|
|
62
61
|
}
|
|
63
62
|
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
-
|
|
63
|
+
type MenuItemIndicatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
|
65
64
|
interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
|
66
65
|
}
|
|
67
66
|
declare const DropdownMenuItemIndicator: React.ForwardRefExoticComponent<DropdownMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
68
|
-
|
|
67
|
+
type MenuSeparatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
|
69
68
|
interface DropdownMenuSeparatorProps extends MenuSeparatorProps {
|
|
70
69
|
}
|
|
71
70
|
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
72
|
-
|
|
71
|
+
type MenuArrowProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
|
73
72
|
interface DropdownMenuArrowProps extends MenuArrowProps {
|
|
74
73
|
}
|
|
75
74
|
declare const DropdownMenuArrow: React.ForwardRefExoticComponent<DropdownMenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -80,11 +79,11 @@ interface DropdownMenuSubProps {
|
|
|
80
79
|
onOpenChange?(open: boolean): void;
|
|
81
80
|
}
|
|
82
81
|
declare const DropdownMenuSub: React.FC<DropdownMenuSubProps>;
|
|
83
|
-
|
|
82
|
+
type MenuSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
|
84
83
|
interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {
|
|
85
84
|
}
|
|
86
85
|
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
87
|
-
|
|
86
|
+
type MenuSubContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
|
88
87
|
interface DropdownMenuSubContentProps extends MenuSubContentProps {
|
|
89
88
|
}
|
|
90
89
|
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import * as Radix from '@radix-ui/react-primitive';
|
|
3
2
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
3
|
import * as MenuPrimitive from '@radix-ui/react-menu';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
type Scope<C = any> = {
|
|
7
6
|
[scopeName: string]: React.Context<C>[];
|
|
8
7
|
} | undefined;
|
|
9
|
-
|
|
8
|
+
type ScopeHook = (scope: Scope) => {
|
|
10
9
|
[__scopeProp: string]: Scope;
|
|
11
10
|
};
|
|
12
11
|
interface CreateScope {
|
|
@@ -14,7 +13,7 @@ interface CreateScope {
|
|
|
14
13
|
(): ScopeHook;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
type Direction = 'ltr' | 'rtl';
|
|
18
17
|
declare const createDropdownMenuScope: CreateScope;
|
|
19
18
|
interface DropdownMenuProps {
|
|
20
19
|
children?: React.ReactNode;
|
|
@@ -25,51 +24,51 @@ interface DropdownMenuProps {
|
|
|
25
24
|
modal?: boolean;
|
|
26
25
|
}
|
|
27
26
|
declare const DropdownMenu: React.FC<DropdownMenuProps>;
|
|
28
|
-
|
|
27
|
+
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
29
28
|
interface DropdownMenuTriggerProps extends PrimitiveButtonProps {
|
|
30
29
|
}
|
|
31
30
|
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
-
|
|
31
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
|
33
32
|
interface DropdownMenuPortalProps extends MenuPortalProps {
|
|
34
33
|
}
|
|
35
34
|
declare const DropdownMenuPortal: React.FC<DropdownMenuPortalProps>;
|
|
36
|
-
|
|
35
|
+
type MenuContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
|
37
36
|
interface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {
|
|
38
37
|
}
|
|
39
38
|
declare const DropdownMenuContent: React.ForwardRefExoticComponent<DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
-
|
|
39
|
+
type MenuGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
|
41
40
|
interface DropdownMenuGroupProps extends MenuGroupProps {
|
|
42
41
|
}
|
|
43
42
|
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
-
|
|
43
|
+
type MenuLabelProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
|
45
44
|
interface DropdownMenuLabelProps extends MenuLabelProps {
|
|
46
45
|
}
|
|
47
46
|
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>>;
|
|
48
|
-
|
|
47
|
+
type MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
|
49
48
|
interface DropdownMenuItemProps extends MenuItemProps {
|
|
50
49
|
}
|
|
51
50
|
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
52
|
-
|
|
51
|
+
type MenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
|
53
52
|
interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
|
54
53
|
}
|
|
55
54
|
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
-
|
|
55
|
+
type MenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
|
57
56
|
interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {
|
|
58
57
|
}
|
|
59
58
|
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
-
|
|
59
|
+
type MenuRadioItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
|
61
60
|
interface DropdownMenuRadioItemProps extends MenuRadioItemProps {
|
|
62
61
|
}
|
|
63
62
|
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
-
|
|
63
|
+
type MenuItemIndicatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
|
65
64
|
interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
|
66
65
|
}
|
|
67
66
|
declare const DropdownMenuItemIndicator: React.ForwardRefExoticComponent<DropdownMenuItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
68
|
-
|
|
67
|
+
type MenuSeparatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
|
69
68
|
interface DropdownMenuSeparatorProps extends MenuSeparatorProps {
|
|
70
69
|
}
|
|
71
70
|
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
72
|
-
|
|
71
|
+
type MenuArrowProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
|
73
72
|
interface DropdownMenuArrowProps extends MenuArrowProps {
|
|
74
73
|
}
|
|
75
74
|
declare const DropdownMenuArrow: React.ForwardRefExoticComponent<DropdownMenuArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -80,11 +79,11 @@ interface DropdownMenuSubProps {
|
|
|
80
79
|
onOpenChange?(open: boolean): void;
|
|
81
80
|
}
|
|
82
81
|
declare const DropdownMenuSub: React.FC<DropdownMenuSubProps>;
|
|
83
|
-
|
|
82
|
+
type MenuSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
|
84
83
|
interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {
|
|
85
84
|
}
|
|
86
85
|
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>>;
|
|
87
|
-
|
|
86
|
+
type MenuSubContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
|
88
87
|
interface DropdownMenuSubContentProps extends MenuSubContentProps {
|
|
89
88
|
}
|
|
90
89
|
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -1,269 +1,192 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// packages/react/dropdown-menu/src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
Arrow: () => Arrow2,
|
|
35
|
+
CheckboxItem: () => CheckboxItem2,
|
|
36
|
+
Content: () => Content2,
|
|
37
|
+
DropdownMenu: () => DropdownMenu,
|
|
38
|
+
DropdownMenuArrow: () => DropdownMenuArrow,
|
|
39
|
+
DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem,
|
|
40
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
|
41
|
+
DropdownMenuGroup: () => DropdownMenuGroup,
|
|
42
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
|
43
|
+
DropdownMenuItemIndicator: () => DropdownMenuItemIndicator,
|
|
44
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
|
45
|
+
DropdownMenuPortal: () => DropdownMenuPortal,
|
|
46
|
+
DropdownMenuRadioGroup: () => DropdownMenuRadioGroup,
|
|
47
|
+
DropdownMenuRadioItem: () => DropdownMenuRadioItem,
|
|
48
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
|
49
|
+
DropdownMenuSub: () => DropdownMenuSub,
|
|
50
|
+
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
51
|
+
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
52
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
53
|
+
Group: () => Group2,
|
|
54
|
+
Item: () => Item2,
|
|
55
|
+
ItemIndicator: () => ItemIndicator2,
|
|
56
|
+
Label: () => Label2,
|
|
57
|
+
Portal: () => Portal2,
|
|
58
|
+
RadioGroup: () => RadioGroup2,
|
|
59
|
+
RadioItem: () => RadioItem2,
|
|
60
|
+
Root: () => Root2,
|
|
61
|
+
Separator: () => Separator2,
|
|
62
|
+
Sub: () => Sub2,
|
|
63
|
+
SubContent: () => SubContent2,
|
|
64
|
+
SubTrigger: () => SubTrigger2,
|
|
65
|
+
Trigger: () => Trigger,
|
|
66
|
+
createDropdownMenuScope: () => createDropdownMenuScope
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(src_exports);
|
|
69
|
+
|
|
70
|
+
// packages/react/dropdown-menu/src/DropdownMenu.tsx
|
|
71
|
+
var React = __toESM(require("react"));
|
|
72
|
+
var import_primitive = require("@radix-ui/primitive");
|
|
73
|
+
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
74
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
75
|
+
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
|
|
76
|
+
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
77
|
+
var MenuPrimitive = __toESM(require("@radix-ui/react-menu"));
|
|
78
|
+
var import_react_menu = require("@radix-ui/react-menu");
|
|
79
|
+
var import_react_id = require("@radix-ui/react-id");
|
|
80
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
81
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
82
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = (0, import_react_context.createContextScope)(
|
|
83
|
+
DROPDOWN_MENU_NAME,
|
|
84
|
+
[import_react_menu.createMenuScope]
|
|
85
|
+
);
|
|
86
|
+
var useMenuScope = (0, import_react_menu.createMenuScope)();
|
|
87
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
88
|
+
var DropdownMenu = (props) => {
|
|
89
|
+
const {
|
|
90
|
+
__scopeDropdownMenu,
|
|
91
|
+
children,
|
|
92
|
+
dir,
|
|
93
|
+
open: openProp,
|
|
94
|
+
defaultOpen,
|
|
95
|
+
onOpenChange,
|
|
96
|
+
modal = true
|
|
97
|
+
} = props;
|
|
98
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
99
|
+
const triggerRef = React.useRef(null);
|
|
100
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
101
|
+
prop: openProp,
|
|
102
|
+
defaultProp: defaultOpen,
|
|
103
|
+
onChange: onOpenChange
|
|
15
104
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
DropdownMenuProvider,
|
|
107
|
+
{
|
|
108
|
+
scope: __scopeDropdownMenu,
|
|
109
|
+
triggerId: (0, import_react_id.useId)(),
|
|
110
|
+
triggerRef,
|
|
111
|
+
contentId: (0, import_react_id.useId)(),
|
|
112
|
+
open,
|
|
113
|
+
onOpenChange: setOpen,
|
|
114
|
+
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
115
|
+
modal,
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Root, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
21
117
|
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
// packages/react/dropdown-menu/src/DropdownMenu.tsx
|
|
34
|
-
var React = __toESM(__require("react"));
|
|
35
|
-
var import_primitive = __require("@radix-ui/primitive");
|
|
36
|
-
var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
|
|
37
|
-
var import_react_context = __require("@radix-ui/react-context");
|
|
38
|
-
var import_react_use_controllable_state = __require("@radix-ui/react-use-controllable-state");
|
|
39
|
-
var import_react_primitive = __require("@radix-ui/react-primitive");
|
|
40
|
-
var MenuPrimitive = __toESM(__require("@radix-ui/react-menu"));
|
|
41
|
-
var import_react_menu = __require("@radix-ui/react-menu");
|
|
42
|
-
var import_react_id = __require("@radix-ui/react-id");
|
|
43
|
-
var import_jsx_runtime = __require("react/jsx-runtime");
|
|
44
|
-
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
45
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = (0, import_react_context.createContextScope)(
|
|
46
|
-
DROPDOWN_MENU_NAME,
|
|
47
|
-
[import_react_menu.createMenuScope]
|
|
48
118
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
open: openProp,
|
|
57
|
-
defaultOpen,
|
|
58
|
-
onOpenChange,
|
|
59
|
-
modal = true
|
|
60
|
-
} = props;
|
|
119
|
+
};
|
|
120
|
+
DropdownMenu.displayName = DROPDOWN_MENU_NAME;
|
|
121
|
+
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
122
|
+
var DropdownMenuTrigger = React.forwardRef(
|
|
123
|
+
(props, forwardedRef) => {
|
|
124
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
125
|
+
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
61
126
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
prop: openProp,
|
|
65
|
-
defaultProp: defaultOpen,
|
|
66
|
-
onChange: onOpenChange
|
|
67
|
-
});
|
|
68
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
-
DropdownMenuProvider,
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
128
|
+
import_react_primitive.Primitive.button,
|
|
70
129
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
open,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var DropdownMenuTrigger = React.forwardRef(
|
|
86
|
-
(props, forwardedRef) => {
|
|
87
|
-
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
88
|
-
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
89
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
90
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
-
import_react_primitive.Primitive.button,
|
|
92
|
-
{
|
|
93
|
-
type: "button",
|
|
94
|
-
id: context.triggerId,
|
|
95
|
-
"aria-haspopup": "menu",
|
|
96
|
-
"aria-expanded": context.open,
|
|
97
|
-
"aria-controls": context.open ? context.contentId : void 0,
|
|
98
|
-
"data-state": context.open ? "open" : "closed",
|
|
99
|
-
"data-disabled": disabled ? "" : void 0,
|
|
100
|
-
disabled,
|
|
101
|
-
...triggerProps,
|
|
102
|
-
ref: (0, import_react_compose_refs.composeRefs)(forwardedRef, context.triggerRef),
|
|
103
|
-
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => {
|
|
104
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
105
|
-
context.onOpenToggle();
|
|
106
|
-
if (!context.open) event.preventDefault();
|
|
107
|
-
}
|
|
108
|
-
}),
|
|
109
|
-
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
110
|
-
if (disabled) return;
|
|
111
|
-
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
|
112
|
-
if (event.key === "ArrowDown") context.onOpenChange(true);
|
|
113
|
-
if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault();
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
) });
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
|
120
|
-
var PORTAL_NAME = "DropdownMenuPortal";
|
|
121
|
-
var DropdownMenuPortal = (props) => {
|
|
122
|
-
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
123
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
124
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Portal, { ...menuScope, ...portalProps });
|
|
125
|
-
};
|
|
126
|
-
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
127
|
-
var CONTENT_NAME = "DropdownMenuContent";
|
|
128
|
-
var DropdownMenuContent = React.forwardRef(
|
|
129
|
-
(props, forwardedRef) => {
|
|
130
|
-
const { __scopeDropdownMenu, ...contentProps } = props;
|
|
131
|
-
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
132
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
133
|
-
const hasInteractedOutsideRef = React.useRef(false);
|
|
134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
-
MenuPrimitive.Content,
|
|
136
|
-
{
|
|
137
|
-
id: context.contentId,
|
|
138
|
-
"aria-labelledby": context.triggerId,
|
|
139
|
-
...menuScope,
|
|
140
|
-
...contentProps,
|
|
141
|
-
ref: forwardedRef,
|
|
142
|
-
onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
|
|
143
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
144
|
-
hasInteractedOutsideRef.current = false;
|
|
145
|
-
event.preventDefault();
|
|
146
|
-
}),
|
|
147
|
-
onInteractOutside: (0, import_primitive.composeEventHandlers)(props.onInteractOutside, (event) => {
|
|
148
|
-
const originalEvent = event.detail.originalEvent;
|
|
149
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
150
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
151
|
-
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
|
|
152
|
-
}),
|
|
153
|
-
style: {
|
|
154
|
-
...props.style,
|
|
155
|
-
// re-namespace exposed content custom properties
|
|
156
|
-
...{
|
|
157
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
158
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
159
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
160
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
161
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
162
|
-
}
|
|
130
|
+
type: "button",
|
|
131
|
+
id: context.triggerId,
|
|
132
|
+
"aria-haspopup": "menu",
|
|
133
|
+
"aria-expanded": context.open,
|
|
134
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
135
|
+
"data-state": context.open ? "open" : "closed",
|
|
136
|
+
"data-disabled": disabled ? "" : void 0,
|
|
137
|
+
disabled,
|
|
138
|
+
...triggerProps,
|
|
139
|
+
ref: (0, import_react_compose_refs.composeRefs)(forwardedRef, context.triggerRef),
|
|
140
|
+
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => {
|
|
141
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
142
|
+
context.onOpenToggle();
|
|
143
|
+
if (!context.open) event.preventDefault();
|
|
163
144
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
var DropdownMenuItem = React.forwardRef(
|
|
189
|
-
(props, forwardedRef) => {
|
|
190
|
-
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
191
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
192
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
193
|
-
}
|
|
194
|
-
);
|
|
195
|
-
DropdownMenuItem.displayName = ITEM_NAME;
|
|
196
|
-
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
197
|
-
var DropdownMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {
|
|
198
|
-
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
199
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
200
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
201
|
-
});
|
|
202
|
-
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
203
|
-
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
204
|
-
var DropdownMenuRadioGroup = React.forwardRef((props, forwardedRef) => {
|
|
205
|
-
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
206
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
207
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
208
|
-
});
|
|
209
|
-
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
210
|
-
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
211
|
-
var DropdownMenuRadioItem = React.forwardRef((props, forwardedRef) => {
|
|
212
|
-
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
213
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
215
|
-
});
|
|
216
|
-
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
217
|
-
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
218
|
-
var DropdownMenuItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
219
|
-
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
220
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
221
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
222
|
-
});
|
|
223
|
-
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
224
|
-
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
225
|
-
var DropdownMenuSeparator = React.forwardRef((props, forwardedRef) => {
|
|
226
|
-
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
227
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
228
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
229
|
-
});
|
|
230
|
-
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
231
|
-
var ARROW_NAME = "DropdownMenuArrow";
|
|
232
|
-
var DropdownMenuArrow = React.forwardRef(
|
|
233
|
-
(props, forwardedRef) => {
|
|
234
|
-
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
235
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
236
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
240
|
-
var DropdownMenuSub = (props) => {
|
|
241
|
-
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
242
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
243
|
-
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
244
|
-
prop: openProp,
|
|
245
|
-
defaultProp: defaultOpen,
|
|
246
|
-
onChange: onOpenChange
|
|
247
|
-
});
|
|
248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
249
|
-
};
|
|
250
|
-
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
251
|
-
var DropdownMenuSubTrigger = React.forwardRef((props, forwardedRef) => {
|
|
252
|
-
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
253
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
254
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
255
|
-
});
|
|
256
|
-
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
257
|
-
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
258
|
-
var DropdownMenuSubContent = React.forwardRef((props, forwardedRef) => {
|
|
259
|
-
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
145
|
+
}),
|
|
146
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
147
|
+
if (disabled) return;
|
|
148
|
+
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
|
149
|
+
if (event.key === "ArrowDown") context.onOpenChange(true);
|
|
150
|
+
if (["Enter", " ", "ArrowDown"].includes(event.key)) event.preventDefault();
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
) });
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
|
157
|
+
var PORTAL_NAME = "DropdownMenuPortal";
|
|
158
|
+
var DropdownMenuPortal = (props) => {
|
|
159
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
160
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Portal, { ...menuScope, ...portalProps });
|
|
162
|
+
};
|
|
163
|
+
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
164
|
+
var CONTENT_NAME = "DropdownMenuContent";
|
|
165
|
+
var DropdownMenuContent = React.forwardRef(
|
|
166
|
+
(props, forwardedRef) => {
|
|
167
|
+
const { __scopeDropdownMenu, ...contentProps } = props;
|
|
168
|
+
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
260
169
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
170
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
261
171
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
262
|
-
MenuPrimitive.
|
|
172
|
+
MenuPrimitive.Content,
|
|
263
173
|
{
|
|
174
|
+
id: context.contentId,
|
|
175
|
+
"aria-labelledby": context.triggerId,
|
|
264
176
|
...menuScope,
|
|
265
|
-
...
|
|
177
|
+
...contentProps,
|
|
266
178
|
ref: forwardedRef,
|
|
179
|
+
onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
|
|
180
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
181
|
+
hasInteractedOutsideRef.current = false;
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
}),
|
|
184
|
+
onInteractOutside: (0, import_primitive.composeEventHandlers)(props.onInteractOutside, (event) => {
|
|
185
|
+
const originalEvent = event.detail.originalEvent;
|
|
186
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
187
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
188
|
+
if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
|
|
189
|
+
}),
|
|
267
190
|
style: {
|
|
268
191
|
...props.style,
|
|
269
192
|
// re-namespace exposed content custom properties
|
|
@@ -277,23 +200,136 @@
|
|
|
277
200
|
}
|
|
278
201
|
}
|
|
279
202
|
);
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
206
|
+
var GROUP_NAME = "DropdownMenuGroup";
|
|
207
|
+
var DropdownMenuGroup = React.forwardRef(
|
|
208
|
+
(props, forwardedRef) => {
|
|
209
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
210
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
215
|
+
var LABEL_NAME = "DropdownMenuLabel";
|
|
216
|
+
var DropdownMenuLabel = React.forwardRef(
|
|
217
|
+
(props, forwardedRef) => {
|
|
218
|
+
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
219
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
DropdownMenuLabel.displayName = LABEL_NAME;
|
|
224
|
+
var ITEM_NAME = "DropdownMenuItem";
|
|
225
|
+
var DropdownMenuItem = React.forwardRef(
|
|
226
|
+
(props, forwardedRef) => {
|
|
227
|
+
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
228
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
DropdownMenuItem.displayName = ITEM_NAME;
|
|
233
|
+
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
234
|
+
var DropdownMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {
|
|
235
|
+
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
236
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
238
|
+
});
|
|
239
|
+
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
240
|
+
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
241
|
+
var DropdownMenuRadioGroup = React.forwardRef((props, forwardedRef) => {
|
|
242
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
243
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
245
|
+
});
|
|
246
|
+
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
247
|
+
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
248
|
+
var DropdownMenuRadioItem = React.forwardRef((props, forwardedRef) => {
|
|
249
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
250
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
252
|
+
});
|
|
253
|
+
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
254
|
+
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
255
|
+
var DropdownMenuItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
256
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
257
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
259
|
+
});
|
|
260
|
+
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
261
|
+
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
262
|
+
var DropdownMenuSeparator = React.forwardRef((props, forwardedRef) => {
|
|
263
|
+
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
264
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
266
|
+
});
|
|
267
|
+
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
268
|
+
var ARROW_NAME = "DropdownMenuArrow";
|
|
269
|
+
var DropdownMenuArrow = React.forwardRef(
|
|
270
|
+
(props, forwardedRef) => {
|
|
271
|
+
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
272
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
277
|
+
var DropdownMenuSub = (props) => {
|
|
278
|
+
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
279
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
280
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
281
|
+
prop: openProp,
|
|
282
|
+
defaultProp: defaultOpen,
|
|
283
|
+
onChange: onOpenChange
|
|
280
284
|
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
286
|
+
};
|
|
287
|
+
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
288
|
+
var DropdownMenuSubTrigger = React.forwardRef((props, forwardedRef) => {
|
|
289
|
+
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
290
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
292
|
+
});
|
|
293
|
+
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
294
|
+
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
295
|
+
var DropdownMenuSubContent = React.forwardRef((props, forwardedRef) => {
|
|
296
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
297
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
299
|
+
MenuPrimitive.SubContent,
|
|
300
|
+
{
|
|
301
|
+
...menuScope,
|
|
302
|
+
...subContentProps,
|
|
303
|
+
ref: forwardedRef,
|
|
304
|
+
style: {
|
|
305
|
+
...props.style,
|
|
306
|
+
// re-namespace exposed content custom properties
|
|
307
|
+
...{
|
|
308
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
309
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
310
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
311
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
312
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
});
|
|
318
|
+
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
319
|
+
var Root2 = DropdownMenu;
|
|
320
|
+
var Trigger = DropdownMenuTrigger;
|
|
321
|
+
var Portal2 = DropdownMenuPortal;
|
|
322
|
+
var Content2 = DropdownMenuContent;
|
|
323
|
+
var Group2 = DropdownMenuGroup;
|
|
324
|
+
var Label2 = DropdownMenuLabel;
|
|
325
|
+
var Item2 = DropdownMenuItem;
|
|
326
|
+
var CheckboxItem2 = DropdownMenuCheckboxItem;
|
|
327
|
+
var RadioGroup2 = DropdownMenuRadioGroup;
|
|
328
|
+
var RadioItem2 = DropdownMenuRadioItem;
|
|
329
|
+
var ItemIndicator2 = DropdownMenuItemIndicator;
|
|
330
|
+
var Separator2 = DropdownMenuSeparator;
|
|
331
|
+
var Arrow2 = DropdownMenuArrow;
|
|
332
|
+
var Sub2 = DropdownMenuSub;
|
|
333
|
+
var SubTrigger2 = DropdownMenuSubTrigger;
|
|
334
|
+
var SubContent2 = DropdownMenuSubContent;
|
|
299
335
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/DropdownMenu.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext<DropdownMenuContextValue>(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode;\n dir?: Direction;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst DropdownMenu: React.FC<DropdownMenuProps> = (props: ScopedProps<DropdownMenuProps>) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DropdownMenuProvider\n scope={__scopeDropdownMenu}\n triggerId={useId()}\n triggerRef={triggerRef}\n contentId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n <MenuPrimitive.Root {...menuScope} open={open} onOpenChange={setOpen} dir={dir} modal={modal}>\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n (props: ScopedProps<DropdownMenuTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Anchor asChild {...menuScope}>\n <Primitive.button\n type=\"button\"\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={context.open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n {...triggerProps}\n ref={composeRefs(forwardedRef, context.triggerRef)}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n }\n);\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DropdownMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC<DropdownMenuPortalProps> = (\n props: ScopedProps<DropdownMenuPortalProps>\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nDropdownMenuPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {}\n\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props: ScopedProps<DropdownMenuContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'DropdownMenuGroup';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n (props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'DropdownMenuLabel';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n (props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'DropdownMenuItem';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'DropdownMenuCheckboxItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props: ScopedProps<DropdownMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'DropdownMenuRadioGroup';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>((props: ScopedProps<DropdownMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'DropdownMenuRadioItem';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props: ScopedProps<DropdownMenuRadioItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'DropdownMenuItemIndicator';\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>((props: ScopedProps<DropdownMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'DropdownMenuSeparator';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>((props: ScopedProps<DropdownMenuSeparatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'DropdownMenuArrow';\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<DropdownMenuArrowElement, DropdownMenuArrowProps>(\n (props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = (\n props: ScopedProps<DropdownMenuSubProps>\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={setOpen}>\n {children}\n </MenuPrimitive.Sub>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'DropdownMenuSubTrigger';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...subTriggerProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'DropdownMenuSubContent';\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props: ScopedProps<DropdownMenuSubContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n <MenuPrimitive.SubContent\n {...menuScope}\n {...subContentProps}\n ref={forwardedRef}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\nconst Trigger = DropdownMenuTrigger;\nconst Portal = DropdownMenuPortal;\nconst Content = DropdownMenuContent;\nconst Group = DropdownMenuGroup;\nconst Label = DropdownMenuLabel;\nconst Item = DropdownMenuItem;\nconst CheckboxItem = DropdownMenuCheckboxItem;\nconst RadioGroup = DropdownMenuRadioGroup;\nconst RadioItem = DropdownMenuRadioItem;\nconst ItemIndicator = DropdownMenuItemIndicator;\nconst Separator = DropdownMenuSeparator;\nconst Arrow = DropdownMenuArrow;\nconst Sub = DropdownMenuSub;\nconst SubTrigger = DropdownMenuSubTrigger;\nconst SubContent = DropdownMenuSubContent;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\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};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Root", "Portal", "Content", "Group", "Label", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "ItemIndicator", "Separator", "Arrow", "Sub", "SubTrigger", "SubContent"]
|
|
3
|
+
"sources": ["../src/index.ts", "../src/DropdownMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\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 './DropdownMenu';\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n} from './DropdownMenu';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext<DropdownMenuContextValue>(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode;\n dir?: Direction;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst DropdownMenu: React.FC<DropdownMenuProps> = (props: ScopedProps<DropdownMenuProps>) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DropdownMenuProvider\n scope={__scopeDropdownMenu}\n triggerId={useId()}\n triggerRef={triggerRef}\n contentId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n <MenuPrimitive.Root {...menuScope} open={open} onOpenChange={setOpen} dir={dir} modal={modal}>\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n (props: ScopedProps<DropdownMenuTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Anchor asChild {...menuScope}>\n <Primitive.button\n type=\"button\"\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={context.open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n {...triggerProps}\n ref={composeRefs(forwardedRef, context.triggerRef)}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n }\n);\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DropdownMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC<DropdownMenuPortalProps> = (\n props: ScopedProps<DropdownMenuPortalProps>\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nDropdownMenuPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {}\n\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props: ScopedProps<DropdownMenuContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'DropdownMenuGroup';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n (props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'DropdownMenuLabel';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n (props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'DropdownMenuItem';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'DropdownMenuCheckboxItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props: ScopedProps<DropdownMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'DropdownMenuRadioGroup';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>((props: ScopedProps<DropdownMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'DropdownMenuRadioItem';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props: ScopedProps<DropdownMenuRadioItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'DropdownMenuItemIndicator';\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>((props: ScopedProps<DropdownMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'DropdownMenuSeparator';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>((props: ScopedProps<DropdownMenuSeparatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'DropdownMenuArrow';\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<DropdownMenuArrowElement, DropdownMenuArrowProps>(\n (props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = (\n props: ScopedProps<DropdownMenuSubProps>\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={setOpen}>\n {children}\n </MenuPrimitive.Sub>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'DropdownMenuSubTrigger';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...subTriggerProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'DropdownMenuSubContent';\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props: ScopedProps<DropdownMenuSubContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n <MenuPrimitive.SubContent\n {...menuScope}\n {...subContentProps}\n ref={forwardedRef}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\nconst Trigger = DropdownMenuTrigger;\nconst Portal = DropdownMenuPortal;\nconst Content = DropdownMenuContent;\nconst Group = DropdownMenuGroup;\nconst Label = DropdownMenuLabel;\nconst Item = DropdownMenuItem;\nconst CheckboxItem = DropdownMenuCheckboxItem;\nconst RadioGroup = DropdownMenuRadioGroup;\nconst RadioItem = DropdownMenuRadioItem;\nconst ItemIndicator = DropdownMenuItemIndicator;\nconst Separator = DropdownMenuSeparator;\nconst Arrow = DropdownMenuArrow;\nconst Sub = DropdownMenuSub;\nconst SubTrigger = DropdownMenuSubTrigger;\nconst SubContent = DropdownMenuSubContent;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\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};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;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AAMC,aAAY;AAClB,IAAMC,iBAAgB;AACtB,IAAMC,aAAY;AAClB,IAAMC,SAAQ;AACd,IAAMC,OAAM;AACZ,IAAMC,cAAa;AACnB,IAAMC,cAAa;",
|
|
6
|
+
"names": ["Arrow", "CheckboxItem", "Content", "Group", "Item", "ItemIndicator", "Label", "Portal", "RadioGroup", "RadioItem", "Root", "Separator", "Sub", "SubContent", "SubTrigger", "Root", "Portal", "Content", "Group", "Label", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "ItemIndicator", "Separator", "Arrow", "Sub", "SubTrigger", "SubContent"]
|
|
7
7
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/DropdownMenu.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext<DropdownMenuContextValue>(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode;\n dir?: Direction;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst DropdownMenu: React.FC<DropdownMenuProps> = (props: ScopedProps<DropdownMenuProps>) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DropdownMenuProvider\n scope={__scopeDropdownMenu}\n triggerId={useId()}\n triggerRef={triggerRef}\n contentId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n <MenuPrimitive.Root {...menuScope} open={open} onOpenChange={setOpen} dir={dir} modal={modal}>\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n (props: ScopedProps<DropdownMenuTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Anchor asChild {...menuScope}>\n <Primitive.button\n type=\"button\"\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={context.open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n {...triggerProps}\n ref={composeRefs(forwardedRef, context.triggerRef)}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n }\n);\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DropdownMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC<DropdownMenuPortalProps> = (\n props: ScopedProps<DropdownMenuPortalProps>\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nDropdownMenuPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {}\n\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props: ScopedProps<DropdownMenuContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'DropdownMenuGroup';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n (props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'DropdownMenuLabel';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n (props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'DropdownMenuItem';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'DropdownMenuCheckboxItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props: ScopedProps<DropdownMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'DropdownMenuRadioGroup';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>((props: ScopedProps<DropdownMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'DropdownMenuRadioItem';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props: ScopedProps<DropdownMenuRadioItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'DropdownMenuItemIndicator';\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>((props: ScopedProps<DropdownMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'DropdownMenuSeparator';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>((props: ScopedProps<DropdownMenuSeparatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'DropdownMenuArrow';\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<DropdownMenuArrowElement, DropdownMenuArrowProps>(\n (props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = (\n props: ScopedProps<DropdownMenuSubProps>\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={setOpen}>\n {children}\n </MenuPrimitive.Sub>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'DropdownMenuSubTrigger';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...subTriggerProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'DropdownMenuSubContent';\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props: ScopedProps<DropdownMenuSubContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n <MenuPrimitive.SubContent\n {...menuScope}\n {...subContentProps}\n ref={forwardedRef}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\nconst Trigger = DropdownMenuTrigger;\nconst Portal = DropdownMenuPortal;\nconst Content = DropdownMenuContent;\nconst Group = DropdownMenuGroup;\nconst Label = DropdownMenuLabel;\nconst Item = DropdownMenuItem;\nconst CheckboxItem = DropdownMenuCheckboxItem;\nconst RadioGroup = DropdownMenuRadioGroup;\nconst RadioItem = DropdownMenuRadioItem;\nconst ItemIndicator = DropdownMenuItemIndicator;\nconst Separator = DropdownMenuSeparator;\nconst Arrow = DropdownMenuArrow;\nconst Sub = DropdownMenuSub;\nconst SubTrigger = DropdownMenuSubTrigger;\nconst SubContent = DropdownMenuSubContent;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\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};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"],
|
|
5
|
-
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,YAAY,mBAAmB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,aAAa;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { composeRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = 'DropdownMenu';\n\ntype ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nconst useMenuScope = createMenuScope();\n\ntype DropdownMenuContextValue = {\n triggerId: string;\n triggerRef: React.RefObject<HTMLButtonElement>;\n contentId: string;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n modal: boolean;\n};\n\nconst [DropdownMenuProvider, useDropdownMenuContext] =\n createDropdownMenuContext<DropdownMenuContextValue>(DROPDOWN_MENU_NAME);\n\ninterface DropdownMenuProps {\n children?: React.ReactNode;\n dir?: Direction;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n modal?: boolean;\n}\n\nconst DropdownMenu: React.FC<DropdownMenuProps> = (props: ScopedProps<DropdownMenuProps>) => {\n const {\n __scopeDropdownMenu,\n children,\n dir,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = true,\n } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <DropdownMenuProvider\n scope={__scopeDropdownMenu}\n triggerId={useId()}\n triggerRef={triggerRef}\n contentId={useId()}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n modal={modal}\n >\n <MenuPrimitive.Root {...menuScope} open={open} onOpenChange={setOpen} dir={dir} modal={modal}>\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'DropdownMenuTrigger';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n (props: ScopedProps<DropdownMenuTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;\n const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Anchor asChild {...menuScope}>\n <Primitive.button\n type=\"button\"\n id={context.triggerId}\n aria-haspopup=\"menu\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={context.open ? 'open' : 'closed'}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n {...triggerProps}\n ref={composeRefs(forwardedRef, context.triggerRef)}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (!disabled && event.button === 0 && event.ctrlKey === false) {\n context.onOpenToggle();\n // prevent trigger focusing when opening\n // this allows the content to be given focus without competition\n if (!context.open) event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (disabled) return;\n if (['Enter', ' '].includes(event.key)) context.onOpenToggle();\n if (event.key === 'ArrowDown') context.onOpenChange(true);\n // prevent keydown from scrolling window / first focused item to execute\n // that keydown (inadvertently closing the menu)\n if (['Enter', ' ', 'ArrowDown'].includes(event.key)) event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n }\n);\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'DropdownMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\ninterface DropdownMenuPortalProps extends MenuPortalProps {}\n\nconst DropdownMenuPortal: React.FC<DropdownMenuPortalProps> = (\n props: ScopedProps<DropdownMenuPortalProps>\n) => {\n const { __scopeDropdownMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nDropdownMenuPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'DropdownMenuContent';\n\ntype DropdownMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface DropdownMenuContentProps extends Omit<MenuContentProps, 'onEntryFocus'> {}\n\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (props: ScopedProps<DropdownMenuContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...contentProps } = props;\n const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n id={context.contentId}\n aria-labelledby={context.triggerId}\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n hasInteractedOutsideRef.current = false;\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n })}\n onInteractOutside={composeEventHandlers(props.onInteractOutside, (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;\n })}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin':\n 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height':\n 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'DropdownMenuGroup';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n (props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'DropdownMenuLabel';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {}\n\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n (props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'DropdownMenuItem';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface DropdownMenuItemProps extends MenuItemProps {}\n\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'DropdownMenuCheckboxItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\ninterface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props: ScopedProps<DropdownMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'DropdownMenuRadioGroup';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>((props: ScopedProps<DropdownMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'DropdownMenuRadioItem';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\ninterface DropdownMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props: ScopedProps<DropdownMenuRadioItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'DropdownMenuItemIndicator';\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\ninterface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst DropdownMenuItemIndicator = React.forwardRef<\n DropdownMenuItemIndicatorElement,\n DropdownMenuItemIndicatorProps\n>((props: ScopedProps<DropdownMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'DropdownMenuSeparator';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>((props: ScopedProps<DropdownMenuSeparatorProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'DropdownMenuArrow';\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<DropdownMenuArrowElement, DropdownMenuArrowProps>(\n (props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSub\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DropdownMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = (\n props: ScopedProps<DropdownMenuSubProps>\n) => {\n const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n return (\n <MenuPrimitive.Sub {...menuScope} open={open} onOpenChange={setOpen}>\n {children}\n </MenuPrimitive.Sub>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'DropdownMenuSubTrigger';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...subTriggerProps} ref={forwardedRef} />;\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'DropdownMenuSubContent';\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps extends MenuSubContentProps {}\n\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props: ScopedProps<DropdownMenuSubContentProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n\n return (\n <MenuPrimitive.SubContent\n {...menuScope}\n {...subContentProps}\n ref={forwardedRef}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\nconst Trigger = DropdownMenuTrigger;\nconst Portal = DropdownMenuPortal;\nconst Content = DropdownMenuContent;\nconst Group = DropdownMenuGroup;\nconst Label = DropdownMenuLabel;\nconst Item = DropdownMenuItem;\nconst CheckboxItem = DropdownMenuCheckboxItem;\nconst RadioGroup = DropdownMenuRadioGroup;\nconst RadioItem = DropdownMenuRadioItem;\nconst ItemIndicator = DropdownMenuItemIndicator;\nconst Separator = DropdownMenuSeparator;\nconst Arrow = DropdownMenuArrow;\nconst Sub = DropdownMenuSub;\nconst SubTrigger = DropdownMenuSubTrigger;\nconst SubContent = DropdownMenuSubContent;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuPortal,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuItemIndicator,\n DropdownMenuSeparator,\n DropdownMenuArrow,\n DropdownMenuSub,\n DropdownMenuSubTrigger,\n DropdownMenuSubContent,\n //\n Root,\n Trigger,\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};\nexport type {\n DropdownMenuProps,\n DropdownMenuTriggerProps,\n DropdownMenuPortalProps,\n DropdownMenuContentProps,\n DropdownMenuGroupProps,\n DropdownMenuLabelProps,\n DropdownMenuItemProps,\n DropdownMenuCheckboxItemProps,\n DropdownMenuRadioGroupProps,\n DropdownMenuRadioItemProps,\n DropdownMenuItemIndicatorProps,\n DropdownMenuSeparatorProps,\n DropdownMenuArrowProps,\n DropdownMenuSubProps,\n DropdownMenuSubTriggerProps,\n DropdownMenuSubContentProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,YAAY,mBAAmB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AAsEhB;AA5DN,IAAM,qBAAqB;AAG3B,IAAM,CAAC,2BAA2B,uBAAuB,IAAI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AACnE,QAAM,EAAE,qBAAqB,GAAG,gBAAgB,IAAI;AACpD,QAAM,YAAY,aAAa,mBAAmB;AAElD,SACE;AAAA,IAAe;AAAA,IAAd;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,OAAO;AAAA,QACL,GAAG,MAAM;AAAA;AAAA,QAET,GAAG;AAAA,UACD,kDAAkD;AAAA,UAClD,iDAAiD;AAAA,UACjD,kDAAkD;AAAA,UAClD,uCAAuC;AAAA,UACvC,wCAAwC;AAAA,QAC1C;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,uBAAuB,cAAc;AAIrC,IAAMA,QAAO;AACb,IAAM,UAAU;AAChB,IAAMC,UAAS;AACf,IAAMC,WAAU;AAChB,IAAMC,SAAQ;AACd,IAAMC,SAAQ;AACd,IAAMC,QAAO;AACb,IAAMC,gBAAe;AACrB,IAAMC,cAAa;AACnB,IAAMC,aAAY;AAClB,IAAMC,iBAAgB;AACtB,IAAMC,aAAY;AAClB,IAAMC,SAAQ;AACd,IAAMC,OAAM;AACZ,IAAMC,cAAa;AACnB,IAAMC,cAAa;",
|
|
6
6
|
"names": ["Root", "Portal", "Content", "Group", "Label", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "ItemIndicator", "Separator", "Arrow", "Sub", "SubTrigger", "SubContent"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-dropdown-menu",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"version": "yarn version"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@radix-ui/primitive": "1.1.0-rc.
|
|
32
|
-
"@radix-ui/react-compose-refs": "1.1.0-rc.
|
|
33
|
-
"@radix-ui/react-context": "1.1.0-rc.
|
|
34
|
-
"@radix-ui/react-id": "1.1.0-rc.
|
|
35
|
-
"@radix-ui/react-menu": "2.1.0-rc.
|
|
36
|
-
"@radix-ui/react-primitive": "
|
|
37
|
-
"@radix-ui/react-use-controllable-state": "1.1.0-rc.
|
|
31
|
+
"@radix-ui/primitive": "1.1.0-rc.4",
|
|
32
|
+
"@radix-ui/react-compose-refs": "1.1.0-rc.4",
|
|
33
|
+
"@radix-ui/react-context": "1.1.0-rc.4",
|
|
34
|
+
"@radix-ui/react-id": "1.1.0-rc.4",
|
|
35
|
+
"@radix-ui/react-menu": "2.1.0-rc.4",
|
|
36
|
+
"@radix-ui/react-primitive": "2.0.0-rc.1",
|
|
37
|
+
"@radix-ui/react-use-controllable-state": "1.1.0-rc.4"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@types/react": "*",
|
|
41
41
|
"@types/react-dom": "*",
|
|
42
|
-
"react": "^16.8 || ^17.0 || ^18.0",
|
|
43
|
-
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
42
|
+
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0",
|
|
43
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependenciesMeta": {
|
|
46
46
|
"@types/react": {
|