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