@radix-ui/react-context-menu 2.1.6-rc.9 → 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.mjs CHANGED
@@ -1,367 +1,322 @@
1
- import $3TiJz$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
2
- import {useState as $3TiJz$useState, useCallback as $3TiJz$useCallback, createElement as $3TiJz$createElement, forwardRef as $3TiJz$forwardRef, useRef as $3TiJz$useRef, useEffect as $3TiJz$useEffect, Fragment as $3TiJz$Fragment} from "react";
3
- import {composeEventHandlers as $3TiJz$composeEventHandlers} from "@radix-ui/primitive";
4
- import {createContextScope as $3TiJz$createContextScope} from "@radix-ui/react-context";
5
- import {Primitive as $3TiJz$Primitive} from "@radix-ui/react-primitive";
6
- import {createMenuScope as $3TiJz$createMenuScope, Root as $3TiJz$Root, Anchor as $3TiJz$Anchor, Portal as $3TiJz$Portal, Content as $3TiJz$Content, Group as $3TiJz$Group, Label as $3TiJz$Label, Item as $3TiJz$Item, CheckboxItem as $3TiJz$CheckboxItem, RadioGroup as $3TiJz$RadioGroup, RadioItem as $3TiJz$RadioItem, ItemIndicator as $3TiJz$ItemIndicator, Separator as $3TiJz$Separator, Arrow as $3TiJz$Arrow, Sub as $3TiJz$Sub, SubTrigger as $3TiJz$SubTrigger, SubContent as $3TiJz$SubContent} from "@radix-ui/react-menu";
7
- import {useCallbackRef as $3TiJz$useCallbackRef} from "@radix-ui/react-use-callback-ref";
8
- import {useControllableState as $3TiJz$useControllableState} from "@radix-ui/react-use-controllable-state";
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
- const $1b0217ee4a91d156$var$useMenuScope = $3TiJz$createMenuScope();
26
- const [$1b0217ee4a91d156$var$ContextMenuProvider, $1b0217ee4a91d156$var$useContextMenuContext] = $1b0217ee4a91d156$var$createContextMenuContext($1b0217ee4a91d156$var$CONTEXT_MENU_NAME);
27
- const $1b0217ee4a91d156$export$8dc6765e8be191c7 = (props)=>{
28
- const { __scopeContextMenu: __scopeContextMenu , children: children , onOpenChange: onOpenChange , dir: dir , modal: modal = true } = props;
29
- const [open1, setOpen] = $3TiJz$useState(false);
30
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
31
- const handleOpenChangeProp = $3TiJz$useCallbackRef(onOpenChange);
32
- const handleOpenChange = $3TiJz$useCallback((open)=>{
33
- setOpen(open);
34
- handleOpenChangeProp(open);
35
- }, [
36
- handleOpenChangeProp
37
- ]);
38
- return /*#__PURE__*/ $3TiJz$createElement($1b0217ee4a91d156$var$ContextMenuProvider, {
39
- scope: __scopeContextMenu,
40
- open: open1,
41
- onOpenChange: handleOpenChange,
42
- modal: modal
43
- }, /*#__PURE__*/ $3TiJz$createElement($3TiJz$Root, $3TiJz$babelruntimehelpersesmextends({}, menuScope, {
44
- dir: dir,
45
- open: open1,
46
- onOpenChange: handleOpenChange,
47
- modal: modal
48
- }), children));
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$8dc6765e8be191c7, {
51
- displayName: $1b0217ee4a91d156$var$CONTEXT_MENU_NAME
52
- });
53
- /* -------------------------------------------------------------------------------------------------
54
- * ContextMenuTrigger
55
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$TRIGGER_NAME = 'ContextMenuTrigger';
56
- const $1b0217ee4a91d156$export$be6fc7b1d5b0beb9 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
57
- const { __scopeContextMenu: __scopeContextMenu , disabled: disabled = false , ...triggerProps } = props;
58
- const context = $1b0217ee4a91d156$var$useContextMenuContext($1b0217ee4a91d156$var$TRIGGER_NAME, __scopeContextMenu);
59
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
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 virtualRef = $3TiJz$useRef({
65
- getBoundingClientRect: ()=>DOMRect.fromRect({
66
- width: 0,
67
- height: 0,
68
- ...pointRef.current
69
- })
70
- });
71
- const longPressTimerRef = $3TiJz$useRef(0);
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
- $3TiJz$useEffect(()=>clearLongPress
82
- , [
83
- clearLongPress
84
- ]);
85
- $3TiJz$useEffect(()=>void (disabled && clearLongPress())
86
- , [
87
- disabled,
88
- clearLongPress
89
- ]);
90
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Fragment, null, /*#__PURE__*/ $3TiJz$createElement($3TiJz$Anchor, $3TiJz$babelruntimehelpersesmextends({}, menuScope, {
91
- virtualRef: virtualRef
92
- })), /*#__PURE__*/ $3TiJz$createElement($3TiJz$Primitive.span, $3TiJz$babelruntimehelpersesmextends({
93
- "data-state": context.open ? 'open' : 'closed',
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
- onPointerDown: disabled ? props.onPointerDown : $3TiJz$composeEventHandlers(props.onPointerDown, $1b0217ee4a91d156$var$whenTouchOrPen((event)=>{
111
- // clear the long press here in case there's multiple touch points
112
- clearLongPress();
113
- longPressTimerRef.current = window.setTimeout(()=>handleOpen(event)
114
- , 700);
115
- })),
116
- onPointerMove: disabled ? props.onPointerMove : $3TiJz$composeEventHandlers(props.onPointerMove, $1b0217ee4a91d156$var$whenTouchOrPen(clearLongPress)),
117
- onPointerCancel: disabled ? props.onPointerCancel : $3TiJz$composeEventHandlers(props.onPointerCancel, $1b0217ee4a91d156$var$whenTouchOrPen(clearLongPress)),
118
- onPointerUp: disabled ? props.onPointerUp : $3TiJz$composeEventHandlers(props.onPointerUp, $1b0217ee4a91d156$var$whenTouchOrPen(clearLongPress))
119
- })));
120
- });
121
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$be6fc7b1d5b0beb9, {
122
- displayName: $1b0217ee4a91d156$var$TRIGGER_NAME
123
- });
124
- /* -------------------------------------------------------------------------------------------------
125
- * ContextMenuPortal
126
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$PORTAL_NAME = 'ContextMenuPortal';
127
- const $1b0217ee4a91d156$export$14afd0be83e45060 = (props)=>{
128
- const { __scopeContextMenu: __scopeContextMenu , ...portalProps } = props;
129
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
130
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Portal, $3TiJz$babelruntimehelpersesmextends({}, menuScope, portalProps));
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$14afd0be83e45060, {
133
- displayName: $1b0217ee4a91d156$var$PORTAL_NAME
134
- });
135
- /* -------------------------------------------------------------------------------------------------
136
- * ContextMenuContent
137
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$CONTENT_NAME = 'ContextMenuContent';
138
- const $1b0217ee4a91d156$export$572205900c9369e = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
139
- const { __scopeContextMenu: __scopeContextMenu , ...contentProps } = props;
140
- const context = $1b0217ee4a91d156$var$useContextMenuContext($1b0217ee4a91d156$var$CONTENT_NAME, __scopeContextMenu);
141
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
142
- const hasInteractedOutsideRef = $3TiJz$useRef(false);
143
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Content, $3TiJz$babelruntimehelpersesmextends({}, menuScope, contentProps, {
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
- var _props$onCloseAutoFoc;
150
- (_props$onCloseAutoFoc = props.onCloseAutoFocus) === null || _props$onCloseAutoFoc === void 0 || _props$onCloseAutoFoc.call(props, event);
151
- if (!event.defaultPrevented && hasInteractedOutsideRef.current) event.preventDefault();
152
- hasInteractedOutsideRef.current = false;
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
- var _props$onInteractOuts;
156
- (_props$onInteractOuts = props.onInteractOutside) === null || _props$onInteractOuts === void 0 || _props$onInteractOuts.call(props, event);
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
- ...props.style,
161
- '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
162
- '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',
163
- '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',
164
- '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',
165
- '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)'
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$572205900c9369e, {
170
- displayName: $1b0217ee4a91d156$var$CONTENT_NAME
171
- });
172
- /* -------------------------------------------------------------------------------------------------
173
- * ContextMenuGroup
174
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$GROUP_NAME = 'ContextMenuGroup';
175
- const $1b0217ee4a91d156$export$9860523b0fcdd664 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
176
- const { __scopeContextMenu: __scopeContextMenu , ...groupProps } = props;
177
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
178
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Group, $3TiJz$babelruntimehelpersesmextends({}, menuScope, groupProps, {
179
- ref: forwardedRef
180
- }));
181
- });
182
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$9860523b0fcdd664, {
183
- displayName: $1b0217ee4a91d156$var$GROUP_NAME
184
- });
185
- /* -------------------------------------------------------------------------------------------------
186
- * ContextMenuLabel
187
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$LABEL_NAME = 'ContextMenuLabel';
188
- const $1b0217ee4a91d156$export$d4b9d3b609a10742 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
189
- const { __scopeContextMenu: __scopeContextMenu , ...labelProps } = props;
190
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
191
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Label, $3TiJz$babelruntimehelpersesmextends({}, menuScope, labelProps, {
192
- ref: forwardedRef
193
- }));
194
- });
195
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$d4b9d3b609a10742, {
196
- displayName: $1b0217ee4a91d156$var$LABEL_NAME
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
- * ContextMenuItem
200
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$ITEM_NAME = 'ContextMenuItem';
201
- const $1b0217ee4a91d156$export$16a26dc176a49100 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
202
- const { __scopeContextMenu: __scopeContextMenu , ...itemProps } = props;
203
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$16a26dc176a49100, {
209
- displayName: $1b0217ee4a91d156$var$ITEM_NAME
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
- * ContextMenuCheckboxItem
213
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$CHECKBOX_ITEM_NAME = 'ContextMenuCheckboxItem';
214
- const $1b0217ee4a91d156$export$b6adbe51d5d8b7ec = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
215
- const { __scopeContextMenu: __scopeContextMenu , ...checkboxItemProps } = props;
216
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$b6adbe51d5d8b7ec, {
222
- displayName: $1b0217ee4a91d156$var$CHECKBOX_ITEM_NAME
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
- * ContextMenuRadioGroup
226
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$RADIO_GROUP_NAME = 'ContextMenuRadioGroup';
227
- const $1b0217ee4a91d156$export$db5c89af5ed9aa07 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
228
- const { __scopeContextMenu: __scopeContextMenu , ...radioGroupProps } = props;
229
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
230
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$RadioGroup, $3TiJz$babelruntimehelpersesmextends({}, menuScope, radioGroupProps, {
231
- ref: forwardedRef
232
- }));
233
- });
234
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$db5c89af5ed9aa07, {
235
- displayName: $1b0217ee4a91d156$var$RADIO_GROUP_NAME
236
- });
237
- /* -------------------------------------------------------------------------------------------------
238
- * ContextMenuRadioItem
239
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$RADIO_ITEM_NAME = 'ContextMenuRadioItem';
240
- const $1b0217ee4a91d156$export$8a727d09a7d9bfc2 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
241
- const { __scopeContextMenu: __scopeContextMenu , ...radioItemProps } = props;
242
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
243
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$RadioItem, $3TiJz$babelruntimehelpersesmextends({}, menuScope, radioItemProps, {
244
- ref: forwardedRef
245
- }));
246
- });
247
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$8a727d09a7d9bfc2, {
248
- displayName: $1b0217ee4a91d156$var$RADIO_ITEM_NAME
249
- });
250
- /* -------------------------------------------------------------------------------------------------
251
- * ContextMenuItemIndicator
252
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$INDICATOR_NAME = 'ContextMenuItemIndicator';
253
- const $1b0217ee4a91d156$export$9ed8194dee42d94b = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
254
- const { __scopeContextMenu: __scopeContextMenu , ...itemIndicatorProps } = props;
255
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
256
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$ItemIndicator, $3TiJz$babelruntimehelpersesmextends({}, menuScope, itemIndicatorProps, {
257
- ref: forwardedRef
258
- }));
259
- });
260
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$9ed8194dee42d94b, {
261
- displayName: $1b0217ee4a91d156$var$INDICATOR_NAME
262
- });
263
- /* -------------------------------------------------------------------------------------------------
264
- * ContextMenuSeparator
265
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SEPARATOR_NAME = 'ContextMenuSeparator';
266
- const $1b0217ee4a91d156$export$8d6b009fadfe1207 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
267
- const { __scopeContextMenu: __scopeContextMenu , ...separatorProps } = props;
268
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
269
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Separator, $3TiJz$babelruntimehelpersesmextends({}, menuScope, separatorProps, {
270
- ref: forwardedRef
271
- }));
272
- });
273
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$8d6b009fadfe1207, {
274
- displayName: $1b0217ee4a91d156$var$SEPARATOR_NAME
275
- });
276
- /* -------------------------------------------------------------------------------------------------
277
- * ContextMenuArrow
278
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$ARROW_NAME = 'ContextMenuArrow';
279
- const $1b0217ee4a91d156$export$f47d0a58228a61e2 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
280
- const { __scopeContextMenu: __scopeContextMenu , ...arrowProps } = props;
281
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
282
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Arrow, $3TiJz$babelruntimehelpersesmextends({}, menuScope, arrowProps, {
283
- ref: forwardedRef
284
- }));
285
- });
286
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$f47d0a58228a61e2, {
287
- displayName: $1b0217ee4a91d156$var$ARROW_NAME
288
- });
289
- /* -------------------------------------------------------------------------------------------------
290
- * ContextMenuSub
291
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SUB_NAME = 'ContextMenuSub';
292
- const $1b0217ee4a91d156$export$5bc21d1c00c4b201 = (props)=>{
293
- const { __scopeContextMenu: __scopeContextMenu , children: children , onOpenChange: onOpenChange , open: openProp , defaultOpen: defaultOpen } = props;
294
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
295
- const [open, setOpen] = $3TiJz$useControllableState({
296
- prop: openProp,
297
- defaultProp: defaultOpen,
298
- onChange: onOpenChange
299
- });
300
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$Sub, $3TiJz$babelruntimehelpersesmextends({}, menuScope, {
301
- open: open,
302
- onOpenChange: setOpen
303
- }), children);
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$5bc21d1c00c4b201, {
306
- displayName: $1b0217ee4a91d156$var$SUB_NAME
307
- });
308
- /* -------------------------------------------------------------------------------------------------
309
- * ContextMenuSubTrigger
310
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SUB_TRIGGER_NAME = 'ContextMenuSubTrigger';
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
- * ContextMenuSubContent
323
- * -----------------------------------------------------------------------------------------------*/ const $1b0217ee4a91d156$var$SUB_CONTENT_NAME = 'ContextMenuSubContent';
324
- const $1b0217ee4a91d156$export$2c967063bd2dc512 = /*#__PURE__*/ $3TiJz$forwardRef((props, forwardedRef)=>{
325
- const { __scopeContextMenu: __scopeContextMenu , ...subContentProps } = props;
326
- const menuScope = $1b0217ee4a91d156$var$useMenuScope(__scopeContextMenu);
327
- return /*#__PURE__*/ $3TiJz$createElement($3TiJz$SubContent, $3TiJz$babelruntimehelpersesmextends({}, menuScope, subContentProps, {
328
- ref: forwardedRef,
329
- style: {
330
- ...props.style,
331
- '--radix-context-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
332
- '--radix-context-menu-content-available-width': 'var(--radix-popper-available-width)',
333
- '--radix-context-menu-content-available-height': 'var(--radix-popper-available-height)',
334
- '--radix-context-menu-trigger-width': 'var(--radix-popper-anchor-width)',
335
- '--radix-context-menu-trigger-height': 'var(--radix-popper-anchor-height)'
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
- /*#__PURE__*/ Object.assign($1b0217ee4a91d156$export$2c967063bd2dc512, {
340
- displayName: $1b0217ee4a91d156$var$SUB_CONTENT_NAME
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
- const $1b0217ee4a91d156$export$be92b6f5f03c0fe9 = $1b0217ee4a91d156$export$8dc6765e8be191c7;
347
- const $1b0217ee4a91d156$export$41fb9f06171c75f4 = $1b0217ee4a91d156$export$be6fc7b1d5b0beb9;
348
- const $1b0217ee4a91d156$export$602eac185826482c = $1b0217ee4a91d156$export$14afd0be83e45060;
349
- const $1b0217ee4a91d156$export$7c6e2c02157bb7d2 = $1b0217ee4a91d156$export$572205900c9369e;
350
- const $1b0217ee4a91d156$export$eb2fcfdbd7ba97d4 = $1b0217ee4a91d156$export$9860523b0fcdd664;
351
- const $1b0217ee4a91d156$export$b04be29aa201d4f5 = $1b0217ee4a91d156$export$d4b9d3b609a10742;
352
- const $1b0217ee4a91d156$export$6d08773d2e66f8f2 = $1b0217ee4a91d156$export$16a26dc176a49100;
353
- const $1b0217ee4a91d156$export$16ce288f89fa631c = $1b0217ee4a91d156$export$b6adbe51d5d8b7ec;
354
- const $1b0217ee4a91d156$export$a98f0dcb43a68a25 = $1b0217ee4a91d156$export$db5c89af5ed9aa07;
355
- const $1b0217ee4a91d156$export$371ab307eab489c0 = $1b0217ee4a91d156$export$8a727d09a7d9bfc2;
356
- const $1b0217ee4a91d156$export$c3468e2714d175fa = $1b0217ee4a91d156$export$9ed8194dee42d94b;
357
- const $1b0217ee4a91d156$export$1ff3c3f08ae963c0 = $1b0217ee4a91d156$export$8d6b009fadfe1207;
358
- const $1b0217ee4a91d156$export$21b07c8f274aebd5 = $1b0217ee4a91d156$export$f47d0a58228a61e2;
359
- const $1b0217ee4a91d156$export$d7a01e11500dfb6f = $1b0217ee4a91d156$export$5bc21d1c00c4b201;
360
- const $1b0217ee4a91d156$export$2ea8a7a591ac5eac = $1b0217ee4a91d156$export$30b2b5c64556d316;
361
- const $1b0217ee4a91d156$export$6d4de93b380beddf = $1b0217ee4a91d156$export$2c967063bd2dc512;
362
-
363
-
364
-
365
-
366
- export {$1b0217ee4a91d156$export$1059331f43ddcc82 as createContextMenuScope, $1b0217ee4a91d156$export$8dc6765e8be191c7 as ContextMenu, $1b0217ee4a91d156$export$be6fc7b1d5b0beb9 as ContextMenuTrigger, $1b0217ee4a91d156$export$14afd0be83e45060 as ContextMenuPortal, $1b0217ee4a91d156$export$572205900c9369e as ContextMenuContent, $1b0217ee4a91d156$export$9860523b0fcdd664 as ContextMenuGroup, $1b0217ee4a91d156$export$d4b9d3b609a10742 as ContextMenuLabel, $1b0217ee4a91d156$export$16a26dc176a49100 as ContextMenuItem, $1b0217ee4a91d156$export$b6adbe51d5d8b7ec as ContextMenuCheckboxItem, $1b0217ee4a91d156$export$db5c89af5ed9aa07 as ContextMenuRadioGroup, $1b0217ee4a91d156$export$8a727d09a7d9bfc2 as ContextMenuRadioItem, $1b0217ee4a91d156$export$9ed8194dee42d94b as ContextMenuItemIndicator, $1b0217ee4a91d156$export$8d6b009fadfe1207 as ContextMenuSeparator, $1b0217ee4a91d156$export$f47d0a58228a61e2 as ContextMenuArrow, $1b0217ee4a91d156$export$5bc21d1c00c4b201 as ContextMenuSub, $1b0217ee4a91d156$export$30b2b5c64556d316 as ContextMenuSubTrigger, $1b0217ee4a91d156$export$2c967063bd2dc512 as ContextMenuSubContent, $1b0217ee4a91d156$export$be92b6f5f03c0fe9 as Root, $1b0217ee4a91d156$export$41fb9f06171c75f4 as Trigger, $1b0217ee4a91d156$export$602eac185826482c as Portal, $1b0217ee4a91d156$export$7c6e2c02157bb7d2 as Content, $1b0217ee4a91d156$export$eb2fcfdbd7ba97d4 as Group, $1b0217ee4a91d156$export$b04be29aa201d4f5 as Label, $1b0217ee4a91d156$export$6d08773d2e66f8f2 as Item, $1b0217ee4a91d156$export$16ce288f89fa631c as CheckboxItem, $1b0217ee4a91d156$export$a98f0dcb43a68a25 as RadioGroup, $1b0217ee4a91d156$export$371ab307eab489c0 as RadioItem, $1b0217ee4a91d156$export$c3468e2714d175fa as ItemIndicator, $1b0217ee4a91d156$export$1ff3c3f08ae963c0 as Separator, $1b0217ee4a91d156$export$21b07c8f274aebd5 as Arrow, $1b0217ee4a91d156$export$d7a01e11500dfb6f as Sub, $1b0217ee4a91d156$export$2ea8a7a591ac5eac as SubTrigger, $1b0217ee4a91d156$export$6d4de93b380beddf as SubContent};
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