boreal-ui 0.0.899-experimental.4 → 0.0.899
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/core/Menu-B90TbWpJ.js +563 -0
- package/dist/core/Menu-CXmtgHBx.cjs +1 -0
- package/dist/core/Menu.cjs.js +1 -1
- package/dist/core/Menu.css +1 -1
- package/dist/core/Menu.js +1 -1
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.js +1 -1
- package/dist/next/Menu-v24Jd3cQ.js +565 -0
- package/dist/next/Menu.css +1 -1
- package/dist/next/Menu.js +1 -1
- package/dist/next/index.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/Menu/MenuBase.d.ts.map +1 -1
- package/dist/types/components/Menu/core/Menu.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/Menu-BKciX3ik.cjs +0 -1
- package/dist/core/Menu-DMMSFvdI.js +0 -532
- package/dist/next/Menu-BiXA3t10.js +0 -534
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
import { jsxs as K, jsx as b, Fragment as rn } from "react/jsx-runtime";
|
|
2
|
+
import { e as un } from "./propAliases-C-VkrhZR.js";
|
|
3
|
+
import Te, { useState as P, useRef as ee, useId as on, useCallback as _, useLayoutEffect as sn, useEffect as fe, useMemo as ln } from "react";
|
|
4
|
+
import { c as g } from "./classNames-Dz0_huu_.js";
|
|
5
|
+
import { c as ne } from "./capitalize-D_pj4b3P.js";
|
|
6
|
+
import { g as dn, f as cn, b as mn, a as fn } from "./styleConfig-4yWEoquf.js";
|
|
7
|
+
import './Menu.css';const B = "root", i = 8, bn = (o, p) => o ? `${o}.${p}` : `${p}`, hn = (o) => {
|
|
8
|
+
const p = o.split(".");
|
|
9
|
+
return p.length > 1 ? p.slice(0, -1).join(".") : null;
|
|
10
|
+
}, Ae = (o) => Array.isArray(o.items) && o.items.length > 0, be = (o, p) => o === p || (o == null ? void 0 : o.startsWith(`${p}.`)) === !0, De = (o) => o.getAttribute("aria-disabled") === "true" || o instanceof HTMLButtonElement && o.disabled, Re = ({
|
|
11
|
+
items: o,
|
|
12
|
+
children: p,
|
|
13
|
+
trigger: I,
|
|
14
|
+
open: he,
|
|
15
|
+
defaultOpen: We = !1,
|
|
16
|
+
position: q,
|
|
17
|
+
activation: te = I ? "click" : "contextmenu",
|
|
18
|
+
onOpenChange: F,
|
|
19
|
+
onPositionChange: Y,
|
|
20
|
+
closeOnSelect: ve = !0,
|
|
21
|
+
focusFirstItemOnOpen: ye = !0,
|
|
22
|
+
theme: ae = dn(),
|
|
23
|
+
glass: re = cn(),
|
|
24
|
+
rounding: A = mn(),
|
|
25
|
+
shadow: D = fn(),
|
|
26
|
+
state: R,
|
|
27
|
+
className: He,
|
|
28
|
+
targetClassName: Me,
|
|
29
|
+
triggerClassName: pe,
|
|
30
|
+
menuClassName: we,
|
|
31
|
+
itemClassName: Oe,
|
|
32
|
+
id: Be,
|
|
33
|
+
menuId: qe,
|
|
34
|
+
"aria-label": Fe = "Context menu",
|
|
35
|
+
"aria-labelledby": _e,
|
|
36
|
+
"aria-describedby": Ye,
|
|
37
|
+
"data-testid": je,
|
|
38
|
+
testId: x = je ?? "menu",
|
|
39
|
+
triggerProps: m,
|
|
40
|
+
menuProps: w,
|
|
41
|
+
onKeyDown: ue,
|
|
42
|
+
classMap: r,
|
|
43
|
+
...S
|
|
44
|
+
}) => {
|
|
45
|
+
const [ze, Xe] = P(We), [Ge, Ue] = P(
|
|
46
|
+
q ?? { x: 0, y: 0 }
|
|
47
|
+
), [ge, W] = P(null), [oe, xe] = P(
|
|
48
|
+
{}
|
|
49
|
+
), se = ee(null), le = ee(null), j = ee(null), $ = ee(null), Ve = on(), ke = he !== void 0, f = he ?? ze, z = qe ?? `${Ve}-menu`, X = q ?? Ge, de = Te.isValidElement(I), G = _(
|
|
50
|
+
(e) => {
|
|
51
|
+
ke || Xe(e), e || W(null), F == null || F(e);
|
|
52
|
+
},
|
|
53
|
+
[ke, F]
|
|
54
|
+
), Ne = _(
|
|
55
|
+
(e) => {
|
|
56
|
+
q || Ue(e), Y == null || Y(e);
|
|
57
|
+
},
|
|
58
|
+
[Y, q]
|
|
59
|
+
), U = _(
|
|
60
|
+
(e) => {
|
|
61
|
+
Ne(e), G(!0);
|
|
62
|
+
},
|
|
63
|
+
[Ne, G]
|
|
64
|
+
), v = _(() => {
|
|
65
|
+
var e;
|
|
66
|
+
G(!1), (e = j.current) == null || e.focus();
|
|
67
|
+
}, [G]), H = _((e) => e ? Array.from(
|
|
68
|
+
e.querySelectorAll('[data-menu-item="true"]')
|
|
69
|
+
).filter((t) => t.closest("[data-menu-panel]") === e && !De(t)) : [], []), V = _(
|
|
70
|
+
(e, t) => {
|
|
71
|
+
var u;
|
|
72
|
+
const n = H(e);
|
|
73
|
+
if (n.length === 0) return;
|
|
74
|
+
const s = (t + n.length) % n.length;
|
|
75
|
+
(u = n[s]) == null || u.focus();
|
|
76
|
+
},
|
|
77
|
+
[H]
|
|
78
|
+
), ie = _(
|
|
79
|
+
(e) => {
|
|
80
|
+
var t;
|
|
81
|
+
(t = H(e)[0]) == null || t.focus();
|
|
82
|
+
},
|
|
83
|
+
[H]
|
|
84
|
+
), E = _(() => {
|
|
85
|
+
if (!f || !$.current) {
|
|
86
|
+
xe({});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const e = window.innerWidth || document.documentElement.clientWidth || 0, t = window.innerHeight || document.documentElement.clientHeight || 0, n = `${Math.max(120, t - i * 2)}px`, s = `${Math.max(160, e - i * 2)}px`, u = [
|
|
90
|
+
$.current,
|
|
91
|
+
...Array.from(
|
|
92
|
+
$.current.querySelectorAll("[data-menu-panel]")
|
|
93
|
+
)
|
|
94
|
+
], h = {};
|
|
95
|
+
u.forEach((c) => {
|
|
96
|
+
const a = c.dataset.menuPanelPath ?? B, l = c.getBoundingClientRect(), y = {
|
|
97
|
+
"--menu-panel-max-height": n,
|
|
98
|
+
"--menu-panel-max-width": s
|
|
99
|
+
};
|
|
100
|
+
if (a === B) {
|
|
101
|
+
const O = Math.min(
|
|
102
|
+
Math.max(i, X.x),
|
|
103
|
+
Math.max(
|
|
104
|
+
i,
|
|
105
|
+
e - l.width - i
|
|
106
|
+
)
|
|
107
|
+
), Z = Math.min(
|
|
108
|
+
Math.max(i, X.y),
|
|
109
|
+
Math.max(
|
|
110
|
+
i,
|
|
111
|
+
t - l.height - i
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
y.left = `${Math.round(O)}px`, y.top = `${Math.round(Z)}px`, h[a] = { style: y };
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const C = c.closest(
|
|
118
|
+
'[data-menu-item-wrapper="true"]'
|
|
119
|
+
), k = C == null ? void 0 : C.getBoundingClientRect(), L = Math.max(l.width, c.offsetWidth, 160), M = k ? e - k.right - i : e - l.right - i, J = k ? k.left - i : l.left - i, Q = M >= L || M >= J ? "right" : "left";
|
|
120
|
+
let N = 0;
|
|
121
|
+
l.bottom > t - i && (N -= l.bottom - (t - i)), l.top + N < i && (N += i - (l.top + N)), y["--menu-panel-offset-y"] = `${Math.round(N)}px`, h[a] = { placement: Q, style: y };
|
|
122
|
+
}), xe(h);
|
|
123
|
+
}, [f, X.x, X.y]);
|
|
124
|
+
sn(() => {
|
|
125
|
+
f && E();
|
|
126
|
+
}, [f, o, ge, E]), fe(() => {
|
|
127
|
+
if (f)
|
|
128
|
+
return window.addEventListener("resize", E), window.addEventListener("scroll", E, !0), () => {
|
|
129
|
+
window.removeEventListener("resize", E), window.removeEventListener("scroll", E, !0);
|
|
130
|
+
};
|
|
131
|
+
}, [f, E]), fe(() => {
|
|
132
|
+
!f || !ye || ie($.current);
|
|
133
|
+
}, [ye, ie, f]), fe(() => {
|
|
134
|
+
if (!f) return;
|
|
135
|
+
const e = (t) => {
|
|
136
|
+
var n;
|
|
137
|
+
(n = se.current) != null && n.contains(t.target) || v();
|
|
138
|
+
};
|
|
139
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
140
|
+
}, [v, f]);
|
|
141
|
+
const Je = ln(
|
|
142
|
+
() => g(
|
|
143
|
+
r.menu,
|
|
144
|
+
r[ae],
|
|
145
|
+
R && r[R],
|
|
146
|
+
re && r.glass,
|
|
147
|
+
D && r[`shadow${ne(D)}`],
|
|
148
|
+
A && r[`round${ne(A)}`],
|
|
149
|
+
we,
|
|
150
|
+
w == null ? void 0 : w.className
|
|
151
|
+
),
|
|
152
|
+
[
|
|
153
|
+
r,
|
|
154
|
+
re,
|
|
155
|
+
we,
|
|
156
|
+
w == null ? void 0 : w.className,
|
|
157
|
+
A,
|
|
158
|
+
D,
|
|
159
|
+
R,
|
|
160
|
+
ae
|
|
161
|
+
]
|
|
162
|
+
), Qe = (e) => g(
|
|
163
|
+
r.menu,
|
|
164
|
+
r.submenu,
|
|
165
|
+
e && r.submenuOpen,
|
|
166
|
+
r[ae],
|
|
167
|
+
R && r[R],
|
|
168
|
+
re && r.glass,
|
|
169
|
+
D && r[`shadow${ne(D)}`],
|
|
170
|
+
A && r[`round${ne(A)}`]
|
|
171
|
+
), ce = oe[B], Ze = (e) => {
|
|
172
|
+
var t;
|
|
173
|
+
(t = S.onContextMenu) == null || t.call(S, e), !(e.defaultPrevented || !["contextmenu", "both"].includes(te)) && (e.preventDefault(), U({ x: e.clientX, y: e.clientY }));
|
|
174
|
+
}, Ke = (e) => {
|
|
175
|
+
var s, u, h, c;
|
|
176
|
+
if ((s = S.onClick) == null || s.call(S, e), e.defaultPrevented || !["click", "both"].includes(te))
|
|
177
|
+
return;
|
|
178
|
+
const t = e.target;
|
|
179
|
+
if ((u = $.current) != null && u.contains(t) || (h = j.current) != null && h.contains(t))
|
|
180
|
+
return;
|
|
181
|
+
const n = (c = le.current) == null ? void 0 : c.getBoundingClientRect();
|
|
182
|
+
U({
|
|
183
|
+
x: (n == null ? void 0 : n.left) ?? e.clientX,
|
|
184
|
+
y: (n == null ? void 0 : n.bottom) ?? e.clientY
|
|
185
|
+
});
|
|
186
|
+
}, Ie = (e) => {
|
|
187
|
+
var n, s;
|
|
188
|
+
if ((n = m == null ? void 0 : m.onClick) == null || n.call(
|
|
189
|
+
m,
|
|
190
|
+
e
|
|
191
|
+
), e.defaultPrevented) return;
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
const t = (s = j.current) == null ? void 0 : s.getBoundingClientRect();
|
|
194
|
+
U({
|
|
195
|
+
x: (t == null ? void 0 : t.left) ?? e.clientX,
|
|
196
|
+
y: (t == null ? void 0 : t.bottom) ?? e.clientY
|
|
197
|
+
});
|
|
198
|
+
}, Se = _(
|
|
199
|
+
(e) => {
|
|
200
|
+
if (j.current = e, !de) return;
|
|
201
|
+
const n = I.props.ref;
|
|
202
|
+
typeof n == "function" ? n(e) : n && "current" in n && (n.current = e);
|
|
203
|
+
},
|
|
204
|
+
[de, I]
|
|
205
|
+
), Pe = () => {
|
|
206
|
+
if (!I) return null;
|
|
207
|
+
if (de) {
|
|
208
|
+
const e = I;
|
|
209
|
+
return Te.cloneElement(e, {
|
|
210
|
+
ref: Se,
|
|
211
|
+
className: g(
|
|
212
|
+
e.props.className,
|
|
213
|
+
pe,
|
|
214
|
+
m == null ? void 0 : m.className
|
|
215
|
+
),
|
|
216
|
+
"aria-haspopup": "menu",
|
|
217
|
+
"aria-expanded": f,
|
|
218
|
+
"aria-controls": z,
|
|
219
|
+
"data-testid": `${x}-trigger`,
|
|
220
|
+
onClick: (t) => {
|
|
221
|
+
var n, s;
|
|
222
|
+
(s = (n = e.props).onClick) == null || s.call(n, t), !t.defaultPrevented && Ie(t);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return /* @__PURE__ */ b(
|
|
227
|
+
"button",
|
|
228
|
+
{
|
|
229
|
+
...m,
|
|
230
|
+
ref: Se,
|
|
231
|
+
type: (m == null ? void 0 : m.type) ?? "button",
|
|
232
|
+
className: g(
|
|
233
|
+
r.trigger,
|
|
234
|
+
r.triggerPlain,
|
|
235
|
+
pe,
|
|
236
|
+
m == null ? void 0 : m.className
|
|
237
|
+
),
|
|
238
|
+
"aria-haspopup": "menu",
|
|
239
|
+
"aria-expanded": f,
|
|
240
|
+
"aria-controls": z,
|
|
241
|
+
"data-testid": `${x}-trigger`,
|
|
242
|
+
onClick: (e) => Ie(e),
|
|
243
|
+
children: I
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}, $e = (e, t) => {
|
|
247
|
+
var n, s;
|
|
248
|
+
e.stopPropagation(), !(t.disabled || Ae(t)) && ((n = t.onSelect) == null || n.call(t, e), (s = t.onClick) == null || s.call(t), !e.defaultPrevented && ve && v());
|
|
249
|
+
}, en = (e) => {
|
|
250
|
+
const t = () => {
|
|
251
|
+
const n = document.getElementById(e);
|
|
252
|
+
n instanceof HTMLElement && ie(n);
|
|
253
|
+
};
|
|
254
|
+
window.requestAnimationFrame ? window.requestAnimationFrame(t) : window.setTimeout(t);
|
|
255
|
+
}, nn = (e) => {
|
|
256
|
+
var h, c;
|
|
257
|
+
if (ue == null || ue(e), e.defaultPrevented) return;
|
|
258
|
+
if (!f && (e.key === "ContextMenu" || e.shiftKey && e.key === "F10")) {
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
const a = (h = le.current) == null ? void 0 : h.getBoundingClientRect();
|
|
261
|
+
U({
|
|
262
|
+
x: (a == null ? void 0 : a.left) ?? i,
|
|
263
|
+
y: (a == null ? void 0 : a.bottom) ?? i
|
|
264
|
+
});
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (!f) return;
|
|
268
|
+
const t = document.activeElement instanceof HTMLElement ? document.activeElement : null, n = (t == null ? void 0 : t.closest("[data-menu-panel]")) ?? $.current, s = H(n), u = t ? s.indexOf(t) : -1;
|
|
269
|
+
if (e.key === "Escape") {
|
|
270
|
+
e.preventDefault(), v();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (e.key === "Tab") {
|
|
274
|
+
v();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (e.key === "ArrowDown") {
|
|
278
|
+
e.preventDefault(), V(n, u + 1);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (e.key === "ArrowUp") {
|
|
282
|
+
e.preventDefault(), V(
|
|
283
|
+
n,
|
|
284
|
+
u < 0 ? s.length - 1 : u - 1
|
|
285
|
+
);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (e.key === "Home") {
|
|
289
|
+
e.preventDefault(), V(n, 0);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (e.key === "End") {
|
|
293
|
+
e.preventDefault(), V(n, s.length - 1);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (e.key === "ArrowRight") {
|
|
297
|
+
const a = t == null ? void 0 : t.dataset.menuItemPath, l = t == null ? void 0 : t.getAttribute("aria-controls");
|
|
298
|
+
(t == null ? void 0 : t.dataset.menuHasSubmenu) === "true" && a && l && (e.preventDefault(), W(a), en(l));
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (e.key === "ArrowLeft") {
|
|
302
|
+
const a = n == null ? void 0 : n.dataset.menuPanelPath;
|
|
303
|
+
if (a && a !== B) {
|
|
304
|
+
e.preventDefault();
|
|
305
|
+
const l = hn(a);
|
|
306
|
+
W(l);
|
|
307
|
+
const y = (c = se.current) == null ? void 0 : c.querySelector(
|
|
308
|
+
`[data-menu-item-path="${a}"][data-menu-item="true"]`
|
|
309
|
+
);
|
|
310
|
+
y == null || y.focus();
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
315
|
+
const a = (t == null ? void 0 : t.dataset.menuItem) === "true" ? t : null;
|
|
316
|
+
if (!a || De(a)) return;
|
|
317
|
+
e.preventDefault(), a.click();
|
|
318
|
+
}
|
|
319
|
+
}, me = (e, t) => /* @__PURE__ */ K(rn, { children: [
|
|
320
|
+
/* @__PURE__ */ K("span", { className: r.itemContent, children: [
|
|
321
|
+
e.icon && /* @__PURE__ */ b("span", { className: r.icon, "aria-hidden": "true", children: e.icon }),
|
|
322
|
+
e.label && /* @__PURE__ */ b("span", { className: r.label, children: e.label })
|
|
323
|
+
] }),
|
|
324
|
+
e.shortcut && /* @__PURE__ */ b("span", { className: r.shortcut, "aria-hidden": "true", children: e.shortcut }),
|
|
325
|
+
t && /* @__PURE__ */ b("span", { className: r.submenuIndicator, "aria-hidden": "true", children: ">" })
|
|
326
|
+
] }), Ee = (e, t = "") => e.map((n, s) => {
|
|
327
|
+
var Z, Ce;
|
|
328
|
+
const u = bn(t, s), h = n.type ?? "item", c = n["data-testid"] ?? n.testId;
|
|
329
|
+
if (h === "separator")
|
|
330
|
+
return /* @__PURE__ */ b(
|
|
331
|
+
"div",
|
|
332
|
+
{
|
|
333
|
+
role: "separator",
|
|
334
|
+
className: r.separator,
|
|
335
|
+
"data-testid": c ?? `${x}-${u}-separator`
|
|
336
|
+
},
|
|
337
|
+
n.id ?? u
|
|
338
|
+
);
|
|
339
|
+
if (h === "label")
|
|
340
|
+
return /* @__PURE__ */ b(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
role: "none",
|
|
344
|
+
className: g(r.sectionLabel, n.className),
|
|
345
|
+
"data-testid": c ?? `${x}-${u}-label`,
|
|
346
|
+
children: n.label
|
|
347
|
+
},
|
|
348
|
+
n.id ?? u
|
|
349
|
+
);
|
|
350
|
+
const a = Ae(n), l = a && be(ge, u), y = n.submenuId ?? `${z}-${u}-submenu`, C = n.role ?? "menuitem", k = (d = !0) => {
|
|
351
|
+
a && !n.disabled && W(
|
|
352
|
+
(T) => d && T && be(T, u) ? T : u
|
|
353
|
+
);
|
|
354
|
+
}, L = () => k(!1), M = () => {
|
|
355
|
+
a || W((d) => d && (t ? be(d, t) ? t : d : null));
|
|
356
|
+
}, J = () => {
|
|
357
|
+
if (a) {
|
|
358
|
+
k();
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
M();
|
|
362
|
+
}, Q = () => {
|
|
363
|
+
k();
|
|
364
|
+
}, N = (d) => {
|
|
365
|
+
const T = d.target, tn = d.currentTarget.closest("[data-menu-panel]"), Le = T.closest("[data-menu-panel]"), an = T.closest('[data-menu-item-wrapper="true"]');
|
|
366
|
+
Le && Le !== tn || an === d.currentTarget && (a ? L() : M());
|
|
367
|
+
}, O = {
|
|
368
|
+
id: n.id,
|
|
369
|
+
className: g(
|
|
370
|
+
r.item,
|
|
371
|
+
n.destructive && r.destructive,
|
|
372
|
+
n.inset && r.inset,
|
|
373
|
+
a && r.submenuTrigger,
|
|
374
|
+
n.disabled && r.disabled,
|
|
375
|
+
Oe,
|
|
376
|
+
n.className
|
|
377
|
+
),
|
|
378
|
+
role: C,
|
|
379
|
+
title: n.title,
|
|
380
|
+
"aria-label": n["aria-label"],
|
|
381
|
+
"aria-describedby": n["aria-describedby"],
|
|
382
|
+
"aria-current": n["aria-current"],
|
|
383
|
+
"aria-disabled": n.disabled || void 0,
|
|
384
|
+
"aria-checked": C === "menuitemcheckbox" || C === "menuitemradio" ? n.checked : void 0,
|
|
385
|
+
"aria-haspopup": a ? "menu" : void 0,
|
|
386
|
+
"aria-expanded": a ? l : void 0,
|
|
387
|
+
"aria-controls": a ? y : void 0,
|
|
388
|
+
"data-menu-item": "true",
|
|
389
|
+
"data-menu-item-path": u,
|
|
390
|
+
"data-menu-has-submenu": a ? "true" : void 0,
|
|
391
|
+
"data-testid": c
|
|
392
|
+
};
|
|
393
|
+
return /* @__PURE__ */ K(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
className: g(
|
|
397
|
+
r.itemWrapper,
|
|
398
|
+
a && r.hasSubmenu
|
|
399
|
+
),
|
|
400
|
+
role: "group",
|
|
401
|
+
"data-menu-item-wrapper": "true",
|
|
402
|
+
"data-menu-item-path": u,
|
|
403
|
+
onMouseEnter: J,
|
|
404
|
+
onMouseOver: N,
|
|
405
|
+
onPointerEnter: J,
|
|
406
|
+
onPointerOver: N,
|
|
407
|
+
children: [
|
|
408
|
+
a ? /* @__PURE__ */ b(
|
|
409
|
+
"button",
|
|
410
|
+
{
|
|
411
|
+
type: "button",
|
|
412
|
+
disabled: n.disabled,
|
|
413
|
+
...O,
|
|
414
|
+
onMouseEnter: Q,
|
|
415
|
+
onMouseOver: L,
|
|
416
|
+
onPointerEnter: Q,
|
|
417
|
+
onPointerOver: L,
|
|
418
|
+
onClick: (d) => {
|
|
419
|
+
d.stopPropagation(), L();
|
|
420
|
+
},
|
|
421
|
+
children: me(n, !0)
|
|
422
|
+
}
|
|
423
|
+
) : n.href ? /* @__PURE__ */ b(
|
|
424
|
+
"a",
|
|
425
|
+
{
|
|
426
|
+
href: n.disabled ? void 0 : n.href,
|
|
427
|
+
target: n.disabled ? void 0 : n.target,
|
|
428
|
+
rel: n.rel ?? (n.target === "_blank" ? "noopener noreferrer" : void 0),
|
|
429
|
+
...O,
|
|
430
|
+
onClick: (d) => {
|
|
431
|
+
if (d.stopPropagation(), n.disabled) {
|
|
432
|
+
d.preventDefault();
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
$e(d, n);
|
|
436
|
+
},
|
|
437
|
+
children: me(n, !1)
|
|
438
|
+
}
|
|
439
|
+
) : /* @__PURE__ */ b(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
type: "button",
|
|
443
|
+
disabled: n.disabled,
|
|
444
|
+
...O,
|
|
445
|
+
onClick: (d) => $e(d, n),
|
|
446
|
+
children: me(n, !1)
|
|
447
|
+
}
|
|
448
|
+
),
|
|
449
|
+
a && l && /* @__PURE__ */ b(
|
|
450
|
+
"div",
|
|
451
|
+
{
|
|
452
|
+
id: y,
|
|
453
|
+
role: "menu",
|
|
454
|
+
"aria-label": n.submenuAriaLabel ?? (typeof n.label == "string" ? n.label : void 0),
|
|
455
|
+
className: Qe(l),
|
|
456
|
+
"data-menu-panel": "true",
|
|
457
|
+
"data-menu-panel-path": u,
|
|
458
|
+
"data-placement": (Z = oe[u]) == null ? void 0 : Z.placement,
|
|
459
|
+
"data-testid": c ? `${c}-submenu` : `${x}-${u}-submenu`,
|
|
460
|
+
style: (Ce = oe[u]) == null ? void 0 : Ce.style,
|
|
461
|
+
children: Ee(n.items ?? [], u)
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
]
|
|
465
|
+
},
|
|
466
|
+
n.id ?? u
|
|
467
|
+
);
|
|
468
|
+
});
|
|
469
|
+
return /* @__PURE__ */ K(
|
|
470
|
+
"div",
|
|
471
|
+
{
|
|
472
|
+
...S,
|
|
473
|
+
id: Be,
|
|
474
|
+
ref: se,
|
|
475
|
+
className: g(r.wrapper, He),
|
|
476
|
+
"data-testid": x,
|
|
477
|
+
onContextMenu: Ze,
|
|
478
|
+
onClick: Ke,
|
|
479
|
+
onKeyDown: nn,
|
|
480
|
+
children: [
|
|
481
|
+
Pe(),
|
|
482
|
+
p && /* @__PURE__ */ b(
|
|
483
|
+
"div",
|
|
484
|
+
{
|
|
485
|
+
ref: le,
|
|
486
|
+
className: g(r.target, Me),
|
|
487
|
+
tabIndex: te === "manual" ? void 0 : 0,
|
|
488
|
+
"data-testid": `${x}-target`,
|
|
489
|
+
children: p
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
f && /* @__PURE__ */ b(
|
|
493
|
+
"div",
|
|
494
|
+
{
|
|
495
|
+
...w,
|
|
496
|
+
id: z,
|
|
497
|
+
ref: $,
|
|
498
|
+
role: "menu",
|
|
499
|
+
"aria-label": _e ? void 0 : Fe,
|
|
500
|
+
"aria-labelledby": _e,
|
|
501
|
+
"aria-describedby": Ye,
|
|
502
|
+
className: Je,
|
|
503
|
+
"data-menu-panel": "true",
|
|
504
|
+
"data-menu-panel-path": B,
|
|
505
|
+
"data-testid": `${x}-menu`,
|
|
506
|
+
style: {
|
|
507
|
+
...ce == null ? void 0 : ce.style,
|
|
508
|
+
...w == null ? void 0 : w.style
|
|
509
|
+
},
|
|
510
|
+
children: Ee(o)
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
};
|
|
517
|
+
Re.displayName = "BaseMenu";
|
|
518
|
+
const yn = {
|
|
519
|
+
wrapper: "menu",
|
|
520
|
+
target: "menu_target",
|
|
521
|
+
trigger: "menu_trigger",
|
|
522
|
+
triggerPlain: "menu_triggerPlain",
|
|
523
|
+
menu: "menu_panel",
|
|
524
|
+
item: "menu_item",
|
|
525
|
+
itemWrapper: "menu_itemWrapper",
|
|
526
|
+
itemContent: "menu_itemContent",
|
|
527
|
+
icon: "menu_icon",
|
|
528
|
+
label: "menu_label",
|
|
529
|
+
shortcut: "menu_shortcut",
|
|
530
|
+
separator: "menu_separator",
|
|
531
|
+
sectionLabel: "menu_sectionLabel",
|
|
532
|
+
hasSubmenu: "menu_hasSubmenu",
|
|
533
|
+
submenu: "menu_submenu",
|
|
534
|
+
submenuOpen: "menu_submenu_open",
|
|
535
|
+
submenuTrigger: "menu_submenuTrigger",
|
|
536
|
+
submenuIndicator: "menu_submenuIndicator",
|
|
537
|
+
destructive: "menu_destructive",
|
|
538
|
+
inset: "menu_inset",
|
|
539
|
+
primary: "menu_primary",
|
|
540
|
+
secondary: "menu_secondary",
|
|
541
|
+
tertiary: "menu_tertiary",
|
|
542
|
+
quaternary: "menu_quaternary",
|
|
543
|
+
clear: "menu_clear",
|
|
544
|
+
success: "menu_success",
|
|
545
|
+
info: "menu_info",
|
|
546
|
+
error: "menu_error",
|
|
547
|
+
warning: "menu_warning",
|
|
548
|
+
disabled: "menu_disabled",
|
|
549
|
+
glass: "menu_glass",
|
|
550
|
+
shadowNone: "menu_shadow-None",
|
|
551
|
+
shadowLight: "menu_shadow-Light",
|
|
552
|
+
shadowMedium: "menu_shadow-Medium",
|
|
553
|
+
shadowStrong: "menu_shadow-Strong",
|
|
554
|
+
shadowIntense: "menu_shadow-Intense",
|
|
555
|
+
roundNone: "menu_round-None",
|
|
556
|
+
roundSmall: "menu_round-Small",
|
|
557
|
+
roundMedium: "menu_round-Medium",
|
|
558
|
+
roundLarge: "menu_round-Large"
|
|
559
|
+
}, pn = (o) => /* @__PURE__ */ b(Re, { ...o, classMap: un(yn) });
|
|
560
|
+
pn.displayName = "Menu";
|
|
561
|
+
export {
|
|
562
|
+
pn as M
|
|
563
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require('./Menu.css');const i=require("react/jsx-runtime"),nn=require("./propAliases-Bfsf5cJN.cjs"),s=require("react"),_=require("./classNames-C7V3kfBj.cjs"),K=require("./capitalize-CnTiekgk.cjs"),P=require("./styleConfig-BB8MdwYx.cjs"),M="root",m=8,tn=(o,x)=>o?`${o}.${x}`:`${x}`,an=o=>{const x=o.split(".");return x.length>1?x.slice(0,-1).join("."):null},Ee=o=>Array.isArray(o.items)&&o.items.length>0,de=(o,x)=>o===x||(o==null?void 0:o.startsWith(`${x}.`))===!0,$e=o=>o.getAttribute("aria-disabled")==="true"||o instanceof HTMLButtonElement&&o.disabled,Le=({items:o,children:x,trigger:C,open:me,defaultOpen:Te=!1,position:O,activation:ee=C?"click":"contextmenu",onOpenChange:B,onPositionChange:z,closeOnSelect:je=!0,focusFirstItemOnOpen:fe=!0,theme:ne=P.getDefaultTheme(),glass:te=P.getDefaultGlass(),rounding:T=P.getDefaultRounding(),shadow:j=P.getDefaultShadow(),state:A,className:Ae,targetClassName:De,triggerClassName:be,menuClassName:he,itemClassName:qe,id:We,menuId:ve,"aria-label":He="Context menu","aria-labelledby":ye,"aria-describedby":Me,"data-testid":Oe,testId:N=Oe??"menu",triggerProps:b,menuProps:w,onKeyDown:ae,classMap:u,...S})=>{const[Be,ze]=s.useState(Te),[Fe,Ye]=s.useState(O??{x:0,y:0}),[pe,D]=s.useState(null),[ue,xe]=s.useState({}),re=s.useRef(null),se=s.useRef(null),F=s.useRef(null),I=s.useRef(null),Xe=s.useId(),we=me!==void 0,h=me??Be,Y=ve??`${Xe}-menu`,X=O??Fe,oe=s.isValidElement(C),G=s.useCallback(e=>{we||ze(e),e||D(null),B==null||B(e)},[we,B]),_e=s.useCallback(e=>{O||Ye(e),z==null||z(e)},[z,O]),U=s.useCallback(e=>{_e(e),G(!0)},[_e,G]),q=s.useCallback(()=>{var e;G(!1),(e=F.current)==null||e.focus()},[G]),W=s.useCallback(e=>e?Array.from(e.querySelectorAll('[data-menu-item="true"]')).filter(t=>t.closest("[data-menu-panel]")===e&&!$e(t)):[],[]),V=s.useCallback((e,t)=>{var r;const n=W(e);if(n.length===0)return;const l=(t+n.length)%n.length;(r=n[l])==null||r.focus()},[W]),le=s.useCallback(e=>{var t;(t=W(e)[0])==null||t.focus()},[W]),E=s.useCallback(()=>{if(!h||!I.current){xe({});return}const e=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0,n=`${Math.max(120,t-m*2)}px`,l=`${Math.max(160,e-m*2)}px`,r=[I.current,...Array.from(I.current.querySelectorAll("[data-menu-panel]"))],y={};r.forEach(f=>{const a=f.dataset.menuPanelPath??M,c=f.getBoundingClientRect(),p={"--menu-panel-max-height":n,"--menu-panel-max-width":l};if(a===M){const H=Math.min(Math.max(m,X.x),Math.max(m,e-c.width-m)),Z=Math.min(Math.max(m,X.y),Math.max(m,t-c.height-m));p.left=`${Math.round(H)}px`,p.top=`${Math.round(Z)}px`,y[a]={style:p};return}const $=f.closest('[data-menu-item-wrapper="true"]'),g=$==null?void 0:$.getBoundingClientRect(),L=Math.max(c.width,f.offsetWidth,160),v=g?e-g.right-m:e-c.right-m,J=g?g.left-m:c.left-m,Q=v>=L||v>=J?"right":"left";let k=0;c.bottom>t-m&&(k-=c.bottom-(t-m)),c.top+k<m&&(k+=m-(c.top+k)),p["--menu-panel-offset-y"]=`${Math.round(k)}px`,y[a]={placement:Q,style:p}}),xe(y)},[h,X.x,X.y]);s.useLayoutEffect(()=>{h&&E()},[h,o,pe,E]),s.useEffect(()=>{if(h)return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[h,E]),s.useEffect(()=>{!h||!fe||le(I.current)},[fe,le,h]),s.useEffect(()=>{if(!h)return;const e=t=>{var n;(n=re.current)!=null&&n.contains(t.target)||q()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[q,h]);const Ge=s.useMemo(()=>_.combineClassNames(u.menu,u[ne],A&&u[A],te&&u.glass,j&&u[`shadow${K.capitalize(j)}`],T&&u[`round${K.capitalize(T)}`],he,w==null?void 0:w.className),[u,te,he,w==null?void 0:w.className,T,j,A,ne]),Ue=e=>_.combineClassNames(u.menu,u.submenu,e&&u.submenuOpen,u[ne],A&&u[A],te&&u.glass,j&&u[`shadow${K.capitalize(j)}`],T&&u[`round${K.capitalize(T)}`]),ie=ue[M],Ve=e=>{var t;(t=S.onContextMenu)==null||t.call(S,e),!(e.defaultPrevented||!["contextmenu","both"].includes(ee))&&(e.preventDefault(),U({x:e.clientX,y:e.clientY}))},Je=e=>{var l,r,y,f;if((l=S.onClick)==null||l.call(S,e),e.defaultPrevented||!["click","both"].includes(ee))return;const t=e.target;if((r=I.current)!=null&&r.contains(t)||(y=F.current)!=null&&y.contains(t))return;const n=(f=se.current)==null?void 0:f.getBoundingClientRect();U({x:(n==null?void 0:n.left)??e.clientX,y:(n==null?void 0:n.bottom)??e.clientY})},Ne=e=>{var n,l;if((n=b==null?void 0:b.onClick)==null||n.call(b,e),e.defaultPrevented)return;e.stopPropagation();const t=(l=F.current)==null?void 0:l.getBoundingClientRect();U({x:(t==null?void 0:t.left)??e.clientX,y:(t==null?void 0:t.bottom)??e.clientY})},ge=s.useCallback(e=>{if(F.current=e,!oe)return;const n=C.props.ref;typeof n=="function"?n(e):n&&"current"in n&&(n.current=e)},[oe,C]),Qe=()=>{if(!C)return null;if(oe){const e=C;return s.cloneElement(e,{ref:ge,className:_.combineClassNames(e.props.className,be,b==null?void 0:b.className),"aria-haspopup":"menu","aria-expanded":h,"aria-controls":Y,"data-testid":`${N}-trigger`,onClick:t=>{var n,l;(l=(n=e.props).onClick)==null||l.call(n,t),!t.defaultPrevented&&Ne(t)}})}return i.jsx("button",{...b,ref:ge,type:(b==null?void 0:b.type)??"button",className:_.combineClassNames(u.trigger,u.triggerPlain,be,b==null?void 0:b.className),"aria-haspopup":"menu","aria-expanded":h,"aria-controls":Y,"data-testid":`${N}-trigger`,onClick:e=>Ne(e),children:C})},ke=(e,t)=>{var n,l;e.stopPropagation(),!(t.disabled||Ee(t))&&((n=t.onSelect)==null||n.call(t,e),(l=t.onClick)==null||l.call(t),!e.defaultPrevented&&je&&q())},Ze=e=>{const t=()=>{const n=document.getElementById(e);n instanceof HTMLElement&&le(n)};window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t)},Ke=e=>{var y,f;if(ae==null||ae(e),e.defaultPrevented)return;if(!h&&(e.key==="ContextMenu"||e.shiftKey&&e.key==="F10")){e.preventDefault();const a=(y=se.current)==null?void 0:y.getBoundingClientRect();U({x:(a==null?void 0:a.left)??m,y:(a==null?void 0:a.bottom)??m});return}if(!h)return;const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=(t==null?void 0:t.closest("[data-menu-panel]"))??I.current,l=W(n),r=t?l.indexOf(t):-1;if(e.key==="Escape"){e.preventDefault(),q();return}if(e.key==="Tab"){q();return}if(e.key==="ArrowDown"){e.preventDefault(),V(n,r+1);return}if(e.key==="ArrowUp"){e.preventDefault(),V(n,r<0?l.length-1:r-1);return}if(e.key==="Home"){e.preventDefault(),V(n,0);return}if(e.key==="End"){e.preventDefault(),V(n,l.length-1);return}if(e.key==="ArrowRight"){const a=t==null?void 0:t.dataset.menuItemPath,c=t==null?void 0:t.getAttribute("aria-controls");(t==null?void 0:t.dataset.menuHasSubmenu)==="true"&&a&&c&&(e.preventDefault(),D(a),Ze(c));return}if(e.key==="ArrowLeft"){const a=n==null?void 0:n.dataset.menuPanelPath;if(a&&a!==M){e.preventDefault();const c=an(a);D(c);const p=(f=re.current)==null?void 0:f.querySelector(`[data-menu-item-path="${a}"][data-menu-item="true"]`);p==null||p.focus()}return}if(e.key==="Enter"||e.key===" "){const a=(t==null?void 0:t.dataset.menuItem)==="true"?t:null;if(!a||$e(a))return;e.preventDefault(),a.click()}},ce=(e,t)=>i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:u.itemContent,children:[e.icon&&i.jsx("span",{className:u.icon,"aria-hidden":"true",children:e.icon}),e.label&&i.jsx("span",{className:u.label,children:e.label})]}),e.shortcut&&i.jsx("span",{className:u.shortcut,"aria-hidden":"true",children:e.shortcut}),t&&i.jsx("span",{className:u.submenuIndicator,"aria-hidden":"true",children:">"})]}),Ce=(e,t="")=>e.map((n,l)=>{var Z,Se;const r=tn(t,l),y=n.type??"item",f=n["data-testid"]??n.testId;if(y==="separator")return i.jsx("div",{role:"separator",className:u.separator,"data-testid":f??`${N}-${r}-separator`},n.id??r);if(y==="label")return i.jsx("div",{role:"none",className:_.combineClassNames(u.sectionLabel,n.className),"data-testid":f??`${N}-${r}-label`,children:n.label},n.id??r);const a=Ee(n),c=a&&de(pe,r),p=n.submenuId??`${Y}-${r}-submenu`,$=n.role??"menuitem",g=(d=!0)=>{a&&!n.disabled&&D(R=>d&&R&&de(R,r)?R:r)},L=()=>g(!1),v=()=>{a||D(d=>d&&(t?de(d,t)?t:d:null))},J=()=>{if(a){g();return}v()},Q=()=>{g()},k=d=>{const R=d.target,Pe=d.currentTarget.closest("[data-menu-panel]"),Ie=R.closest("[data-menu-panel]"),en=R.closest('[data-menu-item-wrapper="true"]');Ie&&Ie!==Pe||en===d.currentTarget&&(a?L():v())},H={id:n.id,className:_.combineClassNames(u.item,n.destructive&&u.destructive,n.inset&&u.inset,a&&u.submenuTrigger,n.disabled&&u.disabled,qe,n.className),role:$,title:n.title,"aria-label":n["aria-label"],"aria-describedby":n["aria-describedby"],"aria-current":n["aria-current"],"aria-disabled":n.disabled||void 0,"aria-checked":$==="menuitemcheckbox"||$==="menuitemradio"?n.checked:void 0,"aria-haspopup":a?"menu":void 0,"aria-expanded":a?c:void 0,"aria-controls":a?p:void 0,"data-menu-item":"true","data-menu-item-path":r,"data-menu-has-submenu":a?"true":void 0,"data-testid":f};return i.jsxs("div",{className:_.combineClassNames(u.itemWrapper,a&&u.hasSubmenu),role:"group","data-menu-item-wrapper":"true","data-menu-item-path":r,onMouseEnter:J,onMouseOver:k,onPointerEnter:J,onPointerOver:k,children:[a?i.jsx("button",{type:"button",disabled:n.disabled,...H,onMouseEnter:Q,onMouseOver:L,onPointerEnter:Q,onPointerOver:L,onClick:d=>{d.stopPropagation(),L()},children:ce(n,!0)}):n.href?i.jsx("a",{href:n.disabled?void 0:n.href,target:n.disabled?void 0:n.target,rel:n.rel??(n.target==="_blank"?"noopener noreferrer":void 0),...H,onClick:d=>{if(d.stopPropagation(),n.disabled){d.preventDefault();return}ke(d,n)},children:ce(n,!1)}):i.jsx("button",{type:"button",disabled:n.disabled,...H,onClick:d=>ke(d,n),children:ce(n,!1)}),a&&c&&i.jsx("div",{id:p,role:"menu","aria-label":n.submenuAriaLabel??(typeof n.label=="string"?n.label:void 0),className:Ue(c),"data-menu-panel":"true","data-menu-panel-path":r,"data-placement":(Z=ue[r])==null?void 0:Z.placement,"data-testid":f?`${f}-submenu`:`${N}-${r}-submenu`,style:(Se=ue[r])==null?void 0:Se.style,children:Ce(n.items??[],r)})]},n.id??r)});return i.jsxs("div",{...S,id:We,ref:re,className:_.combineClassNames(u.wrapper,Ae),"data-testid":N,onContextMenu:Ve,onClick:Je,onKeyDown:Ke,children:[Qe(),x&&i.jsx("div",{ref:se,className:_.combineClassNames(u.target,De),tabIndex:ee==="manual"?void 0:0,"data-testid":`${N}-target`,children:x}),h&&i.jsx("div",{...w,id:Y,ref:I,role:"menu","aria-label":ye?void 0:He,"aria-labelledby":ye,"aria-describedby":Me,className:Ge,"data-menu-panel":"true","data-menu-panel-path":M,"data-testid":`${N}-menu`,style:{...ie==null?void 0:ie.style,...w==null?void 0:w.style},children:Ce(o)})]})};Le.displayName="BaseMenu";const un={wrapper:"menu",target:"menu_target",trigger:"menu_trigger",triggerPlain:"menu_triggerPlain",menu:"menu_panel",item:"menu_item",itemWrapper:"menu_itemWrapper",itemContent:"menu_itemContent",icon:"menu_icon",label:"menu_label",shortcut:"menu_shortcut",separator:"menu_separator",sectionLabel:"menu_sectionLabel",hasSubmenu:"menu_hasSubmenu",submenu:"menu_submenu",submenuOpen:"menu_submenu_open",submenuTrigger:"menu_submenuTrigger",submenuIndicator:"menu_submenuIndicator",destructive:"menu_destructive",inset:"menu_inset",primary:"menu_primary",secondary:"menu_secondary",tertiary:"menu_tertiary",quaternary:"menu_quaternary",clear:"menu_clear",success:"menu_success",info:"menu_info",error:"menu_error",warning:"menu_warning",disabled:"menu_disabled",glass:"menu_glass",shadowNone:"menu_shadow-None",shadowLight:"menu_shadow-Light",shadowMedium:"menu_shadow-Medium",shadowStrong:"menu_shadow-Strong",shadowIntense:"menu_shadow-Intense",roundNone:"menu_round-None",roundSmall:"menu_round-Small",roundMedium:"menu_round-Medium",roundLarge:"menu_round-Large"},Re=o=>i.jsx(Le,{...o,classMap:nn.expandClassMap(un)});Re.displayName="Menu";exports.Menu=Re;
|
package/dist/core/Menu.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Menu-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./Menu-CXmtgHBx.cjs");exports.default=e.Menu;
|
package/dist/core/Menu.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";@layer boreal-ui.reset,boreal-ui.base,boreal-ui.components,boreal-ui.overrides;@layer boreal-ui.components{.menu{position:relative;display:inline-block;max-width:100%;font-family:var(--font-family-ui)}.menu_target{min-width:0;max-width:100%;outline:none}.menu_target:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:2px;border-radius:var(--border-radius-sm)}.menu_trigger{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacing-xs);min-width:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.menu_trigger:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:2px}.menu_triggerPlain{padding:var(--spacing-sm) var(--spacing-md);border:1px solid var(--border-color);border-radius:var(--border-radius-md);background:var(--background-color-lighter);color:var(--text-color-primary);font-family:var(--font-family-ui);font-size:var(--font-size-label);line-height:var(--line-height-label);cursor:pointer;transition:background-color var(--transition-default),border-color var(--transition-default),box-shadow var(--transition-default)}.menu_triggerPlain:hover{background:var(--background-color-dark)}.
|
|
1
|
+
@charset "UTF-8";@layer boreal-ui.reset,boreal-ui.base,boreal-ui.components,boreal-ui.overrides;@layer boreal-ui.components{.menu{position:relative;display:inline-block;max-width:100%;font-family:var(--font-family-ui)}.menu_target{min-width:0;max-width:100%;outline:none}.menu_target:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:2px;border-radius:var(--border-radius-sm)}.menu_trigger{display:inline-flex;align-items:center;justify-content:center;gap:var(--spacing-xs);min-width:0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.menu_trigger:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:2px}.menu_triggerPlain{padding:var(--spacing-sm) var(--spacing-md);border:1px solid var(--border-color);border-radius:var(--border-radius-md);background:var(--background-color-lighter);color:var(--text-color-primary);font-family:var(--font-family-ui);font-size:var(--font-size-label);line-height:var(--line-height-label);cursor:pointer;transition:background-color var(--transition-default),border-color var(--transition-default),box-shadow var(--transition-default)}.menu_triggerPlain:hover{background:var(--background-color-dark)}.menu_panel{position:fixed;top:var(--spacing-sm);left:var(--spacing-sm);z-index:90;width:max-content;min-width:12rem;max-width:var(--menu-panel-max-width, calc(100vw - 1rem) );max-height:var(--menu-panel-max-height, calc(100vh - 1rem) );overflow:visible;padding:var(--spacing-xs) 0;border:1px solid var(--border-color);background:var(--background-color-lighter);color:var(--text-color-primary);font-family:var(--font-family-ui);font-size:var(--font-size-label);line-height:var(--line-height-label);box-shadow:var(--box-shadow-md);animation:fade-in .16s ease-in-out}.menu_panel:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:2px}.menu_panel.menu_primary{--menu-glass-bg: var(--primary-glass-background);--menu-glass-hover-bg: var(--primary-glass-background-hover);--menu-glass-border: var(--primary-glass-border);--menu-glass-text: var(--text-color-primary);--menu-item-hover-bg: var(--primary-color-hover);border-color:var(--primary-color)}.menu_panel.menu_secondary{--menu-glass-bg: var(--secondary-glass-background);--menu-glass-hover-bg: var(--secondary-glass-background-hover);--menu-glass-border: var(--secondary-glass-border);--menu-glass-text: var(--text-color-secondary);--menu-item-hover-bg: var(--secondary-color-hover);border-color:var(--secondary-color)}.menu_panel.menu_tertiary{--menu-glass-bg: var(--tertiary-glass-background);--menu-glass-hover-bg: var(--tertiary-glass-background-hover);--menu-glass-border: var(--tertiary-glass-border);--menu-glass-text: var(--text-color-tertiary);--menu-item-hover-bg: var(--tertiary-color-hover);border-color:var(--tertiary-color)}.menu_panel.menu_quaternary{--menu-glass-bg: var(--quaternary-glass-background);--menu-glass-hover-bg: var(--quaternary-glass-background-hover);--menu-glass-border: var(--quaternary-glass-border);--menu-glass-text: var(--text-color-quaternary);--menu-item-hover-bg: var(--quaternary-color-hover);border-color:var(--quaternary-color)}.menu_panel.menu_clear{--menu-glass-bg: var(--clear-glass-background);--menu-glass-hover-bg: var(--clear-glass-background-hover);--menu-glass-border: var(--clear-glass-border);--menu-glass-text: var(--text-color);--menu-item-hover-bg: rgba(0, 0, 0, .2);border-color:var(--border-color)}.menu_panel.menu_success{--menu-glass-bg: var(--success-glass-background);--menu-glass-hover-bg: var(--success-glass-background-hover);--menu-glass-border: var(--success-glass-border);--menu-glass-text: var(--success-text-color);--menu-item-hover-bg: var(--success-color-hover);border-color:var(--success-color)}.menu_panel.menu_error{--menu-glass-bg: var(--error-glass-background);--menu-glass-hover-bg: var(--error-glass-background-hover);--menu-glass-border: var(--error-glass-border);--menu-glass-text: var(--error-text-color);--menu-item-hover-bg: var(--error-color-hover);border-color:var(--error-color)}.menu_panel.menu_warning{--menu-glass-bg: var(--warning-glass-background);--menu-glass-hover-bg: var(--warning-glass-background-hover);--menu-glass-border: var(--warning-glass-border);--menu-glass-text: var(--warning-text-color);--menu-item-hover-bg: var(--warning-color-hover);border-color:var(--warning-color)}.menu_panel.menu_info{--menu-glass-bg: var(--info-glass-background);--menu-glass-hover-bg: var(--info-glass-background-hover);--menu-glass-border: var(--info-glass-border);--menu-glass-text: var(--info-text-color);--menu-item-hover-bg: var(--info-color-hover);border-color:var(--info-color)}.menu_panel.menu_clear{--menu-item-hover-text: var(--text-color-primary);color:var(--text-color)}.menu_panel.menu_glass{background:var(--menu-glass-bg, rgba(255, 255, 255, .18));border:1px solid var(--menu-glass-border, rgba(255, 255, 255, .34));-webkit-backdrop-filter:blur(16px) saturate(var(--glass-saturate));backdrop-filter:blur(16px) saturate(var(--glass-saturate))}.menu_itemWrapper{position:relative;min-width:100%}.menu_item{display:flex;align-items:center;justify-content:flex-start;gap:var(--spacing-sm);width:100%;min-width:0;padding:var(--spacing-sm) var(--spacing-md);border:0;background:transparent;color:var(--text-color);font-family:var(--font-family-ui);font-size:var(--font-size-label);font-weight:var(--font-weight-label);line-height:var(--line-height-label);text-align:left;text-decoration:none;cursor:pointer;transition:background-color var(--transition-default),color var(--transition-default)}.menu_item:hover,.menu_item:focus{background:var(--menu-item-hover-bg, var(--background-color-dark));outline:none}.menu_item:focus-visible{outline:2px solid var(--focus-outline-color, var(--primary-color));outline-offset:-2px}.menu_item[aria-disabled=true],.menu_item.menu_disabled{opacity:.58;cursor:not-allowed;pointer-events:none}.menu_itemContent{display:inline-flex;align-items:center;gap:var(--spacing-sm);min-width:0;flex:1 1 auto;overflow-wrap:anywhere}.menu_icon{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}.menu_label{min-width:0;overflow-wrap:anywhere}.menu_shortcut{flex:0 0 auto;margin-left:var(--spacing-md);color:var(--text-color-secondary);font-size:var(--font-size-caption);white-space:nowrap}.menu_separator{height:1px;margin:var(--spacing-xs) var(--spacing-sm);background:var(--border-color)}.menu_sectionLabel{padding:var(--spacing-xs) var(--spacing-md);color:var(--text-color-primary);font-size:var(--font-size-caption);font-weight:var(--font-weight-heading);line-height:var(--line-height-caption);overflow-wrap:anywhere}.menu_submenuTrigger{justify-content:space-between}.menu_submenuIndicator{flex:0 0 auto;margin-left:auto;padding-left:var(--spacing-sm);line-height:1}.menu_submenu{position:absolute;top:var(--menu-panel-offset-y, 0);left:100%;min-width:max(100%,12rem);margin-left:var(--spacing-xs)}.menu_submenu[data-placement=left]{right:100%;left:auto;margin-right:var(--spacing-xs);margin-left:0}.menu_submenu_open,.menu_hasSubmenu{min-width:100%}.menu_destructive{color:var(--danger-color, var(--error-color))}.menu_inset .menu_itemContent{padding-left:calc(var(--spacing-md) + var(--spacing-sm))}.menu_panel.menu_glass .menu_item:hover,.menu_panel.menu_glass .menu_item:focus{background:var(--menu-glass-hover-bg, rgba(255, 255, 255, .24))}.menu_panel.menu_clear .menu_label{color:var(--text-color)}.menu_panel.menu_clear .menu_item:hover{background-color:var(--background-color-dark)}.menu_round-None{border-radius:var(--border-radius-none)}.menu_round-Small{border-radius:var(--border-radius-sm)}.menu_round-Medium{border-radius:var(--border-radius-md)}.menu_round-Large{border-radius:var(--border-radius-lg)}.menu_round-Full{border-radius:var(--border-radius-full)}.menu_shadow-None{box-shadow:var(--box-shadow-none)}.menu_shadow-Light{box-shadow:var(--box-shadow-light)}.menu_shadow-Medium{box-shadow:var(--box-shadow-medium)}.menu_shadow-Strong{box-shadow:var(--box-shadow-heavy)}.menu_shadow-Intense{box-shadow:var(--box-shadow-intense)}@media(max-width:479.98px){.menu_panel{min-width:min(16rem,100vw - 1rem);max-height:min(50vh,var(--menu-panel-max-height, 50vh));padding-bottom:calc(env(safe-area-inset-bottom,0px) + var(--spacing-sm))}.menu_item{padding:var(--spacing-md)}.menu_submenu{position:static;width:100%;min-width:100%;margin:var(--spacing-xxs) 0 0;box-shadow:none}}@media(prefers-reduced-motion:reduce){.menu_panel,.menu_item{transition:none!important;animation:none!important}}@media(forced-colors:active){.menu_panel,.menu_panel.menu_glass{background:Canvas;color:CanvasText;border-color:ButtonText;-webkit-backdrop-filter:none;backdrop-filter:none}.menu_item:focus-visible{outline:2px solid Highlight}}}
|
package/dist/core/Menu.js
CHANGED