@radix-ui/react-context-menu 2.1.6-rc.9 → 2.2.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +83 -71
- package/dist/index.d.ts +83 -71
- package/dist/index.js +307 -393
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +296 -339
- package/dist/index.mjs.map +7 -1
- package/package.json +7 -8
- package/dist/index.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,367 +1,324 @@
|
|
|
1
|
-
|
|
2
|
-
import {useState as $3TiJz$useState, useCallback as $3TiJz$useCallback, createElement as $3TiJz$createElement, forwardRef as $3TiJz$forwardRef, useRef as $3TiJz$useRef, useEffect as $3TiJz$useEffect, Fragment as $3TiJz$Fragment} from "react";
|
|
3
|
-
import {composeEventHandlers as $3TiJz$composeEventHandlers} from "@radix-ui/primitive";
|
|
4
|
-
import {createContextScope as $3TiJz$createContextScope} from "@radix-ui/react-context";
|
|
5
|
-
import {Primitive as $3TiJz$Primitive} from "@radix-ui/react-primitive";
|
|
6
|
-
import {createMenuScope as $3TiJz$createMenuScope, Root as $3TiJz$Root, Anchor as $3TiJz$Anchor, Portal as $3TiJz$Portal, Content as $3TiJz$Content, Group as $3TiJz$Group, Label as $3TiJz$Label, Item as $3TiJz$Item, CheckboxItem as $3TiJz$CheckboxItem, RadioGroup as $3TiJz$RadioGroup, RadioItem as $3TiJz$RadioItem, ItemIndicator as $3TiJz$ItemIndicator, Separator as $3TiJz$Separator, Arrow as $3TiJz$Arrow, Sub as $3TiJz$Sub, SubTrigger as $3TiJz$SubTrigger, SubContent as $3TiJz$SubContent} from "@radix-ui/react-menu";
|
|
7
|
-
import {useCallbackRef as $3TiJz$useCallbackRef} from "@radix-ui/react-use-callback-ref";
|
|
8
|
-
import {useControllableState as $3TiJz$useControllableState} from "@radix-ui/react-use-controllable-state";
|
|
1
|
+
"use client";
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$3TiJz$createMenuScope
|
|
3
|
+
// packages/react/context-menu/src/ContextMenu.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
6
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
7
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
8
|
+
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
9
|
+
import { createMenuScope } from "@radix-ui/react-menu";
|
|
10
|
+
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
|
|
11
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var CONTEXT_MENU_NAME = "ContextMenu";
|
|
14
|
+
var [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [
|
|
15
|
+
createMenuScope
|
|
24
16
|
]);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
var useMenuScope = createMenuScope();
|
|
18
|
+
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
|
|
19
|
+
var ContextMenu = (props) => {
|
|
20
|
+
const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;
|
|
21
|
+
const [open, setOpen] = React.useState(false);
|
|
22
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
23
|
+
const handleOpenChangeProp = useCallbackRef(onOpenChange);
|
|
24
|
+
const handleOpenChange = React.useCallback(
|
|
25
|
+
(open2) => {
|
|
26
|
+
setOpen(open2);
|
|
27
|
+
handleOpenChangeProp(open2);
|
|
28
|
+
},
|
|
29
|
+
[handleOpenChangeProp]
|
|
30
|
+
);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
ContextMenuProvider,
|
|
33
|
+
{
|
|
34
|
+
scope: __scopeContextMenu,
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange: handleOpenChange,
|
|
37
|
+
modal,
|
|
38
|
+
children: /* @__PURE__ */ jsx(
|
|
39
|
+
MenuPrimitive.Root,
|
|
40
|
+
{
|
|
41
|
+
...menuScope,
|
|
42
|
+
dir,
|
|
43
|
+
open,
|
|
44
|
+
onOpenChange: handleOpenChange,
|
|
45
|
+
modal,
|
|
46
|
+
children
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
49
51
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
const {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
const pointRef = $3TiJz$useRef({
|
|
61
|
-
x: 0,
|
|
62
|
-
y: 0
|
|
63
|
-
});
|
|
64
|
-
const virtualRef = $3TiJz$useRef({
|
|
65
|
-
getBoundingClientRect: ()=>DOMRect.fromRect({
|
|
66
|
-
width: 0,
|
|
67
|
-
height: 0,
|
|
68
|
-
...pointRef.current
|
|
69
|
-
})
|
|
52
|
+
ContextMenu.displayName = CONTEXT_MENU_NAME;
|
|
53
|
+
var TRIGGER_NAME = "ContextMenuTrigger";
|
|
54
|
+
var ContextMenuTrigger = React.forwardRef(
|
|
55
|
+
(props, forwardedRef) => {
|
|
56
|
+
const { __scopeContextMenu, disabled = false, ...triggerProps } = props;
|
|
57
|
+
const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);
|
|
58
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
59
|
+
const pointRef = React.useRef({ x: 0, y: 0 });
|
|
60
|
+
const virtualRef = React.useRef({
|
|
61
|
+
getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current })
|
|
70
62
|
});
|
|
71
|
-
const longPressTimerRef =
|
|
72
|
-
const clearLongPress =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
context.onOpenChange(true);
|
|
63
|
+
const longPressTimerRef = React.useRef(0);
|
|
64
|
+
const clearLongPress = React.useCallback(
|
|
65
|
+
() => window.clearTimeout(longPressTimerRef.current),
|
|
66
|
+
[]
|
|
67
|
+
);
|
|
68
|
+
const handleOpen = (event) => {
|
|
69
|
+
pointRef.current = { x: event.clientX, y: event.clientY };
|
|
70
|
+
context.onOpenChange(true);
|
|
80
71
|
};
|
|
81
|
-
|
|
82
|
-
, [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"data-disabled": disabled ? '' : undefined
|
|
95
|
-
}, triggerProps, {
|
|
96
|
-
ref: forwardedRef // prevent iOS context menu from appearing
|
|
97
|
-
,
|
|
98
|
-
style: {
|
|
99
|
-
WebkitTouchCallout: 'none',
|
|
100
|
-
...props.style
|
|
101
|
-
} // if trigger is disabled, enable the native Context Menu
|
|
102
|
-
,
|
|
103
|
-
onContextMenu: disabled ? props.onContextMenu : $3TiJz$composeEventHandlers(props.onContextMenu, (event)=>{
|
|
104
|
-
// clearing the long press here because some platforms already support
|
|
105
|
-
// long press to trigger a `contextmenu` event
|
|
72
|
+
React.useEffect(() => clearLongPress, [clearLongPress]);
|
|
73
|
+
React.useEffect(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);
|
|
74
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
|
+
/* @__PURE__ */ jsx(MenuPrimitive.Anchor, { ...menuScope, virtualRef }),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
Primitive.span,
|
|
78
|
+
{
|
|
79
|
+
"data-state": context.open ? "open" : "closed",
|
|
80
|
+
"data-disabled": disabled ? "" : void 0,
|
|
81
|
+
...triggerProps,
|
|
82
|
+
ref: forwardedRef,
|
|
83
|
+
style: { WebkitTouchCallout: "none", ...props.style },
|
|
84
|
+
onContextMenu: disabled ? props.onContextMenu : composeEventHandlers(props.onContextMenu, (event) => {
|
|
106
85
|
clearLongPress();
|
|
107
86
|
handleOpen(event);
|
|
108
87
|
event.preventDefault();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
88
|
+
}),
|
|
89
|
+
onPointerDown: disabled ? props.onPointerDown : composeEventHandlers(
|
|
90
|
+
props.onPointerDown,
|
|
91
|
+
whenTouchOrPen((event) => {
|
|
92
|
+
clearLongPress();
|
|
93
|
+
longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);
|
|
94
|
+
})
|
|
95
|
+
),
|
|
96
|
+
onPointerMove: disabled ? props.onPointerMove : composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress)),
|
|
97
|
+
onPointerCancel: disabled ? props.onPointerCancel : composeEventHandlers(props.onPointerCancel, whenTouchOrPen(clearLongPress)),
|
|
98
|
+
onPointerUp: disabled ? props.onPointerUp : composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
ContextMenuTrigger.displayName = TRIGGER_NAME;
|
|
105
|
+
var PORTAL_NAME = "ContextMenuPortal";
|
|
106
|
+
var ContextMenuPortal = (props) => {
|
|
107
|
+
const { __scopeContextMenu, ...portalProps } = props;
|
|
108
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
109
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { ...menuScope, ...portalProps });
|
|
131
110
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
111
|
+
ContextMenuPortal.displayName = PORTAL_NAME;
|
|
112
|
+
var CONTENT_NAME = "ContextMenuContent";
|
|
113
|
+
var ContextMenuContent = React.forwardRef(
|
|
114
|
+
(props, forwardedRef) => {
|
|
115
|
+
const { __scopeContextMenu, ...contentProps } = props;
|
|
116
|
+
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
|
117
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
118
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
119
|
+
return /* @__PURE__ */ jsx(
|
|
120
|
+
MenuPrimitive.Content,
|
|
121
|
+
{
|
|
122
|
+
...menuScope,
|
|
123
|
+
...contentProps,
|
|
144
124
|
ref: forwardedRef,
|
|
145
125
|
side: "right",
|
|
146
126
|
sideOffset: 2,
|
|
147
127
|
align: "start",
|
|
148
|
-
onCloseAutoFocus: (event)=>{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
onCloseAutoFocus: (event) => {
|
|
129
|
+
props.onCloseAutoFocus?.(event);
|
|
130
|
+
if (!event.defaultPrevented && hasInteractedOutsideRef.current) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
hasInteractedOutsideRef.current = false;
|
|
153
134
|
},
|
|
154
|
-
onInteractOutside: (event)=>{
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
|
135
|
+
onInteractOutside: (event) => {
|
|
136
|
+
props.onInteractOutside?.(event);
|
|
137
|
+
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
|
158
138
|
},
|
|
159
139
|
style: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
140
|
+
...props.style,
|
|
141
|
+
// re-namespace exposed content custom properties
|
|
142
|
+
...{
|
|
143
|
+
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
144
|
+
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
145
|
+
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
146
|
+
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
147
|
+
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
148
|
+
}
|
|
166
149
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
ContextMenuContent.displayName = CONTENT_NAME;
|
|
155
|
+
var GROUP_NAME = "ContextMenuGroup";
|
|
156
|
+
var ContextMenuGroup = React.forwardRef(
|
|
157
|
+
(props, forwardedRef) => {
|
|
158
|
+
const { __scopeContextMenu, ...groupProps } = props;
|
|
159
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
160
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
ContextMenuGroup.displayName = GROUP_NAME;
|
|
164
|
+
var LABEL_NAME = "ContextMenuLabel";
|
|
165
|
+
var ContextMenuLabel = React.forwardRef(
|
|
166
|
+
(props, forwardedRef) => {
|
|
167
|
+
const { __scopeContextMenu, ...labelProps } = props;
|
|
168
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
169
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
ContextMenuLabel.displayName = LABEL_NAME;
|
|
173
|
+
var ITEM_NAME = "ContextMenuItem";
|
|
174
|
+
var ContextMenuItem = React.forwardRef(
|
|
175
|
+
(props, forwardedRef) => {
|
|
176
|
+
const { __scopeContextMenu, ...itemProps } = props;
|
|
177
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
178
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
ContextMenuItem.displayName = ITEM_NAME;
|
|
182
|
+
var CHECKBOX_ITEM_NAME = "ContextMenuCheckboxItem";
|
|
183
|
+
var ContextMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {
|
|
184
|
+
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
|
185
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
186
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
184
187
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Label, $3TiJz$babelruntimehelpersesmextends({}, menuScope, labelProps, {
|
|
192
|
-
ref: forwardedRef
|
|
193
|
-
}));
|
|
188
|
+
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
189
|
+
var RADIO_GROUP_NAME = "ContextMenuRadioGroup";
|
|
190
|
+
var ContextMenuRadioGroup = React.forwardRef((props, forwardedRef) => {
|
|
191
|
+
const { __scopeContextMenu, ...radioGroupProps } = props;
|
|
192
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
193
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
194
194
|
});
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
196
|
+
var RADIO_ITEM_NAME = "ContextMenuRadioItem";
|
|
197
|
+
var ContextMenuRadioItem = React.forwardRef((props, forwardedRef) => {
|
|
198
|
+
const { __scopeContextMenu, ...radioItemProps } = props;
|
|
199
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
200
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
197
201
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Item, $3TiJz$babelruntimehelpersesmextends({}, menuScope, itemProps, {
|
|
205
|
-
ref: forwardedRef
|
|
206
|
-
}));
|
|
202
|
+
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
203
|
+
var INDICATOR_NAME = "ContextMenuItemIndicator";
|
|
204
|
+
var ContextMenuItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
205
|
+
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
|
206
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
207
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
207
208
|
});
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
ContextMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
210
|
+
var SEPARATOR_NAME = "ContextMenuSeparator";
|
|
211
|
+
var ContextMenuSeparator = React.forwardRef((props, forwardedRef) => {
|
|
212
|
+
const { __scopeContextMenu, ...separatorProps } = props;
|
|
213
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
214
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
210
215
|
});
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const { __scopeContextMenu
|
|
216
|
-
const menuScope =
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
ref: forwardedRef
|
|
232
|
-
}));
|
|
233
|
-
});
|
|
234
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$db5c89af5ed9aa07, {
|
|
235
|
-
displayName: $1b0217ee4a91d156$var$RADIO_GROUP_NAME
|
|
236
|
-
});
|
|
237
|
-
/* -------------------------------------------------------------------------------------------------
|
|
238
|
-
* ContextMenuRadioItem
|
|
239
|
-
* -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$RADIO_ITEM_NAME = 'ContextMenuRadioItem';
|
|
240
|
-
const $1b0217ee4a91d156$export$8a727d09a7d9bfc2 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
|
|
241
|
-
const { __scopeContextMenu: __scopeContextMenu , ...radioItemProps } = props;
|
|
242
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
243
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$RadioItem, $3TiJz$babelruntimehelpersesmextends({}, menuScope, radioItemProps, {
|
|
244
|
-
ref: forwardedRef
|
|
245
|
-
}));
|
|
246
|
-
});
|
|
247
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$8a727d09a7d9bfc2, {
|
|
248
|
-
displayName: $1b0217ee4a91d156$var$RADIO_ITEM_NAME
|
|
249
|
-
});
|
|
250
|
-
/* -------------------------------------------------------------------------------------------------
|
|
251
|
-
* ContextMenuItemIndicator
|
|
252
|
-
* -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$INDICATOR_NAME = 'ContextMenuItemIndicator';
|
|
253
|
-
const $1b0217ee4a91d156$export$9ed8194dee42d94b = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
|
|
254
|
-
const { __scopeContextMenu: __scopeContextMenu , ...itemIndicatorProps } = props;
|
|
255
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
256
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$ItemIndicator, $3TiJz$babelruntimehelpersesmextends({}, menuScope, itemIndicatorProps, {
|
|
257
|
-
ref: forwardedRef
|
|
258
|
-
}));
|
|
259
|
-
});
|
|
260
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$9ed8194dee42d94b, {
|
|
261
|
-
displayName: $1b0217ee4a91d156$var$INDICATOR_NAME
|
|
262
|
-
});
|
|
263
|
-
/* -------------------------------------------------------------------------------------------------
|
|
264
|
-
* ContextMenuSeparator
|
|
265
|
-
* -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SEPARATOR_NAME = 'ContextMenuSeparator';
|
|
266
|
-
const $1b0217ee4a91d156$export$8d6b009fadfe1207 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
|
|
267
|
-
const { __scopeContextMenu: __scopeContextMenu , ...separatorProps } = props;
|
|
268
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
269
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Separator, $3TiJz$babelruntimehelpersesmextends({}, menuScope, separatorProps, {
|
|
270
|
-
ref: forwardedRef
|
|
271
|
-
}));
|
|
272
|
-
});
|
|
273
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$8d6b009fadfe1207, {
|
|
274
|
-
displayName: $1b0217ee4a91d156$var$SEPARATOR_NAME
|
|
275
|
-
});
|
|
276
|
-
/* -------------------------------------------------------------------------------------------------
|
|
277
|
-
* ContextMenuArrow
|
|
278
|
-
* -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$ARROW_NAME = 'ContextMenuArrow';
|
|
279
|
-
const $1b0217ee4a91d156$export$f47d0a58228a61e2 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
|
|
280
|
-
const { __scopeContextMenu: __scopeContextMenu , ...arrowProps } = props;
|
|
281
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
282
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Arrow, $3TiJz$babelruntimehelpersesmextends({}, menuScope, arrowProps, {
|
|
283
|
-
ref: forwardedRef
|
|
284
|
-
}));
|
|
285
|
-
});
|
|
286
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$f47d0a58228a61e2, {
|
|
287
|
-
displayName: $1b0217ee4a91d156$var$ARROW_NAME
|
|
288
|
-
});
|
|
289
|
-
/* -------------------------------------------------------------------------------------------------
|
|
290
|
-
* ContextMenuSub
|
|
291
|
-
* -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SUB_NAME = 'ContextMenuSub';
|
|
292
|
-
const $1b0217ee4a91d156$export$5bc21d1c00c4b201 = (props)=>{
|
|
293
|
-
const { __scopeContextMenu: __scopeContextMenu , children: children , onOpenChange: onOpenChange , open: openProp , defaultOpen: defaultOpen } = props;
|
|
294
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
295
|
-
const [open, setOpen] = $3TiJz$useControllableState({
|
|
296
|
-
prop: openProp,
|
|
297
|
-
defaultProp: defaultOpen,
|
|
298
|
-
onChange: onOpenChange
|
|
299
|
-
});
|
|
300
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Sub, $3TiJz$babelruntimehelpersesmextends({}, menuScope, {
|
|
301
|
-
open: open,
|
|
302
|
-
onOpenChange: setOpen
|
|
303
|
-
}), children);
|
|
216
|
+
ContextMenuSeparator.displayName = SEPARATOR_NAME;
|
|
217
|
+
var ARROW_NAME = "ContextMenuArrow";
|
|
218
|
+
var ContextMenuArrow = React.forwardRef(
|
|
219
|
+
(props, forwardedRef) => {
|
|
220
|
+
const { __scopeContextMenu, ...arrowProps } = props;
|
|
221
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
222
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
ContextMenuArrow.displayName = ARROW_NAME;
|
|
226
|
+
var SUB_NAME = "ContextMenuSub";
|
|
227
|
+
var ContextMenuSub = (props) => {
|
|
228
|
+
const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = props;
|
|
229
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
230
|
+
const [open, setOpen] = useControllableState({
|
|
231
|
+
prop: openProp,
|
|
232
|
+
defaultProp: defaultOpen,
|
|
233
|
+
onChange: onOpenChange
|
|
234
|
+
});
|
|
235
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
304
236
|
};
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const $1b0217ee4a91d156$export$30b2b5c64556d316 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
|
|
312
|
-
const { __scopeContextMenu: __scopeContextMenu , ...triggerItemProps } = props;
|
|
313
|
-
const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
|
|
314
|
-
return /*#__PURE__*/ $3TiJz$createElement($3TiJz$SubTrigger, $3TiJz$babelruntimehelpersesmextends({}, menuScope, triggerItemProps, {
|
|
315
|
-
ref: forwardedRef
|
|
316
|
-
}));
|
|
317
|
-
});
|
|
318
|
-
/*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$30b2b5c64556d316, {
|
|
319
|
-
displayName: $1b0217ee4a91d156$var$SUB_TRIGGER_NAME
|
|
237
|
+
ContextMenuSub.displayName = SUB_NAME;
|
|
238
|
+
var SUB_TRIGGER_NAME = "ContextMenuSubTrigger";
|
|
239
|
+
var ContextMenuSubTrigger = React.forwardRef((props, forwardedRef) => {
|
|
240
|
+
const { __scopeContextMenu, ...triggerItemProps } = props;
|
|
241
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
242
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.SubTrigger, { ...menuScope, ...triggerItemProps, ref: forwardedRef });
|
|
320
243
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
244
|
+
ContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
245
|
+
var SUB_CONTENT_NAME = "ContextMenuSubContent";
|
|
246
|
+
var ContextMenuSubContent = React.forwardRef((props, forwardedRef) => {
|
|
247
|
+
const { __scopeContextMenu, ...subContentProps } = props;
|
|
248
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
249
|
+
return /* @__PURE__ */ jsx(
|
|
250
|
+
MenuPrimitive.SubContent,
|
|
251
|
+
{
|
|
252
|
+
...menuScope,
|
|
253
|
+
...subContentProps,
|
|
254
|
+
ref: forwardedRef,
|
|
255
|
+
style: {
|
|
256
|
+
...props.style,
|
|
257
|
+
// re-namespace exposed content custom properties
|
|
258
|
+
...{
|
|
259
|
+
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
260
|
+
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
261
|
+
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
262
|
+
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
263
|
+
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
336
264
|
}
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
displayName: $1b0217ee4a91d156$var$SUB_CONTENT_NAME
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
);
|
|
341
268
|
});
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
269
|
+
ContextMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
270
|
+
function whenTouchOrPen(handler) {
|
|
271
|
+
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
|
345
272
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
273
|
+
var Root2 = ContextMenu;
|
|
274
|
+
var Trigger = ContextMenuTrigger;
|
|
275
|
+
var Portal2 = ContextMenuPortal;
|
|
276
|
+
var Content2 = ContextMenuContent;
|
|
277
|
+
var Group2 = ContextMenuGroup;
|
|
278
|
+
var Label2 = ContextMenuLabel;
|
|
279
|
+
var Item2 = ContextMenuItem;
|
|
280
|
+
var CheckboxItem2 = ContextMenuCheckboxItem;
|
|
281
|
+
var RadioGroup2 = ContextMenuRadioGroup;
|
|
282
|
+
var RadioItem2 = ContextMenuRadioItem;
|
|
283
|
+
var ItemIndicator2 = ContextMenuItemIndicator;
|
|
284
|
+
var Separator2 = ContextMenuSeparator;
|
|
285
|
+
var Arrow2 = ContextMenuArrow;
|
|
286
|
+
var Sub2 = ContextMenuSub;
|
|
287
|
+
var SubTrigger2 = ContextMenuSubTrigger;
|
|
288
|
+
var SubContent2 = ContextMenuSubContent;
|
|
289
|
+
export {
|
|
290
|
+
Arrow2 as Arrow,
|
|
291
|
+
CheckboxItem2 as CheckboxItem,
|
|
292
|
+
Content2 as Content,
|
|
293
|
+
ContextMenu,
|
|
294
|
+
ContextMenuArrow,
|
|
295
|
+
ContextMenuCheckboxItem,
|
|
296
|
+
ContextMenuContent,
|
|
297
|
+
ContextMenuGroup,
|
|
298
|
+
ContextMenuItem,
|
|
299
|
+
ContextMenuItemIndicator,
|
|
300
|
+
ContextMenuLabel,
|
|
301
|
+
ContextMenuPortal,
|
|
302
|
+
ContextMenuRadioGroup,
|
|
303
|
+
ContextMenuRadioItem,
|
|
304
|
+
ContextMenuSeparator,
|
|
305
|
+
ContextMenuSub,
|
|
306
|
+
ContextMenuSubContent,
|
|
307
|
+
ContextMenuSubTrigger,
|
|
308
|
+
ContextMenuTrigger,
|
|
309
|
+
Group2 as Group,
|
|
310
|
+
Item2 as Item,
|
|
311
|
+
ItemIndicator2 as ItemIndicator,
|
|
312
|
+
Label2 as Label,
|
|
313
|
+
Portal2 as Portal,
|
|
314
|
+
RadioGroup2 as RadioGroup,
|
|
315
|
+
RadioItem2 as RadioItem,
|
|
316
|
+
Root2 as Root,
|
|
317
|
+
Separator2 as Separator,
|
|
318
|
+
Sub2 as Sub,
|
|
319
|
+
SubContent2 as SubContent,
|
|
320
|
+
SubTrigger2 as SubTrigger,
|
|
321
|
+
Trigger,
|
|
322
|
+
createContextMenuScope
|
|
323
|
+
};
|
|
367
324
|
//# sourceMappingURL=index.mjs.map
|