@huin-core/react-dropdown-menu 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +111 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +438 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +406 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +3 -2
package/dist/index.d.mts
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
import * as React$1 from 'react';
|
2
|
+
import React__default from 'react';
|
3
|
+
import { Primitive } from '@huin-core/react-primitive';
|
4
|
+
import * as MenuPrimitive from '@huin-core/react-menu';
|
5
|
+
|
6
|
+
type Scope<C = any> = {
|
7
|
+
[scopeName: string]: React$1.Context<C>[];
|
8
|
+
} | undefined;
|
9
|
+
type ScopeHook = (scope: Scope) => {
|
10
|
+
[__scopeProp: string]: Scope;
|
11
|
+
};
|
12
|
+
interface CreateScope {
|
13
|
+
scopeName: string;
|
14
|
+
(): ScopeHook;
|
15
|
+
}
|
16
|
+
|
17
|
+
type Direction = "ltr" | "rtl";
|
18
|
+
declare const createDropdownMenuScope: CreateScope;
|
19
|
+
interface DropdownMenuProps {
|
20
|
+
children?: React$1.ReactNode;
|
21
|
+
dir?: Direction;
|
22
|
+
open?: boolean;
|
23
|
+
defaultOpen?: boolean;
|
24
|
+
onOpenChange?(open: boolean): void;
|
25
|
+
modal?: boolean;
|
26
|
+
}
|
27
|
+
declare const DropdownMenu: React$1.FC<DropdownMenuProps>;
|
28
|
+
declare const Root: React$1.FC<DropdownMenuProps>;
|
29
|
+
|
30
|
+
type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
|
31
|
+
interface DropdownMenuTriggerProps extends PrimitiveButtonProps {
|
32
|
+
}
|
33
|
+
declare const DropdownMenuTrigger: React__default.ForwardRefExoticComponent<DropdownMenuTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
34
|
+
|
35
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
36
|
+
interface DropdownMenuPortalProps extends MenuPortalProps {
|
37
|
+
}
|
38
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPortalProps>;
|
39
|
+
|
40
|
+
type MenuContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
41
|
+
interface DropdownMenuContentProps extends Omit<MenuContentProps, "onEntryFocus"> {
|
42
|
+
}
|
43
|
+
declare const DropdownMenuContent: React__default.ForwardRefExoticComponent<DropdownMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
44
|
+
|
45
|
+
type MenuGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
46
|
+
interface DropdownMenuGroupProps extends MenuGroupProps {
|
47
|
+
}
|
48
|
+
declare const DropdownMenuGroup: React__default.ForwardRefExoticComponent<DropdownMenuGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
49
|
+
|
50
|
+
type MenuLabelProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
51
|
+
interface DropdownMenuLabelProps extends MenuLabelProps {
|
52
|
+
inset?: boolean;
|
53
|
+
}
|
54
|
+
declare const DropdownMenuLabel: React__default.ForwardRefExoticComponent<DropdownMenuLabelProps & React__default.RefAttributes<HTMLDivElement>>;
|
55
|
+
|
56
|
+
type MenuItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
57
|
+
interface DropdownMenuItemProps extends MenuItemProps {
|
58
|
+
inset?: boolean;
|
59
|
+
}
|
60
|
+
declare const DropdownMenuItem: React__default.ForwardRefExoticComponent<DropdownMenuItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
61
|
+
|
62
|
+
type MenuCheckboxItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
63
|
+
interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
64
|
+
}
|
65
|
+
declare const DropdownMenuCheckboxItem: React__default.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
66
|
+
|
67
|
+
type MenuRadioGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
68
|
+
interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {
|
69
|
+
}
|
70
|
+
declare const DropdownMenuRadioGroup: React__default.ForwardRefExoticComponent<DropdownMenuRadioGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
71
|
+
|
72
|
+
type MenuRadioItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
73
|
+
interface DropdownMenuRadioItemProps extends MenuRadioItemProps {
|
74
|
+
}
|
75
|
+
declare const DropdownMenuRadioItem: React__default.ForwardRefExoticComponent<DropdownMenuRadioItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
76
|
+
|
77
|
+
type MenuItemIndicatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
78
|
+
interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
79
|
+
}
|
80
|
+
declare const DropdownMenuItemIndicator: React__default.ForwardRefExoticComponent<DropdownMenuItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
|
81
|
+
|
82
|
+
type MenuSeparatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
83
|
+
interface DropdownMenuSeparatorProps extends MenuSeparatorProps {
|
84
|
+
}
|
85
|
+
declare const DropdownMenuSeparator: React__default.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
86
|
+
|
87
|
+
type MenuArrowProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
88
|
+
interface DropdownMenuArrowProps extends MenuArrowProps {
|
89
|
+
}
|
90
|
+
declare const DropdownMenuArrow: React__default.ForwardRefExoticComponent<DropdownMenuArrowProps & React__default.RefAttributes<SVGSVGElement>>;
|
91
|
+
|
92
|
+
interface DropdownMenuSubProps {
|
93
|
+
children?: React.ReactNode;
|
94
|
+
open?: boolean;
|
95
|
+
defaultOpen?: boolean;
|
96
|
+
onOpenChange?(open: boolean): void;
|
97
|
+
}
|
98
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuSubProps>;
|
99
|
+
|
100
|
+
type MenuSubTriggerProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
101
|
+
interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {
|
102
|
+
inset?: boolean;
|
103
|
+
}
|
104
|
+
declare const DropdownMenuSubTrigger: React__default.ForwardRefExoticComponent<DropdownMenuSubTriggerProps & React__default.RefAttributes<HTMLDivElement>>;
|
105
|
+
|
106
|
+
type MenuSubContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
107
|
+
interface DropdownMenuSubContentProps extends MenuSubContentProps {
|
108
|
+
}
|
109
|
+
declare const DropdownMenuSubContent: React__default.ForwardRefExoticComponent<DropdownMenuSubContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
110
|
+
|
111
|
+
export { DropdownMenu, DropdownMenuArrow, type DropdownMenuArrowProps, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemIndicator, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, type DropdownMenuPortalProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, Root, createDropdownMenuScope };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
import * as React$1 from 'react';
|
2
|
+
import React__default from 'react';
|
3
|
+
import { Primitive } from '@huin-core/react-primitive';
|
4
|
+
import * as MenuPrimitive from '@huin-core/react-menu';
|
5
|
+
|
6
|
+
type Scope<C = any> = {
|
7
|
+
[scopeName: string]: React$1.Context<C>[];
|
8
|
+
} | undefined;
|
9
|
+
type ScopeHook = (scope: Scope) => {
|
10
|
+
[__scopeProp: string]: Scope;
|
11
|
+
};
|
12
|
+
interface CreateScope {
|
13
|
+
scopeName: string;
|
14
|
+
(): ScopeHook;
|
15
|
+
}
|
16
|
+
|
17
|
+
type Direction = "ltr" | "rtl";
|
18
|
+
declare const createDropdownMenuScope: CreateScope;
|
19
|
+
interface DropdownMenuProps {
|
20
|
+
children?: React$1.ReactNode;
|
21
|
+
dir?: Direction;
|
22
|
+
open?: boolean;
|
23
|
+
defaultOpen?: boolean;
|
24
|
+
onOpenChange?(open: boolean): void;
|
25
|
+
modal?: boolean;
|
26
|
+
}
|
27
|
+
declare const DropdownMenu: React$1.FC<DropdownMenuProps>;
|
28
|
+
declare const Root: React$1.FC<DropdownMenuProps>;
|
29
|
+
|
30
|
+
type PrimitiveButtonProps = React__default.ComponentPropsWithoutRef<typeof Primitive.button>;
|
31
|
+
interface DropdownMenuTriggerProps extends PrimitiveButtonProps {
|
32
|
+
}
|
33
|
+
declare const DropdownMenuTrigger: React__default.ForwardRefExoticComponent<DropdownMenuTriggerProps & React__default.RefAttributes<HTMLButtonElement>>;
|
34
|
+
|
35
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
36
|
+
interface DropdownMenuPortalProps extends MenuPortalProps {
|
37
|
+
}
|
38
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPortalProps>;
|
39
|
+
|
40
|
+
type MenuContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
41
|
+
interface DropdownMenuContentProps extends Omit<MenuContentProps, "onEntryFocus"> {
|
42
|
+
}
|
43
|
+
declare const DropdownMenuContent: React__default.ForwardRefExoticComponent<DropdownMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
44
|
+
|
45
|
+
type MenuGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
46
|
+
interface DropdownMenuGroupProps extends MenuGroupProps {
|
47
|
+
}
|
48
|
+
declare const DropdownMenuGroup: React__default.ForwardRefExoticComponent<DropdownMenuGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
49
|
+
|
50
|
+
type MenuLabelProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
51
|
+
interface DropdownMenuLabelProps extends MenuLabelProps {
|
52
|
+
inset?: boolean;
|
53
|
+
}
|
54
|
+
declare const DropdownMenuLabel: React__default.ForwardRefExoticComponent<DropdownMenuLabelProps & React__default.RefAttributes<HTMLDivElement>>;
|
55
|
+
|
56
|
+
type MenuItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
57
|
+
interface DropdownMenuItemProps extends MenuItemProps {
|
58
|
+
inset?: boolean;
|
59
|
+
}
|
60
|
+
declare const DropdownMenuItem: React__default.ForwardRefExoticComponent<DropdownMenuItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
61
|
+
|
62
|
+
type MenuCheckboxItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
63
|
+
interface DropdownMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
64
|
+
}
|
65
|
+
declare const DropdownMenuCheckboxItem: React__default.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
66
|
+
|
67
|
+
type MenuRadioGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
68
|
+
interface DropdownMenuRadioGroupProps extends MenuRadioGroupProps {
|
69
|
+
}
|
70
|
+
declare const DropdownMenuRadioGroup: React__default.ForwardRefExoticComponent<DropdownMenuRadioGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
71
|
+
|
72
|
+
type MenuRadioItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
73
|
+
interface DropdownMenuRadioItemProps extends MenuRadioItemProps {
|
74
|
+
}
|
75
|
+
declare const DropdownMenuRadioItem: React__default.ForwardRefExoticComponent<DropdownMenuRadioItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
76
|
+
|
77
|
+
type MenuItemIndicatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
78
|
+
interface DropdownMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
79
|
+
}
|
80
|
+
declare const DropdownMenuItemIndicator: React__default.ForwardRefExoticComponent<DropdownMenuItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
|
81
|
+
|
82
|
+
type MenuSeparatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
83
|
+
interface DropdownMenuSeparatorProps extends MenuSeparatorProps {
|
84
|
+
}
|
85
|
+
declare const DropdownMenuSeparator: React__default.ForwardRefExoticComponent<DropdownMenuSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
86
|
+
|
87
|
+
type MenuArrowProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
88
|
+
interface DropdownMenuArrowProps extends MenuArrowProps {
|
89
|
+
}
|
90
|
+
declare const DropdownMenuArrow: React__default.ForwardRefExoticComponent<DropdownMenuArrowProps & React__default.RefAttributes<SVGSVGElement>>;
|
91
|
+
|
92
|
+
interface DropdownMenuSubProps {
|
93
|
+
children?: React.ReactNode;
|
94
|
+
open?: boolean;
|
95
|
+
defaultOpen?: boolean;
|
96
|
+
onOpenChange?(open: boolean): void;
|
97
|
+
}
|
98
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuSubProps>;
|
99
|
+
|
100
|
+
type MenuSubTriggerProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
101
|
+
interface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {
|
102
|
+
inset?: boolean;
|
103
|
+
}
|
104
|
+
declare const DropdownMenuSubTrigger: React__default.ForwardRefExoticComponent<DropdownMenuSubTriggerProps & React__default.RefAttributes<HTMLDivElement>>;
|
105
|
+
|
106
|
+
type MenuSubContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
107
|
+
interface DropdownMenuSubContentProps extends MenuSubContentProps {
|
108
|
+
}
|
109
|
+
declare const DropdownMenuSubContent: React__default.ForwardRefExoticComponent<DropdownMenuSubContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
110
|
+
|
111
|
+
export { DropdownMenu, DropdownMenuArrow, type DropdownMenuArrowProps, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, DropdownMenuItemIndicator, type DropdownMenuItemIndicatorProps, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, type DropdownMenuPortalProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuSub, DropdownMenuSubContent, type DropdownMenuSubContentProps, type DropdownMenuSubProps, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, Root, createDropdownMenuScope };
|
package/dist/index.js
ADDED
@@ -0,0 +1,438 @@
|
|
1
|
+
"use strict";
|
2
|
+
"use client";
|
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
|
+
DropdownMenu: () => DropdownMenu,
|
35
|
+
DropdownMenuArrow: () => DropdownMenuArrow,
|
36
|
+
DropdownMenuCheckboxItem: () => DropdownMenuCheckboxItem,
|
37
|
+
DropdownMenuContent: () => DropdownMenuContent,
|
38
|
+
DropdownMenuGroup: () => DropdownMenuGroup,
|
39
|
+
DropdownMenuItem: () => DropdownMenuItem,
|
40
|
+
DropdownMenuItemIndicator: () => DropdownMenuItemIndicator,
|
41
|
+
DropdownMenuLabel: () => DropdownMenuLabel,
|
42
|
+
DropdownMenuPortal: () => DropdownMenuPortal,
|
43
|
+
DropdownMenuRadioGroup: () => DropdownMenuRadioGroup,
|
44
|
+
DropdownMenuRadioItem: () => DropdownMenuRadioItem,
|
45
|
+
DropdownMenuSeparator: () => DropdownMenuSeparator,
|
46
|
+
DropdownMenuSub: () => DropdownMenuSub,
|
47
|
+
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
48
|
+
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
49
|
+
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
50
|
+
Root: () => Root2,
|
51
|
+
createDropdownMenuScope: () => createDropdownMenuScope
|
52
|
+
});
|
53
|
+
module.exports = __toCommonJS(src_exports);
|
54
|
+
|
55
|
+
// packages/react/dropdown-menu/src/DropdownMenu.tsx
|
56
|
+
var React = __toESM(require("react"));
|
57
|
+
var import_react_context = require("@huin-core/react-context");
|
58
|
+
var import_react_use_controllable_state = require("@huin-core/react-use-controllable-state");
|
59
|
+
var MenuPrimitive = __toESM(require("@huin-core/react-menu"));
|
60
|
+
var import_react_menu = require("@huin-core/react-menu");
|
61
|
+
var import_react_id = require("@huin-core/react-id");
|
62
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
63
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
64
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = (0, import_react_context.createContextScope)(
|
65
|
+
DROPDOWN_MENU_NAME,
|
66
|
+
[import_react_menu.createMenuScope]
|
67
|
+
);
|
68
|
+
var useMenuScope = (0, import_react_menu.createMenuScope)();
|
69
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
70
|
+
var DropdownMenu = (props) => {
|
71
|
+
const {
|
72
|
+
__scopeDropdownMenu,
|
73
|
+
children,
|
74
|
+
dir,
|
75
|
+
open: openProp,
|
76
|
+
defaultOpen,
|
77
|
+
onOpenChange,
|
78
|
+
modal = true
|
79
|
+
} = props;
|
80
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
81
|
+
const triggerRef = React.useRef(null);
|
82
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
83
|
+
prop: openProp,
|
84
|
+
defaultProp: defaultOpen,
|
85
|
+
onChange: onOpenChange
|
86
|
+
});
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
88
|
+
DropdownMenuProvider,
|
89
|
+
{
|
90
|
+
scope: __scopeDropdownMenu,
|
91
|
+
triggerId: (0, import_react_id.useId)(),
|
92
|
+
triggerRef,
|
93
|
+
contentId: (0, import_react_id.useId)(),
|
94
|
+
open,
|
95
|
+
onOpenChange: setOpen,
|
96
|
+
onOpenToggle: React.useCallback(
|
97
|
+
() => setOpen((prevOpen) => !prevOpen),
|
98
|
+
[setOpen]
|
99
|
+
),
|
100
|
+
modal,
|
101
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
102
|
+
MenuPrimitive.Root,
|
103
|
+
{
|
104
|
+
...menuScope,
|
105
|
+
open,
|
106
|
+
onOpenChange: setOpen,
|
107
|
+
dir,
|
108
|
+
modal,
|
109
|
+
children
|
110
|
+
}
|
111
|
+
)
|
112
|
+
}
|
113
|
+
);
|
114
|
+
};
|
115
|
+
DropdownMenu.displayName = DROPDOWN_MENU_NAME;
|
116
|
+
var Root2 = DropdownMenu;
|
117
|
+
|
118
|
+
// packages/react/dropdown-menu/src/DropdownMenuTrigger.tsx
|
119
|
+
var import_react = __toESM(require("react"));
|
120
|
+
var import_react_primitive = require("@huin-core/react-primitive");
|
121
|
+
var MenuPrimitive2 = __toESM(require("@huin-core/react-menu"));
|
122
|
+
var import_react_compose_refs = require("@huin-core/react-compose-refs");
|
123
|
+
var import_primitive = require("@huin-core/primitive");
|
124
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
125
|
+
var TRIGGER_NAME = "DropdownMenuTrigger";
|
126
|
+
var DropdownMenuTrigger = import_react.default.forwardRef((props, forwardedRef) => {
|
127
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
128
|
+
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
129
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MenuPrimitive2.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
131
|
+
import_react_primitive.Primitive.button,
|
132
|
+
{
|
133
|
+
type: "button",
|
134
|
+
id: context.triggerId,
|
135
|
+
"aria-haspopup": "menu",
|
136
|
+
"aria-expanded": context.open,
|
137
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
138
|
+
"data-state": context.open ? "open" : "closed",
|
139
|
+
"data-disabled": disabled ? "" : void 0,
|
140
|
+
disabled,
|
141
|
+
...triggerProps,
|
142
|
+
ref: (0, import_react_compose_refs.composeRefs)(forwardedRef, context.triggerRef),
|
143
|
+
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => {
|
144
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
145
|
+
context.onOpenToggle();
|
146
|
+
if (!context.open) event.preventDefault();
|
147
|
+
}
|
148
|
+
}),
|
149
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
150
|
+
if (disabled) return;
|
151
|
+
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
152
|
+
if (event.key === "ArrowDown") context.onOpenChange(true);
|
153
|
+
if (["Enter", " ", "ArrowDown"].includes(event.key))
|
154
|
+
event.preventDefault();
|
155
|
+
})
|
156
|
+
}
|
157
|
+
) });
|
158
|
+
});
|
159
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
160
|
+
|
161
|
+
// packages/react/dropdown-menu/src/DropdownMenuPortal.tsx
|
162
|
+
var MenuPrimitive3 = __toESM(require("@huin-core/react-menu"));
|
163
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
164
|
+
var PORTAL_NAME = "DropdownMenuPortal";
|
165
|
+
var DropdownMenuPortal = (props) => {
|
166
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
167
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuPrimitive3.Portal, { ...menuScope, ...portalProps });
|
169
|
+
};
|
170
|
+
DropdownMenuPortal.displayName = PORTAL_NAME;
|
171
|
+
|
172
|
+
// packages/react/dropdown-menu/src/DropdownMenuContent.tsx
|
173
|
+
var MenuPrimitive4 = __toESM(require("@huin-core/react-menu"));
|
174
|
+
var import_react2 = __toESM(require("react"));
|
175
|
+
var import_primitive2 = require("@huin-core/primitive");
|
176
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
177
|
+
var CONTENT_NAME = "DropdownMenuContent";
|
178
|
+
var DropdownMenuContent = import_react2.default.forwardRef((props, forwardedRef) => {
|
179
|
+
const { __scopeDropdownMenu, ...contentProps } = props;
|
180
|
+
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
181
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
182
|
+
const hasInteractedOutsideRef = import_react2.default.useRef(false);
|
183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
184
|
+
MenuPrimitive4.Content,
|
185
|
+
{
|
186
|
+
id: context.contentId,
|
187
|
+
"aria-labelledby": context.triggerId,
|
188
|
+
...menuScope,
|
189
|
+
...contentProps,
|
190
|
+
ref: forwardedRef,
|
191
|
+
onCloseAutoFocus: (0, import_primitive2.composeEventHandlers)(
|
192
|
+
props.onCloseAutoFocus,
|
193
|
+
(event) => {
|
194
|
+
if (!hasInteractedOutsideRef.current)
|
195
|
+
context.triggerRef.current?.focus();
|
196
|
+
hasInteractedOutsideRef.current = false;
|
197
|
+
event.preventDefault();
|
198
|
+
}
|
199
|
+
),
|
200
|
+
onInteractOutside: (0, import_primitive2.composeEventHandlers)(
|
201
|
+
props.onInteractOutside,
|
202
|
+
(event) => {
|
203
|
+
const originalEvent = event.detail.originalEvent;
|
204
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
205
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
206
|
+
if (!context.modal || isRightClick)
|
207
|
+
hasInteractedOutsideRef.current = true;
|
208
|
+
}
|
209
|
+
),
|
210
|
+
style: {
|
211
|
+
...props.style,
|
212
|
+
// re-namespace exposed content custom properties
|
213
|
+
...{
|
214
|
+
"--huin-core-dropdown-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
215
|
+
"--huin-core-dropdown-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
216
|
+
"--huin-core-dropdown-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
217
|
+
"--huin-core-dropdown-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
218
|
+
"--huin-core-dropdown-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
);
|
223
|
+
});
|
224
|
+
DropdownMenuContent.displayName = CONTENT_NAME;
|
225
|
+
|
226
|
+
// packages/react/dropdown-menu/src/DropdownMenuGroup.tsx
|
227
|
+
var MenuPrimitive5 = __toESM(require("@huin-core/react-menu"));
|
228
|
+
var import_react3 = __toESM(require("react"));
|
229
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
230
|
+
var GROUP_NAME = "DropdownMenuGroup";
|
231
|
+
var DropdownMenuGroup = import_react3.default.forwardRef((props, forwardedRef) => {
|
232
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
233
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MenuPrimitive5.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
235
|
+
});
|
236
|
+
DropdownMenuGroup.displayName = GROUP_NAME;
|
237
|
+
|
238
|
+
// packages/react/dropdown-menu/src/DropdownMenuLabel.tsx
|
239
|
+
var MenuPrimitive6 = __toESM(require("@huin-core/react-menu"));
|
240
|
+
var import_react4 = __toESM(require("react"));
|
241
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
242
|
+
var LABEL_NAME = "DropdownMenuLabel";
|
243
|
+
var DropdownMenuLabel = import_react4.default.forwardRef((props, forwardedRef) => {
|
244
|
+
const { __scopeDropdownMenu, inset, ...labelProps } = props;
|
245
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuPrimitive6.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
247
|
+
});
|
248
|
+
DropdownMenuLabel.displayName = LABEL_NAME;
|
249
|
+
|
250
|
+
// packages/react/dropdown-menu/src/DropdownMenuItem.tsx
|
251
|
+
var MenuPrimitive7 = __toESM(require("@huin-core/react-menu"));
|
252
|
+
var import_react5 = __toESM(require("react"));
|
253
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
254
|
+
var ITEM_NAME = "DropdownMenuItem";
|
255
|
+
var DropdownMenuItem = import_react5.default.forwardRef((props, forwardedRef) => {
|
256
|
+
const { __scopeDropdownMenu, inset, ...itemProps } = props;
|
257
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPrimitive7.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
259
|
+
});
|
260
|
+
DropdownMenuItem.displayName = ITEM_NAME;
|
261
|
+
|
262
|
+
// packages/react/dropdown-menu/src/DropdownMenuCheckboxItem.tsx
|
263
|
+
var MenuPrimitive8 = __toESM(require("@huin-core/react-menu"));
|
264
|
+
var import_react6 = __toESM(require("react"));
|
265
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
266
|
+
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
267
|
+
var DropdownMenuCheckboxItem = import_react6.default.forwardRef((props, forwardedRef) => {
|
268
|
+
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
269
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
271
|
+
MenuPrimitive8.CheckboxItem,
|
272
|
+
{
|
273
|
+
...menuScope,
|
274
|
+
...checkboxItemProps,
|
275
|
+
ref: forwardedRef
|
276
|
+
}
|
277
|
+
);
|
278
|
+
});
|
279
|
+
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
280
|
+
|
281
|
+
// packages/react/dropdown-menu/src/DropdownMenuRadioGroup.tsx
|
282
|
+
var MenuPrimitive9 = __toESM(require("@huin-core/react-menu"));
|
283
|
+
var import_react7 = __toESM(require("react"));
|
284
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
285
|
+
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
286
|
+
var DropdownMenuRadioGroup = import_react7.default.forwardRef((props, forwardedRef) => {
|
287
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
288
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
290
|
+
MenuPrimitive9.RadioGroup,
|
291
|
+
{
|
292
|
+
...menuScope,
|
293
|
+
...radioGroupProps,
|
294
|
+
ref: forwardedRef
|
295
|
+
}
|
296
|
+
);
|
297
|
+
});
|
298
|
+
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
299
|
+
|
300
|
+
// packages/react/dropdown-menu/src/DropdownMenuRadioItem.tsx
|
301
|
+
var MenuPrimitive10 = __toESM(require("@huin-core/react-menu"));
|
302
|
+
var import_react8 = __toESM(require("react"));
|
303
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
304
|
+
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
305
|
+
var DropdownMenuRadioItem = import_react8.default.forwardRef((props, forwardedRef) => {
|
306
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
307
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
309
|
+
MenuPrimitive10.RadioItem,
|
310
|
+
{
|
311
|
+
...menuScope,
|
312
|
+
...radioItemProps,
|
313
|
+
ref: forwardedRef
|
314
|
+
}
|
315
|
+
);
|
316
|
+
});
|
317
|
+
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
318
|
+
|
319
|
+
// packages/react/dropdown-menu/src/DropdownMenuItemIndicator.tsx
|
320
|
+
var MenuPrimitive11 = __toESM(require("@huin-core/react-menu"));
|
321
|
+
var import_react9 = __toESM(require("react"));
|
322
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
323
|
+
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
324
|
+
var DropdownMenuItemIndicator = import_react9.default.forwardRef((props, forwardedRef) => {
|
325
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
326
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
328
|
+
MenuPrimitive11.ItemIndicator,
|
329
|
+
{
|
330
|
+
...menuScope,
|
331
|
+
...itemIndicatorProps,
|
332
|
+
ref: forwardedRef
|
333
|
+
}
|
334
|
+
);
|
335
|
+
});
|
336
|
+
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
337
|
+
|
338
|
+
// packages/react/dropdown-menu/src/DropdownMenuSeparator.tsx
|
339
|
+
var MenuPrimitive12 = __toESM(require("@huin-core/react-menu"));
|
340
|
+
var import_react10 = __toESM(require("react"));
|
341
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
342
|
+
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
343
|
+
var DropdownMenuSeparator = import_react10.default.forwardRef((props, forwardedRef) => {
|
344
|
+
const { __scopeDropdownMenu, ...separatorProps } = props;
|
345
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
347
|
+
MenuPrimitive12.Separator,
|
348
|
+
{
|
349
|
+
...menuScope,
|
350
|
+
...separatorProps,
|
351
|
+
ref: forwardedRef
|
352
|
+
}
|
353
|
+
);
|
354
|
+
});
|
355
|
+
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
356
|
+
|
357
|
+
// packages/react/dropdown-menu/src/DropdownMenuArrow.tsx
|
358
|
+
var MenuPrimitive13 = __toESM(require("@huin-core/react-menu"));
|
359
|
+
var import_react11 = __toESM(require("react"));
|
360
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
361
|
+
var ARROW_NAME = "DropdownMenuArrow";
|
362
|
+
var DropdownMenuArrow = import_react11.default.forwardRef((props, forwardedRef) => {
|
363
|
+
const { __scopeDropdownMenu, ...arrowProps } = props;
|
364
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuPrimitive13.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
366
|
+
});
|
367
|
+
DropdownMenuArrow.displayName = ARROW_NAME;
|
368
|
+
|
369
|
+
// packages/react/dropdown-menu/src/DropdownMenuSub.tsx
|
370
|
+
var MenuPrimitive14 = __toESM(require("@huin-core/react-menu"));
|
371
|
+
var import_react_use_controllable_state2 = require("@huin-core/react-use-controllable-state");
|
372
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
373
|
+
var DropdownMenuSub = (props) => {
|
374
|
+
const {
|
375
|
+
__scopeDropdownMenu,
|
376
|
+
children,
|
377
|
+
open: openProp,
|
378
|
+
onOpenChange,
|
379
|
+
defaultOpen
|
380
|
+
} = props;
|
381
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
382
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state2.useControllableState)({
|
383
|
+
prop: openProp,
|
384
|
+
defaultProp: defaultOpen,
|
385
|
+
onChange: onOpenChange
|
386
|
+
});
|
387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuPrimitive14.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
388
|
+
};
|
389
|
+
|
390
|
+
// packages/react/dropdown-menu/src/DropdownMenuSubTrigger.tsx
|
391
|
+
var MenuPrimitive15 = __toESM(require("@huin-core/react-menu"));
|
392
|
+
var import_react12 = __toESM(require("react"));
|
393
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
394
|
+
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
395
|
+
var DropdownMenuSubTrigger = import_react12.default.forwardRef((props, forwardedRef) => {
|
396
|
+
const { __scopeDropdownMenu, inset, ...subTriggerProps } = props;
|
397
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
399
|
+
MenuPrimitive15.SubTrigger,
|
400
|
+
{
|
401
|
+
...menuScope,
|
402
|
+
...subTriggerProps,
|
403
|
+
ref: forwardedRef
|
404
|
+
}
|
405
|
+
);
|
406
|
+
});
|
407
|
+
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
408
|
+
|
409
|
+
// packages/react/dropdown-menu/src/DropdownMenuSubContent.tsx
|
410
|
+
var MenuPrimitive16 = __toESM(require("@huin-core/react-menu"));
|
411
|
+
var import_react13 = __toESM(require("react"));
|
412
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
413
|
+
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
414
|
+
var DropdownMenuSubContent = import_react13.default.forwardRef((props, forwardedRef) => {
|
415
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
416
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
418
|
+
MenuPrimitive16.SubContent,
|
419
|
+
{
|
420
|
+
...menuScope,
|
421
|
+
...subContentProps,
|
422
|
+
ref: forwardedRef,
|
423
|
+
style: {
|
424
|
+
...props.style,
|
425
|
+
// re-namespace exposed content custom properties
|
426
|
+
...{
|
427
|
+
"--huin-core-dropdown-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
428
|
+
"--huin-core-dropdown-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
429
|
+
"--huin-core-dropdown-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
430
|
+
"--huin-core-dropdown-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
431
|
+
"--huin-core-dropdown-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
432
|
+
}
|
433
|
+
}
|
434
|
+
}
|
435
|
+
);
|
436
|
+
});
|
437
|
+
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
438
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/index.ts", "../src/DropdownMenu.tsx", "../src/DropdownMenuTrigger.tsx", "../src/DropdownMenuPortal.tsx", "../src/DropdownMenuContent.tsx", "../src/DropdownMenuGroup.tsx", "../src/DropdownMenuLabel.tsx", "../src/DropdownMenuItem.tsx", "../src/DropdownMenuCheckboxItem.tsx", "../src/DropdownMenuRadioGroup.tsx", "../src/DropdownMenuRadioItem.tsx", "../src/DropdownMenuItemIndicator.tsx", "../src/DropdownMenuSeparator.tsx", "../src/DropdownMenuArrow.tsx", "../src/DropdownMenuSub.tsx", "../src/DropdownMenuSubTrigger.tsx", "../src/DropdownMenuSubContent.tsx"],
|
4
|
+
"sourcesContent": ["\"use client\";\nexport { createDropdownMenuScope, DropdownMenu, Root } from \"./DropdownMenu\";\nexport { DropdownMenuTrigger } from \"./DropdownMenuTrigger\";\nexport { DropdownMenuPortal } from \"./DropdownMenuPortal\";\nexport { DropdownMenuContent } from \"./DropdownMenuContent\";\nexport { DropdownMenuGroup } from \"./DropdownMenuGroup\";\nexport { DropdownMenuLabel } from \"./DropdownMenuLabel\";\nexport { DropdownMenuItem } from \"./DropdownMenuItem\";\nexport { DropdownMenuCheckboxItem } from \"./DropdownMenuCheckboxItem\";\nexport { DropdownMenuRadioGroup } from \"./DropdownMenuRadioGroup\";\nexport { DropdownMenuRadioItem } from \"./DropdownMenuRadioItem\";\nexport { DropdownMenuItemIndicator } from \"./DropdownMenuItemIndicator\";\nexport { DropdownMenuSeparator } from \"./DropdownMenuSeparator\";\nexport { DropdownMenuArrow } from \"./DropdownMenuArrow\";\nexport { DropdownMenuSub } from \"./DropdownMenuSub\";\nexport { DropdownMenuSubTrigger } from \"./DropdownMenuSubTrigger\";\nexport { DropdownMenuSubContent } from \"./DropdownMenuSubContent\";\n\nexport type { DropdownMenuProps } from \"./DropdownMenu\";\nexport type { DropdownMenuTriggerProps } from \"./DropdownMenuTrigger\";\nexport type { DropdownMenuPortalProps } from \"./DropdownMenuPortal\";\nexport type { DropdownMenuContentProps } from \"./DropdownMenuContent\";\nexport type { DropdownMenuGroupProps } from \"./DropdownMenuGroup\";\nexport type { DropdownMenuLabelProps } from \"./DropdownMenuLabel\";\nexport type { DropdownMenuItemProps } from \"./DropdownMenuItem\";\nexport type { DropdownMenuCheckboxItemProps } from \"./DropdownMenuCheckboxItem\";\nexport type { DropdownMenuRadioGroupProps } from \"./DropdownMenuRadioGroup\";\nexport type { DropdownMenuRadioItemProps } from \"./DropdownMenuRadioItem\";\nexport type { DropdownMenuItemIndicatorProps } from \"./DropdownMenuItemIndicator\";\nexport type { DropdownMenuSeparatorProps } from \"./DropdownMenuSeparator\";\nexport type { DropdownMenuArrowProps } from \"./DropdownMenuArrow\";\nexport type { DropdownMenuSubProps } from \"./DropdownMenuSub\";\nexport type { DropdownMenuSubTriggerProps } from \"./DropdownMenuSubTrigger\";\nexport type { DropdownMenuSubContentProps } from \"./DropdownMenuSubContent\";\n", "import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { createMenuScope } from \"@huin-core/react-menu\";\nimport { useId } from \"@huin-core/react-id\";\n\nimport type { Scope } from \"@huin-core/react-context\";\n\ntype Direction = \"ltr\" | \"rtl\";\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = \"DropdownMenu\";\n\nexport type ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nexport const 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\nexport const [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> = (\n props: ScopedProps<DropdownMenuProps>\n) => {\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(\n () => setOpen((prevOpen) => !prevOpen),\n [setOpen]\n )}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n open={open}\n onOpenChange={setOpen}\n dir={dir}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n //\n Root,\n};\nexport type { DropdownMenuProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport {\n ScopedProps,\n useDropdownMenuContext,\n useMenuScope,\n} from \"./DropdownMenu\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { composeRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"DropdownMenuTrigger\";\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<\n DropdownMenuTriggerElement,\n 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))\n event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n});\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\nexport { DropdownMenuTrigger };\nexport type { DropdownMenuTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst PORTAL_NAME = \"DropdownMenuPortal\";\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Portal\n>;\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\nexport { DropdownMenuPortal };\nexport type { DropdownMenuPortalProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport {\n ScopedProps,\n useDropdownMenuContext,\n useMenuScope,\n} from \"./DropdownMenu\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst CONTENT_NAME = \"DropdownMenuContent\";\n\ntype DropdownMenuContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Content\n>;\ninterface DropdownMenuContentProps\n extends Omit<MenuContentProps, \"onEntryFocus\"> {}\n\nconst DropdownMenuContent = React.forwardRef<\n DropdownMenuContentElement,\n 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(\n props.onCloseAutoFocus,\n (event) => {\n if (!hasInteractedOutsideRef.current)\n 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 )}\n onInteractOutside={composeEventHandlers(\n props.onInteractOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick =\n originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick)\n hasInteractedOutsideRef.current = true;\n }\n )}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-dropdown-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-dropdown-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-dropdown-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-dropdown-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-dropdown-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\nexport { DropdownMenuContent };\nexport type { DropdownMenuContentProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst GROUP_NAME = \"DropdownMenuGroup\";\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Group\n>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<\n DropdownMenuGroupElement,\n DropdownMenuGroupProps\n>((props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\nexport { DropdownMenuGroup };\nexport type { DropdownMenuGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst LABEL_NAME = \"DropdownMenuLabel\";\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Label\n>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {\n inset?: boolean;\n}\n\nconst DropdownMenuLabel = React.forwardRef<\n DropdownMenuLabelElement,\n DropdownMenuLabelProps\n>((props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\nexport { DropdownMenuLabel };\nexport type { DropdownMenuLabelProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\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 inset?: boolean;\n}\n\nconst DropdownMenuItem = React.forwardRef<\n DropdownMenuItemElement,\n DropdownMenuItemProps\n>((props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\nexport { DropdownMenuItem };\nexport type { DropdownMenuItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\nconst CHECKBOX_ITEM_NAME = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.CheckboxItem\n>;\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 (\n <MenuPrimitive.CheckboxItem\n {...menuScope}\n {...checkboxItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\nexport { DropdownMenuCheckboxItem };\nexport type { DropdownMenuCheckboxItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst RADIO_GROUP_NAME = \"DropdownMenuRadioGroup\";\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<\n typeof MenuPrimitive.RadioGroup\n>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioGroup\n>;\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 (\n <MenuPrimitive.RadioGroup\n {...menuScope}\n {...radioGroupProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\nexport { DropdownMenuRadioGroup };\nexport type { DropdownMenuRadioGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst RADIO_ITEM_NAME = \"DropdownMenuRadioItem\";\n\ntype DropdownMenuRadioItemElement = React.ElementRef<\n typeof MenuPrimitive.RadioItem\n>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioItem\n>;\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 (\n <MenuPrimitive.RadioItem\n {...menuScope}\n {...radioItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\nexport { DropdownMenuRadioItem };\nexport type { DropdownMenuRadioItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst INDICATOR_NAME = \"DropdownMenuItemIndicator\";\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.ItemIndicator\n>;\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 (\n <MenuPrimitive.ItemIndicator\n {...menuScope}\n {...itemIndicatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\nexport { DropdownMenuItemIndicator };\nexport type { DropdownMenuItemIndicatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SEPARATOR_NAME = \"DropdownMenuSeparator\";\n\ntype DropdownMenuSeparatorElement = React.ElementRef<\n typeof MenuPrimitive.Separator\n>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Separator\n>;\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 (\n <MenuPrimitive.Separator\n {...menuScope}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\nexport { DropdownMenuSeparator };\nexport type { DropdownMenuSeparatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst ARROW_NAME = \"DropdownMenuArrow\";\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Arrow\n>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<\n DropdownMenuArrowElement,\n DropdownMenuArrowProps\n>((props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\nexport { DropdownMenuArrow };\nexport type { DropdownMenuArrowProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\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 {\n __scopeDropdownMenu,\n children,\n open: openProp,\n onOpenChange,\n defaultOpen,\n } = 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\nexport { DropdownMenuSub };\nexport type { DropdownMenuSubProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SUB_TRIGGER_NAME = \"DropdownMenuSubTrigger\";\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<\n typeof MenuPrimitive.SubTrigger\n>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubTrigger\n>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {\n inset?: boolean;\n}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.SubTrigger\n {...menuScope}\n {...subTriggerProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\nexport { DropdownMenuSubTrigger };\nexport type { DropdownMenuSubTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SUB_CONTENT_NAME = \"DropdownMenuSubContent\";\n\ntype DropdownMenuSubContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubContent\n>;\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 \"--huin-core-dropdown-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-dropdown-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-dropdown-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-dropdown-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-dropdown-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\nexport { DropdownMenuSubContent };\nexport type { DropdownMenuSubContentProps };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,0CAAqC;AACrC,oBAA+B;AAC/B,wBAAgC;AAChC,sBAAsB;AA2EhB;AAjEN,IAAM,qBAAqB;AAG3B,IAAM,CAAC,2BAA2B,uBAAuB,QAAI;AAAA,EAC3D;AAAA,EACA,CAAC,iCAAe;AAClB;AACO,IAAM,mBAAe,mCAAgB;AAYrC,IAAM,CAAC,sBAAsB,sBAAsB,IACxD,0BAAoD,kBAAkB;AAWxE,IAAM,eAA4C,CAChD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AACJ,QAAM,YAAY,aAAa,mBAAmB;AAClD,QAAM,aAAmB,aAA0B,IAAI;AACvD,QAAM,CAAC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AI;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,sDACE;AAAA,UACF,qDACE;AAAA,UACF,sDACE;AAAA,UACF,2CACE;AAAA,UACF,4CACE;AAAA,QACJ;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,uBAAuB,cAAc;",
|
6
|
+
"names": ["Root", "Root", "MenuPrimitive", "import_jsx_runtime", "React", "MenuPrimitive", "import_jsx_runtime", "MenuPrimitive", "import_react", "import_primitive", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react_use_controllable_state", "import_jsx_runtime", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React"]
|
7
|
+
}
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,406 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// packages/react/dropdown-menu/src/DropdownMenu.tsx
|
4
|
+
import * as React from "react";
|
5
|
+
import { createContextScope } from "@huin-core/react-context";
|
6
|
+
import { useControllableState } from "@huin-core/react-use-controllable-state";
|
7
|
+
import * as MenuPrimitive from "@huin-core/react-menu";
|
8
|
+
import { createMenuScope } from "@huin-core/react-menu";
|
9
|
+
import { useId } from "@huin-core/react-id";
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
11
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
12
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
13
|
+
DROPDOWN_MENU_NAME,
|
14
|
+
[createMenuScope]
|
15
|
+
);
|
16
|
+
var useMenuScope = createMenuScope();
|
17
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
18
|
+
var DropdownMenu = (props) => {
|
19
|
+
const {
|
20
|
+
__scopeDropdownMenu,
|
21
|
+
children,
|
22
|
+
dir,
|
23
|
+
open: openProp,
|
24
|
+
defaultOpen,
|
25
|
+
onOpenChange,
|
26
|
+
modal = true
|
27
|
+
} = props;
|
28
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
29
|
+
const triggerRef = React.useRef(null);
|
30
|
+
const [open = false, setOpen] = useControllableState({
|
31
|
+
prop: openProp,
|
32
|
+
defaultProp: defaultOpen,
|
33
|
+
onChange: onOpenChange
|
34
|
+
});
|
35
|
+
return /* @__PURE__ */ jsx(
|
36
|
+
DropdownMenuProvider,
|
37
|
+
{
|
38
|
+
scope: __scopeDropdownMenu,
|
39
|
+
triggerId: useId(),
|
40
|
+
triggerRef,
|
41
|
+
contentId: useId(),
|
42
|
+
open,
|
43
|
+
onOpenChange: setOpen,
|
44
|
+
onOpenToggle: React.useCallback(
|
45
|
+
() => setOpen((prevOpen) => !prevOpen),
|
46
|
+
[setOpen]
|
47
|
+
),
|
48
|
+
modal,
|
49
|
+
children: /* @__PURE__ */ jsx(
|
50
|
+
MenuPrimitive.Root,
|
51
|
+
{
|
52
|
+
...menuScope,
|
53
|
+
open,
|
54
|
+
onOpenChange: setOpen,
|
55
|
+
dir,
|
56
|
+
modal,
|
57
|
+
children
|
58
|
+
}
|
59
|
+
)
|
60
|
+
}
|
61
|
+
);
|
62
|
+
};
|
63
|
+
DropdownMenu.displayName = DROPDOWN_MENU_NAME;
|
64
|
+
var Root2 = DropdownMenu;
|
65
|
+
|
66
|
+
// packages/react/dropdown-menu/src/DropdownMenuTrigger.tsx
|
67
|
+
import React2 from "react";
|
68
|
+
import { Primitive } from "@huin-core/react-primitive";
|
69
|
+
import * as MenuPrimitive2 from "@huin-core/react-menu";
|
70
|
+
import { composeRefs } from "@huin-core/react-compose-refs";
|
71
|
+
import { composeEventHandlers } from "@huin-core/primitive";
|
72
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
73
|
+
var TRIGGER_NAME = "DropdownMenuTrigger";
|
74
|
+
var DropdownMenuTrigger = React2.forwardRef((props, forwardedRef) => {
|
75
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
76
|
+
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
77
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
78
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive2.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx2(
|
79
|
+
Primitive.button,
|
80
|
+
{
|
81
|
+
type: "button",
|
82
|
+
id: context.triggerId,
|
83
|
+
"aria-haspopup": "menu",
|
84
|
+
"aria-expanded": context.open,
|
85
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
86
|
+
"data-state": context.open ? "open" : "closed",
|
87
|
+
"data-disabled": disabled ? "" : void 0,
|
88
|
+
disabled,
|
89
|
+
...triggerProps,
|
90
|
+
ref: composeRefs(forwardedRef, context.triggerRef),
|
91
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
92
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
93
|
+
context.onOpenToggle();
|
94
|
+
if (!context.open) event.preventDefault();
|
95
|
+
}
|
96
|
+
}),
|
97
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
98
|
+
if (disabled) return;
|
99
|
+
if (["Enter", " "].includes(event.key)) context.onOpenToggle();
|
100
|
+
if (event.key === "ArrowDown") context.onOpenChange(true);
|
101
|
+
if (["Enter", " ", "ArrowDown"].includes(event.key))
|
102
|
+
event.preventDefault();
|
103
|
+
})
|
104
|
+
}
|
105
|
+
) });
|
106
|
+
});
|
107
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
108
|
+
|
109
|
+
// packages/react/dropdown-menu/src/DropdownMenuPortal.tsx
|
110
|
+
import * as MenuPrimitive3 from "@huin-core/react-menu";
|
111
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
112
|
+
var PORTAL_NAME = "DropdownMenuPortal";
|
113
|
+
var DropdownMenuPortal = (props) => {
|
114
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
115
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
116
|
+
return /* @__PURE__ */ jsx3(MenuPrimitive3.Portal, { ...menuScope, ...portalProps });
|
117
|
+
};
|
118
|
+
DropdownMenuPortal.displayName = PORTAL_NAME;
|
119
|
+
|
120
|
+
// packages/react/dropdown-menu/src/DropdownMenuContent.tsx
|
121
|
+
import * as MenuPrimitive4 from "@huin-core/react-menu";
|
122
|
+
import React3 from "react";
|
123
|
+
import { composeEventHandlers as composeEventHandlers2 } from "@huin-core/primitive";
|
124
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
125
|
+
var CONTENT_NAME = "DropdownMenuContent";
|
126
|
+
var DropdownMenuContent = React3.forwardRef((props, forwardedRef) => {
|
127
|
+
const { __scopeDropdownMenu, ...contentProps } = props;
|
128
|
+
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
129
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
130
|
+
const hasInteractedOutsideRef = React3.useRef(false);
|
131
|
+
return /* @__PURE__ */ jsx4(
|
132
|
+
MenuPrimitive4.Content,
|
133
|
+
{
|
134
|
+
id: context.contentId,
|
135
|
+
"aria-labelledby": context.triggerId,
|
136
|
+
...menuScope,
|
137
|
+
...contentProps,
|
138
|
+
ref: forwardedRef,
|
139
|
+
onCloseAutoFocus: composeEventHandlers2(
|
140
|
+
props.onCloseAutoFocus,
|
141
|
+
(event) => {
|
142
|
+
if (!hasInteractedOutsideRef.current)
|
143
|
+
context.triggerRef.current?.focus();
|
144
|
+
hasInteractedOutsideRef.current = false;
|
145
|
+
event.preventDefault();
|
146
|
+
}
|
147
|
+
),
|
148
|
+
onInteractOutside: composeEventHandlers2(
|
149
|
+
props.onInteractOutside,
|
150
|
+
(event) => {
|
151
|
+
const originalEvent = event.detail.originalEvent;
|
152
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
153
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
154
|
+
if (!context.modal || isRightClick)
|
155
|
+
hasInteractedOutsideRef.current = true;
|
156
|
+
}
|
157
|
+
),
|
158
|
+
style: {
|
159
|
+
...props.style,
|
160
|
+
// re-namespace exposed content custom properties
|
161
|
+
...{
|
162
|
+
"--huin-core-dropdown-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
163
|
+
"--huin-core-dropdown-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
164
|
+
"--huin-core-dropdown-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
165
|
+
"--huin-core-dropdown-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
166
|
+
"--huin-core-dropdown-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
);
|
171
|
+
});
|
172
|
+
DropdownMenuContent.displayName = CONTENT_NAME;
|
173
|
+
|
174
|
+
// packages/react/dropdown-menu/src/DropdownMenuGroup.tsx
|
175
|
+
import * as MenuPrimitive5 from "@huin-core/react-menu";
|
176
|
+
import React4 from "react";
|
177
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
178
|
+
var GROUP_NAME = "DropdownMenuGroup";
|
179
|
+
var DropdownMenuGroup = React4.forwardRef((props, forwardedRef) => {
|
180
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
181
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
182
|
+
return /* @__PURE__ */ jsx5(MenuPrimitive5.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
183
|
+
});
|
184
|
+
DropdownMenuGroup.displayName = GROUP_NAME;
|
185
|
+
|
186
|
+
// packages/react/dropdown-menu/src/DropdownMenuLabel.tsx
|
187
|
+
import * as MenuPrimitive6 from "@huin-core/react-menu";
|
188
|
+
import React5 from "react";
|
189
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
190
|
+
var LABEL_NAME = "DropdownMenuLabel";
|
191
|
+
var DropdownMenuLabel = React5.forwardRef((props, forwardedRef) => {
|
192
|
+
const { __scopeDropdownMenu, inset, ...labelProps } = props;
|
193
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
194
|
+
return /* @__PURE__ */ jsx6(MenuPrimitive6.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
195
|
+
});
|
196
|
+
DropdownMenuLabel.displayName = LABEL_NAME;
|
197
|
+
|
198
|
+
// packages/react/dropdown-menu/src/DropdownMenuItem.tsx
|
199
|
+
import * as MenuPrimitive7 from "@huin-core/react-menu";
|
200
|
+
import React6 from "react";
|
201
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
202
|
+
var ITEM_NAME = "DropdownMenuItem";
|
203
|
+
var DropdownMenuItem = React6.forwardRef((props, forwardedRef) => {
|
204
|
+
const { __scopeDropdownMenu, inset, ...itemProps } = props;
|
205
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
206
|
+
return /* @__PURE__ */ jsx7(MenuPrimitive7.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
207
|
+
});
|
208
|
+
DropdownMenuItem.displayName = ITEM_NAME;
|
209
|
+
|
210
|
+
// packages/react/dropdown-menu/src/DropdownMenuCheckboxItem.tsx
|
211
|
+
import * as MenuPrimitive8 from "@huin-core/react-menu";
|
212
|
+
import React7 from "react";
|
213
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
214
|
+
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
215
|
+
var DropdownMenuCheckboxItem = React7.forwardRef((props, forwardedRef) => {
|
216
|
+
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
217
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
218
|
+
return /* @__PURE__ */ jsx8(
|
219
|
+
MenuPrimitive8.CheckboxItem,
|
220
|
+
{
|
221
|
+
...menuScope,
|
222
|
+
...checkboxItemProps,
|
223
|
+
ref: forwardedRef
|
224
|
+
}
|
225
|
+
);
|
226
|
+
});
|
227
|
+
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
228
|
+
|
229
|
+
// packages/react/dropdown-menu/src/DropdownMenuRadioGroup.tsx
|
230
|
+
import * as MenuPrimitive9 from "@huin-core/react-menu";
|
231
|
+
import React8 from "react";
|
232
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
233
|
+
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
234
|
+
var DropdownMenuRadioGroup = React8.forwardRef((props, forwardedRef) => {
|
235
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
236
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
237
|
+
return /* @__PURE__ */ jsx9(
|
238
|
+
MenuPrimitive9.RadioGroup,
|
239
|
+
{
|
240
|
+
...menuScope,
|
241
|
+
...radioGroupProps,
|
242
|
+
ref: forwardedRef
|
243
|
+
}
|
244
|
+
);
|
245
|
+
});
|
246
|
+
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
247
|
+
|
248
|
+
// packages/react/dropdown-menu/src/DropdownMenuRadioItem.tsx
|
249
|
+
import * as MenuPrimitive10 from "@huin-core/react-menu";
|
250
|
+
import React9 from "react";
|
251
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
252
|
+
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
253
|
+
var DropdownMenuRadioItem = React9.forwardRef((props, forwardedRef) => {
|
254
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
255
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
256
|
+
return /* @__PURE__ */ jsx10(
|
257
|
+
MenuPrimitive10.RadioItem,
|
258
|
+
{
|
259
|
+
...menuScope,
|
260
|
+
...radioItemProps,
|
261
|
+
ref: forwardedRef
|
262
|
+
}
|
263
|
+
);
|
264
|
+
});
|
265
|
+
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
266
|
+
|
267
|
+
// packages/react/dropdown-menu/src/DropdownMenuItemIndicator.tsx
|
268
|
+
import * as MenuPrimitive11 from "@huin-core/react-menu";
|
269
|
+
import React10 from "react";
|
270
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
271
|
+
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
272
|
+
var DropdownMenuItemIndicator = React10.forwardRef((props, forwardedRef) => {
|
273
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
274
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
275
|
+
return /* @__PURE__ */ jsx11(
|
276
|
+
MenuPrimitive11.ItemIndicator,
|
277
|
+
{
|
278
|
+
...menuScope,
|
279
|
+
...itemIndicatorProps,
|
280
|
+
ref: forwardedRef
|
281
|
+
}
|
282
|
+
);
|
283
|
+
});
|
284
|
+
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
285
|
+
|
286
|
+
// packages/react/dropdown-menu/src/DropdownMenuSeparator.tsx
|
287
|
+
import * as MenuPrimitive12 from "@huin-core/react-menu";
|
288
|
+
import React11 from "react";
|
289
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
290
|
+
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
291
|
+
var DropdownMenuSeparator = React11.forwardRef((props, forwardedRef) => {
|
292
|
+
const { __scopeDropdownMenu, ...separatorProps } = props;
|
293
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
294
|
+
return /* @__PURE__ */ jsx12(
|
295
|
+
MenuPrimitive12.Separator,
|
296
|
+
{
|
297
|
+
...menuScope,
|
298
|
+
...separatorProps,
|
299
|
+
ref: forwardedRef
|
300
|
+
}
|
301
|
+
);
|
302
|
+
});
|
303
|
+
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
304
|
+
|
305
|
+
// packages/react/dropdown-menu/src/DropdownMenuArrow.tsx
|
306
|
+
import * as MenuPrimitive13 from "@huin-core/react-menu";
|
307
|
+
import React12 from "react";
|
308
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
309
|
+
var ARROW_NAME = "DropdownMenuArrow";
|
310
|
+
var DropdownMenuArrow = React12.forwardRef((props, forwardedRef) => {
|
311
|
+
const { __scopeDropdownMenu, ...arrowProps } = props;
|
312
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
313
|
+
return /* @__PURE__ */ jsx13(MenuPrimitive13.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
314
|
+
});
|
315
|
+
DropdownMenuArrow.displayName = ARROW_NAME;
|
316
|
+
|
317
|
+
// packages/react/dropdown-menu/src/DropdownMenuSub.tsx
|
318
|
+
import * as MenuPrimitive14 from "@huin-core/react-menu";
|
319
|
+
import { useControllableState as useControllableState2 } from "@huin-core/react-use-controllable-state";
|
320
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
321
|
+
var DropdownMenuSub = (props) => {
|
322
|
+
const {
|
323
|
+
__scopeDropdownMenu,
|
324
|
+
children,
|
325
|
+
open: openProp,
|
326
|
+
onOpenChange,
|
327
|
+
defaultOpen
|
328
|
+
} = props;
|
329
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
330
|
+
const [open = false, setOpen] = useControllableState2({
|
331
|
+
prop: openProp,
|
332
|
+
defaultProp: defaultOpen,
|
333
|
+
onChange: onOpenChange
|
334
|
+
});
|
335
|
+
return /* @__PURE__ */ jsx14(MenuPrimitive14.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
336
|
+
};
|
337
|
+
|
338
|
+
// packages/react/dropdown-menu/src/DropdownMenuSubTrigger.tsx
|
339
|
+
import * as MenuPrimitive15 from "@huin-core/react-menu";
|
340
|
+
import React13 from "react";
|
341
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
342
|
+
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
343
|
+
var DropdownMenuSubTrigger = React13.forwardRef((props, forwardedRef) => {
|
344
|
+
const { __scopeDropdownMenu, inset, ...subTriggerProps } = props;
|
345
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
346
|
+
return /* @__PURE__ */ jsx15(
|
347
|
+
MenuPrimitive15.SubTrigger,
|
348
|
+
{
|
349
|
+
...menuScope,
|
350
|
+
...subTriggerProps,
|
351
|
+
ref: forwardedRef
|
352
|
+
}
|
353
|
+
);
|
354
|
+
});
|
355
|
+
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
356
|
+
|
357
|
+
// packages/react/dropdown-menu/src/DropdownMenuSubContent.tsx
|
358
|
+
import * as MenuPrimitive16 from "@huin-core/react-menu";
|
359
|
+
import React14 from "react";
|
360
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
361
|
+
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
362
|
+
var DropdownMenuSubContent = React14.forwardRef((props, forwardedRef) => {
|
363
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
364
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
365
|
+
return /* @__PURE__ */ jsx16(
|
366
|
+
MenuPrimitive16.SubContent,
|
367
|
+
{
|
368
|
+
...menuScope,
|
369
|
+
...subContentProps,
|
370
|
+
ref: forwardedRef,
|
371
|
+
style: {
|
372
|
+
...props.style,
|
373
|
+
// re-namespace exposed content custom properties
|
374
|
+
...{
|
375
|
+
"--huin-core-dropdown-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
376
|
+
"--huin-core-dropdown-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
377
|
+
"--huin-core-dropdown-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
378
|
+
"--huin-core-dropdown-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
379
|
+
"--huin-core-dropdown-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
380
|
+
}
|
381
|
+
}
|
382
|
+
}
|
383
|
+
);
|
384
|
+
});
|
385
|
+
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
386
|
+
export {
|
387
|
+
DropdownMenu,
|
388
|
+
DropdownMenuArrow,
|
389
|
+
DropdownMenuCheckboxItem,
|
390
|
+
DropdownMenuContent,
|
391
|
+
DropdownMenuGroup,
|
392
|
+
DropdownMenuItem,
|
393
|
+
DropdownMenuItemIndicator,
|
394
|
+
DropdownMenuLabel,
|
395
|
+
DropdownMenuPortal,
|
396
|
+
DropdownMenuRadioGroup,
|
397
|
+
DropdownMenuRadioItem,
|
398
|
+
DropdownMenuSeparator,
|
399
|
+
DropdownMenuSub,
|
400
|
+
DropdownMenuSubContent,
|
401
|
+
DropdownMenuSubTrigger,
|
402
|
+
DropdownMenuTrigger,
|
403
|
+
Root2 as Root,
|
404
|
+
createDropdownMenuScope
|
405
|
+
};
|
406
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/DropdownMenu.tsx", "../src/DropdownMenuTrigger.tsx", "../src/DropdownMenuPortal.tsx", "../src/DropdownMenuContent.tsx", "../src/DropdownMenuGroup.tsx", "../src/DropdownMenuLabel.tsx", "../src/DropdownMenuItem.tsx", "../src/DropdownMenuCheckboxItem.tsx", "../src/DropdownMenuRadioGroup.tsx", "../src/DropdownMenuRadioItem.tsx", "../src/DropdownMenuItemIndicator.tsx", "../src/DropdownMenuSeparator.tsx", "../src/DropdownMenuArrow.tsx", "../src/DropdownMenuSub.tsx", "../src/DropdownMenuSubTrigger.tsx", "../src/DropdownMenuSubContent.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { createMenuScope } from \"@huin-core/react-menu\";\nimport { useId } from \"@huin-core/react-id\";\n\nimport type { Scope } from \"@huin-core/react-context\";\n\ntype Direction = \"ltr\" | \"rtl\";\n\n/* -------------------------------------------------------------------------------------------------\n * DropdownMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst DROPDOWN_MENU_NAME = \"DropdownMenu\";\n\nexport type ScopedProps<P> = P & { __scopeDropdownMenu?: Scope };\nconst [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(\n DROPDOWN_MENU_NAME,\n [createMenuScope]\n);\nexport const 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\nexport const [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> = (\n props: ScopedProps<DropdownMenuProps>\n) => {\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(\n () => setOpen((prevOpen) => !prevOpen),\n [setOpen]\n )}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n open={open}\n onOpenChange={setOpen}\n dir={dir}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </DropdownMenuProvider>\n );\n};\n\nDropdownMenu.displayName = DROPDOWN_MENU_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = DropdownMenu;\n\nexport {\n createDropdownMenuScope,\n //\n DropdownMenu,\n //\n Root,\n};\nexport type { DropdownMenuProps };\n", "import React from \"react\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport {\n ScopedProps,\n useDropdownMenuContext,\n useMenuScope,\n} from \"./DropdownMenu\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { composeRefs } from \"@huin-core/react-compose-refs\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst TRIGGER_NAME = \"DropdownMenuTrigger\";\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<\n typeof Primitive.button\n>;\ninterface DropdownMenuTriggerProps extends PrimitiveButtonProps {}\n\nconst DropdownMenuTrigger = React.forwardRef<\n DropdownMenuTriggerElement,\n 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))\n event.preventDefault();\n })}\n />\n </MenuPrimitive.Anchor>\n );\n});\n\nDropdownMenuTrigger.displayName = TRIGGER_NAME;\n\nexport { DropdownMenuTrigger };\nexport type { DropdownMenuTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst PORTAL_NAME = \"DropdownMenuPortal\";\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Portal\n>;\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\nexport { DropdownMenuPortal };\nexport type { DropdownMenuPortalProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport {\n ScopedProps,\n useDropdownMenuContext,\n useMenuScope,\n} from \"./DropdownMenu\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\n\nconst CONTENT_NAME = \"DropdownMenuContent\";\n\ntype DropdownMenuContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Content\n>;\ninterface DropdownMenuContentProps\n extends Omit<MenuContentProps, \"onEntryFocus\"> {}\n\nconst DropdownMenuContent = React.forwardRef<\n DropdownMenuContentElement,\n 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(\n props.onCloseAutoFocus,\n (event) => {\n if (!hasInteractedOutsideRef.current)\n 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 )}\n onInteractOutside={composeEventHandlers(\n props.onInteractOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent as PointerEvent;\n const ctrlLeftClick =\n originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n if (!context.modal || isRightClick)\n hasInteractedOutsideRef.current = true;\n }\n )}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n \"--huin-core-dropdown-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-dropdown-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-dropdown-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-dropdown-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-dropdown-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nDropdownMenuContent.displayName = CONTENT_NAME;\n\nexport { DropdownMenuContent };\nexport type { DropdownMenuContentProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst GROUP_NAME = \"DropdownMenuGroup\";\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Group\n>;\ninterface DropdownMenuGroupProps extends MenuGroupProps {}\n\nconst DropdownMenuGroup = React.forwardRef<\n DropdownMenuGroupElement,\n DropdownMenuGroupProps\n>((props: ScopedProps<DropdownMenuGroupProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuGroup.displayName = GROUP_NAME;\n\nexport { DropdownMenuGroup };\nexport type { DropdownMenuGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst LABEL_NAME = \"DropdownMenuLabel\";\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Label\n>;\ninterface DropdownMenuLabelProps extends MenuLabelProps {\n inset?: boolean;\n}\n\nconst DropdownMenuLabel = React.forwardRef<\n DropdownMenuLabelElement,\n DropdownMenuLabelProps\n>((props: ScopedProps<DropdownMenuLabelProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuLabel.displayName = LABEL_NAME;\n\nexport { DropdownMenuLabel };\nexport type { DropdownMenuLabelProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\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 inset?: boolean;\n}\n\nconst DropdownMenuItem = React.forwardRef<\n DropdownMenuItemElement,\n DropdownMenuItemProps\n>((props: ScopedProps<DropdownMenuItemProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuItem.displayName = ITEM_NAME;\n\nexport { DropdownMenuItem };\nexport type { DropdownMenuItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\nconst CHECKBOX_ITEM_NAME = \"DropdownMenuCheckboxItem\";\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.CheckboxItem\n>;\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 (\n <MenuPrimitive.CheckboxItem\n {...menuScope}\n {...checkboxItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\nexport { DropdownMenuCheckboxItem };\nexport type { DropdownMenuCheckboxItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst RADIO_GROUP_NAME = \"DropdownMenuRadioGroup\";\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<\n typeof MenuPrimitive.RadioGroup\n>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioGroup\n>;\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 (\n <MenuPrimitive.RadioGroup\n {...menuScope}\n {...radioGroupProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\nexport { DropdownMenuRadioGroup };\nexport type { DropdownMenuRadioGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst RADIO_ITEM_NAME = \"DropdownMenuRadioItem\";\n\ntype DropdownMenuRadioItemElement = React.ElementRef<\n typeof MenuPrimitive.RadioItem\n>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioItem\n>;\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 (\n <MenuPrimitive.RadioItem\n {...menuScope}\n {...radioItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\nexport { DropdownMenuRadioItem };\nexport type { DropdownMenuRadioItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst INDICATOR_NAME = \"DropdownMenuItemIndicator\";\n\ntype DropdownMenuItemIndicatorElement = React.ElementRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.ItemIndicator\n>;\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 (\n <MenuPrimitive.ItemIndicator\n {...menuScope}\n {...itemIndicatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuItemIndicator.displayName = INDICATOR_NAME;\n\nexport { DropdownMenuItemIndicator };\nexport type { DropdownMenuItemIndicatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SEPARATOR_NAME = \"DropdownMenuSeparator\";\n\ntype DropdownMenuSeparatorElement = React.ElementRef<\n typeof MenuPrimitive.Separator\n>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Separator\n>;\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 (\n <MenuPrimitive.Separator\n {...menuScope}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuSeparator.displayName = SEPARATOR_NAME;\nexport { DropdownMenuSeparator };\nexport type { DropdownMenuSeparatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst ARROW_NAME = \"DropdownMenuArrow\";\n\ntype DropdownMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Arrow\n>;\ninterface DropdownMenuArrowProps extends MenuArrowProps {}\n\nconst DropdownMenuArrow = React.forwardRef<\n DropdownMenuArrowElement,\n DropdownMenuArrowProps\n>((props: ScopedProps<DropdownMenuArrowProps>, forwardedRef) => {\n const { __scopeDropdownMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />\n );\n});\n\nDropdownMenuArrow.displayName = ARROW_NAME;\n\nexport { DropdownMenuArrow };\nexport type { DropdownMenuArrowProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\nimport { useControllableState } from \"@huin-core/react-use-controllable-state\";\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 {\n __scopeDropdownMenu,\n children,\n open: openProp,\n onOpenChange,\n defaultOpen,\n } = 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\nexport { DropdownMenuSub };\nexport type { DropdownMenuSubProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SUB_TRIGGER_NAME = \"DropdownMenuSubTrigger\";\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<\n typeof MenuPrimitive.SubTrigger\n>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubTrigger\n>;\ninterface DropdownMenuSubTriggerProps extends MenuSubTriggerProps {\n inset?: boolean;\n}\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props: ScopedProps<DropdownMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeDropdownMenu, inset, ...subTriggerProps } = props;\n const menuScope = useMenuScope(__scopeDropdownMenu);\n return (\n <MenuPrimitive.SubTrigger\n {...menuScope}\n {...subTriggerProps}\n ref={forwardedRef}\n />\n );\n});\n\nDropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\nexport { DropdownMenuSubTrigger };\nexport type { DropdownMenuSubTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./DropdownMenu\";\n\nconst SUB_CONTENT_NAME = \"DropdownMenuSubContent\";\n\ntype DropdownMenuSubContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubContent\n>;\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 \"--huin-core-dropdown-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-dropdown-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-dropdown-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-dropdown-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-dropdown-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nDropdownMenuSubContent.displayName = SUB_CONTENT_NAME;\n\nexport { DropdownMenuSubContent };\nexport type { DropdownMenuSubContentProps };\n"],
|
5
|
+
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,4BAA4B;AACrC,YAAY,mBAAmB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,aAAa;AA2EhB;AAjEN,IAAM,qBAAqB;AAG3B,IAAM,CAAC,2BAA2B,uBAAuB,IAAI;AAAA,EAC3D;AAAA,EACA,CAAC,eAAe;AAClB;AACO,IAAM,eAAe,gBAAgB;AAYrC,IAAM,CAAC,sBAAsB,sBAAsB,IACxD,0BAAoD,kBAAkB;AAWxE,IAAM,eAA4C,CAChD,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AACJ,QAAM,YAAY,aAAa,mBAAmB;AAClD,QAAM,aAAmB,aAA0B,IAAI;AACvD,QAAM,CAAC,OAAO,OAAO,OAAO,IAAI,qBAAqB;AAAA,IACnD,MAAM;AAAA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AY,aAAa,mBAAmB;AAElD,SACE,gBAAAD;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,sDACE;AAAA,UACF,qDACE;AAAA,UACF,sDACE;AAAA,UACF,2CACE;AAAA,UACF,4CACE;AAAA,QACJ;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,uBAAuB,cAAc;",
|
6
|
+
"names": ["Root", "React", "MenuPrimitive", "jsx", "React", "MenuPrimitive", "jsx", "MenuPrimitive", "React", "composeEventHandlers", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "useControllableState", "jsx", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React"]
|
7
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@huin-core/react-dropdown-menu",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
@@ -20,7 +20,8 @@
|
|
20
20
|
"types": "./dist/index.d.ts",
|
21
21
|
"files": [
|
22
22
|
"dist",
|
23
|
-
"README.md"
|
23
|
+
"README.md",
|
24
|
+
"package.json"
|
24
25
|
],
|
25
26
|
"sideEffects": false,
|
26
27
|
"scripts": {
|