@blakesteve/roster 5.8.0 → 5.10.0

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.
Files changed (44) hide show
  1. package/README.md +126 -23
  2. package/dist/components/atoms/Button/button-variants.js +1 -1
  3. package/dist/components/atoms/Eyebrow/eyebrow-variants.d.ts +2 -2
  4. package/dist/components/atoms/Input/input-variants.js +1 -1
  5. package/dist/components/atoms/Skeleton/Skeleton.cjs +1 -1
  6. package/dist/components/atoms/Skeleton/Skeleton.d.ts +19 -3
  7. package/dist/components/atoms/Skeleton/Skeleton.js +38 -33
  8. package/dist/components/atoms/ThemeToggle/ThemeToggle.d.ts +1 -1
  9. package/dist/components/molecules/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  10. package/dist/components/molecules/CheckboxGroup/checkbox-group-variants.d.ts +1 -1
  11. package/dist/components/molecules/Menu/Menu.cjs +1 -0
  12. package/dist/components/molecules/Menu/Menu.d.ts +169 -0
  13. package/dist/components/molecules/Menu/Menu.js +577 -0
  14. package/dist/components/molecules/Menu/menu-typeahead.cjs +1 -0
  15. package/dist/components/molecules/Menu/menu-typeahead.d.ts +7 -0
  16. package/dist/components/molecules/Menu/menu-typeahead.js +13 -0
  17. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
  18. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +13 -4
  19. package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +35 -35
  20. package/dist/components/molecules/Toast/Toaster.d.ts +1 -1
  21. package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
  22. package/dist/components/organisms/Navbar/Navbar.d.ts +1 -1
  23. package/dist/components/organisms/Navbar/Navbar.js +275 -302
  24. package/dist/index.d.ts +1 -0
  25. package/dist/lib/utils.cjs +1 -1
  26. package/dist/lib/utils.js +4 -1
  27. package/dist/meta.json +3 -3
  28. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +7 -7
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
  30. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +5 -5
  31. package/dist/node_modules/@headlessui/react/dist/components/portal/portal.js +6 -6
  32. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.cjs +1 -1
  33. package/dist/node_modules/@headlessui/react/dist/utils/focus-management.js +52 -61
  34. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +6 -6
  35. package/dist/roster.cjs +1 -1
  36. package/dist/roster.css +1 -1
  37. package/dist/roster.js +127 -116
  38. package/package.json +2 -1
  39. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.cjs +0 -1
  40. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.js +0 -21
  41. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.cjs +0 -1
  42. package/dist/node_modules/@headlessui/react/dist/components/menu/menu-machine.js +0 -120
  43. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.cjs +0 -1
  44. package/dist/node_modules/@headlessui/react/dist/components/menu/menu.js +0 -197
@@ -0,0 +1,577 @@
1
+ "use client";
2
+ import { jsx as c, jsxs as N, Fragment as j } from "react/jsx-runtime";
3
+ import * as i from "react";
4
+ import { Portal as q } from "../../../node_modules/@headlessui/react/dist/components/portal/portal.js";
5
+ import { useFloating as ge, offset as he, flip as be, shift as ye, size as ve } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
6
+ import { cn as E } from "../../../lib/utils.js";
7
+ import { POPUP_PANEL as we } from "../../../internal/popup.js";
8
+ import { Button as xe } from "../../atoms/Button/Button.js";
9
+ import { nextByTypeahead as ke } from "./menu-typeahead.js";
10
+ import { autoUpdate as Ie } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
11
+ function Ee({ href: e, to: r, children: n, ...s }) {
12
+ return /* @__PURE__ */ c("a", { href: e, ...s, children: n });
13
+ }
14
+ const G = i.createContext(null), B = i.createContext(null), Y = i.createContext(null);
15
+ function C(e) {
16
+ const r = i.useContext(G);
17
+ if (!r) throw new Error(`<${e}> must be inside a <Menu>.`);
18
+ return r;
19
+ }
20
+ function _(e) {
21
+ const r = i.useContext(B);
22
+ if (!r) throw new Error(`<${e}> must be inside <MenuItems> or a <MenuSubmenu>.`);
23
+ return r;
24
+ }
25
+ const Se = "[data-menu-item]", X = 100, Pe = 75, Me = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])';
26
+ function L(e) {
27
+ return e ? [...e.querySelectorAll(Se)].filter((r) => r.closest("[data-menu-panel]") === e) : [];
28
+ }
29
+ function S(e) {
30
+ e && (e.focus({ preventScroll: !0 }), e.scrollIntoView?.({ block: "nearest" }));
31
+ }
32
+ function z(e) {
33
+ return !!e && getComputedStyle(e).direction === "rtl";
34
+ }
35
+ function Te(e, r) {
36
+ const n = [...document.querySelectorAll(Me)].filter(
37
+ (t) => t === e || t.tabIndex >= 0 && !t.matches(":disabled") && !t.closest("[data-menu-panel], [inert]") && t.getClientRects().length > 0 && getComputedStyle(t).visibility !== "hidden" && !Ae(t, r)
38
+ ), s = n.indexOf(e);
39
+ ((r ? n[s - 1] : n[s + 1]) ?? e).focus();
40
+ }
41
+ function Ae(e, r) {
42
+ if (!(e instanceof HTMLInputElement) || e.type !== "radio" || !e.name) return !1;
43
+ const n = [...e.ownerDocument.querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)].filter(
44
+ (a) => a.form === e.form && !a.disabled
45
+ );
46
+ return (n.find((a) => a.checked) ?? (r ? n[n.length - 1] : n[0])) !== e;
47
+ }
48
+ const D = { x: Number.NaN, y: Number.NaN };
49
+ let U = !1;
50
+ function Ce() {
51
+ U || typeof window > "u" || (U = !0, window.addEventListener(
52
+ "pointermove",
53
+ (e) => {
54
+ D.x = e.clientX, D.y = e.clientY;
55
+ },
56
+ { passive: !0 }
57
+ ));
58
+ }
59
+ function J(e) {
60
+ return !Number.isNaN(D.x) && (e.clientX !== D.x || e.clientY !== D.y);
61
+ }
62
+ const V = (e) => `radial-gradient(farthest-side at 50% ${e === "top" ? "0" : "100%"}, var(--menu-edge), transparent)`, Q = {
63
+ backgroundImage: "var(--menu-edge-top, none), var(--menu-edge-bottom, none)",
64
+ backgroundPosition: "top, bottom",
65
+ backgroundSize: "100% 0.5rem",
66
+ backgroundRepeat: "no-repeat"
67
+ };
68
+ function Re(e) {
69
+ i.useLayoutEffect(() => {
70
+ if (!e) return;
71
+ const r = () => {
72
+ const s = e.scrollTop > 8, a = e.scrollTop + e.clientHeight < e.scrollHeight - 8;
73
+ e.toggleAttribute("data-more-above", s), e.toggleAttribute("data-more-below", a), e.style.setProperty("--menu-edge-top", s ? V("top") : "none"), e.style.setProperty("--menu-edge-bottom", a ? V("bottom") : "none");
74
+ };
75
+ r(), e.addEventListener("scroll", r, { passive: !0 });
76
+ const n = typeof ResizeObserver > "u" ? null : new ResizeObserver(r);
77
+ return n?.observe(e), () => {
78
+ e.removeEventListener("scroll", r), n?.disconnect();
79
+ };
80
+ }, [e]);
81
+ }
82
+ function Z(e, r) {
83
+ const [n, s] = e.split("-"), a = r ? "right" : "left", t = r ? "left" : "right";
84
+ return n === "top" || n === "bottom" ? `${n === "bottom" ? "top" : "bottom"} ${s === "end" ? t : s === "start" ? a : "center"}` : `${s === "end" ? "bottom" : "top"} ${n === "right" ? "left" : "right"}`;
85
+ }
86
+ const ee = /* @__PURE__ */ E(
87
+ "rst:font-ui",
88
+ we,
89
+ /* Its own width wherever it lands: a fixed panel sized by the room to its
90
+ right resizes as it's placed, and the placement runs again. */
91
+ "rst:w-max rst:min-w-48 rst:max-w-[min(20rem,calc(100vw-1rem))] rst:overflow-y-auto rst:overscroll-contain rst:custom-scrollbar",
92
+ /* The scroll shadows' color: stronger on a dark panel, where a faint one vanishes. */
93
+ "rst:[--menu-edge:rgb(0_0_0/0.18)] rst:dark:[--menu-edge:rgb(0_0_0/0.6)]",
94
+ /* The entrance: a fade and a slight grow from the corner nearest the
95
+ button. Leaving is quicker. Neither moves under reduced motion. Opacity
96
+ and scale only: a transition on the position would fly the panel in
97
+ from the corner of the screen. */
98
+ "rst:transition-[opacity,scale] rst:duration-100 rst:ease-out rst:data-closed:opacity-0 rst:data-closed:scale-95 rst:data-leaving:duration-75 rst:data-leaving:ease-in rst:data-closed:pointer-events-none rst:motion-reduce:transition-none"
99
+ );
100
+ function te(e) {
101
+ const [r, n] = i.useState(e), [s, a] = i.useState(!0);
102
+ return i.useLayoutEffect(() => {
103
+ if (e) {
104
+ n(!0);
105
+ const o = requestAnimationFrame(() => a(!1));
106
+ return () => cancelAnimationFrame(o);
107
+ }
108
+ a(!0);
109
+ const t = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, d = window.setTimeout(() => n(!1), t ? 0 : Pe);
110
+ return () => window.clearTimeout(d);
111
+ }, [e]), { mounted: r, closed: s, leaving: r && !e };
112
+ }
113
+ function re(e, r, n, s, a, t = !1) {
114
+ const [d, o] = i.useState(null), u = ge({
115
+ open: r,
116
+ strategy: "fixed",
117
+ /* Placed by top and left, not a transform: the entrance's scale would
118
+ scale a transform's translation too, and slide the panel in. */
119
+ transform: !1,
120
+ placement: n,
121
+ elements: { reference: e },
122
+ whileElementsMounted: Ie,
123
+ middleware: [
124
+ he(s),
125
+ be({ padding: 8 }),
126
+ ye({ padding: 8, crossAxis: t }),
127
+ ve({
128
+ padding: 8,
129
+ apply({ availableHeight: m, elements: l }) {
130
+ l.floating.style.maxHeight = `min(var(--anchor-max-height, 100vh), ${Math.max(m, 96)}px)`;
131
+ }
132
+ })
133
+ ]
134
+ }), { setFloating: p } = u.refs, f = i.useCallback(
135
+ (m) => {
136
+ a.current = m, o(m), p(m);
137
+ },
138
+ [a, p]
139
+ );
140
+ return Re(d), { ...u, setPanel: f, panelEl: d };
141
+ }
142
+ const ne = 500;
143
+ function oe() {
144
+ const e = i.useRef({ text: "", at: 0 }), r = i.useCallback(() => e.current.text !== "" && performance.now() - e.current.at <= ne, []);
145
+ return { typedRef: e, typingAhead: r };
146
+ }
147
+ function se({
148
+ panelRef: e,
149
+ typedRef: r,
150
+ onEscape: n,
151
+ onBack: s
152
+ }) {
153
+ const a = C("MenuItems");
154
+ return (t) => {
155
+ const d = e.current;
156
+ if (!d || !d.contains(t.target) || (!t.ctrlKey && !t.metaKey && !t.altKey && t.stopPropagation(), t.defaultPrevented)) return;
157
+ const o = L(d), u = o.indexOf(document.activeElement), p = z(d);
158
+ switch (t.key) {
159
+ case "ArrowDown":
160
+ t.preventDefault(), t.stopPropagation(), S(o[(u + 1) % o.length]);
161
+ return;
162
+ case "ArrowUp":
163
+ t.preventDefault(), t.stopPropagation(), S(o[u <= 0 ? o.length - 1 : u - 1]);
164
+ return;
165
+ case "Home":
166
+ case "PageUp":
167
+ t.preventDefault(), t.stopPropagation(), S(o[0]);
168
+ return;
169
+ case "End":
170
+ case "PageDown":
171
+ t.preventDefault(), t.stopPropagation(), S(o[o.length - 1]);
172
+ return;
173
+ case "Escape":
174
+ t.preventDefault(), t.stopPropagation(), n();
175
+ return;
176
+ case "Tab": {
177
+ t.preventDefault(), t.stopPropagation();
178
+ const f = a.triggerRef.current;
179
+ a.close(!1), f && Te(f, t.shiftKey);
180
+ return;
181
+ }
182
+ case "ArrowLeft":
183
+ case "ArrowRight":
184
+ s && t.key === (p ? "ArrowRight" : "ArrowLeft") && (t.preventDefault(), t.stopPropagation(), s());
185
+ return;
186
+ }
187
+ if (t.key.length === 1 && !t.ctrlKey && !t.metaKey && !t.altKey) {
188
+ const f = performance.now(), m = r.current.text !== "" && f - r.current.at <= ne;
189
+ if (t.key === " " && !m) return;
190
+ t.preventDefault(), r.current = { text: m ? r.current.text + t.key : t.key, at: f };
191
+ const l = o.map((x) => x.dataset.menuText ?? x.textContent ?? ""), b = ke(l, u, r.current.text);
192
+ b !== -1 && S(o[b]);
193
+ }
194
+ };
195
+ }
196
+ function Ue({ children: e, open: r, onOpenChange: n, linkComponent: s = Ee }) {
197
+ const [a, t] = i.useState(!1), d = r ?? a, o = i.useId(), u = i.useRef(null), [p, f] = i.useState(null), m = i.useCallback((g) => {
198
+ u.current = g, f(g);
199
+ }, []), l = i.useRef("panel"), b = i.useCallback(
200
+ (g) => {
201
+ r === void 0 && t(g), n?.(g);
202
+ },
203
+ [r, n]
204
+ ), x = i.useMemo(
205
+ () => ({
206
+ treeId: o,
207
+ open: d,
208
+ openWith: (g) => {
209
+ l.current = g, b(!0);
210
+ },
211
+ close: (g) => {
212
+ b(!1), g && u.current?.focus();
213
+ },
214
+ triggerRef: u,
215
+ triggerEl: p,
216
+ registerTrigger: m,
217
+ triggerId: `${o}-button`,
218
+ panelId: `${o}-menu`,
219
+ focusOnOpen: l,
220
+ linkComponent: s
221
+ }),
222
+ [o, d, b, s, p, m]
223
+ );
224
+ return i.useEffect(() => {
225
+ if (!d) return;
226
+ Ce();
227
+ const g = (I) => {
228
+ I.target?.closest?.(`[data-menu-tree="${o}"]`) || (b(!1), requestAnimationFrame(() => {
229
+ (document.activeElement === document.body || !document.activeElement) && u.current?.focus({ preventScroll: !0 });
230
+ }));
231
+ };
232
+ return document.addEventListener("pointerdown", g, !0), () => document.removeEventListener("pointerdown", g, !0);
233
+ }, [d, o, b]), /* @__PURE__ */ c(G.Provider, { value: x, children: e });
234
+ }
235
+ const Ve = i.forwardRef(function({ plain: r = !1, className: n, onClick: s, onKeyDown: a, children: t, ...d }, o) {
236
+ const { variant: u, colorScheme: p, size: f, isLoading: m, loadingLabel: l, startIcon: b, endIcon: x, surface: g, ...I } = d, h = C("MenuButton"), { registerTrigger: P } = h, M = i.useCallback(
237
+ (y) => {
238
+ P(y), typeof o == "function" ? o(y) : o && (o.current = y);
239
+ },
240
+ [P, o]
241
+ ), T = {
242
+ id: h.triggerId,
243
+ "aria-haspopup": "menu",
244
+ "aria-expanded": h.open,
245
+ "aria-controls": h.open ? h.panelId : void 0,
246
+ "data-menu-tree": h.treeId,
247
+ onClick: (y) => {
248
+ s?.(y), !y.defaultPrevented && (h.open ? h.close(!1) : h.openWith("panel"));
249
+ },
250
+ onKeyDown: (y) => {
251
+ if (a?.(y), y.defaultPrevented) return;
252
+ const v = y.key === "Enter" || y.key === " " || y.key === "ArrowDown" ? "first" : y.key === "ArrowUp" ? "last" : null;
253
+ if (!v) return;
254
+ y.preventDefault();
255
+ const k = h.open ? document.getElementById(h.panelId) : null;
256
+ if (k) {
257
+ const R = L(k);
258
+ S(v === "last" ? R[R.length - 1] : R[0]);
259
+ return;
260
+ }
261
+ h.openWith(v);
262
+ }
263
+ };
264
+ return r ? /* @__PURE__ */ c("button", { ref: M, type: "button", className: n, ...I, ...T, children: t }) : (
265
+ /* min 44 by 44 whatever the size: the target a finger needs. */
266
+ /* @__PURE__ */ c(
267
+ xe,
268
+ {
269
+ ref: M,
270
+ className: E("rst:min-h-11 rst:min-w-11", n),
271
+ variant: u,
272
+ colorScheme: p,
273
+ size: f,
274
+ isLoading: m,
275
+ loadingLabel: l,
276
+ startIcon: b,
277
+ endIcon: x,
278
+ surface: g,
279
+ ...I,
280
+ ...T,
281
+ children: t
282
+ }
283
+ )
284
+ );
285
+ });
286
+ function je({ children: e, align: r = "start", offset: n = 4, className: s, ...a }) {
287
+ const t = C("MenuItems"), { mounted: d, closed: o, leaving: u } = te(t.open), p = i.useRef(null), f = z(t.triggerEl), { setPanel: m, panelEl: l, floatingStyles: b, placement: x, isPositioned: g } = re(t.triggerEl, d, `bottom-${r}`, n, p), I = ae(), { typedRef: h, typingAhead: P } = oe(), M = se({ panelRef: p, typedRef: h, onEscape: () => t.close(!0) });
288
+ i.useLayoutEffect(() => {
289
+ if (!t.open || !l) return;
290
+ const v = L(l), k = t.focusOnOpen.current;
291
+ k === "first" && v[0] ? S(v[0]) : k === "last" && v.length ? S(v[v.length - 1]) : l.focus({ preventScroll: !0 });
292
+ }, [t.open, l, t.focusOnOpen]), i.useLayoutEffect(() => {
293
+ if (!g || !l) return;
294
+ const v = document.activeElement;
295
+ v && v !== l && l.contains(v) && v.scrollIntoView?.({ block: "nearest" });
296
+ }, [g, l]), i.useLayoutEffect(() => {
297
+ !t.open && l?.contains(document.activeElement) && t.triggerRef.current?.focus({ preventScroll: !0 });
298
+ }, [t.open, l, t.triggerRef]);
299
+ const T = (v) => {
300
+ const k = v.relatedTarget;
301
+ k && !k.closest(`[data-menu-tree="${t.treeId}"]`) && t.close(!1);
302
+ };
303
+ if (!d) return null;
304
+ const y = !!t.triggerEl?.closest(".dark");
305
+ return /* @__PURE__ */ c(q, { children: /* @__PURE__ */ c(B.Provider, { value: { ...I, panelRef: p, typingAhead: P }, children: /* @__PURE__ */ c(
306
+ "div",
307
+ {
308
+ ref: m,
309
+ id: t.panelId,
310
+ dir: f ? "rtl" : "ltr",
311
+ role: "menu",
312
+ "aria-labelledby": a["aria-label"] ? void 0 : t.triggerId,
313
+ "aria-label": a["aria-label"],
314
+ tabIndex: -1,
315
+ "data-menu-panel": "",
316
+ "data-menu-tree": t.treeId,
317
+ "data-closed": o ? "" : void 0,
318
+ "data-leaving": u ? "" : void 0,
319
+ onKeyDown: M,
320
+ onBlur: T,
321
+ style: { ...b, ...Q, transformOrigin: Z(x, f) },
322
+ className: E(y && "dark", ee, s),
323
+ children: e
324
+ }
325
+ ) }) });
326
+ }
327
+ function ae() {
328
+ const [e, r] = i.useState(null), n = i.useRef(!1), s = i.useRef(void 0);
329
+ return i.useEffect(() => () => window.clearTimeout(s.current), []), {
330
+ openSubmenu: e,
331
+ focusFirstInSubmenu: n,
332
+ setOpenSubmenu: (a, t = !1) => {
333
+ window.clearTimeout(s.current), n.current = t, r(a);
334
+ },
335
+ hoverItem: (a) => {
336
+ window.clearTimeout(s.current), a === null && (s.current = window.setTimeout(() => r(null), X));
337
+ }
338
+ };
339
+ }
340
+ const O = /* @__PURE__ */ E(
341
+ /* A button or a link reset to a row: no border, no fill, the panel's type. */
342
+ "rst:relative rst:flex rst:w-full rst:min-h-11 rst:items-center rst:gap-2.5 rst:border-0 rst:bg-transparent rst:px-3 rst:py-2 rst:text-start rst:text-sm rst:text-inherit rst:no-underline rst:[font-family:inherit] rst:cursor-pointer rst:select-none rst:outline-none rst:transition-colors",
343
+ /* Focus follows the pointer, so the highlight is focus. In forced colors a
344
+ fill is dropped, so focus draws an outline there instead. */
345
+ "rst:focus:bg-primary-100 rst:focus:text-primary-900 rst:dark:focus:bg-primary-900/30 rst:dark:focus:text-primary-100 rst:forced-colors:focus:outline-solid rst:forced-colors:focus:outline-2 rst:forced-colors:focus:-outline-offset-2",
346
+ "rst:aria-disabled:opacity-50 rst:aria-disabled:cursor-not-allowed"
347
+ ), H = "rst:text-error-600 rst:dark:text-error-400 rst:focus:bg-error-50 rst:focus:text-error-700 rst:dark:focus:bg-error-900/30 rst:dark:focus:text-error-300", De = () => /* @__PURE__ */ c("svg", { viewBox: "0 0 16 16", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ c("path", { d: "M3.5 8.5 6.5 11.5 12.5 4.5" }) }), Le = () => /* @__PURE__ */ c("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: /* @__PURE__ */ c("circle", { cx: "8", cy: "8", r: "3.5", fill: "currentColor" }) }), Ne = () => /* @__PURE__ */ c("svg", { viewBox: "0 0 16 16", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", className: "rst:rtl:rotate-180", children: /* @__PURE__ */ c("path", { d: "M6 3.5 10.5 8 6 12.5" }) });
348
+ function A({ icon: e, shortcut: r, description: n, badge: s, children: a }, t, d, o) {
349
+ const u = t ?? e;
350
+ return /* @__PURE__ */ N(j, { children: [
351
+ u != null && /* With a description, the icon lines up with the label, not the middle of both lines. */
352
+ /* @__PURE__ */ c("span", { "aria-hidden": "true", className: E("rst:flex rst:size-4 rst:shrink-0 rst:items-center rst:justify-center", n != null && "rst:self-start rst:mt-0.5"), "data-menu-lead": "", children: u }),
353
+ /* @__PURE__ */ N("span", { className: "rst:min-w-0 rst:flex-1 rst:break-words", "data-menu-label": "", children: [
354
+ a,
355
+ n != null && /* @__PURE__ */ c("span", { id: o, "aria-hidden": "true", className: "rst:block rst:text-xs rst:opacity-75", "data-menu-description": "", children: n })
356
+ ] }),
357
+ s != null && /* @__PURE__ */ c("span", { className: "rst:flex rst:shrink-0 rst:items-center", "data-menu-badge": "", children: s }),
358
+ r && /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "rst:ms-auto rst:shrink-0 rst:ps-4 rst:text-xs rst:tracking-wide rst:opacity-70", "data-menu-shortcut": "", children: r }),
359
+ d
360
+ ] });
361
+ }
362
+ function F({
363
+ disabled: e,
364
+ closeOnSelect: r,
365
+ onChoose: n,
366
+ spaceKeepsOpen: s
367
+ }) {
368
+ const a = C("MenuItem"), t = _("MenuItem"), d = (o, u) => {
369
+ if (e) {
370
+ o.preventDefault();
371
+ return;
372
+ }
373
+ n(o), u && a.close(!0);
374
+ };
375
+ return {
376
+ onClick: (o) => d(o, r),
377
+ onKeyDown: (o) => {
378
+ if (o.key === " ") {
379
+ if (t.typingAhead()) return;
380
+ o.preventDefault(), d(o, r && !s);
381
+ }
382
+ },
383
+ onPointerMove: (o) => {
384
+ J(o) && (t.hoverItem(null), document.activeElement !== o.currentTarget && o.currentTarget.focus({ preventScroll: !0 }));
385
+ }
386
+ };
387
+ }
388
+ function qe({ onSelect: e, href: r, closeOnSelect: n = !0, disabled: s, destructive: a, keyshortcuts: t, textValue: d, className: o, ...u }) {
389
+ const p = C("MenuItem"), f = _("MenuItem"), m = i.useId(), l = F({ disabled: s, closeOnSelect: n, onChoose: (g) => e?.(g) }), b = E(O, a && H, o), x = {
390
+ role: "menuitem",
391
+ tabIndex: -1,
392
+ "aria-disabled": s ? !0 : void 0,
393
+ "aria-keyshortcuts": t,
394
+ "aria-describedby": u.description != null ? m : void 0,
395
+ "data-menu-item": "",
396
+ "data-menu-text": d,
397
+ "data-destructive": a ? "" : void 0
398
+ };
399
+ if (r !== void 0) {
400
+ const g = p.linkComponent;
401
+ return /* @__PURE__ */ c(
402
+ g,
403
+ {
404
+ href: r,
405
+ to: r,
406
+ className: b,
407
+ ...x,
408
+ onClick: l.onClick,
409
+ onPointerMove: l.onPointerMove,
410
+ onKeyDown: (I) => {
411
+ if (I.key === " ") {
412
+ if (f.typingAhead()) return;
413
+ I.preventDefault(), s || I.currentTarget.click();
414
+ }
415
+ },
416
+ children: A(u, void 0, void 0, m)
417
+ }
418
+ );
419
+ }
420
+ return /* @__PURE__ */ c("button", { type: "button", className: b, ...x, ...l, children: A(u, void 0, void 0, m) });
421
+ }
422
+ function Ge({ checked: e, onCheckedChange: r, indicator: n, closeOnSelect: s = !0, disabled: a, destructive: t, keyshortcuts: d, textValue: o, className: u, ...p }) {
423
+ const f = F({ disabled: a, closeOnSelect: s, spaceKeepsOpen: !0, onChoose: () => r(!e) }), m = i.useId();
424
+ return /* @__PURE__ */ c(
425
+ "button",
426
+ {
427
+ type: "button",
428
+ role: "menuitemcheckbox",
429
+ "aria-checked": e,
430
+ "aria-describedby": p.description != null ? m : void 0,
431
+ tabIndex: -1,
432
+ "aria-disabled": a || void 0,
433
+ "aria-keyshortcuts": d,
434
+ "data-menu-item": "",
435
+ "data-menu-text": o,
436
+ className: E(O, t && H, u),
437
+ ...f,
438
+ children: n === void 0 ? A(p, /* @__PURE__ */ c("span", { className: e ? void 0 : "rst:invisible", "data-menu-check": "", children: /* @__PURE__ */ c(De, {}) }), void 0, m) : A(p, void 0, /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "rst:ms-auto rst:flex rst:shrink-0 rst:items-center", children: n }), m)
439
+ }
440
+ );
441
+ }
442
+ function Ye({ value: e, onValueChange: r, label: n, children: s, className: a }) {
443
+ return /* @__PURE__ */ c(Y.Provider, { value: { value: e, onValueChange: r }, children: /* @__PURE__ */ c(Oe, { label: n, className: a, children: s }) });
444
+ }
445
+ function Xe({ value: e, closeOnSelect: r = !0, disabled: n, destructive: s, keyshortcuts: a, textValue: t, className: d, ...o }) {
446
+ const u = i.useContext(Y);
447
+ if (!u) throw new Error("<MenuRadioItem> must be inside a <MenuRadioGroup>.");
448
+ const p = u.value === e, f = F({ disabled: n, closeOnSelect: r, spaceKeepsOpen: !0, onChoose: () => u.onValueChange?.(e) }), m = i.useId();
449
+ return /* @__PURE__ */ c(
450
+ "button",
451
+ {
452
+ type: "button",
453
+ role: "menuitemradio",
454
+ "aria-checked": p,
455
+ "aria-describedby": o.description != null ? m : void 0,
456
+ tabIndex: -1,
457
+ "aria-disabled": n || void 0,
458
+ "aria-keyshortcuts": a,
459
+ "data-menu-item": "",
460
+ "data-menu-text": t,
461
+ className: E(O, s && H, d),
462
+ ...f,
463
+ children: A(o, /* @__PURE__ */ c("span", { className: p ? void 0 : "rst:invisible", "data-menu-check": "", children: /* @__PURE__ */ c(Le, {}) }), void 0, m)
464
+ }
465
+ );
466
+ }
467
+ function Oe({ label: e, children: r, className: n }) {
468
+ const s = i.useId();
469
+ return /* @__PURE__ */ N("div", { role: "group", "aria-labelledby": e ? s : void 0, className: n, children: [
470
+ e && /* @__PURE__ */ c(
471
+ "div",
472
+ {
473
+ id: s,
474
+ className: "rst:px-3 rst:pt-2 rst:pb-1 rst:text-xs rst:font-semibold rst:text-gray-600 rst:dark:text-gray-400",
475
+ "data-menu-heading": "",
476
+ children: e
477
+ }
478
+ ),
479
+ r
480
+ ] });
481
+ }
482
+ function Je({ className: e }) {
483
+ return /* @__PURE__ */ c("div", { role: "separator", className: E("rst:my-1 rst:h-[var(--roster-border-width,1px)] rst:bg-[var(--roster-popover-border)]", e) });
484
+ }
485
+ function Qe({ label: e, children: r, icon: n, disabled: s, textValue: a, className: t, panelClassName: d }) {
486
+ const o = C("MenuSubmenu"), u = _("MenuSubmenu"), p = i.useId(), f = `${p}-item`, m = `${p}-menu`, l = u.openSubmenu === f, b = i.useRef(null), [x, g] = i.useState(null), I = i.useCallback((w) => {
487
+ b.current = w, g(w);
488
+ }, []), h = i.useRef(null), P = i.useRef(void 0), M = i.useRef("mouse"), { mounted: T, closed: y, leaving: v } = te(l), k = z(x), { setPanel: R, panelEl: K, floatingStyles: ie, placement: ue } = re(
489
+ x,
490
+ T,
491
+ k ? "left-start" : "right-start",
492
+ { mainAxis: 0, alignmentAxis: -4 },
493
+ h,
494
+ !0
495
+ ), ce = ae();
496
+ i.useEffect(() => () => window.clearTimeout(P.current), []);
497
+ const W = () => {
498
+ u.setOpenSubmenu(null), b.current?.focus({ preventScroll: !0 });
499
+ }, { typedRef: le, typingAhead: de } = oe(), me = se({ panelRef: h, typedRef: le, onEscape: W, onBack: W });
500
+ i.useLayoutEffect(() => {
501
+ !l || !K || u.focusFirstInSubmenu.current && S(L(K)[0]);
502
+ }, [l, K, u.focusFirstInSubmenu]);
503
+ const $ = (w) => {
504
+ if (!s) {
505
+ if (l && w && h.current) {
506
+ S(L(h.current)[0]);
507
+ return;
508
+ }
509
+ u.setOpenSubmenu(f, w);
510
+ }
511
+ }, fe = !!o.triggerEl?.closest(".dark");
512
+ return /* @__PURE__ */ N(j, { children: [
513
+ /* @__PURE__ */ c(
514
+ "button",
515
+ {
516
+ ref: I,
517
+ id: f,
518
+ type: "button",
519
+ role: "menuitem",
520
+ tabIndex: -1,
521
+ "aria-haspopup": "menu",
522
+ "aria-expanded": l,
523
+ "aria-controls": l ? m : void 0,
524
+ "aria-disabled": s || void 0,
525
+ "data-menu-item": "",
526
+ "data-menu-text": a,
527
+ "data-menu-tree": o.treeId,
528
+ className: E(O, l && "rst:bg-gray-100 rst:dark:bg-gray-700/50", t),
529
+ onPointerDown: (w) => {
530
+ M.current = w.pointerType;
531
+ },
532
+ onClick: () => l && M.current !== "mouse" ? u.setOpenSubmenu(null) : $(!1),
533
+ onKeyDown: (w) => {
534
+ const pe = k ? "ArrowLeft" : "ArrowRight";
535
+ w.key === " " && u.typingAhead() || (w.key === pe || w.key === "Enter" || w.key === " ") && (w.preventDefault(), $(!0));
536
+ },
537
+ onPointerMove: (w) => {
538
+ J(w) && (u.hoverItem(f), document.activeElement !== w.currentTarget && w.currentTarget.focus({ preventScroll: !0 }), !l && !s && (window.clearTimeout(P.current), P.current = window.setTimeout(() => $(!1), X)));
539
+ },
540
+ onPointerLeave: () => window.clearTimeout(P.current),
541
+ children: A({ icon: n, children: e }, void 0, /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "rst:ms-auto rst:flex rst:shrink-0 rst:items-center rst:opacity-70", "data-menu-chevron": "", children: /* @__PURE__ */ c(Ne, {}) }))
542
+ }
543
+ ),
544
+ T && /* @__PURE__ */ c(q, { children: /* @__PURE__ */ c(B.Provider, { value: { ...ce, panelRef: h, typingAhead: de }, children: /* @__PURE__ */ c(
545
+ "div",
546
+ {
547
+ ref: R,
548
+ id: m,
549
+ dir: k ? "rtl" : "ltr",
550
+ role: "menu",
551
+ "aria-labelledby": f,
552
+ tabIndex: -1,
553
+ "data-menu-panel": "",
554
+ "data-menu-tree": o.treeId,
555
+ "data-closed": y ? "" : void 0,
556
+ "data-leaving": v ? "" : void 0,
557
+ onKeyDown: me,
558
+ onPointerEnter: () => u.hoverItem(f),
559
+ style: { ...ie, ...Q, transformOrigin: Z(ue, k) },
560
+ className: E(fe && "dark", ee, d),
561
+ children: r
562
+ }
563
+ ) }) })
564
+ ] });
565
+ }
566
+ export {
567
+ Ue as Menu,
568
+ Ve as MenuButton,
569
+ Ge as MenuCheckboxItem,
570
+ Oe as MenuGroup,
571
+ qe as MenuItem,
572
+ je as MenuItems,
573
+ Ye as MenuRadioGroup,
574
+ Xe as MenuRadioItem,
575
+ Je as MenuSeparator,
576
+ Qe as MenuSubmenu
577
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function h(r,n,s){const e=s.toLocaleLowerCase();if(!e||r.length===0)return-1;const o=[...e].every(t=>t===e[0]),c=o?e[0]:e,i=o?n+1:n;for(let t=0;t<r.length;t++){const a=(Math.max(i,0)+t)%r.length;if(r[a].trim().toLocaleLowerCase().startsWith(c))return a}return-1}exports.nextByTypeahead=h;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The item typeahead lands on: the next one, after `current`, whose label
3
+ * starts with what's been typed, wrapping round to the start. Typing the same
4
+ * letter again cycles through the items starting with it. `-1` when nothing
5
+ * matches, so focus stays put.
6
+ */
7
+ export declare function nextByTypeahead(labels: string[], current: number, typed: string): number;
@@ -0,0 +1,13 @@
1
+ function i(r, n, s) {
2
+ const t = s.toLocaleLowerCase();
3
+ if (!t || r.length === 0) return -1;
4
+ const o = [...t].every((e) => e === t[0]), c = o ? t[0] : t, h = o ? n + 1 : n;
5
+ for (let e = 0; e < r.length; e++) {
6
+ const a = (Math.max(h, 0) + e) % r.length;
7
+ if (r[a].trim().toLocaleLowerCase().startsWith(c)) return a;
8
+ }
9
+ return -1;
10
+ }
11
+ export {
12
+ i as nextByTypeahead
13
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("../../../lib/utils.cjs"),x=require("../../atoms/Card/Card.cjs"),m=require("../../atoms/Eyebrow/Eyebrow.cjs"),c=require("../../atoms/Stat/stat-variants.cjs"),h=require("../../organisms/Table/Table.cjs"),t=require("../../atoms/Skeleton/Skeleton.cjs");function j({media:r,lines:a=3,variant:s,padding:i,className:n}){return e.jsxs(x.Card,{variant:s,padding:i,className:n,"aria-hidden":"true","data-skeleton":"card",children:[r!==void 0&&e.jsx(t.Skeleton,{shape:"block",height:r,className:"rst:mb-4"}),e.jsx(t.Skeleton,{size:"lg",width:"45%"}),a>0&&e.jsx(t.Skeleton,{size:"md",lines:a,className:"rst:mt-2"})]})}function S({columns:r,className:a}){const s=["70%","50%","60%","40%"];return e.jsx(h.TableRow,{"aria-hidden":"true",className:a,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,r)},(i,n)=>e.jsx(h.TableCell,{children:e.jsx(t.Skeleton,{size:"inherit",width:s[n%s.length]})},n))})}function k({size:r="md",withName:a=!1,className:s}){return a?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:items-center rst:gap-3",s),"data-skeleton":"avatar",children:[e.jsx(t.Skeleton,{shape:"circle",size:r}),e.jsx(t.Skeleton,{size:"md",width:"8rem"})]}):e.jsx(t.Skeleton,{shape:"circle",size:r,className:s})}function w({size:r="md",semantics:a="definition",source:s=!1,className:i}){const n=c.statValueVariants({size:r,colorScheme:"neutral"}),o=e.jsx(t.Skeleton,{size:"inherit",width:"2.5em"}),d=e.jsx(m.Eyebrow,{size:"xs",children:e.jsx(t.Skeleton,{size:"inherit",width:"9em"})}),u=e.jsx("span",{className:c.statSourceClass,children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})});return a==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:l.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:n,children:o}),d,s&&u]}):e.jsxs("div",{"aria-hidden":"true",className:l.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2 rst:flex",children:d}),s?e.jsxs("dd",{className:l.cn("rst:m-0",n,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:l.cn(c.statSourceClass,"rst:row-start-3"),children:e.jsx(t.Skeleton,{size:"inherit",width:"12em"})})]}):e.jsx("dd",{className:l.cn("rst:m-0 rst:col-start-1 rst:row-start-1",n),children:o})]})}exports.SkeletonAvatar=k;exports.SkeletonCard=j;exports.SkeletonStat=w;exports.SkeletonTableRow=S;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../../lib/utils.cjs"),j=require("../../atoms/Card/Card.cjs"),S=require("../../atoms/Eyebrow/Eyebrow.cjs"),d=require("../../atoms/Stat/stat-variants.cjs"),u=require("../../organisms/Table/Table.cjs"),s=require("../../atoms/Skeleton/Skeleton.cjs");function k({media:a,lines:n=3,variant:r,padding:t,animation:i,className:l}){return e.jsxs(j.Card,{variant:r,padding:t,className:l,"aria-hidden":"true","data-skeleton":"card",children:[a!==void 0&&e.jsx(s.Skeleton,{shape:"block",height:a,animation:i,className:"rst:mb-4"}),e.jsx(s.Skeleton,{size:"lg",width:"45%",animation:i}),n>0&&e.jsx(s.Skeleton,{size:"md",lines:n,animation:i,className:"rst:mt-2"})]})}function m({columns:a,animation:n,className:r}){const t=["70%","50%","60%","40%"];return e.jsx(u.TableRow,{"aria-hidden":"true",className:r,"data-skeleton":"table-row",children:Array.from({length:Math.max(1,a)},(i,l)=>e.jsx(u.TableCell,{children:e.jsx(s.Skeleton,{size:"inherit",width:t[l%t.length],animation:n})},l))})}function w({size:a="md",withName:n=!1,animation:r,className:t}){return n?e.jsxs("span",{"aria-hidden":"true",className:c.cn("rst:flex rst:items-center rst:gap-3",t),"data-skeleton":"avatar",children:[e.jsx(s.Skeleton,{shape:"circle",size:a,animation:r}),e.jsx(s.Skeleton,{size:"md",width:"8rem",animation:r})]}):e.jsx(s.Skeleton,{shape:"circle",size:a,animation:r,className:t})}function p({size:a="md",semantics:n="definition",source:r=!1,animation:t,className:i}){const l=d.statValueVariants({size:a,colorScheme:"neutral"}),o=e.jsx(s.Skeleton,{size:"inherit",width:"2.5em",animation:t}),h=e.jsx(S.Eyebrow,{size:"xs",children:e.jsx(s.Skeleton,{size:"inherit",width:"9em",animation:t})}),x=e.jsx("span",{className:d.statSourceClass,children:e.jsx(s.Skeleton,{size:"inherit",width:"12em",animation:t})});return n==="standalone"?e.jsxs("span",{"aria-hidden":"true",className:c.cn("rst:flex rst:flex-col rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("span",{className:l,children:o}),h,r&&x]}):e.jsxs("div",{"aria-hidden":"true",className:c.cn("rst:grid rst:content-start rst:gap-[3px]",i),"data-skeleton":"stat",children:[e.jsx("dt",{className:"rst:relative rst:col-start-1 rst:row-start-2 rst:flex",children:h}),r?e.jsxs("dd",{className:c.cn("rst:m-0",l,"rst:col-start-1 rst:row-span-3 rst:row-start-1 rst:grid rst:grid-rows-subgrid"),children:[e.jsx("span",{className:"rst:row-start-1",children:o}),e.jsx("span",{className:c.cn(d.statSourceClass,"rst:row-start-3"),children:e.jsx(s.Skeleton,{size:"inherit",width:"12em",animation:t})})]}):e.jsx("dd",{className:c.cn("rst:m-0 rst:col-start-1 rst:row-start-1",l),children:o})]})}exports.SkeletonAvatar=w;exports.SkeletonCard=k;exports.SkeletonStat=p;exports.SkeletonTableRow=m;