@radix-ui/react-context-menu 2.2.0-rc.2 → 2.2.0-rc.3
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.js +325 -289
- package/dist/index.js.map +4 -4
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,287 +1,208 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
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);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
pointRef.current = { x: event.clientX, y: event.clientY };
|
|
100
|
-
context.onOpenChange(true);
|
|
101
|
-
};
|
|
102
|
-
React.useEffect(() => clearLongPress, [clearLongPress]);
|
|
103
|
-
React.useEffect(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);
|
|
104
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { ...menuScope, virtualRef }),
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
-
import_react_primitive.Primitive.span,
|
|
108
|
-
{
|
|
109
|
-
"data-state": context.open ? "open" : "closed",
|
|
110
|
-
"data-disabled": disabled ? "" : void 0,
|
|
111
|
-
...triggerProps,
|
|
112
|
-
ref: forwardedRef,
|
|
113
|
-
style: { WebkitTouchCallout: "none", ...props.style },
|
|
114
|
-
onContextMenu: disabled ? props.onContextMenu : (0, import_primitive.composeEventHandlers)(props.onContextMenu, (event) => {
|
|
115
|
-
clearLongPress();
|
|
116
|
-
handleOpen(event);
|
|
117
|
-
event.preventDefault();
|
|
118
|
-
}),
|
|
119
|
-
onPointerDown: disabled ? props.onPointerDown : (0, import_primitive.composeEventHandlers)(
|
|
120
|
-
props.onPointerDown,
|
|
121
|
-
whenTouchOrPen((event) => {
|
|
122
|
-
clearLongPress();
|
|
123
|
-
longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);
|
|
124
|
-
})
|
|
125
|
-
),
|
|
126
|
-
onPointerMove: disabled ? props.onPointerMove : (0, import_primitive.composeEventHandlers)(props.onPointerMove, whenTouchOrPen(clearLongPress)),
|
|
127
|
-
onPointerCancel: disabled ? props.onPointerCancel : (0, import_primitive.composeEventHandlers)(props.onPointerCancel, whenTouchOrPen(clearLongPress)),
|
|
128
|
-
onPointerUp: disabled ? props.onPointerUp : (0, import_primitive.composeEventHandlers)(props.onPointerUp, whenTouchOrPen(clearLongPress))
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
] });
|
|
132
|
-
}
|
|
31
|
+
// packages/react/context-menu/src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
Arrow: () => Arrow2,
|
|
35
|
+
CheckboxItem: () => CheckboxItem2,
|
|
36
|
+
Content: () => Content2,
|
|
37
|
+
ContextMenu: () => ContextMenu,
|
|
38
|
+
ContextMenuArrow: () => ContextMenuArrow,
|
|
39
|
+
ContextMenuCheckboxItem: () => ContextMenuCheckboxItem,
|
|
40
|
+
ContextMenuContent: () => ContextMenuContent,
|
|
41
|
+
ContextMenuGroup: () => ContextMenuGroup,
|
|
42
|
+
ContextMenuItem: () => ContextMenuItem,
|
|
43
|
+
ContextMenuItemIndicator: () => ContextMenuItemIndicator,
|
|
44
|
+
ContextMenuLabel: () => ContextMenuLabel,
|
|
45
|
+
ContextMenuPortal: () => ContextMenuPortal,
|
|
46
|
+
ContextMenuRadioGroup: () => ContextMenuRadioGroup,
|
|
47
|
+
ContextMenuRadioItem: () => ContextMenuRadioItem,
|
|
48
|
+
ContextMenuSeparator: () => ContextMenuSeparator,
|
|
49
|
+
ContextMenuSub: () => ContextMenuSub,
|
|
50
|
+
ContextMenuSubContent: () => ContextMenuSubContent,
|
|
51
|
+
ContextMenuSubTrigger: () => ContextMenuSubTrigger,
|
|
52
|
+
ContextMenuTrigger: () => ContextMenuTrigger,
|
|
53
|
+
Group: () => Group2,
|
|
54
|
+
Item: () => Item2,
|
|
55
|
+
ItemIndicator: () => ItemIndicator2,
|
|
56
|
+
Label: () => Label2,
|
|
57
|
+
Portal: () => Portal2,
|
|
58
|
+
RadioGroup: () => RadioGroup2,
|
|
59
|
+
RadioItem: () => RadioItem2,
|
|
60
|
+
Root: () => Root2,
|
|
61
|
+
Separator: () => Separator2,
|
|
62
|
+
Sub: () => Sub2,
|
|
63
|
+
SubContent: () => SubContent2,
|
|
64
|
+
SubTrigger: () => SubTrigger2,
|
|
65
|
+
Trigger: () => Trigger,
|
|
66
|
+
createContextMenuScope: () => createContextMenuScope
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(src_exports);
|
|
69
|
+
|
|
70
|
+
// packages/react/context-menu/src/ContextMenu.tsx
|
|
71
|
+
var React = __toESM(require("react"));
|
|
72
|
+
var import_primitive = require("@radix-ui/primitive");
|
|
73
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
74
|
+
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
75
|
+
var MenuPrimitive = __toESM(require("@radix-ui/react-menu"));
|
|
76
|
+
var import_react_menu = require("@radix-ui/react-menu");
|
|
77
|
+
var import_react_use_callback_ref = require("@radix-ui/react-use-callback-ref");
|
|
78
|
+
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
|
|
79
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
80
|
+
var CONTEXT_MENU_NAME = "ContextMenu";
|
|
81
|
+
var [createContextMenuContext, createContextMenuScope] = (0, import_react_context.createContextScope)(CONTEXT_MENU_NAME, [
|
|
82
|
+
import_react_menu.createMenuScope
|
|
83
|
+
]);
|
|
84
|
+
var useMenuScope = (0, import_react_menu.createMenuScope)();
|
|
85
|
+
var [ContextMenuProvider, useContextMenuContext] = createContextMenuContext(CONTEXT_MENU_NAME);
|
|
86
|
+
var ContextMenu = (props) => {
|
|
87
|
+
const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = props;
|
|
88
|
+
const [open, setOpen] = React.useState(false);
|
|
89
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
90
|
+
const handleOpenChangeProp = (0, import_react_use_callback_ref.useCallbackRef)(onOpenChange);
|
|
91
|
+
const handleOpenChange = React.useCallback(
|
|
92
|
+
(open2) => {
|
|
93
|
+
setOpen(open2);
|
|
94
|
+
handleOpenChangeProp(open2);
|
|
95
|
+
},
|
|
96
|
+
[handleOpenChangeProp]
|
|
133
97
|
);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var ContextMenuContent = React.forwardRef(
|
|
144
|
-
(props, forwardedRef) => {
|
|
145
|
-
const { __scopeContextMenu, ...contentProps } = props;
|
|
146
|
-
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
|
147
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
148
|
-
const hasInteractedOutsideRef = React.useRef(false);
|
|
149
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
-
MenuPrimitive.Content,
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
ContextMenuProvider,
|
|
100
|
+
{
|
|
101
|
+
scope: __scopeContextMenu,
|
|
102
|
+
open,
|
|
103
|
+
onOpenChange: handleOpenChange,
|
|
104
|
+
modal,
|
|
105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
MenuPrimitive.Root,
|
|
151
107
|
{
|
|
152
108
|
...menuScope,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
onCloseAutoFocus: (event) => {
|
|
159
|
-
props.onCloseAutoFocus?.(event);
|
|
160
|
-
if (!event.defaultPrevented && hasInteractedOutsideRef.current) {
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
}
|
|
163
|
-
hasInteractedOutsideRef.current = false;
|
|
164
|
-
},
|
|
165
|
-
onInteractOutside: (event) => {
|
|
166
|
-
props.onInteractOutside?.(event);
|
|
167
|
-
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
|
168
|
-
},
|
|
169
|
-
style: {
|
|
170
|
-
...props.style,
|
|
171
|
-
// re-namespace exposed content custom properties
|
|
172
|
-
...{
|
|
173
|
-
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
174
|
-
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
175
|
-
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
176
|
-
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
177
|
-
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
109
|
+
dir,
|
|
110
|
+
open,
|
|
111
|
+
onOpenChange: handleOpenChange,
|
|
112
|
+
modal,
|
|
113
|
+
children
|
|
180
114
|
}
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
ContextMenuContent.displayName = CONTENT_NAME;
|
|
185
|
-
var GROUP_NAME = "ContextMenuGroup";
|
|
186
|
-
var ContextMenuGroup = React.forwardRef(
|
|
187
|
-
(props, forwardedRef) => {
|
|
188
|
-
const { __scopeContextMenu, ...groupProps } = props;
|
|
189
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
190
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
ContextMenuGroup.displayName = GROUP_NAME;
|
|
194
|
-
var LABEL_NAME = "ContextMenuLabel";
|
|
195
|
-
var ContextMenuLabel = React.forwardRef(
|
|
196
|
-
(props, forwardedRef) => {
|
|
197
|
-
const { __scopeContextMenu, ...labelProps } = props;
|
|
198
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
199
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
ContextMenuLabel.displayName = LABEL_NAME;
|
|
203
|
-
var ITEM_NAME = "ContextMenuItem";
|
|
204
|
-
var ContextMenuItem = React.forwardRef(
|
|
205
|
-
(props, forwardedRef) => {
|
|
206
|
-
const { __scopeContextMenu, ...itemProps } = props;
|
|
207
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
208
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
209
|
-
}
|
|
210
|
-
);
|
|
211
|
-
ContextMenuItem.displayName = ITEM_NAME;
|
|
212
|
-
var CHECKBOX_ITEM_NAME = "ContextMenuCheckboxItem";
|
|
213
|
-
var ContextMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {
|
|
214
|
-
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
|
215
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
216
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
217
|
-
});
|
|
218
|
-
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
219
|
-
var RADIO_GROUP_NAME = "ContextMenuRadioGroup";
|
|
220
|
-
var ContextMenuRadioGroup = React.forwardRef((props, forwardedRef) => {
|
|
221
|
-
const { __scopeContextMenu, ...radioGroupProps } = props;
|
|
222
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
223
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
224
|
-
});
|
|
225
|
-
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
226
|
-
var RADIO_ITEM_NAME = "ContextMenuRadioItem";
|
|
227
|
-
var ContextMenuRadioItem = React.forwardRef((props, forwardedRef) => {
|
|
228
|
-
const { __scopeContextMenu, ...radioItemProps } = props;
|
|
229
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
230
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
231
|
-
});
|
|
232
|
-
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
233
|
-
var INDICATOR_NAME = "ContextMenuItemIndicator";
|
|
234
|
-
var ContextMenuItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
235
|
-
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
|
236
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
237
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
238
|
-
});
|
|
239
|
-
ContextMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
240
|
-
var SEPARATOR_NAME = "ContextMenuSeparator";
|
|
241
|
-
var ContextMenuSeparator = React.forwardRef((props, forwardedRef) => {
|
|
242
|
-
const { __scopeContextMenu, ...separatorProps } = props;
|
|
243
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
244
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
245
|
-
});
|
|
246
|
-
ContextMenuSeparator.displayName = SEPARATOR_NAME;
|
|
247
|
-
var ARROW_NAME = "ContextMenuArrow";
|
|
248
|
-
var ContextMenuArrow = React.forwardRef(
|
|
249
|
-
(props, forwardedRef) => {
|
|
250
|
-
const { __scopeContextMenu, ...arrowProps } = props;
|
|
251
|
-
const menuScope = useMenuScope(__scopeContextMenu);
|
|
252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
115
|
+
)
|
|
253
116
|
}
|
|
254
117
|
);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
118
|
+
};
|
|
119
|
+
ContextMenu.displayName = CONTEXT_MENU_NAME;
|
|
120
|
+
var TRIGGER_NAME = "ContextMenuTrigger";
|
|
121
|
+
var ContextMenuTrigger = React.forwardRef(
|
|
122
|
+
(props, forwardedRef) => {
|
|
123
|
+
const { __scopeContextMenu, disabled = false, ...triggerProps } = props;
|
|
124
|
+
const context = useContextMenuContext(TRIGGER_NAME, __scopeContextMenu);
|
|
259
125
|
const menuScope = useMenuScope(__scopeContextMenu);
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
onChange: onOpenChange
|
|
126
|
+
const pointRef = React.useRef({ x: 0, y: 0 });
|
|
127
|
+
const virtualRef = React.useRef({
|
|
128
|
+
getBoundingClientRect: () => DOMRect.fromRect({ width: 0, height: 0, ...pointRef.current })
|
|
264
129
|
});
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
130
|
+
const longPressTimerRef = React.useRef(0);
|
|
131
|
+
const clearLongPress = React.useCallback(
|
|
132
|
+
() => window.clearTimeout(longPressTimerRef.current),
|
|
133
|
+
[]
|
|
134
|
+
);
|
|
135
|
+
const handleOpen = (event) => {
|
|
136
|
+
pointRef.current = { x: event.clientX, y: event.clientY };
|
|
137
|
+
context.onOpenChange(true);
|
|
138
|
+
};
|
|
139
|
+
React.useEffect(() => clearLongPress, [clearLongPress]);
|
|
140
|
+
React.useEffect(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);
|
|
141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { ...menuScope, virtualRef }),
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_react_primitive.Primitive.span,
|
|
145
|
+
{
|
|
146
|
+
"data-state": context.open ? "open" : "closed",
|
|
147
|
+
"data-disabled": disabled ? "" : void 0,
|
|
148
|
+
...triggerProps,
|
|
149
|
+
ref: forwardedRef,
|
|
150
|
+
style: { WebkitTouchCallout: "none", ...props.style },
|
|
151
|
+
onContextMenu: disabled ? props.onContextMenu : (0, import_primitive.composeEventHandlers)(props.onContextMenu, (event) => {
|
|
152
|
+
clearLongPress();
|
|
153
|
+
handleOpen(event);
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
}),
|
|
156
|
+
onPointerDown: disabled ? props.onPointerDown : (0, import_primitive.composeEventHandlers)(
|
|
157
|
+
props.onPointerDown,
|
|
158
|
+
whenTouchOrPen((event) => {
|
|
159
|
+
clearLongPress();
|
|
160
|
+
longPressTimerRef.current = window.setTimeout(() => handleOpen(event), 700);
|
|
161
|
+
})
|
|
162
|
+
),
|
|
163
|
+
onPointerMove: disabled ? props.onPointerMove : (0, import_primitive.composeEventHandlers)(props.onPointerMove, whenTouchOrPen(clearLongPress)),
|
|
164
|
+
onPointerCancel: disabled ? props.onPointerCancel : (0, import_primitive.composeEventHandlers)(props.onPointerCancel, whenTouchOrPen(clearLongPress)),
|
|
165
|
+
onPointerUp: disabled ? props.onPointerUp : (0, import_primitive.composeEventHandlers)(props.onPointerUp, whenTouchOrPen(clearLongPress))
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] });
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
ContextMenuTrigger.displayName = TRIGGER_NAME;
|
|
172
|
+
var PORTAL_NAME = "ContextMenuPortal";
|
|
173
|
+
var ContextMenuPortal = (props) => {
|
|
174
|
+
const { __scopeContextMenu, ...portalProps } = props;
|
|
175
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Portal, { ...menuScope, ...portalProps });
|
|
177
|
+
};
|
|
178
|
+
ContextMenuPortal.displayName = PORTAL_NAME;
|
|
179
|
+
var CONTENT_NAME = "ContextMenuContent";
|
|
180
|
+
var ContextMenuContent = React.forwardRef(
|
|
181
|
+
(props, forwardedRef) => {
|
|
182
|
+
const { __scopeContextMenu, ...contentProps } = props;
|
|
183
|
+
const context = useContextMenuContext(CONTENT_NAME, __scopeContextMenu);
|
|
278
184
|
const menuScope = useMenuScope(__scopeContextMenu);
|
|
185
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
279
186
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
-
MenuPrimitive.
|
|
187
|
+
MenuPrimitive.Content,
|
|
281
188
|
{
|
|
282
189
|
...menuScope,
|
|
283
|
-
...
|
|
190
|
+
...contentProps,
|
|
284
191
|
ref: forwardedRef,
|
|
192
|
+
side: "right",
|
|
193
|
+
sideOffset: 2,
|
|
194
|
+
align: "start",
|
|
195
|
+
onCloseAutoFocus: (event) => {
|
|
196
|
+
props.onCloseAutoFocus?.(event);
|
|
197
|
+
if (!event.defaultPrevented && hasInteractedOutsideRef.current) {
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
}
|
|
200
|
+
hasInteractedOutsideRef.current = false;
|
|
201
|
+
},
|
|
202
|
+
onInteractOutside: (event) => {
|
|
203
|
+
props.onInteractOutside?.(event);
|
|
204
|
+
if (!event.defaultPrevented && !context.modal) hasInteractedOutsideRef.current = true;
|
|
205
|
+
},
|
|
285
206
|
style: {
|
|
286
207
|
...props.style,
|
|
287
208
|
// re-namespace exposed content custom properties
|
|
@@ -295,26 +216,141 @@
|
|
|
295
216
|
}
|
|
296
217
|
}
|
|
297
218
|
);
|
|
298
|
-
});
|
|
299
|
-
ContextMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
300
|
-
function whenTouchOrPen(handler) {
|
|
301
|
-
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
|
302
219
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
220
|
+
);
|
|
221
|
+
ContextMenuContent.displayName = CONTENT_NAME;
|
|
222
|
+
var GROUP_NAME = "ContextMenuGroup";
|
|
223
|
+
var ContextMenuGroup = React.forwardRef(
|
|
224
|
+
(props, forwardedRef) => {
|
|
225
|
+
const { __scopeContextMenu, ...groupProps } = props;
|
|
226
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
ContextMenuGroup.displayName = GROUP_NAME;
|
|
231
|
+
var LABEL_NAME = "ContextMenuLabel";
|
|
232
|
+
var ContextMenuLabel = React.forwardRef(
|
|
233
|
+
(props, forwardedRef) => {
|
|
234
|
+
const { __scopeContextMenu, ...labelProps } = props;
|
|
235
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
237
|
+
}
|
|
238
|
+
);
|
|
239
|
+
ContextMenuLabel.displayName = LABEL_NAME;
|
|
240
|
+
var ITEM_NAME = "ContextMenuItem";
|
|
241
|
+
var ContextMenuItem = React.forwardRef(
|
|
242
|
+
(props, forwardedRef) => {
|
|
243
|
+
const { __scopeContextMenu, ...itemProps } = props;
|
|
244
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
ContextMenuItem.displayName = ITEM_NAME;
|
|
249
|
+
var CHECKBOX_ITEM_NAME = "ContextMenuCheckboxItem";
|
|
250
|
+
var ContextMenuCheckboxItem = React.forwardRef((props, forwardedRef) => {
|
|
251
|
+
const { __scopeContextMenu, ...checkboxItemProps } = props;
|
|
252
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
254
|
+
});
|
|
255
|
+
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
256
|
+
var RADIO_GROUP_NAME = "ContextMenuRadioGroup";
|
|
257
|
+
var ContextMenuRadioGroup = React.forwardRef((props, forwardedRef) => {
|
|
258
|
+
const { __scopeContextMenu, ...radioGroupProps } = props;
|
|
259
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
261
|
+
});
|
|
262
|
+
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
263
|
+
var RADIO_ITEM_NAME = "ContextMenuRadioItem";
|
|
264
|
+
var ContextMenuRadioItem = React.forwardRef((props, forwardedRef) => {
|
|
265
|
+
const { __scopeContextMenu, ...radioItemProps } = props;
|
|
266
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
268
|
+
});
|
|
269
|
+
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
270
|
+
var INDICATOR_NAME = "ContextMenuItemIndicator";
|
|
271
|
+
var ContextMenuItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
272
|
+
const { __scopeContextMenu, ...itemIndicatorProps } = props;
|
|
273
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
275
|
+
});
|
|
276
|
+
ContextMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
277
|
+
var SEPARATOR_NAME = "ContextMenuSeparator";
|
|
278
|
+
var ContextMenuSeparator = React.forwardRef((props, forwardedRef) => {
|
|
279
|
+
const { __scopeContextMenu, ...separatorProps } = props;
|
|
280
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
282
|
+
});
|
|
283
|
+
ContextMenuSeparator.displayName = SEPARATOR_NAME;
|
|
284
|
+
var ARROW_NAME = "ContextMenuArrow";
|
|
285
|
+
var ContextMenuArrow = React.forwardRef(
|
|
286
|
+
(props, forwardedRef) => {
|
|
287
|
+
const { __scopeContextMenu, ...arrowProps } = props;
|
|
288
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
ContextMenuArrow.displayName = ARROW_NAME;
|
|
293
|
+
var SUB_NAME = "ContextMenuSub";
|
|
294
|
+
var ContextMenuSub = (props) => {
|
|
295
|
+
const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = props;
|
|
296
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
297
|
+
const [open, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
298
|
+
prop: openProp,
|
|
299
|
+
defaultProp: defaultOpen,
|
|
300
|
+
onChange: onOpenChange
|
|
301
|
+
});
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
303
|
+
};
|
|
304
|
+
ContextMenuSub.displayName = SUB_NAME;
|
|
305
|
+
var SUB_TRIGGER_NAME = "ContextMenuSubTrigger";
|
|
306
|
+
var ContextMenuSubTrigger = React.forwardRef((props, forwardedRef) => {
|
|
307
|
+
const { __scopeContextMenu, ...triggerItemProps } = props;
|
|
308
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.SubTrigger, { ...menuScope, ...triggerItemProps, ref: forwardedRef });
|
|
310
|
+
});
|
|
311
|
+
ContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
312
|
+
var SUB_CONTENT_NAME = "ContextMenuSubContent";
|
|
313
|
+
var ContextMenuSubContent = React.forwardRef((props, forwardedRef) => {
|
|
314
|
+
const { __scopeContextMenu, ...subContentProps } = props;
|
|
315
|
+
const menuScope = useMenuScope(__scopeContextMenu);
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
317
|
+
MenuPrimitive.SubContent,
|
|
318
|
+
{
|
|
319
|
+
...menuScope,
|
|
320
|
+
...subContentProps,
|
|
321
|
+
ref: forwardedRef,
|
|
322
|
+
style: {
|
|
323
|
+
...props.style,
|
|
324
|
+
// re-namespace exposed content custom properties
|
|
325
|
+
...{
|
|
326
|
+
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
327
|
+
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
328
|
+
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
329
|
+
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
330
|
+
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
});
|
|
336
|
+
ContextMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
337
|
+
function whenTouchOrPen(handler) {
|
|
338
|
+
return (event) => event.pointerType !== "mouse" ? handler(event) : void 0;
|
|
339
|
+
}
|
|
340
|
+
var Root2 = ContextMenu;
|
|
341
|
+
var Trigger = ContextMenuTrigger;
|
|
342
|
+
var Portal2 = ContextMenuPortal;
|
|
343
|
+
var Content2 = ContextMenuContent;
|
|
344
|
+
var Group2 = ContextMenuGroup;
|
|
345
|
+
var Label2 = ContextMenuLabel;
|
|
346
|
+
var Item2 = ContextMenuItem;
|
|
347
|
+
var CheckboxItem2 = ContextMenuCheckboxItem;
|
|
348
|
+
var RadioGroup2 = ContextMenuRadioGroup;
|
|
349
|
+
var RadioItem2 = ContextMenuRadioItem;
|
|
350
|
+
var ItemIndicator2 = ContextMenuItemIndicator;
|
|
351
|
+
var Separator2 = ContextMenuSeparator;
|
|
352
|
+
var Arrow2 = ContextMenuArrow;
|
|
353
|
+
var Sub2 = ContextMenuSub;
|
|
354
|
+
var SubTrigger2 = ContextMenuSubTrigger;
|
|
355
|
+
var SubContent2 = ContextMenuSubContent;
|
|
320
356
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/ContextMenu.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [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> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = 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 * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {\n disabled?: boolean;\n}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, 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: () => 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(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);\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(() => handleOpen(event), 700);\n })\n )\n }\n onPointerMove={\n disabled\n ? props.onPointerMove\n : composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))\n }\n onPointerCancel={\n disabled\n ? props.onPointerCancel\n : composeEventHandlers(props.onPointerCancel, whenTouchOrPen(clearLongPress))\n }\n onPointerUp={\n disabled\n ? props.onPointerUp\n : composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))\n }\n />\n </>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'ContextMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\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\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps\n extends Omit<MenuContentProps, 'onEntryFocus' | 'side' | 'sideOffset' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, 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 '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\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 <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\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 <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\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 <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\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 <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\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 <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSub\n * -----------------------------------------------------------------------------------------------*/\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> = (props: ScopedProps<ContextMenuSubProps>) => {\n const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = 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\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'ContextMenuSubTrigger';\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props: ScopedProps<ContextMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'ContextMenuSubContent';\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\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 '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nContextMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Portal = ContextMenuPortal;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\nconst Sub = ContextMenuSub;\nconst SubTrigger = ContextMenuSubTrigger;\nconst SubContent = ContextMenuSubContent;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuPortal,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuPortalProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n ContextMenuSubProps,\n ContextMenuSubTriggerProps,\n ContextMenuSubContentProps,\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["open", "Root", "Portal", "Content", "Group", "Label", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "ItemIndicator", "Separator", "Arrow", "Sub", "SubTrigger", "SubContent"]
|
|
3
|
+
"sources": ["../src/index.ts", "../src/ContextMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuPortal,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n} from './ContextMenu';\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuPortalProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n ContextMenuSubProps,\n ContextMenuSubTriggerProps,\n ContextMenuSubContentProps,\n} from './ContextMenu';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as MenuPrimitive from '@radix-ui/react-menu';\nimport { createMenuScope } from '@radix-ui/react-menu';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\ntype Direction = 'ltr' | 'rtl';\ntype Point = { x: number; y: number };\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenu\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTEXT_MENU_NAME = 'ContextMenu';\n\ntype ScopedProps<P> = P & { __scopeContextMenu?: Scope };\nconst [createContextMenuContext, createContextMenuScope] = createContextScope(CONTEXT_MENU_NAME, [\n createMenuScope,\n]);\nconst useMenuScope = createMenuScope();\n\ntype ContextMenuContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n modal: boolean;\n};\n\nconst [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> = (props: ScopedProps<ContextMenuProps>) => {\n const { __scopeContextMenu, children, onOpenChange, dir, modal = true } = 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 * ContextMenuTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'ContextMenuTrigger';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface ContextMenuTriggerProps extends PrimitiveSpanProps {\n disabled?: boolean;\n}\n\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, 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: () => 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(() => void (disabled && clearLongPress()), [disabled, clearLongPress]);\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(() => handleOpen(event), 700);\n })\n )\n }\n onPointerMove={\n disabled\n ? props.onPointerMove\n : composeEventHandlers(props.onPointerMove, whenTouchOrPen(clearLongPress))\n }\n onPointerCancel={\n disabled\n ? props.onPointerCancel\n : composeEventHandlers(props.onPointerCancel, whenTouchOrPen(clearLongPress))\n }\n onPointerUp={\n disabled\n ? props.onPointerUp\n : composeEventHandlers(props.onPointerUp, whenTouchOrPen(clearLongPress))\n }\n />\n </>\n );\n }\n);\n\nContextMenuTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'ContextMenuPortal';\n\ntype MenuPortalProps = React.ComponentPropsWithoutRef<typeof MenuPrimitive.Portal>;\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\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ContextMenuContent';\n\ntype ContextMenuContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Content>;\ninterface ContextMenuContentProps\n extends Omit<MenuContentProps, 'onEntryFocus' | 'side' | 'sideOffset' | 'align'> {}\n\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, 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 '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n }\n);\n\nContextMenuContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'ContextMenuGroup';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof MenuPrimitive.Group>;\ntype MenuGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>;\ninterface ContextMenuGroupProps extends MenuGroupProps {}\n\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n (props: ScopedProps<ContextMenuGroupProps>, forwardedRef) => {\n const { __scopeContextMenu, ...groupProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Group {...menuScope} {...groupProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'ContextMenuLabel';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof MenuPrimitive.Label>;\ntype MenuLabelProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Label>;\ninterface ContextMenuLabelProps extends MenuLabelProps {}\n\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n (props: ScopedProps<ContextMenuLabelProps>, forwardedRef) => {\n const { __scopeContextMenu, ...labelProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Label {...menuScope} {...labelProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ContextMenuItem';\n\ntype ContextMenuItemElement = React.ElementRef<typeof MenuPrimitive.Item>;\ntype MenuItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Item>;\ninterface ContextMenuItemProps extends MenuItemProps {}\n\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props: ScopedProps<ContextMenuItemProps>, forwardedRef) => {\n const { __scopeContextMenu, ...itemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Item {...menuScope} {...itemProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuCheckboxItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof MenuPrimitive.CheckboxItem>;\ntype MenuCheckboxItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.CheckboxItem>;\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 <MenuPrimitive.CheckboxItem {...menuScope} {...checkboxItemProps} ref={forwardedRef} />;\n});\n\nContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_GROUP_NAME = 'ContextMenuRadioGroup';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof MenuPrimitive.RadioGroup>;\ntype MenuRadioGroupProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioGroup>;\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 <MenuPrimitive.RadioGroup {...menuScope} {...radioGroupProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioGroup.displayName = RADIO_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuRadioItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst RADIO_ITEM_NAME = 'ContextMenuRadioItem';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof MenuPrimitive.RadioItem>;\ntype MenuRadioItemProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.RadioItem>;\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 <MenuPrimitive.RadioItem {...menuScope} {...radioItemProps} ref={forwardedRef} />;\n});\n\nContextMenuRadioItem.displayName = RADIO_ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'ContextMenuItemIndicator';\n\ntype ContextMenuItemIndicatorElement = React.ElementRef<typeof MenuPrimitive.ItemIndicator>;\ntype MenuItemIndicatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.ItemIndicator>;\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 <MenuPrimitive.ItemIndicator {...menuScope} {...itemIndicatorProps} ref={forwardedRef} />;\n});\n\nContextMenuItemIndicator.displayName = INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'ContextMenuSeparator';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof MenuPrimitive.Separator>;\ntype MenuSeparatorProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Separator>;\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 <MenuPrimitive.Separator {...menuScope} {...separatorProps} ref={forwardedRef} />;\n});\n\nContextMenuSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'ContextMenuArrow';\n\ntype ContextMenuArrowElement = React.ElementRef<typeof MenuPrimitive.Arrow>;\ntype MenuArrowProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.Arrow>;\ninterface ContextMenuArrowProps extends MenuArrowProps {}\n\nconst ContextMenuArrow = React.forwardRef<ContextMenuArrowElement, ContextMenuArrowProps>(\n (props: ScopedProps<ContextMenuArrowProps>, forwardedRef) => {\n const { __scopeContextMenu, ...arrowProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.Arrow {...menuScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nContextMenuArrow.displayName = ARROW_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSub\n * -----------------------------------------------------------------------------------------------*/\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> = (props: ScopedProps<ContextMenuSubProps>) => {\n const { __scopeContextMenu, children, onOpenChange, open: openProp, defaultOpen } = 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\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSubTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_TRIGGER_NAME = 'ContextMenuSubTrigger';\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof MenuPrimitive.SubTrigger>;\ntype MenuSubTriggerProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubTrigger>;\ninterface ContextMenuSubTriggerProps extends MenuSubTriggerProps {}\n\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props: ScopedProps<ContextMenuSubTriggerProps>, forwardedRef) => {\n const { __scopeContextMenu, ...triggerItemProps } = props;\n const menuScope = useMenuScope(__scopeContextMenu);\n return <MenuPrimitive.SubTrigger {...menuScope} {...triggerItemProps} ref={forwardedRef} />;\n});\n\nContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ContextMenuSubContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst SUB_CONTENT_NAME = 'ContextMenuSubContent';\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof MenuPrimitive.Content>;\ntype MenuSubContentProps = Radix.ComponentPropsWithoutRef<typeof MenuPrimitive.SubContent>;\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 '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n});\n\nContextMenuSubContent.displayName = SUB_CONTENT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction whenTouchOrPen<E>(handler: React.PointerEventHandler<E>): React.PointerEventHandler<E> {\n return (event) => (event.pointerType !== 'mouse' ? handler(event) : undefined);\n}\n\nconst Root = ContextMenu;\nconst Trigger = ContextMenuTrigger;\nconst Portal = ContextMenuPortal;\nconst Content = ContextMenuContent;\nconst Group = ContextMenuGroup;\nconst Label = ContextMenuLabel;\nconst Item = ContextMenuItem;\nconst CheckboxItem = ContextMenuCheckboxItem;\nconst RadioGroup = ContextMenuRadioGroup;\nconst RadioItem = ContextMenuRadioItem;\nconst ItemIndicator = ContextMenuItemIndicator;\nconst Separator = ContextMenuSeparator;\nconst Arrow = ContextMenuArrow;\nconst Sub = ContextMenuSub;\nconst SubTrigger = ContextMenuSubTrigger;\nconst SubContent = ContextMenuSubContent;\n\nexport {\n createContextMenuScope,\n //\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuPortal,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuLabel,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuItemIndicator,\n ContextMenuSeparator,\n ContextMenuArrow,\n ContextMenuSub,\n ContextMenuSubTrigger,\n ContextMenuSubContent,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Group,\n Label,\n Item,\n CheckboxItem,\n RadioGroup,\n RadioItem,\n ItemIndicator,\n Separator,\n Arrow,\n Sub,\n SubTrigger,\n SubContent,\n};\nexport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n ContextMenuPortalProps,\n ContextMenuContentProps,\n ContextMenuGroupProps,\n ContextMenuLabelProps,\n ContextMenuItemProps,\n ContextMenuCheckboxItemProps,\n ContextMenuRadioGroupProps,\n ContextMenuRadioItemProps,\n ContextMenuItemIndicatorProps,\n ContextMenuSeparatorProps,\n ContextMenuArrowProps,\n ContextMenuSubProps,\n ContextMenuSubTriggerProps,\n ContextMenuSubContentProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA,oBAAAC;AAAA,EAAA,eAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAAAC;AAAA,EAAA,YAAAC;AAAA,EAAA,qBAAAC;AAAA,EAAA,aAAAC;AAAA,EAAA,cAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA,YAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA,WAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,2BAAmC;AACnC,6BAA0B;AAC1B,oBAA+B;AAC/B,wBAAgC;AAChC,oCAA+B;AAC/B,0CAAqC;AAyD/B;AA7CN,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Z,IAAMC,cAAa;AACnB,IAAMC,cAAa;",
|
|
6
|
+
"names": ["Arrow", "CheckboxItem", "Content", "Group", "Item", "ItemIndicator", "Label", "Portal", "RadioGroup", "RadioItem", "Root", "Separator", "Sub", "SubContent", "SubTrigger", "open", "Root", "Portal", "Content", "Group", "Label", "Item", "CheckboxItem", "RadioGroup", "RadioItem", "ItemIndicator", "Separator", "Arrow", "Sub", "SubTrigger", "SubContent"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-context-menu",
|
|
3
|
-
"version": "2.2.0-rc.
|
|
3
|
+
"version": "2.2.0-rc.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"version": "yarn version"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@radix-ui/primitive": "1.1.0-rc.
|
|
32
|
-
"@radix-ui/react-context": "1.1.0-rc.
|
|
33
|
-
"@radix-ui/react-menu": "2.1.0-rc.
|
|
34
|
-
"@radix-ui/react-primitive": "1.1.0-rc.
|
|
35
|
-
"@radix-ui/react-use-callback-ref": "1.1.0-rc.
|
|
36
|
-
"@radix-ui/react-use-controllable-state": "1.1.0-rc.
|
|
31
|
+
"@radix-ui/primitive": "1.1.0-rc.3",
|
|
32
|
+
"@radix-ui/react-context": "1.1.0-rc.3",
|
|
33
|
+
"@radix-ui/react-menu": "2.1.0-rc.3",
|
|
34
|
+
"@radix-ui/react-primitive": "1.1.0-rc.3",
|
|
35
|
+
"@radix-ui/react-use-callback-ref": "1.1.0-rc.3",
|
|
36
|
+
"@radix-ui/react-use-controllable-state": "1.1.0-rc.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@types/react": "*",
|