@huin-core/react-context-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 +110 -0
- package/dist/index.d.ts +110 -0
- package/dist/index.js +457 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +425 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +3 -2
package/dist/index.d.mts
ADDED
@@ -0,0 +1,110 @@
|
|
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 createContextMenuScope: CreateScope;
|
19
|
+
interface ContextMenuProps {
|
20
|
+
children?: React$1.ReactNode;
|
21
|
+
onOpenChange?(open: boolean): void;
|
22
|
+
dir?: Direction;
|
23
|
+
modal?: boolean;
|
24
|
+
}
|
25
|
+
declare const ContextMenu: React$1.FC<ContextMenuProps>;
|
26
|
+
declare const Root: React$1.FC<ContextMenuProps>;
|
27
|
+
|
28
|
+
type PrimitiveSpanProps = React__default.ComponentPropsWithoutRef<typeof Primitive.span>;
|
29
|
+
interface ContextMenuTriggerProps extends PrimitiveSpanProps {
|
30
|
+
disabled?: boolean;
|
31
|
+
}
|
32
|
+
declare const ContextMenuTrigger: React__default.ForwardRefExoticComponent<ContextMenuTriggerProps & React__default.RefAttributes<HTMLSpanElement>>;
|
33
|
+
|
34
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
35
|
+
interface ContextMenuPortalProps extends MenuPortalProps {
|
36
|
+
}
|
37
|
+
declare const ContextMenuPortal: React.FC<ContextMenuPortalProps>;
|
38
|
+
|
39
|
+
type MenuContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
40
|
+
interface ContextMenuContentProps extends Omit<MenuContentProps, "onEntryFocus" | "side" | "sideOffset" | "align"> {
|
41
|
+
}
|
42
|
+
declare const ContextMenuContent: React__default.ForwardRefExoticComponent<ContextMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
43
|
+
|
44
|
+
type MenuGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
45
|
+
interface ContextMenuGroupProps extends MenuGroupProps {
|
46
|
+
}
|
47
|
+
declare const ContextMenuGroup: React__default.ForwardRefExoticComponent<ContextMenuGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
48
|
+
|
49
|
+
type MenuLabelProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
50
|
+
interface ContextMenuLabelProps extends MenuLabelProps {
|
51
|
+
inset?: boolean;
|
52
|
+
}
|
53
|
+
declare const ContextMenuLabel: React__default.ForwardRefExoticComponent<ContextMenuLabelProps & React__default.RefAttributes<HTMLDivElement>>;
|
54
|
+
|
55
|
+
type MenuItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
56
|
+
interface ContextMenuItemProps extends MenuItemProps {
|
57
|
+
inset?: boolean;
|
58
|
+
}
|
59
|
+
declare const ContextMenuItem: React__default.ForwardRefExoticComponent<ContextMenuItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
60
|
+
|
61
|
+
type MenuCheckboxItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
62
|
+
interface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
63
|
+
}
|
64
|
+
declare const ContextMenuCheckboxItem: React__default.ForwardRefExoticComponent<ContextMenuCheckboxItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
65
|
+
|
66
|
+
type MenuRadioGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
67
|
+
interface ContextMenuRadioGroupProps extends MenuRadioGroupProps {
|
68
|
+
}
|
69
|
+
declare const ContextMenuRadioGroup: React__default.ForwardRefExoticComponent<ContextMenuRadioGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
70
|
+
|
71
|
+
type MenuRadioItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
72
|
+
interface ContextMenuRadioItemProps extends MenuRadioItemProps {
|
73
|
+
}
|
74
|
+
declare const ContextMenuRadioItem: React__default.ForwardRefExoticComponent<ContextMenuRadioItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
75
|
+
|
76
|
+
type MenuItemIndicatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
77
|
+
interface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
78
|
+
}
|
79
|
+
declare const ContextMenuItemIndicator: React__default.ForwardRefExoticComponent<ContextMenuItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
|
80
|
+
|
81
|
+
type MenuSeparatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
82
|
+
interface ContextMenuSeparatorProps extends MenuSeparatorProps {
|
83
|
+
}
|
84
|
+
declare const ContextMenuSeparator: React__default.ForwardRefExoticComponent<ContextMenuSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
85
|
+
|
86
|
+
type MenuArrowProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
87
|
+
interface ContextMenuArrowProps extends MenuArrowProps {
|
88
|
+
}
|
89
|
+
declare const ContextMenuArrow: React__default.ForwardRefExoticComponent<ContextMenuArrowProps & React__default.RefAttributes<SVGSVGElement>>;
|
90
|
+
|
91
|
+
interface ContextMenuSubProps {
|
92
|
+
children?: React.ReactNode;
|
93
|
+
open?: boolean;
|
94
|
+
defaultOpen?: boolean;
|
95
|
+
onOpenChange?(open: boolean): void;
|
96
|
+
}
|
97
|
+
declare const ContextMenuSub: React.FC<ContextMenuSubProps>;
|
98
|
+
|
99
|
+
type MenuSubTriggerProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
100
|
+
interface ContextMenuSubTriggerProps extends MenuSubTriggerProps {
|
101
|
+
inset?: boolean;
|
102
|
+
}
|
103
|
+
declare const ContextMenuSubTrigger: React__default.ForwardRefExoticComponent<ContextMenuSubTriggerProps & React__default.RefAttributes<HTMLDivElement>>;
|
104
|
+
|
105
|
+
type MenuSubContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
106
|
+
interface ContextMenuSubContentProps extends MenuSubContentProps {
|
107
|
+
}
|
108
|
+
declare const ContextMenuSubContent: React__default.ForwardRefExoticComponent<ContextMenuSubContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
109
|
+
|
110
|
+
export { ContextMenu, ContextMenuArrow, type ContextMenuArrowProps, ContextMenuCheckboxItem, type ContextMenuCheckboxItemProps, ContextMenuContent, type ContextMenuContentProps, ContextMenuGroup, type ContextMenuGroupProps, ContextMenuItem, ContextMenuItemIndicator, type ContextMenuItemIndicatorProps, type ContextMenuItemProps, ContextMenuLabel, type ContextMenuLabelProps, ContextMenuPortal, type ContextMenuPortalProps, type ContextMenuProps, ContextMenuRadioGroup, type ContextMenuRadioGroupProps, ContextMenuRadioItem, type ContextMenuRadioItemProps, ContextMenuSeparator, type ContextMenuSeparatorProps, ContextMenuSub, ContextMenuSubContent, type ContextMenuSubContentProps, type ContextMenuSubProps, ContextMenuSubTrigger, type ContextMenuSubTriggerProps, ContextMenuTrigger, type ContextMenuTriggerProps, Root, createContextMenuScope };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,110 @@
|
|
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 createContextMenuScope: CreateScope;
|
19
|
+
interface ContextMenuProps {
|
20
|
+
children?: React$1.ReactNode;
|
21
|
+
onOpenChange?(open: boolean): void;
|
22
|
+
dir?: Direction;
|
23
|
+
modal?: boolean;
|
24
|
+
}
|
25
|
+
declare const ContextMenu: React$1.FC<ContextMenuProps>;
|
26
|
+
declare const Root: React$1.FC<ContextMenuProps>;
|
27
|
+
|
28
|
+
type PrimitiveSpanProps = React__default.ComponentPropsWithoutRef<typeof Primitive.span>;
|
29
|
+
interface ContextMenuTriggerProps extends PrimitiveSpanProps {
|
30
|
+
disabled?: boolean;
|
31
|
+
}
|
32
|
+
declare const ContextMenuTrigger: React__default.ForwardRefExoticComponent<ContextMenuTriggerProps & React__default.RefAttributes<HTMLSpanElement>>;
|
33
|
+
|
34
|
+
type MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;
|
35
|
+
interface ContextMenuPortalProps extends MenuPortalProps {
|
36
|
+
}
|
37
|
+
declare const ContextMenuPortal: React.FC<ContextMenuPortalProps>;
|
38
|
+
|
39
|
+
type MenuContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;
|
40
|
+
interface ContextMenuContentProps extends Omit<MenuContentProps, "onEntryFocus" | "side" | "sideOffset" | "align"> {
|
41
|
+
}
|
42
|
+
declare const ContextMenuContent: React__default.ForwardRefExoticComponent<ContextMenuContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
43
|
+
|
44
|
+
type MenuGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;
|
45
|
+
interface ContextMenuGroupProps extends MenuGroupProps {
|
46
|
+
}
|
47
|
+
declare const ContextMenuGroup: React__default.ForwardRefExoticComponent<ContextMenuGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
48
|
+
|
49
|
+
type MenuLabelProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;
|
50
|
+
interface ContextMenuLabelProps extends MenuLabelProps {
|
51
|
+
inset?: boolean;
|
52
|
+
}
|
53
|
+
declare const ContextMenuLabel: React__default.ForwardRefExoticComponent<ContextMenuLabelProps & React__default.RefAttributes<HTMLDivElement>>;
|
54
|
+
|
55
|
+
type MenuItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;
|
56
|
+
interface ContextMenuItemProps extends MenuItemProps {
|
57
|
+
inset?: boolean;
|
58
|
+
}
|
59
|
+
declare const ContextMenuItem: React__default.ForwardRefExoticComponent<ContextMenuItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
60
|
+
|
61
|
+
type MenuCheckboxItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;
|
62
|
+
interface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {
|
63
|
+
}
|
64
|
+
declare const ContextMenuCheckboxItem: React__default.ForwardRefExoticComponent<ContextMenuCheckboxItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
65
|
+
|
66
|
+
type MenuRadioGroupProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;
|
67
|
+
interface ContextMenuRadioGroupProps extends MenuRadioGroupProps {
|
68
|
+
}
|
69
|
+
declare const ContextMenuRadioGroup: React__default.ForwardRefExoticComponent<ContextMenuRadioGroupProps & React__default.RefAttributes<HTMLDivElement>>;
|
70
|
+
|
71
|
+
type MenuRadioItemProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;
|
72
|
+
interface ContextMenuRadioItemProps extends MenuRadioItemProps {
|
73
|
+
}
|
74
|
+
declare const ContextMenuRadioItem: React__default.ForwardRefExoticComponent<ContextMenuRadioItemProps & React__default.RefAttributes<HTMLDivElement>>;
|
75
|
+
|
76
|
+
type MenuItemIndicatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;
|
77
|
+
interface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {
|
78
|
+
}
|
79
|
+
declare const ContextMenuItemIndicator: React__default.ForwardRefExoticComponent<ContextMenuItemIndicatorProps & React__default.RefAttributes<HTMLSpanElement>>;
|
80
|
+
|
81
|
+
type MenuSeparatorProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;
|
82
|
+
interface ContextMenuSeparatorProps extends MenuSeparatorProps {
|
83
|
+
}
|
84
|
+
declare const ContextMenuSeparator: React__default.ForwardRefExoticComponent<ContextMenuSeparatorProps & React__default.RefAttributes<HTMLDivElement>>;
|
85
|
+
|
86
|
+
type MenuArrowProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;
|
87
|
+
interface ContextMenuArrowProps extends MenuArrowProps {
|
88
|
+
}
|
89
|
+
declare const ContextMenuArrow: React__default.ForwardRefExoticComponent<ContextMenuArrowProps & React__default.RefAttributes<SVGSVGElement>>;
|
90
|
+
|
91
|
+
interface ContextMenuSubProps {
|
92
|
+
children?: React.ReactNode;
|
93
|
+
open?: boolean;
|
94
|
+
defaultOpen?: boolean;
|
95
|
+
onOpenChange?(open: boolean): void;
|
96
|
+
}
|
97
|
+
declare const ContextMenuSub: React.FC<ContextMenuSubProps>;
|
98
|
+
|
99
|
+
type MenuSubTriggerProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;
|
100
|
+
interface ContextMenuSubTriggerProps extends MenuSubTriggerProps {
|
101
|
+
inset?: boolean;
|
102
|
+
}
|
103
|
+
declare const ContextMenuSubTrigger: React__default.ForwardRefExoticComponent<ContextMenuSubTriggerProps & React__default.RefAttributes<HTMLDivElement>>;
|
104
|
+
|
105
|
+
type MenuSubContentProps = React__default.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;
|
106
|
+
interface ContextMenuSubContentProps extends MenuSubContentProps {
|
107
|
+
}
|
108
|
+
declare const ContextMenuSubContent: React__default.ForwardRefExoticComponent<ContextMenuSubContentProps & React__default.RefAttributes<HTMLDivElement>>;
|
109
|
+
|
110
|
+
export { ContextMenu, ContextMenuArrow, type ContextMenuArrowProps, ContextMenuCheckboxItem, type ContextMenuCheckboxItemProps, ContextMenuContent, type ContextMenuContentProps, ContextMenuGroup, type ContextMenuGroupProps, ContextMenuItem, ContextMenuItemIndicator, type ContextMenuItemIndicatorProps, type ContextMenuItemProps, ContextMenuLabel, type ContextMenuLabelProps, ContextMenuPortal, type ContextMenuPortalProps, type ContextMenuProps, ContextMenuRadioGroup, type ContextMenuRadioGroupProps, ContextMenuRadioItem, type ContextMenuRadioItemProps, ContextMenuSeparator, type ContextMenuSeparatorProps, ContextMenuSub, ContextMenuSubContent, type ContextMenuSubContentProps, type ContextMenuSubProps, ContextMenuSubTrigger, type ContextMenuSubTriggerProps, ContextMenuTrigger, type ContextMenuTriggerProps, Root, createContextMenuScope };
|
package/dist/index.js
ADDED
@@ -0,0 +1,457 @@
|
|
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/context-menu/src/index.ts
|
32
|
+
var src_exports = {};
|
33
|
+
__export(src_exports, {
|
34
|
+
ContextMenu: () => ContextMenu,
|
35
|
+
ContextMenuArrow: () => ContextMenuArrow,
|
36
|
+
ContextMenuCheckboxItem: () => ContextMenuCheckboxItem,
|
37
|
+
ContextMenuContent: () => ContextMenuContent,
|
38
|
+
ContextMenuGroup: () => ContextMenuGroup,
|
39
|
+
ContextMenuItem: () => ContextMenuItem,
|
40
|
+
ContextMenuItemIndicator: () => ContextMenuItemIndicator,
|
41
|
+
ContextMenuLabel: () => ContextMenuLabel,
|
42
|
+
ContextMenuPortal: () => ContextMenuPortal,
|
43
|
+
ContextMenuRadioGroup: () => ContextMenuRadioGroup,
|
44
|
+
ContextMenuRadioItem: () => ContextMenuRadioItem,
|
45
|
+
ContextMenuSeparator: () => ContextMenuSeparator,
|
46
|
+
ContextMenuSub: () => ContextMenuSub,
|
47
|
+
ContextMenuSubContent: () => ContextMenuSubContent,
|
48
|
+
ContextMenuSubTrigger: () => ContextMenuSubTrigger,
|
49
|
+
ContextMenuTrigger: () => ContextMenuTrigger,
|
50
|
+
Root: () => Root2,
|
51
|
+
createContextMenuScope: () => createContextMenuScope
|
52
|
+
});
|
53
|
+
module.exports = __toCommonJS(src_exports);
|
54
|
+
|
55
|
+
// packages/react/context-menu/src/ContextMenu.tsx
|
56
|
+
var React = __toESM(require("react"));
|
57
|
+
var import_react_context = require("@huin-core/react-context");
|
58
|
+
var MenuPrimitive = __toESM(require("@huin-core/react-menu"));
|
59
|
+
var import_react_menu = require("@huin-core/react-menu");
|
60
|
+
var import_react_use_callback_ref = require("@huin-core/react-use-callback-ref");
|
61
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
62
|
+
var CONTEXT_MENU_NAME = "ContextMenu";
|
63
|
+
var [createContextMenuContext, createContextMenuScope] = (0, import_react_context.createContextScope)(
|
64
|
+
CONTEXT_MENU_NAME,
|
65
|
+
[import_react_menu.createMenuScope]
|
66
|
+
);
|
67
|
+
var useMenuScope = (0, import_react_menu.createMenuScope)();
|
68
|
+
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
|
69
|
+
var ContextMenu = (props) => {
|
70
|
+
const {
|
71
|
+
__scopeContextMenu,
|
72
|
+
children,
|
73
|
+
onOpenChange,
|
74
|
+
dir,
|
75
|
+
modal = true
|
76
|
+
} = props;
|
77
|
+
const [open, setOpen] = React.useState(false);
|
78
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
79
|
+
const handleOpenChangeProp = (0, import_react_use_callback_ref.useCallbackRef)(onOpenChange);
|
80
|
+
const handleOpenChange = React.useCallback(
|
81
|
+
(open2) => {
|
82
|
+
setOpen(open2);
|
83
|
+
handleOpenChangeProp(open2);
|
84
|
+
},
|
85
|
+
[handleOpenChangeProp]
|
86
|
+
);
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
88
|
+
ContextMenuProvider,
|
89
|
+
{
|
90
|
+
scope: __scopeContextMenu,
|
91
|
+
open,
|
92
|
+
onOpenChange: handleOpenChange,
|
93
|
+
modal,
|
94
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
95
|
+
MenuPrimitive.Root,
|
96
|
+
{
|
97
|
+
...menuScope,
|
98
|
+
dir,
|
99
|
+
open,
|
100
|
+
onOpenChange: handleOpenChange,
|
101
|
+
modal,
|
102
|
+
children
|
103
|
+
}
|
104
|
+
)
|
105
|
+
}
|
106
|
+
);
|
107
|
+
};
|
108
|
+
ContextMenu.displayName = CONTEXT_MENU_NAME;
|
109
|
+
var Root2 = ContextMenu;
|
110
|
+
|
111
|
+
// packages/react/context-menu/src/ContextMenuTrigger.tsx
|
112
|
+
var import_react = __toESM(require("react"));
|
113
|
+
var import_react_primitive = require("@huin-core/react-primitive");
|
114
|
+
var import_primitive = require("@huin-core/primitive");
|
115
|
+
var MenuPrimitive2 = __toESM(require("@huin-core/react-menu"));
|
116
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
117
|
+
var TRIGGER_NAME = "ContextMenuTrigger";
|
118
|
+
var ContextMenuTrigger = import_react.default.forwardRef((props, forwardedRef) => {
|
119
|
+
const { __scopeContextMenu, disabled = false, ...triggerProps } = props;
|
120
|
+
const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);
|
121
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
122
|
+
const pointRef = import_react.default.useRef({ x: 0, y: 0 });
|
123
|
+
const virtualRef = import_react.default.useRef({
|
124
|
+
getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current })
|
125
|
+
});
|
126
|
+
const longPressTimerRef = import_react.default.useRef(0);
|
127
|
+
const clearLongPress = import_react.default.useCallback(
|
128
|
+
() => window.clearTimeout(longPressTimerRef.current),
|
129
|
+
[]
|
130
|
+
);
|
131
|
+
const handleOpen = (event) => {
|
132
|
+
pointRef.current = { x: event.clientX, y: event.clientY };
|
133
|
+
context.onOpenChange(true);
|
134
|
+
};
|
135
|
+
import_react.default.useEffect(() => clearLongPress, [clearLongPress]);
|
136
|
+
import_react.default.useEffect(
|
137
|
+
() => void (disabled && clearLongPress()),
|
138
|
+
[disabled, clearLongPress]
|
139
|
+
);
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MenuPrimitive2.Anchor, { ...menuScope, virtualRef }),
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
143
|
+
import_react_primitive.Primitive.span,
|
144
|
+
{
|
145
|
+
"data-state": context.open ? "open" : "closed",
|
146
|
+
"data-disabled": disabled ? "" : void 0,
|
147
|
+
...triggerProps,
|
148
|
+
ref: forwardedRef,
|
149
|
+
style: { WebkitTouchCallout: "none", ...props.style },
|
150
|
+
onContextMenu: disabled ? props.onContextMenu : (0, import_primitive.composeEventHandlers)(props.onContextMenu, (event) => {
|
151
|
+
clearLongPress();
|
152
|
+
handleOpen(event);
|
153
|
+
event.preventDefault();
|
154
|
+
}),
|
155
|
+
onPointerDown: disabled ? props.onPointerDown : (0, import_primitive.composeEventHandlers)(
|
156
|
+
props.onPointerDown,
|
157
|
+
whenTouchOrPen((event) => {
|
158
|
+
clearLongPress();
|
159
|
+
longPressTimerRef.current = window.setTimeout(
|
160
|
+
() => handleOpen(event),
|
161
|
+
700
|
162
|
+
);
|
163
|
+
})
|
164
|
+
),
|
165
|
+
onPointerMove: disabled ? props.onPointerMove : (0, import_primitive.composeEventHandlers)(
|
166
|
+
props.onPointerMove,
|
167
|
+
whenTouchOrPen(clearLongPress)
|
168
|
+
),
|
169
|
+
onPointerCancel: disabled ? props.onPointerCancel : (0, import_primitive.composeEventHandlers)(
|
170
|
+
props.onPointerCancel,
|
171
|
+
whenTouchOrPen(clearLongPress)
|
172
|
+
),
|
173
|
+
onPointerUp: disabled ? props.onPointerUp : (0, import_primitive.composeEventHandlers)(
|
174
|
+
props.onPointerUp,
|
175
|
+
whenTouchOrPen(clearLongPress)
|
176
|
+
)
|
177
|
+
}
|
178
|
+
)
|
179
|
+
] });
|
180
|
+
});
|
181
|
+
ContextMenuTrigger.displayName = TRIGGER_NAME;
|
182
|
+
function whenTouchOrPen(handler) {
|
183
|
+
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
184
|
+
}
|
185
|
+
|
186
|
+
// packages/react/context-menu/src/ContextMenuPortal.tsx
|
187
|
+
var MenuPrimitive3 = __toESM(require("@huin-core/react-menu"));
|
188
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
189
|
+
var PORTAL_NAME = "ContextMenuPortal";
|
190
|
+
var ContextMenuPortal = (props) => {
|
191
|
+
const { __scopeContextMenu, ...portalProps } = props;
|
192
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuPrimitive3.Portal, { ...menuScope, ...portalProps });
|
194
|
+
};
|
195
|
+
ContextMenuPortal.displayName = PORTAL_NAME;
|
196
|
+
|
197
|
+
// packages/react/context-menu/src/ContextMenuContent.tsx
|
198
|
+
var MenuPrimitive4 = __toESM(require("@huin-core/react-menu"));
|
199
|
+
var import_react2 = __toESM(require("react"));
|
200
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
201
|
+
var CONTENT_NAME = "ContextMenuContent";
|
202
|
+
var ContextMenuContent = import_react2.default.forwardRef((props, forwardedRef) => {
|
203
|
+
const { __scopeContextMenu, ...contentProps } = props;
|
204
|
+
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
205
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
206
|
+
const hasInteractedOutsideRef = import_react2.default.useRef(false);
|
207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
208
|
+
MenuPrimitive4.Content,
|
209
|
+
{
|
210
|
+
...menuScope,
|
211
|
+
...contentProps,
|
212
|
+
ref: forwardedRef,
|
213
|
+
side: "right",
|
214
|
+
sideOffset: 2,
|
215
|
+
align: "start",
|
216
|
+
onCloseAutoFocus: (event) => {
|
217
|
+
props.onCloseAutoFocus?.(event);
|
218
|
+
if (!event.defaultPrevented && hasInteractedOutsideRef.current) {
|
219
|
+
event.preventDefault();
|
220
|
+
}
|
221
|
+
hasInteractedOutsideRef.current = false;
|
222
|
+
},
|
223
|
+
onInteractOutside: (event) => {
|
224
|
+
props.onInteractOutside?.(event);
|
225
|
+
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
226
|
+
},
|
227
|
+
style: {
|
228
|
+
...props.style,
|
229
|
+
// re-namespace exposed content custom properties
|
230
|
+
...{
|
231
|
+
"--huin-core-context-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
232
|
+
"--huin-core-context-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
233
|
+
"--huin-core-context-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
234
|
+
"--huin-core-context-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
235
|
+
"--huin-core-context-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
);
|
240
|
+
});
|
241
|
+
ContextMenuContent.displayName = CONTENT_NAME;
|
242
|
+
|
243
|
+
// packages/react/context-menu/src/ContextMenuGroup.tsx
|
244
|
+
var MenuPrimitive5 = __toESM(require("@huin-core/react-menu"));
|
245
|
+
var import_react3 = __toESM(require("react"));
|
246
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
247
|
+
var GROUP_NAME = "ContextMenuGroup";
|
248
|
+
var ContextMenuGroup = import_react3.default.forwardRef((props, forwardedRef) => {
|
249
|
+
const { __scopeContextMenu, ...groupProps } = props;
|
250
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MenuPrimitive5.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
252
|
+
});
|
253
|
+
ContextMenuGroup.displayName = GROUP_NAME;
|
254
|
+
|
255
|
+
// packages/react/context-menu/src/ContextMenuLabel.tsx
|
256
|
+
var import_react4 = __toESM(require("react"));
|
257
|
+
var MenuPrimitive6 = __toESM(require("@huin-core/react-menu"));
|
258
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
259
|
+
var LABEL_NAME = "ContextMenuLabel";
|
260
|
+
var ContextMenuLabel = import_react4.default.forwardRef((props, forwardedRef) => {
|
261
|
+
const { __scopeContextMenu, inset, ...labelProps } = props;
|
262
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuPrimitive6.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
264
|
+
});
|
265
|
+
ContextMenuLabel.displayName = LABEL_NAME;
|
266
|
+
|
267
|
+
// packages/react/context-menu/src/ContextMenuItem.tsx
|
268
|
+
var MenuPrimitive7 = __toESM(require("@huin-core/react-menu"));
|
269
|
+
var import_react5 = __toESM(require("react"));
|
270
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
271
|
+
var ITEM_NAME = "ContextMenuItem";
|
272
|
+
var ContextMenuItem = import_react5.default.forwardRef((props, forwardedRef) => {
|
273
|
+
const { __scopeContextMenu, inset, ...itemProps } = props;
|
274
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPrimitive7.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
276
|
+
});
|
277
|
+
ContextMenuItem.displayName = ITEM_NAME;
|
278
|
+
|
279
|
+
// packages/react/context-menu/src/ContextMenuCheckboxItem.tsx
|
280
|
+
var MenuPrimitive8 = __toESM(require("@huin-core/react-menu"));
|
281
|
+
var import_react6 = __toESM(require("react"));
|
282
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
283
|
+
var CHECKBOX_ITEM_NAME = "ContextMenuCheckboxItem";
|
284
|
+
var ContextMenuCheckboxItem = import_react6.default.forwardRef((props, forwardedRef) => {
|
285
|
+
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
286
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
288
|
+
MenuPrimitive8.CheckboxItem,
|
289
|
+
{
|
290
|
+
...menuScope,
|
291
|
+
...checkboxItemProps,
|
292
|
+
ref: forwardedRef
|
293
|
+
}
|
294
|
+
);
|
295
|
+
});
|
296
|
+
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
297
|
+
|
298
|
+
// packages/react/context-menu/src/ContextMenuRadioGroup.tsx
|
299
|
+
var MenuPrimitive9 = __toESM(require("@huin-core/react-menu"));
|
300
|
+
var import_react7 = __toESM(require("react"));
|
301
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
302
|
+
var RADIO_GROUP_NAME = "ContextMenuRadioGroup";
|
303
|
+
var ContextMenuRadioGroup = import_react7.default.forwardRef((props, forwardedRef) => {
|
304
|
+
const { __scopeContextMenu, ...radioGroupProps } = props;
|
305
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
307
|
+
MenuPrimitive9.RadioGroup,
|
308
|
+
{
|
309
|
+
...menuScope,
|
310
|
+
...radioGroupProps,
|
311
|
+
ref: forwardedRef
|
312
|
+
}
|
313
|
+
);
|
314
|
+
});
|
315
|
+
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
316
|
+
|
317
|
+
// packages/react/context-menu/src/ContextMenuRadioItem.tsx
|
318
|
+
var MenuPrimitive10 = __toESM(require("@huin-core/react-menu"));
|
319
|
+
var import_react8 = __toESM(require("react"));
|
320
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
321
|
+
var RADIO_ITEM_NAME = "ContextMenuRadioItem";
|
322
|
+
var ContextMenuRadioItem = import_react8.default.forwardRef((props, forwardedRef) => {
|
323
|
+
const { __scopeContextMenu, ...radioItemProps } = props;
|
324
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
326
|
+
MenuPrimitive10.RadioItem,
|
327
|
+
{
|
328
|
+
...menuScope,
|
329
|
+
...radioItemProps,
|
330
|
+
ref: forwardedRef
|
331
|
+
}
|
332
|
+
);
|
333
|
+
});
|
334
|
+
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
335
|
+
|
336
|
+
// packages/react/context-menu/src/ContextMenuItemIndicator.tsx
|
337
|
+
var MenuPrimitive11 = __toESM(require("@huin-core/react-menu"));
|
338
|
+
var import_react9 = __toESM(require("react"));
|
339
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
340
|
+
var INDICATOR_NAME = "ContextMenuItemIndicator";
|
341
|
+
var ContextMenuItemIndicator = import_react9.default.forwardRef((props, forwardedRef) => {
|
342
|
+
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
343
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
345
|
+
MenuPrimitive11.ItemIndicator,
|
346
|
+
{
|
347
|
+
...menuScope,
|
348
|
+
...itemIndicatorProps,
|
349
|
+
ref: forwardedRef
|
350
|
+
}
|
351
|
+
);
|
352
|
+
});
|
353
|
+
ContextMenuItemIndicator.displayName = INDICATOR_NAME;
|
354
|
+
|
355
|
+
// packages/react/context-menu/src/ContextMenuSeparator.tsx
|
356
|
+
var MenuPrimitive12 = __toESM(require("@huin-core/react-menu"));
|
357
|
+
var import_react10 = __toESM(require("react"));
|
358
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
359
|
+
var SEPARATOR_NAME = "ContextMenuSeparator";
|
360
|
+
var ContextMenuSeparator = import_react10.default.forwardRef((props, forwardedRef) => {
|
361
|
+
const { __scopeContextMenu, ...separatorProps } = props;
|
362
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
364
|
+
MenuPrimitive12.Separator,
|
365
|
+
{
|
366
|
+
...menuScope,
|
367
|
+
...separatorProps,
|
368
|
+
ref: forwardedRef
|
369
|
+
}
|
370
|
+
);
|
371
|
+
});
|
372
|
+
ContextMenuSeparator.displayName = SEPARATOR_NAME;
|
373
|
+
|
374
|
+
// packages/react/context-menu/src/ContextMenuArrow.tsx
|
375
|
+
var MenuPrimitive13 = __toESM(require("@huin-core/react-menu"));
|
376
|
+
var import_react11 = __toESM(require("react"));
|
377
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
378
|
+
var ARROW_NAME = "ContextMenuArrow";
|
379
|
+
var ContextMenuArrow = import_react11.default.forwardRef((props, forwardedRef) => {
|
380
|
+
const { __scopeContextMenu, ...arrowProps } = props;
|
381
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuPrimitive13.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
383
|
+
});
|
384
|
+
ContextMenuArrow.displayName = ARROW_NAME;
|
385
|
+
|
386
|
+
// packages/react/context-menu/src/ContextMenuSub.tsx
|
387
|
+
var import_react_use_controllable_state = require("@huin-core/react-use-controllable-state");
|
388
|
+
var MenuPrimitive14 = __toESM(require("@huin-core/react-menu"));
|
389
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
390
|
+
var SUB_NAME = "ContextMenuSub";
|
391
|
+
var ContextMenuSub = (props) => {
|
392
|
+
const {
|
393
|
+
__scopeContextMenu,
|
394
|
+
children,
|
395
|
+
onOpenChange,
|
396
|
+
open: openProp,
|
397
|
+
defaultOpen
|
398
|
+
} = props;
|
399
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
400
|
+
const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
401
|
+
prop: openProp,
|
402
|
+
defaultProp: defaultOpen,
|
403
|
+
onChange: onOpenChange
|
404
|
+
});
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuPrimitive14.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
406
|
+
};
|
407
|
+
ContextMenuSub.displayName = SUB_NAME;
|
408
|
+
|
409
|
+
// packages/react/context-menu/src/ContextMenuSubTrigger.tsx
|
410
|
+
var MenuPrimitive15 = __toESM(require("@huin-core/react-menu"));
|
411
|
+
var import_react12 = __toESM(require("react"));
|
412
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
413
|
+
var SUB_TRIGGER_NAME = "ContextMenuSubTrigger";
|
414
|
+
var ContextMenuSubTrigger = import_react12.default.forwardRef((props, forwardedRef) => {
|
415
|
+
const { __scopeContextMenu, inset, ...triggerItemProps } = props;
|
416
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
418
|
+
MenuPrimitive15.SubTrigger,
|
419
|
+
{
|
420
|
+
...menuScope,
|
421
|
+
...triggerItemProps,
|
422
|
+
ref: forwardedRef
|
423
|
+
}
|
424
|
+
);
|
425
|
+
});
|
426
|
+
ContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
427
|
+
|
428
|
+
// packages/react/context-menu/src/ContextMenuSubContent.tsx
|
429
|
+
var MenuPrimitive16 = __toESM(require("@huin-core/react-menu"));
|
430
|
+
var import_react13 = __toESM(require("react"));
|
431
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
432
|
+
var SUB_CONTENT_NAME = "ContextMenuSubContent";
|
433
|
+
var ContextMenuSubContent = import_react13.default.forwardRef((props, forwardedRef) => {
|
434
|
+
const { __scopeContextMenu, ...subContentProps } = props;
|
435
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
437
|
+
MenuPrimitive16.SubContent,
|
438
|
+
{
|
439
|
+
...menuScope,
|
440
|
+
...subContentProps,
|
441
|
+
ref: forwardedRef,
|
442
|
+
style: {
|
443
|
+
...props.style,
|
444
|
+
// re-namespace exposed content custom properties
|
445
|
+
...{
|
446
|
+
"--huin-core-context-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
447
|
+
"--huin-core-context-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
448
|
+
"--huin-core-context-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
449
|
+
"--huin-core-context-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
450
|
+
"--huin-core-context-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
451
|
+
}
|
452
|
+
}
|
453
|
+
}
|
454
|
+
);
|
455
|
+
});
|
456
|
+
ContextMenuSubContent.displayName = SUB_CONTENT_NAME;
|
457
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/index.ts", "../src/ContextMenu.tsx", "../src/ContextMenuTrigger.tsx", "../src/ContextMenuPortal.tsx", "../src/ContextMenuContent.tsx", "../src/ContextMenuGroup.tsx", "../src/ContextMenuLabel.tsx", "../src/ContextMenuItem.tsx", "../src/ContextMenuCheckboxItem.tsx", "../src/ContextMenuRadioGroup.tsx", "../src/ContextMenuRadioItem.tsx", "../src/ContextMenuItemIndicator.tsx", "../src/ContextMenuSeparator.tsx", "../src/ContextMenuArrow.tsx", "../src/ContextMenuSub.tsx", "../src/ContextMenuSubTrigger.tsx", "../src/ContextMenuSubContent.tsx"],
|
4
|
+
"sourcesContent": ["\"use client\";\nexport { createContextMenuScope, ContextMenu, Root } from \"./ContextMenu\";\nexport { ContextMenuTrigger } from \"./ContextMenuTrigger\";\nexport { ContextMenuPortal } from \"./ContextMenuPortal\";\nexport { ContextMenuContent } from \"./ContextMenuContent\";\nexport { ContextMenuGroup } from \"./ContextMenuGroup\";\nexport { ContextMenuLabel } from \"./ContextMenuLabel\";\nexport { ContextMenuItem } from \"./ContextMenuItem\";\nexport { ContextMenuCheckboxItem } from \"./ContextMenuCheckboxItem\";\nexport { ContextMenuRadioGroup } from \"./ContextMenuRadioGroup\";\nexport { ContextMenuRadioItem } from \"./ContextMenuRadioItem\";\nexport { ContextMenuItemIndicator } from \"./ContextMenuItemIndicator\";\nexport { ContextMenuSeparator } from \"./ContextMenuSeparator\";\nexport { ContextMenuArrow } from \"./ContextMenuArrow\";\nexport { ContextMenuSub } from \"./ContextMenuSub\";\nexport { ContextMenuSubTrigger } from \"./ContextMenuSubTrigger\";\nexport { ContextMenuSubContent } from \"./ContextMenuSubContent\";\nexport type { ContextMenuProps } from \"./ContextMenu\";\nexport type { ContextMenuTriggerProps } from \"./ContextMenuTrigger\";\nexport type { ContextMenuPortalProps } from \"./ContextMenuPortal\";\nexport type { ContextMenuContentProps } from \"./ContextMenuContent\";\nexport type { ContextMenuGroupProps } from \"./ContextMenuGroup\";\nexport type { ContextMenuLabelProps } from \"./ContextMenuLabel\";\nexport type { ContextMenuItemProps } from \"./ContextMenuItem\";\nexport type { ContextMenuCheckboxItemProps } from \"./ContextMenuCheckboxItem\";\nexport type { ContextMenuRadioGroupProps } from \"./ContextMenuRadioGroup\";\nexport type { ContextMenuRadioItemProps } from \"./ContextMenuRadioItem\";\nexport type { ContextMenuItemIndicatorProps } from \"./ContextMenuItemIndicator\";\nexport type { ContextMenuSeparatorProps } from \"./ContextMenuSeparator\";\nexport type { ContextMenuArrowProps } from \"./ContextMenuArrow\";\nexport type { ContextMenuSubProps } from \"./ContextMenuSub\";\nexport type { ContextMenuSubTriggerProps } from \"./ContextMenuSubTrigger\";\nexport type { ContextMenuSubContentProps } from \"./ContextMenuSubContent\";\n", "import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { createMenuScope } from \"@huin-core/react-menu\";\nimport { useCallbackRef } from \"@huin-core/react-use-callback-ref\";\nimport type { Scope } from \"@huin-core/react-context\";\n\ntype Direction = \"ltr\" | \"rtl\";\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = \"ContextMenu\";\n\nexport type ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(\n CONTEXT_MENU_NAME,\n [createMenuScope]\n);\nexport const useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nexport const [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n children?: React.ReactNode;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (\n props: ScopedProps<ContextMenuProps>\n) => {\n const {\n __scopeContextMenu,\n children,\n onOpenChange,\n dir,\n modal = true,\n } = props;\n const [open, setOpen] = React.useState(false);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = ContextMenu;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n //\n Root,\n};\nexport type { ContextMenuProps };\n", "import React from \"react\";\nimport {\n ScopedProps,\n useContextMenuContext,\n useMenuScope,\n} from \"./ContextMenu\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\n\ntype Point = { x: number; y: number };\n\nconst TRIGGER_NAME = \"ContextMenuTrigger\";\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {\n disabled?: boolean;\n}\n\nconst ContextMenuTrigger = React.forwardRef<\n ContextMenuTriggerElement,\n ContextMenuTriggerProps\n>((props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, disabled = false, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () =>\n DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n React.useEffect(\n () => void (disabled && clearLongPress()),\n [disabled, clearLongPress]\n );\n\n return (\n <>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n data-state={context.open ? \"open\" : \"closed\"}\n data-disabled={disabled ? \"\" : undefined}\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: \"none\", ...props.style }}\n // if trigger is disabled, enable the native Context Menu\n onContextMenu={\n disabled\n ? props.onContextMenu\n : composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n handleOpen(event);\n event.preventDefault();\n })\n }\n onPointerDown={\n disabled\n ? props.onPointerDown\n : composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(\n () => handleOpen(event),\n 700\n );\n })\n )\n }\n onPointerMove={\n disabled\n ? props.onPointerMove\n : composeEventHandlers(\n props.onPointerMove,\n whenTouchOrPen(clearLongPress)\n )\n }\n onPointerCancel={\n disabled\n ? props.onPointerCancel\n : composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )\n }\n onPointerUp={\n disabled\n ? props.onPointerUp\n : composeEventHandlers(\n props.onPointerUp,\n whenTouchOrPen(clearLongPress)\n )\n }\n />\n </>\n );\n});\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\nfunction whenTouchOrPen<E>(\n handler: React.PointerEventHandler<E>\n): React.PointerEventHandler<E> {\n return (event) =>\n event.pointerType !== \"mouse\" ? handler(event) : undefined;\n}\n\nexport { ContextMenuTrigger };\nexport type { ContextMenuTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst PORTAL_NAME = \"ContextMenuPortal\";\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Portal\n>;\ninterface ContextMenuPortalProps extends MenuPortalProps {}\n\nconst ContextMenuPortal: React.FC<ContextMenuPortalProps> = (\n props: ScopedProps<ContextMenuPortalProps>\n) => {\n const { __scopeContextMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nContextMenuPortal.displayName = PORTAL_NAME;\n\nexport { ContextMenuPortal };\nexport type {ContextMenuPortalProps}\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport {\n ScopedProps,\n useContextMenuContext,\n useMenuScope,\n} from \"./ContextMenu\";\n\nconst CONTENT_NAME = \"ContextMenuContent\";\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Content\n>;\ninterface ContextMenuContentProps\n extends Omit<\n MenuContentProps,\n \"onEntryFocus\" | \"side\" | \"sideOffset\" | \"align\"\n > {}\n\nconst ContextMenuContent = React.forwardRef<\n ContextMenuContentElement,\n ContextMenuContentProps\n>((props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--huin-core-context-menu-content-transform-origin': 'var(--huin-core-popper-transform-origin)',\n '--huin-core-context-menu-content-available-width': 'var(--huin-core-popper-available-width)',\n '--huin-core-context-menu-content-available-height': 'var(--huin-core-popper-available-height)',\n '--huin-core-context-menu-trigger-width': 'var(--huin-core-popper-anchor-width)',\n '--huin-core-context-menu-trigger-height': 'var(--huin-core-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nContextMenuContent.displayName = CONTENT_NAME;\n\nexport { ContextMenuContent };\nexport type { ContextMenuContentProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst GROUP_NAME = \"ContextMenuGroup\";\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Group\n>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<\n ContextMenuGroupElement,\n ContextMenuGroupProps\n>((props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />\n );\n});\n\nContextMenuGroup.displayName = GROUP_NAME;\n\nexport { ContextMenuGroup };\nexport type { ContextMenuGroupProps };\n", "import React from \"react\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst LABEL_NAME = \"ContextMenuLabel\";\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Label\n>;\ninterface ContextMenuLabelProps extends MenuLabelProps {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<\n ContextMenuLabelElement,\n ContextMenuLabelProps\n>((props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />\n );\n});\n\nContextMenuLabel.displayName = LABEL_NAME;\n\nexport { ContextMenuLabel };\nexport type { ContextMenuLabelProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst ITEM_NAME = \"ContextMenuItem\";\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<\n ContextMenuItemElement,\n ContextMenuItemProps\n>((props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />\n );\n});\n\nContextMenuItem.displayName = ITEM_NAME;\n\nexport { ContextMenuItem };\nexport type { ContextMenuItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst CHECKBOX_ITEM_NAME = \"ContextMenuCheckboxItem\";\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.CheckboxItem\n {...menuScope}\n {...checkboxItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\nexport { ContextMenuCheckboxItem };\nexport type { ContextMenuCheckboxItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport React from \"react\";\n\nconst RADIO_GROUP_NAME = \"ContextMenuRadioGroup\";\n\ntype ContextMenuRadioGroupElement = React.ElementRef<\n typeof MenuPrimitive.RadioGroup\n>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioGroup\n>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.RadioGroup\n {...menuScope}\n {...radioGroupProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\nexport { ContextMenuRadioGroup };\nexport type { ContextMenuRadioGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst RADIO_ITEM_NAME = \"ContextMenuRadioItem\";\n\ntype ContextMenuRadioItemElement = React.ElementRef<\n typeof MenuPrimitive.RadioItem\n>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioItem\n>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.RadioItem\n {...menuScope}\n {...radioItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\nexport { ContextMenuRadioItem };\nexport type { ContextMenuRadioItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport React from \"react\";\n\nconst INDICATOR_NAME = \"ContextMenuItemIndicator\";\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.ItemIndicator\n {...menuScope}\n {...itemIndicatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\nexport { ContextMenuItemIndicator };\nexport type { ContextMenuItemIndicatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SEPARATOR_NAME = \"ContextMenuSeparator\";\n\ntype ContextMenuSeparatorElement = React.ElementRef<\n typeof MenuPrimitive.Separator\n>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Separator\n>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Separator\n {...menuScope}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\nexport { ContextMenuSeparator };\nexport type { ContextMenuSeparatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst ARROW_NAME = \"ContextMenuArrow\";\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Arrow\n>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<\n ContextMenuArrowElement,\n ContextMenuArrowProps\n>((props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />\n );\n});\n\nContextMenuArrow.displayName = ARROW_NAME;\n\nexport { ContextMenuArrow };\nexport type { ContextMenuArrowProps };\n", "import { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\n\nconst SUB_NAME = \"ContextMenuSub\";\n\ninterface ContextMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst ContextMenuSub: React.FC<ContextMenuSubProps> = (\n props: ScopedProps<ContextMenuSubProps>\n) => {\n const {\n __scopeContextMenu,\n children,\n onOpenChange,\n open: openProp,\n defaultOpen,\n } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n const [open, 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\nContextMenuSub.displayName = SUB_NAME;\n\nexport { ContextMenuSub };\nexport type { ContextMenuSubProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SUB_TRIGGER_NAME = \"ContextMenuSubTrigger\";\n\ntype ContextMenuSubTriggerElement = React.ElementRef<\n typeof MenuPrimitive.SubTrigger\n>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubTrigger\n>;\ninterface ContextMenuSubTriggerProps extends MenuSubTriggerProps {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props: ScopedProps<ContextMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.SubTrigger\n {...menuScope}\n {...triggerItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\nexport { ContextMenuSubTrigger };\nexport type { ContextMenuSubTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SUB_CONTENT_NAME = \"ContextMenuSubContent\";\n\ntype ContextMenuSubContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubContent\n>;\ninterface ContextMenuSubContentProps extends MenuSubContentProps {}\n\nconst ContextMenuSubContent = React.forwardRef<\n ContextMenuSubContentElement,\n ContextMenuSubContentProps\n>((props: ScopedProps<ContextMenuSubContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\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-context-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-context-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-context-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-context-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-context-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nContextMenuSubContent.displayName = SUB_CONTENT_NAME;\n\nexport { ContextMenuSubContent };\nexport type { ContextMenuSubContentProps };\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,oBAA+B;AAC/B,wBAAgC;AAChC,oCAA+B;AA+DzB;AAtDN,IAAM,oBAAoB;AAG1B,IAAM,CAAC,0BAA0B,sBAAsB,QAAI;AAAA,EACzD;AAAA,EACA,CAAC,iCAAe;AAClB;AACO,IAAM,mBAAe,mCAAgB;AAQrC,IAAM,CAAC,qBAAqB,qBAAqB,IACtD,yBAAkD,iBAAiB;AASrE,IAAM,cAA0C,CAC9C,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,IAAI;AACJ,QAAM,CAAC,MAAM,OAAO,IAAU,eAAS,KAAK;AAC5C,QAAM,YAAY,aAAa,kBAAkB;AACjD,QAAM,2BAAuB,8CAAe,YAAY;AAExD,QAAM,mBAAyB;AAAA,IAC7B,CAACC,UAAkB;AACjB,cAAQA,KAAI;AACZ,2BAAqBA,KAAI;AAAA,IAC3B;AAAA,IACA,CAAC,oBAAoB;AAAA,EACvB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,MACP;AAAA,MACA,cAAc;AAAA,MACd;AAAA,MAEA;AAAA,QAAe;AAAA,QAAd;AAAA,UACE,GAAG;AAAA,UACJ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P;AAEJ,CAAC;AAED,sBAAsB,cAAc;;;AC/BpC,IAAAC,kBAA+B;AAC/B,IAAAC,iBAAkB;AAqBd,IAAAC,uBAAA;AAlBJ,IAAM,mBAAmB;AAUzB,IAAM,wBAAwB,eAAAC,QAAM,WAGlC,CAAC,OAAgD,iBAAiB;AAClE,QAAM,EAAE,oBAAoB,GAAG,gBAAgB,IAAI;AACnD,QAAM,YAAY,aAAa,kBAAkB;AAEjD,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,qDACE;AAAA,UACF,oDACE;AAAA,UACF,qDACE;AAAA,UACF,0CACE;AAAA,UACF,2CACE;AAAA,QACJ;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,sBAAsB,cAAc;",
|
6
|
+
"names": ["Root", "open", "Root", "MenuPrimitive", "import_jsx_runtime", "React", "MenuPrimitive", "import_jsx_runtime", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "MenuPrimitive", "import_react", "import_jsx_runtime", "React", "import_react", "MenuPrimitive", "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_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,425 @@
|
|
1
|
+
"use client";
|
2
|
+
|
3
|
+
// packages/react/context-menu/src/ContextMenu.tsx
|
4
|
+
import * as React from "react";
|
5
|
+
import { createContextScope } from "@huin-core/react-context";
|
6
|
+
import * as MenuPrimitive from "@huin-core/react-menu";
|
7
|
+
import { createMenuScope } from "@huin-core/react-menu";
|
8
|
+
import { useCallbackRef } from "@huin-core/react-use-callback-ref";
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
10
|
+
var CONTEXT_MENU_NAME = "ContextMenu";
|
11
|
+
var [createContextMenuContext, createContextMenuScope] = createContextScope(
|
12
|
+
CONTEXT_MENU_NAME,
|
13
|
+
[createMenuScope]
|
14
|
+
);
|
15
|
+
var useMenuScope = createMenuScope();
|
16
|
+
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
|
17
|
+
var ContextMenu = (props) => {
|
18
|
+
const {
|
19
|
+
__scopeContextMenu,
|
20
|
+
children,
|
21
|
+
onOpenChange,
|
22
|
+
dir,
|
23
|
+
modal = true
|
24
|
+
} = props;
|
25
|
+
const [open, setOpen] = React.useState(false);
|
26
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
27
|
+
const handleOpenChangeProp = useCallbackRef(onOpenChange);
|
28
|
+
const handleOpenChange = React.useCallback(
|
29
|
+
(open2) => {
|
30
|
+
setOpen(open2);
|
31
|
+
handleOpenChangeProp(open2);
|
32
|
+
},
|
33
|
+
[handleOpenChangeProp]
|
34
|
+
);
|
35
|
+
return /* @__PURE__ */ jsx(
|
36
|
+
ContextMenuProvider,
|
37
|
+
{
|
38
|
+
scope: __scopeContextMenu,
|
39
|
+
open,
|
40
|
+
onOpenChange: handleOpenChange,
|
41
|
+
modal,
|
42
|
+
children: /* @__PURE__ */ jsx(
|
43
|
+
MenuPrimitive.Root,
|
44
|
+
{
|
45
|
+
...menuScope,
|
46
|
+
dir,
|
47
|
+
open,
|
48
|
+
onOpenChange: handleOpenChange,
|
49
|
+
modal,
|
50
|
+
children
|
51
|
+
}
|
52
|
+
)
|
53
|
+
}
|
54
|
+
);
|
55
|
+
};
|
56
|
+
ContextMenu.displayName = CONTEXT_MENU_NAME;
|
57
|
+
var Root2 = ContextMenu;
|
58
|
+
|
59
|
+
// packages/react/context-menu/src/ContextMenuTrigger.tsx
|
60
|
+
import React2 from "react";
|
61
|
+
import { Primitive } from "@huin-core/react-primitive";
|
62
|
+
import { composeEventHandlers } from "@huin-core/primitive";
|
63
|
+
import * as MenuPrimitive2 from "@huin-core/react-menu";
|
64
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
65
|
+
var TRIGGER_NAME = "ContextMenuTrigger";
|
66
|
+
var ContextMenuTrigger = React2.forwardRef((props, forwardedRef) => {
|
67
|
+
const { __scopeContextMenu, disabled = false, ...triggerProps } = props;
|
68
|
+
const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);
|
69
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
70
|
+
const pointRef = React2.useRef({ x: 0, y: 0 });
|
71
|
+
const virtualRef = React2.useRef({
|
72
|
+
getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current })
|
73
|
+
});
|
74
|
+
const longPressTimerRef = React2.useRef(0);
|
75
|
+
const clearLongPress = React2.useCallback(
|
76
|
+
() => window.clearTimeout(longPressTimerRef.current),
|
77
|
+
[]
|
78
|
+
);
|
79
|
+
const handleOpen = (event) => {
|
80
|
+
pointRef.current = { x: event.clientX, y: event.clientY };
|
81
|
+
context.onOpenChange(true);
|
82
|
+
};
|
83
|
+
React2.useEffect(() => clearLongPress, [clearLongPress]);
|
84
|
+
React2.useEffect(
|
85
|
+
() => void (disabled && clearLongPress()),
|
86
|
+
[disabled, clearLongPress]
|
87
|
+
);
|
88
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
89
|
+
/* @__PURE__ */ jsx2(MenuPrimitive2.Anchor, { ...menuScope, virtualRef }),
|
90
|
+
/* @__PURE__ */ jsx2(
|
91
|
+
Primitive.span,
|
92
|
+
{
|
93
|
+
"data-state": context.open ? "open" : "closed",
|
94
|
+
"data-disabled": disabled ? "" : void 0,
|
95
|
+
...triggerProps,
|
96
|
+
ref: forwardedRef,
|
97
|
+
style: { WebkitTouchCallout: "none", ...props.style },
|
98
|
+
onContextMenu: disabled ? props.onContextMenu : composeEventHandlers(props.onContextMenu, (event) => {
|
99
|
+
clearLongPress();
|
100
|
+
handleOpen(event);
|
101
|
+
event.preventDefault();
|
102
|
+
}),
|
103
|
+
onPointerDown: disabled ? props.onPointerDown : composeEventHandlers(
|
104
|
+
props.onPointerDown,
|
105
|
+
whenTouchOrPen((event) => {
|
106
|
+
clearLongPress();
|
107
|
+
longPressTimerRef.current = window.setTimeout(
|
108
|
+
() => handleOpen(event),
|
109
|
+
700
|
110
|
+
);
|
111
|
+
})
|
112
|
+
),
|
113
|
+
onPointerMove: disabled ? props.onPointerMove : composeEventHandlers(
|
114
|
+
props.onPointerMove,
|
115
|
+
whenTouchOrPen(clearLongPress)
|
116
|
+
),
|
117
|
+
onPointerCancel: disabled ? props.onPointerCancel : composeEventHandlers(
|
118
|
+
props.onPointerCancel,
|
119
|
+
whenTouchOrPen(clearLongPress)
|
120
|
+
),
|
121
|
+
onPointerUp: disabled ? props.onPointerUp : composeEventHandlers(
|
122
|
+
props.onPointerUp,
|
123
|
+
whenTouchOrPen(clearLongPress)
|
124
|
+
)
|
125
|
+
}
|
126
|
+
)
|
127
|
+
] });
|
128
|
+
});
|
129
|
+
ContextMenuTrigger.displayName = TRIGGER_NAME;
|
130
|
+
function whenTouchOrPen(handler) {
|
131
|
+
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
// packages/react/context-menu/src/ContextMenuPortal.tsx
|
135
|
+
import * as MenuPrimitive3 from "@huin-core/react-menu";
|
136
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
137
|
+
var PORTAL_NAME = "ContextMenuPortal";
|
138
|
+
var ContextMenuPortal = (props) => {
|
139
|
+
const { __scopeContextMenu, ...portalProps } = props;
|
140
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
141
|
+
return /* @__PURE__ */ jsx3(MenuPrimitive3.Portal, { ...menuScope, ...portalProps });
|
142
|
+
};
|
143
|
+
ContextMenuPortal.displayName = PORTAL_NAME;
|
144
|
+
|
145
|
+
// packages/react/context-menu/src/ContextMenuContent.tsx
|
146
|
+
import * as MenuPrimitive4 from "@huin-core/react-menu";
|
147
|
+
import React3 from "react";
|
148
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
149
|
+
var CONTENT_NAME = "ContextMenuContent";
|
150
|
+
var ContextMenuContent = React3.forwardRef((props, forwardedRef) => {
|
151
|
+
const { __scopeContextMenu, ...contentProps } = props;
|
152
|
+
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
153
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
154
|
+
const hasInteractedOutsideRef = React3.useRef(false);
|
155
|
+
return /* @__PURE__ */ jsx4(
|
156
|
+
MenuPrimitive4.Content,
|
157
|
+
{
|
158
|
+
...menuScope,
|
159
|
+
...contentProps,
|
160
|
+
ref: forwardedRef,
|
161
|
+
side: "right",
|
162
|
+
sideOffset: 2,
|
163
|
+
align: "start",
|
164
|
+
onCloseAutoFocus: (event) => {
|
165
|
+
props.onCloseAutoFocus?.(event);
|
166
|
+
if (!event.defaultPrevented && hasInteractedOutsideRef.current) {
|
167
|
+
event.preventDefault();
|
168
|
+
}
|
169
|
+
hasInteractedOutsideRef.current = false;
|
170
|
+
},
|
171
|
+
onInteractOutside: (event) => {
|
172
|
+
props.onInteractOutside?.(event);
|
173
|
+
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
174
|
+
},
|
175
|
+
style: {
|
176
|
+
...props.style,
|
177
|
+
// re-namespace exposed content custom properties
|
178
|
+
...{
|
179
|
+
"--huin-core-context-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
180
|
+
"--huin-core-context-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
181
|
+
"--huin-core-context-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
182
|
+
"--huin-core-context-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
183
|
+
"--huin-core-context-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
);
|
188
|
+
});
|
189
|
+
ContextMenuContent.displayName = CONTENT_NAME;
|
190
|
+
|
191
|
+
// packages/react/context-menu/src/ContextMenuGroup.tsx
|
192
|
+
import * as MenuPrimitive5 from "@huin-core/react-menu";
|
193
|
+
import React4 from "react";
|
194
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
195
|
+
var GROUP_NAME = "ContextMenuGroup";
|
196
|
+
var ContextMenuGroup = React4.forwardRef((props, forwardedRef) => {
|
197
|
+
const { __scopeContextMenu, ...groupProps } = props;
|
198
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
199
|
+
return /* @__PURE__ */ jsx5(MenuPrimitive5.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
200
|
+
});
|
201
|
+
ContextMenuGroup.displayName = GROUP_NAME;
|
202
|
+
|
203
|
+
// packages/react/context-menu/src/ContextMenuLabel.tsx
|
204
|
+
import React5 from "react";
|
205
|
+
import * as MenuPrimitive6 from "@huin-core/react-menu";
|
206
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
207
|
+
var LABEL_NAME = "ContextMenuLabel";
|
208
|
+
var ContextMenuLabel = React5.forwardRef((props, forwardedRef) => {
|
209
|
+
const { __scopeContextMenu, inset, ...labelProps } = props;
|
210
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
211
|
+
return /* @__PURE__ */ jsx6(MenuPrimitive6.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
212
|
+
});
|
213
|
+
ContextMenuLabel.displayName = LABEL_NAME;
|
214
|
+
|
215
|
+
// packages/react/context-menu/src/ContextMenuItem.tsx
|
216
|
+
import * as MenuPrimitive7 from "@huin-core/react-menu";
|
217
|
+
import React6 from "react";
|
218
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
219
|
+
var ITEM_NAME = "ContextMenuItem";
|
220
|
+
var ContextMenuItem = React6.forwardRef((props, forwardedRef) => {
|
221
|
+
const { __scopeContextMenu, inset, ...itemProps } = props;
|
222
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
223
|
+
return /* @__PURE__ */ jsx7(MenuPrimitive7.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
224
|
+
});
|
225
|
+
ContextMenuItem.displayName = ITEM_NAME;
|
226
|
+
|
227
|
+
// packages/react/context-menu/src/ContextMenuCheckboxItem.tsx
|
228
|
+
import * as MenuPrimitive8 from "@huin-core/react-menu";
|
229
|
+
import React7 from "react";
|
230
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
231
|
+
var CHECKBOX_ITEM_NAME = "ContextMenuCheckboxItem";
|
232
|
+
var ContextMenuCheckboxItem = React7.forwardRef((props, forwardedRef) => {
|
233
|
+
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
234
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
235
|
+
return /* @__PURE__ */ jsx8(
|
236
|
+
MenuPrimitive8.CheckboxItem,
|
237
|
+
{
|
238
|
+
...menuScope,
|
239
|
+
...checkboxItemProps,
|
240
|
+
ref: forwardedRef
|
241
|
+
}
|
242
|
+
);
|
243
|
+
});
|
244
|
+
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
245
|
+
|
246
|
+
// packages/react/context-menu/src/ContextMenuRadioGroup.tsx
|
247
|
+
import * as MenuPrimitive9 from "@huin-core/react-menu";
|
248
|
+
import React8 from "react";
|
249
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
250
|
+
var RADIO_GROUP_NAME = "ContextMenuRadioGroup";
|
251
|
+
var ContextMenuRadioGroup = React8.forwardRef((props, forwardedRef) => {
|
252
|
+
const { __scopeContextMenu, ...radioGroupProps } = props;
|
253
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
254
|
+
return /* @__PURE__ */ jsx9(
|
255
|
+
MenuPrimitive9.RadioGroup,
|
256
|
+
{
|
257
|
+
...menuScope,
|
258
|
+
...radioGroupProps,
|
259
|
+
ref: forwardedRef
|
260
|
+
}
|
261
|
+
);
|
262
|
+
});
|
263
|
+
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
264
|
+
|
265
|
+
// packages/react/context-menu/src/ContextMenuRadioItem.tsx
|
266
|
+
import * as MenuPrimitive10 from "@huin-core/react-menu";
|
267
|
+
import React9 from "react";
|
268
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
269
|
+
var RADIO_ITEM_NAME = "ContextMenuRadioItem";
|
270
|
+
var ContextMenuRadioItem = React9.forwardRef((props, forwardedRef) => {
|
271
|
+
const { __scopeContextMenu, ...radioItemProps } = props;
|
272
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
273
|
+
return /* @__PURE__ */ jsx10(
|
274
|
+
MenuPrimitive10.RadioItem,
|
275
|
+
{
|
276
|
+
...menuScope,
|
277
|
+
...radioItemProps,
|
278
|
+
ref: forwardedRef
|
279
|
+
}
|
280
|
+
);
|
281
|
+
});
|
282
|
+
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
283
|
+
|
284
|
+
// packages/react/context-menu/src/ContextMenuItemIndicator.tsx
|
285
|
+
import * as MenuPrimitive11 from "@huin-core/react-menu";
|
286
|
+
import React10 from "react";
|
287
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
288
|
+
var INDICATOR_NAME = "ContextMenuItemIndicator";
|
289
|
+
var ContextMenuItemIndicator = React10.forwardRef((props, forwardedRef) => {
|
290
|
+
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
291
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
292
|
+
return /* @__PURE__ */ jsx11(
|
293
|
+
MenuPrimitive11.ItemIndicator,
|
294
|
+
{
|
295
|
+
...menuScope,
|
296
|
+
...itemIndicatorProps,
|
297
|
+
ref: forwardedRef
|
298
|
+
}
|
299
|
+
);
|
300
|
+
});
|
301
|
+
ContextMenuItemIndicator.displayName = INDICATOR_NAME;
|
302
|
+
|
303
|
+
// packages/react/context-menu/src/ContextMenuSeparator.tsx
|
304
|
+
import * as MenuPrimitive12 from "@huin-core/react-menu";
|
305
|
+
import React11 from "react";
|
306
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
307
|
+
var SEPARATOR_NAME = "ContextMenuSeparator";
|
308
|
+
var ContextMenuSeparator = React11.forwardRef((props, forwardedRef) => {
|
309
|
+
const { __scopeContextMenu, ...separatorProps } = props;
|
310
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
311
|
+
return /* @__PURE__ */ jsx12(
|
312
|
+
MenuPrimitive12.Separator,
|
313
|
+
{
|
314
|
+
...menuScope,
|
315
|
+
...separatorProps,
|
316
|
+
ref: forwardedRef
|
317
|
+
}
|
318
|
+
);
|
319
|
+
});
|
320
|
+
ContextMenuSeparator.displayName = SEPARATOR_NAME;
|
321
|
+
|
322
|
+
// packages/react/context-menu/src/ContextMenuArrow.tsx
|
323
|
+
import * as MenuPrimitive13 from "@huin-core/react-menu";
|
324
|
+
import React12 from "react";
|
325
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
326
|
+
var ARROW_NAME = "ContextMenuArrow";
|
327
|
+
var ContextMenuArrow = React12.forwardRef((props, forwardedRef) => {
|
328
|
+
const { __scopeContextMenu, ...arrowProps } = props;
|
329
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
330
|
+
return /* @__PURE__ */ jsx13(MenuPrimitive13.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
331
|
+
});
|
332
|
+
ContextMenuArrow.displayName = ARROW_NAME;
|
333
|
+
|
334
|
+
// packages/react/context-menu/src/ContextMenuSub.tsx
|
335
|
+
import { useControllableState } from "@huin-core/react-use-controllable-state";
|
336
|
+
import * as MenuPrimitive14 from "@huin-core/react-menu";
|
337
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
338
|
+
var SUB_NAME = "ContextMenuSub";
|
339
|
+
var ContextMenuSub = (props) => {
|
340
|
+
const {
|
341
|
+
__scopeContextMenu,
|
342
|
+
children,
|
343
|
+
onOpenChange,
|
344
|
+
open: openProp,
|
345
|
+
defaultOpen
|
346
|
+
} = props;
|
347
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
348
|
+
const [open, setOpen] = useControllableState({
|
349
|
+
prop: openProp,
|
350
|
+
defaultProp: defaultOpen,
|
351
|
+
onChange: onOpenChange
|
352
|
+
});
|
353
|
+
return /* @__PURE__ */ jsx14(MenuPrimitive14.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
354
|
+
};
|
355
|
+
ContextMenuSub.displayName = SUB_NAME;
|
356
|
+
|
357
|
+
// packages/react/context-menu/src/ContextMenuSubTrigger.tsx
|
358
|
+
import * as MenuPrimitive15 from "@huin-core/react-menu";
|
359
|
+
import React13 from "react";
|
360
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
361
|
+
var SUB_TRIGGER_NAME = "ContextMenuSubTrigger";
|
362
|
+
var ContextMenuSubTrigger = React13.forwardRef((props, forwardedRef) => {
|
363
|
+
const { __scopeContextMenu, inset, ...triggerItemProps } = props;
|
364
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
365
|
+
return /* @__PURE__ */ jsx15(
|
366
|
+
MenuPrimitive15.SubTrigger,
|
367
|
+
{
|
368
|
+
...menuScope,
|
369
|
+
...triggerItemProps,
|
370
|
+
ref: forwardedRef
|
371
|
+
}
|
372
|
+
);
|
373
|
+
});
|
374
|
+
ContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
375
|
+
|
376
|
+
// packages/react/context-menu/src/ContextMenuSubContent.tsx
|
377
|
+
import * as MenuPrimitive16 from "@huin-core/react-menu";
|
378
|
+
import React14 from "react";
|
379
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
380
|
+
var SUB_CONTENT_NAME = "ContextMenuSubContent";
|
381
|
+
var ContextMenuSubContent = React14.forwardRef((props, forwardedRef) => {
|
382
|
+
const { __scopeContextMenu, ...subContentProps } = props;
|
383
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
384
|
+
return /* @__PURE__ */ jsx16(
|
385
|
+
MenuPrimitive16.SubContent,
|
386
|
+
{
|
387
|
+
...menuScope,
|
388
|
+
...subContentProps,
|
389
|
+
ref: forwardedRef,
|
390
|
+
style: {
|
391
|
+
...props.style,
|
392
|
+
// re-namespace exposed content custom properties
|
393
|
+
...{
|
394
|
+
"--huin-core-context-menu-content-transform-origin": "var(--huin-core-popper-transform-origin)",
|
395
|
+
"--huin-core-context-menu-content-available-width": "var(--huin-core-popper-available-width)",
|
396
|
+
"--huin-core-context-menu-content-available-height": "var(--huin-core-popper-available-height)",
|
397
|
+
"--huin-core-context-menu-trigger-width": "var(--huin-core-popper-anchor-width)",
|
398
|
+
"--huin-core-context-menu-trigger-height": "var(--huin-core-popper-anchor-height)"
|
399
|
+
}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
);
|
403
|
+
});
|
404
|
+
ContextMenuSubContent.displayName = SUB_CONTENT_NAME;
|
405
|
+
export {
|
406
|
+
ContextMenu,
|
407
|
+
ContextMenuArrow,
|
408
|
+
ContextMenuCheckboxItem,
|
409
|
+
ContextMenuContent,
|
410
|
+
ContextMenuGroup,
|
411
|
+
ContextMenuItem,
|
412
|
+
ContextMenuItemIndicator,
|
413
|
+
ContextMenuLabel,
|
414
|
+
ContextMenuPortal,
|
415
|
+
ContextMenuRadioGroup,
|
416
|
+
ContextMenuRadioItem,
|
417
|
+
ContextMenuSeparator,
|
418
|
+
ContextMenuSub,
|
419
|
+
ContextMenuSubContent,
|
420
|
+
ContextMenuSubTrigger,
|
421
|
+
ContextMenuTrigger,
|
422
|
+
Root2 as Root,
|
423
|
+
createContextMenuScope
|
424
|
+
};
|
425
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/ContextMenu.tsx", "../src/ContextMenuTrigger.tsx", "../src/ContextMenuPortal.tsx", "../src/ContextMenuContent.tsx", "../src/ContextMenuGroup.tsx", "../src/ContextMenuLabel.tsx", "../src/ContextMenuItem.tsx", "../src/ContextMenuCheckboxItem.tsx", "../src/ContextMenuRadioGroup.tsx", "../src/ContextMenuRadioItem.tsx", "../src/ContextMenuItemIndicator.tsx", "../src/ContextMenuSeparator.tsx", "../src/ContextMenuArrow.tsx", "../src/ContextMenuSub.tsx", "../src/ContextMenuSubTrigger.tsx", "../src/ContextMenuSubContent.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from \"react\";\nimport { createContextScope } from \"@huin-core/react-context\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { createMenuScope } from \"@huin-core/react-menu\";\nimport { useCallbackRef } from \"@huin-core/react-use-callback-ref\";\nimport type { Scope } from \"@huin-core/react-context\";\n\ntype Direction = \"ltr\" | \"rtl\";\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = \"ContextMenu\";\n\nexport type ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(\n CONTEXT_MENU_NAME,\n [createMenuScope]\n);\nexport const useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nexport const [ContextMenuProvider, useContextMenuContext] =\n createContextMenuContext<ContextMenuContextValue>(CONTEXT_MENU_NAME);\n\ninterface ContextMenuProps {\n children?: React.ReactNode;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n modal?: boolean;\n}\n\nconst ContextMenu: React.FC<ContextMenuProps> = (\n props: ScopedProps<ContextMenuProps>\n) => {\n const {\n __scopeContextMenu,\n children,\n onOpenChange,\n dir,\n modal = true,\n } = props;\n const [open, setOpen] = React.useState(false);\n const menuScope = useMenuScope(__scopeContextMenu);\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n\n const handleOpenChange = React.useCallback(\n (open: boolean) => {\n setOpen(open);\n handleOpenChangeProp(open);\n },\n [handleOpenChangeProp]\n );\n\n return (\n <ContextMenuProvider\n scope={__scopeContextMenu}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n <MenuPrimitive.Root\n {...menuScope}\n dir={dir}\n open={open}\n onOpenChange={handleOpenChange}\n modal={modal}\n >\n {children}\n </MenuPrimitive.Root>\n </ContextMenuProvider>\n );\n};\n\nContextMenu.displayName = CONTEXT_MENU_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = ContextMenu;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n //\n Root,\n};\nexport type { ContextMenuProps };\n", "import React from \"react\";\nimport {\n ScopedProps,\n useContextMenuContext,\n useMenuScope,\n} from \"./ContextMenu\";\nimport { Primitive } from \"@huin-core/react-primitive\";\nimport { composeEventHandlers } from \"@huin-core/primitive\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\n\ntype Point = { x: number; y: number };\n\nconst TRIGGER_NAME = \"ContextMenuTrigger\";\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {\n disabled?: boolean;\n}\n\nconst ContextMenuTrigger = React.forwardRef<\n ContextMenuTriggerElement,\n ContextMenuTriggerProps\n>((props: ScopedProps<ContextMenuTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, disabled = false, ...triggerProps } = props;\n const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const pointRef = React.useRef<Point>({ x: 0, y: 0 });\n const virtualRef = React.useRef({\n getBoundingClientRect: () =>\n DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current }),\n });\n const longPressTimerRef = React.useRef(0);\n const clearLongPress = React.useCallback(\n () => window.clearTimeout(longPressTimerRef.current),\n []\n );\n const handleOpen = (event: React.MouseEvent | React.PointerEvent) => {\n pointRef.current = { x: event.clientX, y: event.clientY };\n context.onOpenChange(true);\n };\n\n React.useEffect(() => clearLongPress, [clearLongPress]);\n React.useEffect(\n () => void (disabled && clearLongPress()),\n [disabled, clearLongPress]\n );\n\n return (\n <>\n <MenuPrimitive.Anchor {...menuScope} virtualRef={virtualRef} />\n <Primitive.span\n data-state={context.open ? \"open\" : \"closed\"}\n data-disabled={disabled ? \"\" : undefined}\n {...triggerProps}\n ref={forwardedRef}\n // prevent iOS context menu from appearing\n style={{ WebkitTouchCallout: \"none\", ...props.style }}\n // if trigger is disabled, enable the native Context Menu\n onContextMenu={\n disabled\n ? props.onContextMenu\n : composeEventHandlers(props.onContextMenu, (event) => {\n // clearing the long press here because some platforms already support\n // long press to trigger a `contextmenu` event\n clearLongPress();\n handleOpen(event);\n event.preventDefault();\n })\n }\n onPointerDown={\n disabled\n ? props.onPointerDown\n : composeEventHandlers(\n props.onPointerDown,\n whenTouchOrPen((event) => {\n // clear the long press here in case there's multiple touch points\n clearLongPress();\n longPressTimerRef.current = window.setTimeout(\n () => handleOpen(event),\n 700\n );\n })\n )\n }\n onPointerMove={\n disabled\n ? props.onPointerMove\n : composeEventHandlers(\n props.onPointerMove,\n whenTouchOrPen(clearLongPress)\n )\n }\n onPointerCancel={\n disabled\n ? props.onPointerCancel\n : composeEventHandlers(\n props.onPointerCancel,\n whenTouchOrPen(clearLongPress)\n )\n }\n onPointerUp={\n disabled\n ? props.onPointerUp\n : composeEventHandlers(\n props.onPointerUp,\n whenTouchOrPen(clearLongPress)\n )\n }\n />\n </>\n );\n});\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\nfunction whenTouchOrPen<E>(\n handler: React.PointerEventHandler<E>\n): React.PointerEventHandler<E> {\n return (event) =>\n event.pointerType !== \"mouse\" ? handler(event) : undefined;\n}\n\nexport { ContextMenuTrigger };\nexport type { ContextMenuTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst PORTAL_NAME = \"ContextMenuPortal\";\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Portal\n>;\ninterface ContextMenuPortalProps extends MenuPortalProps {}\n\nconst ContextMenuPortal: React.FC<ContextMenuPortalProps> = (\n props: ScopedProps<ContextMenuPortalProps>\n) => {\n const { __scopeContextMenu, ...portalProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Portal {...menuScope} {...portalProps} />;\n};\n\nContextMenuPortal.displayName = PORTAL_NAME;\n\nexport { ContextMenuPortal };\nexport type {ContextMenuPortalProps}\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport {\n ScopedProps,\n useContextMenuContext,\n useMenuScope,\n} from \"./ContextMenu\";\n\nconst CONTENT_NAME = \"ContextMenuContent\";\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Content\n>;\ninterface ContextMenuContentProps\n extends Omit<\n MenuContentProps,\n \"onEntryFocus\" | \"side\" | \"sideOffset\" | \"align\"\n > {}\n\nconst ContextMenuContent = React.forwardRef<\n ContextMenuContentElement,\n ContextMenuContentProps\n>((props: ScopedProps<ContextMenuContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...contentProps } = props;\n const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);\n const menuScope = useMenuScope(__scopeContextMenu);\n const hasInteractedOutsideRef = React.useRef(false);\n\n return (\n <MenuPrimitive.Content\n {...menuScope}\n {...contentProps}\n ref={forwardedRef}\n side=\"right\"\n sideOffset={2}\n align=\"start\"\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented && hasInteractedOutsideRef.current) {\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;\n }}\n style={{\n ...props.style,\n // re-namespace exposed content custom properties\n ...{\n '--huin-core-context-menu-content-transform-origin': 'var(--huin-core-popper-transform-origin)',\n '--huin-core-context-menu-content-available-width': 'var(--huin-core-popper-available-width)',\n '--huin-core-context-menu-content-available-height': 'var(--huin-core-popper-available-height)',\n '--huin-core-context-menu-trigger-width': 'var(--huin-core-popper-anchor-width)',\n '--huin-core-context-menu-trigger-height': 'var(--huin-core-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nContextMenuContent.displayName = CONTENT_NAME;\n\nexport { ContextMenuContent };\nexport type { ContextMenuContentProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst GROUP_NAME = \"ContextMenuGroup\";\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Group\n>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<\n ContextMenuGroupElement,\n ContextMenuGroupProps\n>((props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />\n );\n});\n\nContextMenuGroup.displayName = GROUP_NAME;\n\nexport { ContextMenuGroup };\nexport type { ContextMenuGroupProps };\n", "import React from \"react\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst LABEL_NAME = \"ContextMenuLabel\";\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Label\n>;\ninterface ContextMenuLabelProps extends MenuLabelProps {\n inset?: boolean;\n}\n\nconst ContextMenuLabel = React.forwardRef<\n ContextMenuLabelElement,\n ContextMenuLabelProps\n>((props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />\n );\n});\n\nContextMenuLabel.displayName = LABEL_NAME;\n\nexport { ContextMenuLabel };\nexport type { ContextMenuLabelProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst ITEM_NAME = \"ContextMenuItem\";\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {\n inset?: boolean;\n}\n\nconst ContextMenuItem = React.forwardRef<\n ContextMenuItemElement,\n ContextMenuItemProps\n>((props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />\n );\n});\n\nContextMenuItem.displayName = ITEM_NAME;\n\nexport { ContextMenuItem };\nexport type { ContextMenuItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nconst CHECKBOX_ITEM_NAME = \"ContextMenuCheckboxItem\";\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ntype MenuCheckboxItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.CheckboxItem\n>;\ninterface ContextMenuCheckboxItemProps extends MenuCheckboxItemProps {}\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props: ScopedProps<ContextMenuCheckboxItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...checkboxItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.CheckboxItem\n {...menuScope}\n {...checkboxItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\nexport { ContextMenuCheckboxItem };\nexport type { ContextMenuCheckboxItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport React from \"react\";\n\nconst RADIO_GROUP_NAME = \"ContextMenuRadioGroup\";\n\ntype ContextMenuRadioGroupElement = React.ElementRef<\n typeof MenuPrimitive.RadioGroup\n>;\ntype MenuRadioGroupProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioGroup\n>;\ninterface ContextMenuRadioGroupProps extends MenuRadioGroupProps {}\n\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>((props: ScopedProps<ContextMenuRadioGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioGroupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.RadioGroup\n {...menuScope}\n {...radioGroupProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\nexport { ContextMenuRadioGroup };\nexport type { ContextMenuRadioGroupProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst RADIO_ITEM_NAME = \"ContextMenuRadioItem\";\n\ntype ContextMenuRadioItemElement = React.ElementRef<\n typeof MenuPrimitive.RadioItem\n>;\ntype MenuRadioItemProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.RadioItem\n>;\ninterface ContextMenuRadioItemProps extends MenuRadioItemProps {}\n\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props: ScopedProps<ContextMenuRadioItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...radioItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.RadioItem\n {...menuScope}\n {...radioItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\nexport { ContextMenuRadioItem };\nexport type { ContextMenuRadioItemProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport React from \"react\";\n\nconst INDICATOR_NAME = \"ContextMenuItemIndicator\";\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ntype MenuItemIndicatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.ItemIndicator\n>;\ninterface ContextMenuItemIndicatorProps extends MenuItemIndicatorProps {}\n\nconst ContextMenuItemIndicator = React.forwardRef<\n ContextMenuItemIndicatorElement,\n ContextMenuItemIndicatorProps\n>((props: ScopedProps<ContextMenuItemIndicatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemIndicatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.ItemIndicator\n {...menuScope}\n {...itemIndicatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\nexport { ContextMenuItemIndicator };\nexport type { ContextMenuItemIndicatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SEPARATOR_NAME = \"ContextMenuSeparator\";\n\ntype ContextMenuSeparatorElement = React.ElementRef<\n typeof MenuPrimitive.Separator\n>;\ntype MenuSeparatorProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Separator\n>;\ninterface ContextMenuSeparatorProps extends MenuSeparatorProps {}\n\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>((props: ScopedProps<ContextMenuSeparatorProps>, forwardedRef) => {\n const { __scopeContextMenu, ...separatorProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Separator\n {...menuScope}\n {...separatorProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\nexport { ContextMenuSeparator };\nexport type { ContextMenuSeparatorProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst ARROW_NAME = \"ContextMenuArrow\";\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.Arrow\n>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<\n ContextMenuArrowElement,\n ContextMenuArrowProps\n>((props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />\n );\n});\n\nContextMenuArrow.displayName = ARROW_NAME;\n\nexport { ContextMenuArrow };\nexport type { ContextMenuArrowProps };\n", "import { useControllableState } from \"@huin-core/react-use-controllable-state\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\nimport * as MenuPrimitive from \"@huin-core/react-menu\";\n\nconst SUB_NAME = \"ContextMenuSub\";\n\ninterface ContextMenuSubProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n}\n\nconst ContextMenuSub: React.FC<ContextMenuSubProps> = (\n props: ScopedProps<ContextMenuSubProps>\n) => {\n const {\n __scopeContextMenu,\n children,\n onOpenChange,\n open: openProp,\n defaultOpen,\n } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n const [open, 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\nContextMenuSub.displayName = SUB_NAME;\n\nexport { ContextMenuSub };\nexport type { ContextMenuSubProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SUB_TRIGGER_NAME = \"ContextMenuSubTrigger\";\n\ntype ContextMenuSubTriggerElement = React.ElementRef<\n typeof MenuPrimitive.SubTrigger\n>;\ntype MenuSubTriggerProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubTrigger\n>;\ninterface ContextMenuSubTriggerProps extends MenuSubTriggerProps {\n inset?: boolean;\n}\n\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props: ScopedProps<ContextMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, inset, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return (\n <MenuPrimitive.SubTrigger\n {...menuScope}\n {...triggerItemProps}\n ref={forwardedRef}\n />\n );\n});\n\nContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\nexport { ContextMenuSubTrigger };\nexport type { ContextMenuSubTriggerProps };\n", "import * as MenuPrimitive from \"@huin-core/react-menu\";\nimport React from \"react\";\nimport { ScopedProps, useMenuScope } from \"./ContextMenu\";\n\nconst SUB_CONTENT_NAME = \"ContextMenuSubContent\";\n\ntype ContextMenuSubContentElement = React.ElementRef<\n typeof MenuPrimitive.Content\n>;\ntype MenuSubContentProps = React.ComponentPropsWithoutRef<\n typeof MenuPrimitive.SubContent\n>;\ninterface ContextMenuSubContentProps extends MenuSubContentProps {}\n\nconst ContextMenuSubContent = React.forwardRef<\n ContextMenuSubContentElement,\n ContextMenuSubContentProps\n>((props: ScopedProps<ContextMenuSubContentProps>, forwardedRef) => {\n const { __scopeContextMenu, ...subContentProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\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-context-menu-content-transform-origin\":\n \"var(--huin-core-popper-transform-origin)\",\n \"--huin-core-context-menu-content-available-width\":\n \"var(--huin-core-popper-available-width)\",\n \"--huin-core-context-menu-content-available-height\":\n \"var(--huin-core-popper-available-height)\",\n \"--huin-core-context-menu-trigger-width\":\n \"var(--huin-core-popper-anchor-width)\",\n \"--huin-core-context-menu-trigger-height\":\n \"var(--huin-core-popper-anchor-height)\",\n },\n }}\n />\n );\n});\n\nContextMenuSubContent.displayName = SUB_CONTENT_NAME;\n\nexport { ContextMenuSubContent };\nexport type { ContextMenuSubContentProps };\n"],
|
5
|
+
"mappings": ";;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,YAAY,mBAAmB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AA+DzB;AAtDN,IAAM,oBAAoB;AAG1B,IAAM,CAAC,0BAA0B,sBAAsB,IAAI;AAAA,EACzD;AAAA,EACA,CAAC,eAAe;AAClB;AACO,IAAM,eAAe,gBAAgB;AAQrC,IAAM,CAAC,qBAAqB,qBAAqB,IACtD,yBAAkD,iBAAiB;AASrE,IAAM,cAA0C,CAC9C,UACG;AACH,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,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;AAAA,EACZ,CAAC;AAED,SACE,gBAAAA,MAAe,qBAAd,EAAmB,GAAG,WAAW,MAAY,cAAc,SACzD,UACH;AAEJ;AAEA,eAAe,cAAc;;;ACrC7B,YAAYC,qBAAmB;AAC/B,OAAOC,aAAW;AAsBd,gBAAAC,aAAA;AAnBJ,IAAM,mBAAmB;AAYzB,IAAM,wBAAwBC,QAAM,WAGlC,CAAC,OAAgD,iBAAiB;AAClE,QAAM,EAAE,oBAAoB,OAAO,GAAG,iBAAiB,IAAI;AAC3D,QAAM,YAAY,aAAa,kBAAkB;AACjD,SACE,gBAAAD;AAAA,IAAe;AAAA,IAAd;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,KAAK;AAAA;AAAA,EACP;AAEJ,CAAC;AAED,sBAAsB,cAAc;;;AC/BpC,YAAYE,qBAAmB;AAC/B,OAAOC,aAAW;AAqBd,gBAAAC,aAAA;AAlBJ,IAAM,mBAAmB;AAUzB,IAAM,wBAAwBC,QAAM,WAGlC,CAAC,OAAgD,iBAAiB;AAClE,QAAM,EAAE,oBAAoB,GAAG,gBAAgB,IAAI;AACnD,QAAM,YAAY,aAAa,kBAAkB;AAEjD,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,qDACE;AAAA,UACF,oDACE;AAAA,UACF,qDACE;AAAA,UACF,0CACE;AAAA,UACF,2CACE;AAAA,QACJ;AAAA,MACF;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,sBAAsB,cAAc;",
|
6
|
+
"names": ["open", "Root", "React", "MenuPrimitive", "jsx", "React", "MenuPrimitive", "jsx", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "React", "MenuPrimitive", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "React", "jsx", "React", "MenuPrimitive", "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-context-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": {
|