@radix-ui/react-menubar 1.0.5-rc.8 → 1.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +89 -77
- package/dist/index.d.ts +89 -77
- package/dist/index.js +434 -522
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +436 -478
- package/dist/index.mjs.map +7 -1
- package/package.json +11 -12
- package/dist/index.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,549 +1,461 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
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 __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
13
31
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
$parcel$export(module.exports, "Arrow", () => $f5560139001bae38$export$21b07c8f274aebd5);
|
|
53
|
-
$parcel$export(module.exports, "Sub", () => $f5560139001bae38$export$d7a01e11500dfb6f);
|
|
54
|
-
$parcel$export(module.exports, "SubTrigger", () => $f5560139001bae38$export$2ea8a7a591ac5eac);
|
|
55
|
-
$parcel$export(module.exports, "SubContent", () => $f5560139001bae38$export$6d4de93b380beddf);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/* -------------------------------------------------------------------------------------------------
|
|
71
|
-
* Menubar
|
|
72
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$MENUBAR_NAME = 'Menubar';
|
|
73
|
-
const [$f5560139001bae38$var$Collection, $f5560139001bae38$var$useCollection, $f5560139001bae38$var$createCollectionScope] = $fIWtd$radixuireactcollection.createCollection($f5560139001bae38$var$MENUBAR_NAME);
|
|
74
|
-
const [$f5560139001bae38$var$createMenubarContext, $f5560139001bae38$export$7a4049d5555b545c] = $fIWtd$radixuireactcontext.createContextScope($f5560139001bae38$var$MENUBAR_NAME, [
|
|
75
|
-
$f5560139001bae38$var$createCollectionScope,
|
|
76
|
-
$fIWtd$radixuireactrovingfocus.createRovingFocusGroupScope
|
|
77
|
-
]);
|
|
78
|
-
const $f5560139001bae38$var$useMenuScope = $fIWtd$radixuireactmenu.createMenuScope();
|
|
79
|
-
const $f5560139001bae38$var$useRovingFocusGroupScope = $fIWtd$radixuireactrovingfocus.createRovingFocusGroupScope();
|
|
80
|
-
const [$f5560139001bae38$var$MenubarContextProvider, $f5560139001bae38$var$useMenubarContext] = $f5560139001bae38$var$createMenubarContext($f5560139001bae38$var$MENUBAR_NAME);
|
|
81
|
-
const $f5560139001bae38$export$7d4583da7581e674 = /*#__PURE__*/ $fIWtd$react.forwardRef((props, forwardedRef)=>{
|
|
82
|
-
const { __scopeMenubar: __scopeMenubar , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , loop: loop = true , dir: dir , ...menubarProps } = props;
|
|
83
|
-
const direction = $fIWtd$radixuireactdirection.useDirection(dir);
|
|
84
|
-
const rovingFocusGroupScope = $f5560139001bae38$var$useRovingFocusGroupScope(__scopeMenubar);
|
|
85
|
-
const [value1 = '', setValue] = $fIWtd$radixuireactusecontrollablestate.useControllableState({
|
|
32
|
+
// packages/react/menubar/src/Menubar.tsx
|
|
33
|
+
var React = __toESM(__require("react"));
|
|
34
|
+
var import_react_collection = __require("@radix-ui/react-collection");
|
|
35
|
+
var import_react_direction = __require("@radix-ui/react-direction");
|
|
36
|
+
var import_primitive = __require("@radix-ui/primitive");
|
|
37
|
+
var import_react_compose_refs = __require("@radix-ui/react-compose-refs");
|
|
38
|
+
var import_react_context = __require("@radix-ui/react-context");
|
|
39
|
+
var import_react_id = __require("@radix-ui/react-id");
|
|
40
|
+
var MenuPrimitive = __toESM(__require("@radix-ui/react-menu"));
|
|
41
|
+
var import_react_menu = __require("@radix-ui/react-menu");
|
|
42
|
+
var RovingFocusGroup = __toESM(__require("@radix-ui/react-roving-focus"));
|
|
43
|
+
var import_react_roving_focus = __require("@radix-ui/react-roving-focus");
|
|
44
|
+
var import_react_primitive = __require("@radix-ui/react-primitive");
|
|
45
|
+
var import_react_use_controllable_state = __require("@radix-ui/react-use-controllable-state");
|
|
46
|
+
var import_jsx_runtime = __require("react/jsx-runtime");
|
|
47
|
+
var MENUBAR_NAME = "Menubar";
|
|
48
|
+
var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(MENUBAR_NAME);
|
|
49
|
+
var [createMenubarContext, createMenubarScope] = (0, import_react_context.createContextScope)(MENUBAR_NAME, [
|
|
50
|
+
createCollectionScope,
|
|
51
|
+
import_react_roving_focus.createRovingFocusGroupScope
|
|
52
|
+
]);
|
|
53
|
+
var useMenuScope = (0, import_react_menu.createMenuScope)();
|
|
54
|
+
var useRovingFocusGroupScope = (0, import_react_roving_focus.createRovingFocusGroupScope)();
|
|
55
|
+
var [MenubarContextProvider, useMenubarContext] = createMenubarContext(MENUBAR_NAME);
|
|
56
|
+
var Menubar = React.forwardRef(
|
|
57
|
+
(props, forwardedRef) => {
|
|
58
|
+
const {
|
|
59
|
+
__scopeMenubar,
|
|
60
|
+
value: valueProp,
|
|
61
|
+
onValueChange,
|
|
62
|
+
defaultValue,
|
|
63
|
+
loop = true,
|
|
64
|
+
dir,
|
|
65
|
+
...menubarProps
|
|
66
|
+
} = props;
|
|
67
|
+
const direction = (0, import_react_direction.useDirection)(dir);
|
|
68
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenubar);
|
|
69
|
+
const [value = "", setValue] = (0, import_react_use_controllable_state.useControllableState)({
|
|
86
70
|
prop: valueProp,
|
|
87
71
|
onChange: onValueChange,
|
|
88
72
|
defaultProp: defaultValue
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
loop: loop,
|
|
125
|
-
dir: direction,
|
|
126
|
-
currentTabStopId: currentTabStopId,
|
|
127
|
-
onCurrentTabStopIdChange: setCurrentTabStopId
|
|
128
|
-
}), /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({
|
|
129
|
-
role: "menubar"
|
|
130
|
-
}, menubarProps, {
|
|
131
|
-
ref: forwardedRef
|
|
132
|
-
}))))));
|
|
133
|
-
});
|
|
134
|
-
/*#__PURE__*/ Object.assign($f5560139001bae38$export$7d4583da7581e674, {
|
|
135
|
-
displayName: $f5560139001bae38$var$MENUBAR_NAME
|
|
136
|
-
});
|
|
137
|
-
/* -------------------------------------------------------------------------------------------------
|
|
138
|
-
* MenubarMenu
|
|
139
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$MENU_NAME = 'MenubarMenu';
|
|
140
|
-
const [$f5560139001bae38$var$MenubarMenuProvider, $f5560139001bae38$var$useMenubarMenuContext] = $f5560139001bae38$var$createMenubarContext($f5560139001bae38$var$MENU_NAME);
|
|
141
|
-
const $f5560139001bae38$export$c777b394d551050b = (props)=>{
|
|
142
|
-
const { __scopeMenubar: __scopeMenubar , value: valueProp , ...menuProps } = props;
|
|
143
|
-
const autoValue = $fIWtd$radixuireactid.useId(); // We need to provide an initial deterministic value as `useId` will return
|
|
144
|
-
// empty string on the first render and we don't want to match our internal "closed" value.
|
|
145
|
-
const value = valueProp || autoValue || 'LEGACY_REACT_AUTO_VALUE';
|
|
146
|
-
const context = $f5560139001bae38$var$useMenubarContext($f5560139001bae38$var$MENU_NAME, __scopeMenubar);
|
|
147
|
-
const menuScope = $f5560139001bae38$var$useMenuScope(__scopeMenubar);
|
|
148
|
-
const triggerRef = $fIWtd$react.useRef(null);
|
|
149
|
-
const wasKeyboardTriggerOpenRef = $fIWtd$react.useRef(false);
|
|
150
|
-
const open1 = context.value === value;
|
|
151
|
-
$fIWtd$react.useEffect(()=>{
|
|
152
|
-
if (!open1) wasKeyboardTriggerOpenRef.current = false;
|
|
153
|
-
}, [
|
|
154
|
-
open1
|
|
155
|
-
]);
|
|
156
|
-
return /*#__PURE__*/ $fIWtd$react.createElement($f5560139001bae38$var$MenubarMenuProvider, {
|
|
157
|
-
scope: __scopeMenubar,
|
|
158
|
-
value: value,
|
|
159
|
-
triggerId: $fIWtd$radixuireactid.useId(),
|
|
160
|
-
triggerRef: triggerRef,
|
|
161
|
-
contentId: $fIWtd$radixuireactid.useId(),
|
|
162
|
-
wasKeyboardTriggerOpenRef: wasKeyboardTriggerOpenRef
|
|
163
|
-
}, /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactmenu.Root, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({}, menuScope, {
|
|
164
|
-
open: open1,
|
|
165
|
-
onOpenChange: (open)=>{
|
|
166
|
-
// Menu only calls `onOpenChange` when dismissing so we
|
|
167
|
-
// want to close our MenuBar based on the same events.
|
|
168
|
-
if (!open) context.onMenuClose();
|
|
169
|
-
},
|
|
170
|
-
modal: false,
|
|
171
|
-
dir: context.dir
|
|
172
|
-
}, menuProps)));
|
|
173
|
-
};
|
|
174
|
-
/*#__PURE__*/ Object.assign($f5560139001bae38$export$c777b394d551050b, {
|
|
175
|
-
displayName: $f5560139001bae38$var$MENU_NAME
|
|
176
|
-
});
|
|
177
|
-
/* -------------------------------------------------------------------------------------------------
|
|
178
|
-
* MenubarTrigger
|
|
179
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$TRIGGER_NAME = 'MenubarTrigger';
|
|
180
|
-
const $f5560139001bae38$export$df05cd234081ebd5 = /*#__PURE__*/ $fIWtd$react.forwardRef((props, forwardedRef)=>{
|
|
181
|
-
const { __scopeMenubar: __scopeMenubar , disabled: disabled = false , ...triggerProps } = props;
|
|
182
|
-
const rovingFocusGroupScope = $f5560139001bae38$var$useRovingFocusGroupScope(__scopeMenubar);
|
|
183
|
-
const menuScope = $f5560139001bae38$var$useMenuScope(__scopeMenubar);
|
|
184
|
-
const context = $f5560139001bae38$var$useMenubarContext($f5560139001bae38$var$TRIGGER_NAME, __scopeMenubar);
|
|
185
|
-
const menuContext = $f5560139001bae38$var$useMenubarMenuContext($f5560139001bae38$var$TRIGGER_NAME, __scopeMenubar);
|
|
186
|
-
const ref = $fIWtd$react.useRef(null);
|
|
187
|
-
const composedRefs = $fIWtd$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref, menuContext.triggerRef);
|
|
188
|
-
const [isFocused, setIsFocused] = $fIWtd$react.useState(false);
|
|
189
|
-
const open = context.value === menuContext.value;
|
|
190
|
-
return /*#__PURE__*/ $fIWtd$react.createElement($f5560139001bae38$var$Collection.ItemSlot, {
|
|
191
|
-
scope: __scopeMenubar,
|
|
192
|
-
value: menuContext.value,
|
|
193
|
-
disabled: disabled
|
|
194
|
-
}, /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactrovingfocus.Item, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({
|
|
195
|
-
asChild: true
|
|
196
|
-
}, rovingFocusGroupScope, {
|
|
197
|
-
focusable: !disabled,
|
|
198
|
-
tabStopId: menuContext.value
|
|
199
|
-
}), /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactmenu.Anchor, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({
|
|
200
|
-
asChild: true
|
|
201
|
-
}, menuScope), /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactprimitive.Primitive.button, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({
|
|
202
|
-
type: "button",
|
|
203
|
-
role: "menuitem",
|
|
204
|
-
id: menuContext.triggerId,
|
|
205
|
-
"aria-haspopup": "menu",
|
|
206
|
-
"aria-expanded": open,
|
|
207
|
-
"aria-controls": open ? menuContext.contentId : undefined,
|
|
208
|
-
"data-highlighted": isFocused ? '' : undefined,
|
|
209
|
-
"data-state": open ? 'open' : 'closed',
|
|
210
|
-
"data-disabled": disabled ? '' : undefined,
|
|
211
|
-
disabled: disabled
|
|
212
|
-
}, triggerProps, {
|
|
213
|
-
ref: composedRefs,
|
|
214
|
-
onPointerDown: $fIWtd$radixuiprimitive.composeEventHandlers(props.onPointerDown, (event)=>{
|
|
215
|
-
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
|
216
|
-
// but not when the control key is pressed (avoiding MacOS right click)
|
|
217
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
218
|
-
context.onMenuOpen(menuContext.value); // prevent trigger focusing when opening
|
|
219
|
-
// this allows the content to be given focus without competition
|
|
220
|
-
if (!open) event.preventDefault();
|
|
73
|
+
});
|
|
74
|
+
const [currentTabStopId, setCurrentTabStopId] = React.useState(null);
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
+
MenubarContextProvider,
|
|
77
|
+
{
|
|
78
|
+
scope: __scopeMenubar,
|
|
79
|
+
value,
|
|
80
|
+
onMenuOpen: React.useCallback(
|
|
81
|
+
(value2) => {
|
|
82
|
+
setValue(value2);
|
|
83
|
+
setCurrentTabStopId(value2);
|
|
84
|
+
},
|
|
85
|
+
[setValue]
|
|
86
|
+
),
|
|
87
|
+
onMenuClose: React.useCallback(() => setValue(""), [setValue]),
|
|
88
|
+
onMenuToggle: React.useCallback(
|
|
89
|
+
(value2) => {
|
|
90
|
+
setValue((prevValue) => Boolean(prevValue) ? "" : value2);
|
|
91
|
+
setCurrentTabStopId(value2);
|
|
92
|
+
},
|
|
93
|
+
[setValue]
|
|
94
|
+
),
|
|
95
|
+
dir: direction,
|
|
96
|
+
loop,
|
|
97
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: __scopeMenubar, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { scope: __scopeMenubar, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
+
RovingFocusGroup.Root,
|
|
99
|
+
{
|
|
100
|
+
asChild: true,
|
|
101
|
+
...rovingFocusGroupScope,
|
|
102
|
+
orientation: "horizontal",
|
|
103
|
+
loop,
|
|
104
|
+
dir: direction,
|
|
105
|
+
currentTabStopId,
|
|
106
|
+
onCurrentTabStopIdChange: setCurrentTabStopId,
|
|
107
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_primitive.Primitive.div, { role: "menubar", ...menubarProps, ref: forwardedRef })
|
|
221
108
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
),
|
|
250
|
-
|
|
109
|
+
) }) })
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
Menubar.displayName = MENUBAR_NAME;
|
|
115
|
+
var MENU_NAME = "MenubarMenu";
|
|
116
|
+
var [MenubarMenuProvider, useMenubarMenuContext] = createMenubarContext(MENU_NAME);
|
|
117
|
+
var MenubarMenu = (props) => {
|
|
118
|
+
const { __scopeMenubar, value: valueProp, ...menuProps } = props;
|
|
119
|
+
const autoValue = (0, import_react_id.useId)();
|
|
120
|
+
const value = valueProp || autoValue || "LEGACY_REACT_AUTO_VALUE";
|
|
121
|
+
const context = useMenubarContext(MENU_NAME, __scopeMenubar);
|
|
122
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
123
|
+
const triggerRef = React.useRef(null);
|
|
124
|
+
const wasKeyboardTriggerOpenRef = React.useRef(false);
|
|
125
|
+
const open = context.value === value;
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
if (!open) wasKeyboardTriggerOpenRef.current = false;
|
|
128
|
+
}, [open]);
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
130
|
+
MenubarMenuProvider,
|
|
131
|
+
{
|
|
132
|
+
scope: __scopeMenubar,
|
|
133
|
+
value,
|
|
134
|
+
triggerId: (0, import_react_id.useId)(),
|
|
135
|
+
triggerRef,
|
|
136
|
+
contentId: (0, import_react_id.useId)(),
|
|
137
|
+
wasKeyboardTriggerOpenRef,
|
|
138
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
MenuPrimitive.Root,
|
|
140
|
+
{
|
|
141
|
+
...menuScope,
|
|
142
|
+
open,
|
|
143
|
+
onOpenChange: (open2) => {
|
|
144
|
+
if (!open2) context.onMenuClose();
|
|
145
|
+
},
|
|
146
|
+
modal: false,
|
|
147
|
+
dir: context.dir,
|
|
148
|
+
...menuProps
|
|
149
|
+
}
|
|
251
150
|
)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
/*
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
MenubarMenu.displayName = MENU_NAME;
|
|
155
|
+
var TRIGGER_NAME = "MenubarTrigger";
|
|
156
|
+
var MenubarTrigger = React.forwardRef(
|
|
157
|
+
(props, forwardedRef) => {
|
|
158
|
+
const { __scopeMenubar, disabled = false, ...triggerProps } = props;
|
|
159
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenubar);
|
|
160
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
161
|
+
const context = useMenubarContext(TRIGGER_NAME, __scopeMenubar);
|
|
162
|
+
const menuContext = useMenubarMenuContext(TRIGGER_NAME, __scopeMenubar);
|
|
163
|
+
const ref = React.useRef(null);
|
|
164
|
+
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, ref, menuContext.triggerRef);
|
|
165
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
166
|
+
const open = context.value === menuContext.value;
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, { scope: __scopeMenubar, value: menuContext.value, disabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
RovingFocusGroup.Item,
|
|
169
|
+
{
|
|
170
|
+
asChild: true,
|
|
171
|
+
...rovingFocusGroupScope,
|
|
172
|
+
focusable: !disabled,
|
|
173
|
+
tabStopId: menuContext.value,
|
|
174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Anchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
175
|
+
import_react_primitive.Primitive.button,
|
|
176
|
+
{
|
|
177
|
+
type: "button",
|
|
178
|
+
role: "menuitem",
|
|
179
|
+
id: menuContext.triggerId,
|
|
180
|
+
"aria-haspopup": "menu",
|
|
181
|
+
"aria-expanded": open,
|
|
182
|
+
"aria-controls": open ? menuContext.contentId : void 0,
|
|
183
|
+
"data-highlighted": isFocused ? "" : void 0,
|
|
184
|
+
"data-state": open ? "open" : "closed",
|
|
185
|
+
"data-disabled": disabled ? "" : void 0,
|
|
186
|
+
disabled,
|
|
187
|
+
...triggerProps,
|
|
188
|
+
ref: composedRefs,
|
|
189
|
+
onPointerDown: (0, import_primitive.composeEventHandlers)(props.onPointerDown, (event) => {
|
|
190
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
191
|
+
context.onMenuOpen(menuContext.value);
|
|
192
|
+
if (!open) event.preventDefault();
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
onPointerEnter: (0, import_primitive.composeEventHandlers)(props.onPointerEnter, () => {
|
|
196
|
+
const menubarOpen = Boolean(context.value);
|
|
197
|
+
if (menubarOpen && !open) {
|
|
198
|
+
context.onMenuOpen(menuContext.value);
|
|
199
|
+
ref.current?.focus();
|
|
200
|
+
}
|
|
201
|
+
}),
|
|
202
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
203
|
+
if (disabled) return;
|
|
204
|
+
if (["Enter", " "].includes(event.key)) context.onMenuToggle(menuContext.value);
|
|
205
|
+
if (event.key === "ArrowDown") context.onMenuOpen(menuContext.value);
|
|
206
|
+
if (["Enter", " ", "ArrowDown"].includes(event.key)) {
|
|
207
|
+
menuContext.wasKeyboardTriggerOpenRef.current = true;
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
}
|
|
210
|
+
}),
|
|
211
|
+
onFocus: (0, import_primitive.composeEventHandlers)(props.onFocus, () => setIsFocused(true)),
|
|
212
|
+
onBlur: (0, import_primitive.composeEventHandlers)(props.onBlur, () => setIsFocused(false))
|
|
213
|
+
}
|
|
214
|
+
) })
|
|
215
|
+
}
|
|
216
|
+
) });
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
MenubarTrigger.displayName = TRIGGER_NAME;
|
|
220
|
+
var PORTAL_NAME = "MenubarPortal";
|
|
221
|
+
var MenubarPortal = (props) => {
|
|
222
|
+
const { __scopeMenubar, ...portalProps } = props;
|
|
223
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Portal, { ...menuScope, ...portalProps });
|
|
225
|
+
};
|
|
226
|
+
MenubarPortal.displayName = PORTAL_NAME;
|
|
227
|
+
var CONTENT_NAME = "MenubarContent";
|
|
228
|
+
var MenubarContent = React.forwardRef(
|
|
229
|
+
(props, forwardedRef) => {
|
|
230
|
+
const { __scopeMenubar, align = "start", ...contentProps } = props;
|
|
231
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
232
|
+
const context = useMenubarContext(CONTENT_NAME, __scopeMenubar);
|
|
233
|
+
const menuContext = useMenubarMenuContext(CONTENT_NAME, __scopeMenubar);
|
|
234
|
+
const getItems = useCollection(__scopeMenubar);
|
|
235
|
+
const hasInteractedOutsideRef = React.useRef(false);
|
|
236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
|
+
MenuPrimitive.Content,
|
|
238
|
+
{
|
|
239
|
+
id: menuContext.contentId,
|
|
240
|
+
"aria-labelledby": menuContext.triggerId,
|
|
241
|
+
"data-radix-menubar-content": "",
|
|
242
|
+
...menuScope,
|
|
243
|
+
...contentProps,
|
|
244
|
+
ref: forwardedRef,
|
|
245
|
+
align,
|
|
246
|
+
onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
|
|
286
247
|
const menubarOpen = Boolean(context.value);
|
|
287
248
|
if (!menubarOpen && !hasInteractedOutsideRef.current) {
|
|
288
|
-
|
|
289
|
-
(_menuContext$triggerR = menuContext.triggerRef.current) === null || _menuContext$triggerR === void 0 || _menuContext$triggerR.focus();
|
|
249
|
+
menuContext.triggerRef.current?.focus();
|
|
290
250
|
}
|
|
291
|
-
hasInteractedOutsideRef.current = false;
|
|
251
|
+
hasInteractedOutsideRef.current = false;
|
|
292
252
|
event.preventDefault();
|
|
293
|
-
|
|
294
|
-
|
|
253
|
+
}),
|
|
254
|
+
onFocusOutside: (0, import_primitive.composeEventHandlers)(props.onFocusOutside, (event) => {
|
|
295
255
|
const target = event.target;
|
|
296
|
-
const isMenubarTrigger = getItems().some((item)=>
|
|
297
|
-
var _item$ref$current;
|
|
298
|
-
return (_item$ref$current = item.ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.contains(target);
|
|
299
|
-
});
|
|
256
|
+
const isMenubarTrigger = getItems().some((item) => item.ref.current?.contains(target));
|
|
300
257
|
if (isMenubarTrigger) event.preventDefault();
|
|
301
|
-
|
|
302
|
-
|
|
258
|
+
}),
|
|
259
|
+
onInteractOutside: (0, import_primitive.composeEventHandlers)(props.onInteractOutside, () => {
|
|
303
260
|
hasInteractedOutsideRef.current = true;
|
|
304
|
-
|
|
305
|
-
|
|
261
|
+
}),
|
|
262
|
+
onEntryFocus: (event) => {
|
|
306
263
|
if (!menuContext.wasKeyboardTriggerOpenRef.current) event.preventDefault();
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
].includes(event.key)) {
|
|
264
|
+
},
|
|
265
|
+
onKeyDown: (0, import_primitive.composeEventHandlers)(
|
|
266
|
+
props.onKeyDown,
|
|
267
|
+
(event) => {
|
|
268
|
+
if (["ArrowRight", "ArrowLeft"].includes(event.key)) {
|
|
313
269
|
const target = event.target;
|
|
314
|
-
const targetIsSubTrigger = target.hasAttribute(
|
|
315
|
-
const isKeyDownInsideSubMenu = target.closest(
|
|
316
|
-
const prevMenuKey = context.dir ===
|
|
270
|
+
const targetIsSubTrigger = target.hasAttribute("data-radix-menubar-subtrigger");
|
|
271
|
+
const isKeyDownInsideSubMenu = target.closest("[data-radix-menubar-content]") !== event.currentTarget;
|
|
272
|
+
const prevMenuKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
317
273
|
const isPrevKey = prevMenuKey === event.key;
|
|
318
|
-
const isNextKey = !isPrevKey;
|
|
319
|
-
if (isNextKey && targetIsSubTrigger) return;
|
|
274
|
+
const isNextKey = !isPrevKey;
|
|
275
|
+
if (isNextKey && targetIsSubTrigger) return;
|
|
320
276
|
if (isKeyDownInsideSubMenu && isPrevKey) return;
|
|
321
|
-
const items = getItems().filter((item)
|
|
322
|
-
);
|
|
323
|
-
let candidateValues = items.map((item)=>item.value
|
|
324
|
-
);
|
|
277
|
+
const items = getItems().filter((item) => !item.disabled);
|
|
278
|
+
let candidateValues = items.map((item) => item.value);
|
|
325
279
|
if (isPrevKey) candidateValues.reverse();
|
|
326
280
|
const currentIndex = candidateValues.indexOf(menuContext.value);
|
|
327
|
-
candidateValues = context.loop ?
|
|
281
|
+
candidateValues = context.loop ? wrapArray(candidateValues, currentIndex + 1) : candidateValues.slice(currentIndex + 1);
|
|
328
282
|
const [nextValue] = candidateValues;
|
|
329
283
|
if (nextValue) context.onMenuOpen(nextValue);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
checkForDefaultPrevented: false
|
|
333
|
-
|
|
334
|
-
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{ checkForDefaultPrevented: false }
|
|
287
|
+
),
|
|
288
|
+
style: {
|
|
335
289
|
...props.style,
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
290
|
+
// re-namespace exposed content custom properties
|
|
291
|
+
...{
|
|
292
|
+
"--radix-menubar-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
293
|
+
"--radix-menubar-content-available-width": "var(--radix-popper-available-width)",
|
|
294
|
+
"--radix-menubar-content-available-height": "var(--radix-popper-available-height)",
|
|
295
|
+
"--radix-menubar-trigger-width": "var(--radix-popper-anchor-width)",
|
|
296
|
+
"--radix-menubar-trigger-height": "var(--radix-popper-anchor-height)"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
341
299
|
}
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
/*
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
/*
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}));
|
|
434
|
-
});
|
|
435
|
-
/*#__PURE__*/ Object.assign($f5560139001bae38$export$63e15a0e2af5a57, {
|
|
436
|
-
displayName: $f5560139001bae38$var$INDICATOR_NAME
|
|
437
|
-
});
|
|
438
|
-
/* -------------------------------------------------------------------------------------------------
|
|
439
|
-
* MenubarSeparator
|
|
440
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$SEPARATOR_NAME = 'MenubarSeparator';
|
|
441
|
-
const $f5560139001bae38$export$588aef9e7b5183b5 = /*#__PURE__*/ $fIWtd$react.forwardRef((props, forwardedRef)=>{
|
|
442
|
-
const { __scopeMenubar: __scopeMenubar , ...separatorProps } = props;
|
|
443
|
-
const menuScope = $f5560139001bae38$var$useMenuScope(__scopeMenubar);
|
|
444
|
-
return /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactmenu.Separator, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({}, menuScope, separatorProps, {
|
|
445
|
-
ref: forwardedRef
|
|
446
|
-
}));
|
|
447
|
-
});
|
|
448
|
-
/*#__PURE__*/ Object.assign($f5560139001bae38$export$588aef9e7b5183b5, {
|
|
449
|
-
displayName: $f5560139001bae38$var$SEPARATOR_NAME
|
|
450
|
-
});
|
|
451
|
-
/* -------------------------------------------------------------------------------------------------
|
|
452
|
-
* MenubarArrow
|
|
453
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$ARROW_NAME = 'MenubarArrow';
|
|
454
|
-
const $f5560139001bae38$export$474b9891f5b9e633 = /*#__PURE__*/ $fIWtd$react.forwardRef((props, forwardedRef)=>{
|
|
455
|
-
const { __scopeMenubar: __scopeMenubar , ...arrowProps } = props;
|
|
456
|
-
const menuScope = $f5560139001bae38$var$useMenuScope(__scopeMenubar);
|
|
457
|
-
return /*#__PURE__*/ $fIWtd$react.createElement($fIWtd$radixuireactmenu.Arrow, ($parcel$interopDefault($fIWtd$babelruntimehelpersextends))({}, menuScope, arrowProps, {
|
|
458
|
-
ref: forwardedRef
|
|
459
|
-
}));
|
|
460
|
-
});
|
|
461
|
-
/*#__PURE__*/ Object.assign($f5560139001bae38$export$474b9891f5b9e633, {
|
|
462
|
-
displayName: $f5560139001bae38$var$ARROW_NAME
|
|
463
|
-
});
|
|
464
|
-
/* -------------------------------------------------------------------------------------------------
|
|
465
|
-
* MenubarSub
|
|
466
|
-
* -----------------------------------------------------------------------------------------------*/ const $f5560139001bae38$var$SUB_NAME = 'MenubarSub';
|
|
467
|
-
const $f5560139001bae38$export$ed0be551778c493a = (props)=>{
|
|
468
|
-
const { __scopeMenubar: __scopeMenubar , children: children , open: openProp , onOpenChange: onOpenChange , defaultOpen: defaultOpen } = props;
|
|
469
|
-
const menuScope = $f5560139001bae38$var$useMenuScope(__scopeMenubar);
|
|
470
|
-
const [open = false, setOpen] = $fIWtd$radixuireactusecontrollablestate.useControllableState({
|
|
471
|
-
prop: openProp,
|
|
472
|
-
defaultProp: defaultOpen,
|
|
473
|
-
onChange: onOpenChange
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
MenubarContent.displayName = CONTENT_NAME;
|
|
304
|
+
var GROUP_NAME = "MenubarGroup";
|
|
305
|
+
var MenubarGroup = React.forwardRef(
|
|
306
|
+
(props, forwardedRef) => {
|
|
307
|
+
const { __scopeMenubar, ...groupProps } = props;
|
|
308
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Group, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
MenubarGroup.displayName = GROUP_NAME;
|
|
313
|
+
var LABEL_NAME = "MenubarLabel";
|
|
314
|
+
var MenubarLabel = React.forwardRef(
|
|
315
|
+
(props, forwardedRef) => {
|
|
316
|
+
const { __scopeMenubar, ...labelProps } = props;
|
|
317
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
MenubarLabel.displayName = LABEL_NAME;
|
|
322
|
+
var ITEM_NAME = "MenubarItem";
|
|
323
|
+
var MenubarItem = React.forwardRef(
|
|
324
|
+
(props, forwardedRef) => {
|
|
325
|
+
const { __scopeMenubar, ...itemProps } = props;
|
|
326
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Item, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
MenubarItem.displayName = ITEM_NAME;
|
|
331
|
+
var CHECKBOX_ITEM_NAME = "MenubarCheckboxItem";
|
|
332
|
+
var MenubarCheckboxItem = React.forwardRef(
|
|
333
|
+
(props, forwardedRef) => {
|
|
334
|
+
const { __scopeMenubar, ...checkboxItemProps } = props;
|
|
335
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
MenubarCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
340
|
+
var RADIO_GROUP_NAME = "MenubarRadioGroup";
|
|
341
|
+
var MenubarRadioGroup = React.forwardRef(
|
|
342
|
+
(props, forwardedRef) => {
|
|
343
|
+
const { __scopeMenubar, ...radioGroupProps } = props;
|
|
344
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
MenubarRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
349
|
+
var RADIO_ITEM_NAME = "MenubarRadioItem";
|
|
350
|
+
var MenubarRadioItem = React.forwardRef(
|
|
351
|
+
(props, forwardedRef) => {
|
|
352
|
+
const { __scopeMenubar, ...radioItemProps } = props;
|
|
353
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
MenubarRadioItem.displayName = RADIO_ITEM_NAME;
|
|
358
|
+
var INDICATOR_NAME = "MenubarItemIndicator";
|
|
359
|
+
var MenubarItemIndicator = React.forwardRef((props, forwardedRef) => {
|
|
360
|
+
const { __scopeMenubar, ...itemIndicatorProps } = props;
|
|
361
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
363
|
+
});
|
|
364
|
+
MenubarItemIndicator.displayName = INDICATOR_NAME;
|
|
365
|
+
var SEPARATOR_NAME = "MenubarSeparator";
|
|
366
|
+
var MenubarSeparator = React.forwardRef(
|
|
367
|
+
(props, forwardedRef) => {
|
|
368
|
+
const { __scopeMenubar, ...separatorProps } = props;
|
|
369
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
MenubarSeparator.displayName = SEPARATOR_NAME;
|
|
374
|
+
var ARROW_NAME = "MenubarArrow";
|
|
375
|
+
var MenubarArrow = React.forwardRef(
|
|
376
|
+
(props, forwardedRef) => {
|
|
377
|
+
const { __scopeMenubar, ...arrowProps } = props;
|
|
378
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Arrow, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
380
|
+
}
|
|
381
|
+
);
|
|
382
|
+
MenubarArrow.displayName = ARROW_NAME;
|
|
383
|
+
var SUB_NAME = "MenubarSub";
|
|
384
|
+
var MenubarSub = (props) => {
|
|
385
|
+
const { __scopeMenubar, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
386
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
387
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
388
|
+
prop: openProp,
|
|
389
|
+
defaultProp: defaultOpen,
|
|
390
|
+
onChange: onOpenChange
|
|
474
391
|
});
|
|
475
|
-
return
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
/*
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
style: {
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuPrimitive.Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
393
|
+
};
|
|
394
|
+
MenubarSub.displayName = SUB_NAME;
|
|
395
|
+
var SUB_TRIGGER_NAME = "MenubarSubTrigger";
|
|
396
|
+
var MenubarSubTrigger = React.forwardRef(
|
|
397
|
+
(props, forwardedRef) => {
|
|
398
|
+
const { __scopeMenubar, ...subTriggerProps } = props;
|
|
399
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
401
|
+
MenuPrimitive.SubTrigger,
|
|
402
|
+
{
|
|
403
|
+
"data-radix-menubar-subtrigger": "",
|
|
404
|
+
...menuScope,
|
|
405
|
+
...subTriggerProps,
|
|
406
|
+
ref: forwardedRef
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
MenubarSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
412
|
+
var SUB_CONTENT_NAME = "MenubarSubContent";
|
|
413
|
+
var MenubarSubContent = React.forwardRef(
|
|
414
|
+
(props, forwardedRef) => {
|
|
415
|
+
const { __scopeMenubar, ...subContentProps } = props;
|
|
416
|
+
const menuScope = useMenuScope(__scopeMenubar);
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
418
|
+
MenuPrimitive.SubContent,
|
|
419
|
+
{
|
|
420
|
+
...menuScope,
|
|
421
|
+
"data-radix-menubar-content": "",
|
|
422
|
+
...subContentProps,
|
|
423
|
+
ref: forwardedRef,
|
|
424
|
+
style: {
|
|
509
425
|
...props.style,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
426
|
+
// re-namespace exposed content custom properties
|
|
427
|
+
...{
|
|
428
|
+
"--radix-menubar-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
429
|
+
"--radix-menubar-content-available-width": "var(--radix-popper-available-width)",
|
|
430
|
+
"--radix-menubar-content-available-height": "var(--radix-popper-available-height)",
|
|
431
|
+
"--radix-menubar-trigger-width": "var(--radix-popper-anchor-width)",
|
|
432
|
+
"--radix-menubar-trigger-height": "var(--radix-popper-anchor-height)"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
515
435
|
}
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const $f5560139001bae38$export$21b07c8f274aebd5 = $f5560139001bae38$export$474b9891f5b9e633;
|
|
542
|
-
const $f5560139001bae38$export$d7a01e11500dfb6f = $f5560139001bae38$export$ed0be551778c493a;
|
|
543
|
-
const $f5560139001bae38$export$2ea8a7a591ac5eac = $f5560139001bae38$export$1820ea18a1dfed3c;
|
|
544
|
-
const $f5560139001bae38$export$6d4de93b380beddf = $f5560139001bae38$export$1b21e255bb3e4f7f;
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
MenubarSubContent.displayName = SUB_CONTENT_NAME;
|
|
440
|
+
function wrapArray(array, startIndex) {
|
|
441
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
442
|
+
}
|
|
443
|
+
var Root3 = Menubar;
|
|
444
|
+
var Menu = MenubarMenu;
|
|
445
|
+
var Trigger = MenubarTrigger;
|
|
446
|
+
var Portal2 = MenubarPortal;
|
|
447
|
+
var Content2 = MenubarContent;
|
|
448
|
+
var Group2 = MenubarGroup;
|
|
449
|
+
var Label2 = MenubarLabel;
|
|
450
|
+
var Item3 = MenubarItem;
|
|
451
|
+
var CheckboxItem2 = MenubarCheckboxItem;
|
|
452
|
+
var RadioGroup2 = MenubarRadioGroup;
|
|
453
|
+
var RadioItem2 = MenubarRadioItem;
|
|
454
|
+
var ItemIndicator2 = MenubarItemIndicator;
|
|
455
|
+
var Separator2 = MenubarSeparator;
|
|
456
|
+
var Arrow2 = MenubarArrow;
|
|
457
|
+
var Sub2 = MenubarSub;
|
|
458
|
+
var SubTrigger2 = MenubarSubTrigger;
|
|
459
|
+
var SubContent2 = MenubarSubContent;
|
|
460
|
+
})();
|
|
549
461
|
//# sourceMappingURL=index.js.map
|