@alea-design/ui 0.6.1 → 0.7.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.
Files changed (52) hide show
  1. package/dist/components/button/Button.d.ts +3 -1
  2. package/dist/components/button/Button.js +58 -57
  3. package/dist/components/button/Groups.js +41 -41
  4. package/dist/components/data/Data.d.ts +6 -4
  5. package/dist/components/data/Data.js +49 -49
  6. package/dist/components/date/Date.d.ts +3 -1
  7. package/dist/components/date/Date.js +74 -74
  8. package/dist/components/form/Form.d.ts +3 -1
  9. package/dist/components/form/Form.js +44 -52
  10. package/dist/components/form/validity.d.ts +22 -0
  11. package/dist/components/form/validity.js +38 -0
  12. package/dist/components/list/List.d.ts +3 -2
  13. package/dist/components/more/More.d.ts +3 -1
  14. package/dist/components/more/More.js +46 -46
  15. package/dist/components/navigation/Navigation.d.ts +4 -4
  16. package/dist/components/navigation/Navigation.js +94 -94
  17. package/dist/components/navigation/Navigation2.d.ts +3 -1
  18. package/dist/components/navigation/Navigation2.js +218 -210
  19. package/dist/components/page/PageParts.d.ts +6 -2
  20. package/dist/components/page/PageParts.js +85 -85
  21. package/dist/components/shell/AppShell.d.ts +3 -1
  22. package/dist/components/shell/AppShell.js +33 -32
  23. package/dist/components/table/Table.d.ts +8 -3
  24. package/dist/components/table/Table.js +58 -57
  25. package/dist/components/theme/Theme.d.ts +5 -1
  26. package/dist/components/theme/Theme.js +63 -63
  27. package/dist/css/base.css +1 -1
  28. package/dist/css/button.css +1 -1
  29. package/dist/css/data.css +1 -1
  30. package/dist/css/date.css +1 -1
  31. package/dist/css/display.css +1 -1
  32. package/dist/css/feedback.css +1 -1
  33. package/dist/css/groups.json +13 -13
  34. package/dist/css/more.css +1 -1
  35. package/dist/css/navigation.css +1 -1
  36. package/dist/css/page.css +1 -1
  37. package/dist/css/shell.css +1 -1
  38. package/dist/css/table.css +1 -1
  39. package/dist/css/tabs.css +1 -1
  40. package/dist/css/typography.css +1 -1
  41. package/dist/i18n/strings.d.ts +1 -0
  42. package/dist/i18n/strings.js +2 -0
  43. package/dist/index.d.ts +1 -0
  44. package/dist/index.js +279 -275
  45. package/dist/styles.css +1 -1
  46. package/dist/utils/animateRows.d.ts +3 -2
  47. package/dist/utils/animateRows.js +15 -15
  48. package/dist/utils/measure.d.ts +12 -0
  49. package/dist/utils/measure.js +20 -0
  50. package/dist/utils/scrollEdges.d.ts +1 -1
  51. package/dist/utils/scrollEdges.js +23 -22
  52. package/package.json +3 -3
@@ -1,294 +1,295 @@
1
1
  "use client";
2
- import { jsxs as k, jsx as a, Fragment as z } from "react/jsx-runtime";
3
- import { useState as A, useRef as S, forwardRef as Y, useId as K, useEffect as R } from "react";
4
- import { Link as P, Popover as H, Menu as j } from "react-aria-components";
5
- import { withMotionStyle as I } from "@alea-design/motion";
6
- import { ChevronDown as q, MoreHorizontal as G } from "lucide-react";
7
- import { cx as L } from "../../utils/cx.js";
2
+ import { jsxs as E, jsx as a, Fragment as B } from "react/jsx-runtime";
3
+ import { useState as O, useRef as $, forwardRef as Y, useId as I, useEffect as R } from "react";
4
+ import { Link as q, Popover as K, Menu as W } from "react-aria-components";
5
+ import { withMotionStyle as H } from "@alea-design/motion";
6
+ import { ChevronDown as j, MoreHorizontal as G } from "lucide-react";
7
+ import { cx as C } from "../../utils/cx.js";
8
8
  import { useMergedRef as U } from "../../utils/refs.js";
9
- import { MenuSeparator as V, MenuItem as J } from "../menu/Menu.js";
9
+ import { useMeasured as V } from "../../utils/measure.js";
10
+ import { MenuSeparator as J, MenuItem as Q } from "../menu/Menu.js";
10
11
  import { useStrings as T } from "../../i18n/strings.js";
11
- import { Drawer as Q, DrawerContent as Z } from "../overlay/Drawer.js";
12
- const W = (d) => d.map((i, t) => "separator" in i ? /* @__PURE__ */ a(V, {}, `s${t}`) : /* @__PURE__ */ a(J, { id: i.id, icon: i.icon, shortcut: i.shortcut, description: i.description, tone: i.tone, isDisabled: i.isDisabled, children: i.label }, String(i.id)));
13
- function de({ motion: d, children: i, items: t, onAction: p, className: x, areaLabel: N, "aria-label": y }) {
14
- const h = T();
15
- y ?? (y = h.contextMenu);
16
- const [m, b] = A(null), f = S(null), g = S(null), r = S(void 0), n = (e, u) => {
17
- const E = f.current.getBoundingClientRect();
18
- b({ x: e - E.left, y: u - E.top });
12
+ import { Drawer as Z, DrawerContent as _ } from "../overlay/Drawer.js";
13
+ const P = (i) => i.map((l, t) => "separator" in l ? /* @__PURE__ */ a(J, {}, `s${t}`) : /* @__PURE__ */ a(Q, { id: l.id, icon: l.icon, shortcut: l.shortcut, description: l.description, tone: l.tone, isDisabled: l.isDisabled, children: l.label }, String(l.id)));
14
+ function ve({ motion: i, children: l, items: t, onAction: p, className: k, areaLabel: y, "aria-label": x }) {
15
+ const b = T();
16
+ x ?? (x = b.contextMenu);
17
+ const [h, N] = O(null), f = $(null), w = $(null), r = $(void 0), n = (e, c) => {
18
+ const D = f.current.getBoundingClientRect();
19
+ N({ x: e - D.left, y: c - D.top });
19
20
  };
20
- return /* @__PURE__ */ k(
21
+ return /* @__PURE__ */ E(
21
22
  "div",
22
23
  {
23
24
  ref: f,
24
- className: L("alea-context-area", x),
25
+ className: C("alea-context-area", k),
25
26
  tabIndex: 0,
26
27
  role: "group",
27
- "aria-label": `${N}, menu with Shift+F10`,
28
+ "aria-label": `${y}, menu with Shift+F10`,
28
29
  onContextMenu: (e) => {
29
30
  e.preventDefault(), n(e.clientX, e.clientY);
30
31
  },
31
32
  onKeyDown: (e) => {
32
33
  if (e.shiftKey && e.key === "F10" || e.key === "ContextMenu") {
33
34
  e.preventDefault();
34
- const u = f.current.getBoundingClientRect();
35
- n(u.left + 16, u.top + 16);
35
+ const c = f.current.getBoundingClientRect();
36
+ n(c.left + 16, c.top + 16);
36
37
  }
37
38
  },
38
39
  onTouchStart: (e) => {
39
- const u = e.touches[0];
40
- r.current = window.setTimeout(() => n(u.clientX, u.clientY), 550);
40
+ const c = e.touches[0];
41
+ r.current = window.setTimeout(() => n(c.clientX, c.clientY), 550);
41
42
  },
42
43
  onTouchEnd: () => clearTimeout(r.current),
43
44
  onTouchMove: () => clearTimeout(r.current),
44
45
  children: [
45
- i,
46
- /* @__PURE__ */ a("span", { ref: g, className: "alea-context-anchor", style: { left: (m == null ? void 0 : m.x) ?? 0, top: (m == null ? void 0 : m.y) ?? 0 }, "aria-hidden": "true" }),
47
- /* @__PURE__ */ a(H, { triggerRef: g, isOpen: !!m, onOpenChange: (e) => {
48
- var u;
49
- e || (b(null), (u = f.current) == null || u.focus());
50
- }, placement: "bottom start", offset: 2, className: "alea-popover alea-menu-popover", style: I(void 0, d), children: /* @__PURE__ */ a(j, { "aria-label": y, autoFocus: "first", className: "alea-menu", onAction: (e) => {
51
- var u;
52
- p == null || p(e), b(null), (u = f.current) == null || u.focus();
53
- }, children: W(t) }) })
46
+ l,
47
+ /* @__PURE__ */ a("span", { ref: w, className: "alea-context-anchor", style: { left: (h == null ? void 0 : h.x) ?? 0, top: (h == null ? void 0 : h.y) ?? 0 }, "aria-hidden": "true" }),
48
+ /* @__PURE__ */ a(K, { triggerRef: w, isOpen: !!h, onOpenChange: (e) => {
49
+ var c;
50
+ e || (N(null), (c = f.current) == null || c.focus());
51
+ }, placement: "bottom start", offset: 2, className: "alea-popover alea-menu-popover", style: H(void 0, i), children: /* @__PURE__ */ a(W, { "aria-label": x, autoFocus: "first", className: "alea-menu", onAction: (e) => {
52
+ var c;
53
+ p == null || p(e), N(null), (c = f.current) == null || c.focus();
54
+ }, children: P(t) }) })
54
55
  ]
55
56
  }
56
57
  );
57
58
  }
58
- function fe({ motion: d, menus: i, onAction: t, className: p, "aria-label": x }) {
59
- const [N, y] = A(0), [h, m] = A(null), b = S([]), f = (r, n) => {
60
- var u;
61
- const e = (r + i.length) % i.length;
62
- y(e), (u = b.current[e]) == null || u.focus(), m(n ? e : null);
63
- }, g = (r, n) => {
59
+ function he({ motion: i, menus: l, onAction: t, className: p, "aria-label": k }) {
60
+ const [y, x] = O(0), [b, h] = O(null), N = $([]), f = (r, n) => {
61
+ var c;
62
+ const e = (r + l.length) % l.length;
63
+ x(e), (c = N.current[e]) == null || c.focus(), h(n ? e : null);
64
+ }, w = (r, n) => {
64
65
  const e = r.key;
65
66
  if (e === "ArrowRight") f(n + 1, !1);
66
67
  else if (e === "ArrowLeft") f(n - 1, !1);
67
68
  else if (e === "Home") f(0, !1);
68
- else if (e === "End") f(i.length - 1, !1);
69
- else if (e === "ArrowDown" || e === "Enter" || e === " ") m(n);
69
+ else if (e === "End") f(l.length - 1, !1);
70
+ else if (e === "ArrowDown" || e === "Enter" || e === " ") h(n);
70
71
  else return;
71
72
  r.preventDefault();
72
73
  };
73
- return /* @__PURE__ */ a("div", { role: "menubar", "aria-label": x, className: L("alea-menubar", p), children: i.map((r, n) => /* @__PURE__ */ k("span", { className: "alea-menubar-slot", children: [
74
+ return /* @__PURE__ */ a("div", { role: "menubar", "aria-label": k, className: C("alea-menubar", p), children: l.map((r, n) => /* @__PURE__ */ E("span", { className: "alea-menubar-slot", children: [
74
75
  /* @__PURE__ */ a(
75
76
  "button",
76
77
  {
77
78
  ref: (e) => {
78
- b.current[n] = e;
79
+ N.current[n] = e;
79
80
  },
80
81
  type: "button",
81
82
  role: "menuitem",
82
83
  "aria-haspopup": "menu",
83
- "aria-expanded": h === n,
84
- tabIndex: N === n ? 0 : -1,
84
+ "aria-expanded": b === n,
85
+ tabIndex: y === n ? 0 : -1,
85
86
  className: "alea-menubar-item alea-focus-ring",
86
87
  onClick: () => {
87
- y(n), m(h === n ? null : n);
88
+ x(n), h(b === n ? null : n);
88
89
  },
89
90
  onMouseEnter: () => {
90
- h != null && h !== n && (y(n), m(n));
91
+ b != null && b !== n && (x(n), h(n));
91
92
  },
92
- onKeyDown: (e) => g(e, n),
93
+ onKeyDown: (e) => w(e, n),
93
94
  children: r.label
94
95
  }
95
96
  ),
96
- /* @__PURE__ */ a(H, { triggerRef: { current: b.current[n] }, isOpen: h === n, onOpenChange: (e) => {
97
- var u;
98
- e || (m(null), (u = b.current[n]) == null || u.focus());
99
- }, style: I(void 0, d), placement: "bottom start", offset: 4, className: "alea-popover alea-menu-popover", children: /* @__PURE__ */ a("div", { onKeyDown: (e) => {
97
+ /* @__PURE__ */ a(K, { triggerRef: { current: N.current[n] }, isOpen: b === n, onOpenChange: (e) => {
98
+ var c;
99
+ e || (h(null), (c = N.current[n]) == null || c.focus());
100
+ }, style: H(void 0, i), placement: "bottom start", offset: 4, className: "alea-popover alea-menu-popover", children: /* @__PURE__ */ a("div", { onKeyDown: (e) => {
100
101
  e.key === "ArrowRight" && (e.preventDefault(), f(n + 1, !0)), e.key === "ArrowLeft" && (e.preventDefault(), f(n - 1, !0));
101
- }, children: /* @__PURE__ */ a(j, { "aria-label": r.label, autoFocus: "first", className: "alea-menu", onAction: (e) => {
102
- var u;
103
- t == null || t(r.id, e), m(null), (u = b.current[n]) == null || u.focus();
104
- }, children: W(r.items) }) }) })
102
+ }, children: /* @__PURE__ */ a(W, { "aria-label": r.label, autoFocus: "first", className: "alea-menu", onAction: (e) => {
103
+ var c;
104
+ t == null || t(r.id, e), h(null), (c = N.current[n]) == null || c.focus();
105
+ }, children: P(r.items) }) }) })
105
106
  ] }, r.id)) });
106
107
  }
107
- const me = Y(function({ motion: i, trigger: t, children: p, openDelay: x = 500, closeDelay: N = 200, placement: y = "bottom", className: h, style: m }, b) {
108
- const [f, g] = A(!1), r = S(null), n = U(b, r), e = S(void 0), u = K(), E = (s, c) => {
109
- clearTimeout(e.current), e.current = window.setTimeout(() => g(s), c);
108
+ const pe = Y(function({ motion: l, trigger: t, children: p, openDelay: k = 500, closeDelay: y = 200, placement: x = "bottom", className: b, style: h }, N) {
109
+ const [f, w] = O(!1), r = $(null), n = U(N, r), e = $(void 0), c = I(), D = (o, s) => {
110
+ clearTimeout(e.current), e.current = window.setTimeout(() => w(o), s);
110
111
  };
111
112
  return R(() => () => clearTimeout(e.current), []), R(() => {
112
113
  if (!f) return;
113
- const s = (c) => {
114
- c.key === "Escape" && g(!1);
114
+ const o = (s) => {
115
+ s.key === "Escape" && w(!1);
115
116
  };
116
- return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
117
- }, [f]), /* @__PURE__ */ k(z, { children: [
117
+ return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
118
+ }, [f]), /* @__PURE__ */ E(B, { children: [
118
119
  /* @__PURE__ */ a(
119
120
  "span",
120
121
  {
121
122
  ref: n,
122
- style: m,
123
- className: L("alea-hovercard-trigger", h),
124
- "aria-describedby": f ? u : void 0,
125
- onMouseEnter: () => E(!0, x),
126
- onMouseLeave: () => E(!1, N),
127
- onFocus: () => E(!0, x),
128
- onBlur: () => E(!1, N),
123
+ style: h,
124
+ className: C("alea-hovercard-trigger", b),
125
+ "aria-describedby": f ? c : void 0,
126
+ onMouseEnter: () => D(!0, k),
127
+ onMouseLeave: () => D(!1, y),
128
+ onFocus: () => D(!0, k),
129
+ onBlur: () => D(!1, y),
129
130
  children: t
130
131
  }
131
132
  ),
132
- /* @__PURE__ */ a(H, { triggerRef: r, isOpen: f, onOpenChange: g, isNonModal: !0, placement: y, offset: 8, className: "alea-popover alea-hovercard", style: I(void 0, i), children: /* @__PURE__ */ a("div", { id: u, role: "tooltip", onMouseEnter: () => clearTimeout(e.current), onMouseLeave: () => E(!1, N), children: p }) })
133
+ /* @__PURE__ */ a(K, { triggerRef: r, isOpen: f, onOpenChange: w, isNonModal: !0, placement: x, offset: 8, className: "alea-popover alea-hovercard", style: H(void 0, l), children: /* @__PURE__ */ a("div", { id: c, role: "tooltip", onMouseEnter: () => clearTimeout(e.current), onMouseLeave: () => D(!1, y), children: p }) })
133
134
  ] });
134
- }), C = (d) => "items" in d, F = (d) => "href" in d, B = (d, i) => !!i && d.items.some((t) => F(t) ? t.href === i : C(t) ? B(t, i) : !1);
135
- function _({ items: d, current: i, collapsed: t, railLabels: p, accordion: x, size: N = "md", onNavigate: y, className: h, label: m }) {
136
- const b = K(), f = S(null), [g, r] = A(() => {
137
- const s = /* @__PURE__ */ new Set(), c = (o, l) => o.forEach((w) => {
138
- C(w) && B(w, i) && (s.add(`${l}/${w.label}`), c(w.items, `${l}/${w.label}`));
135
+ }), L = (i) => "items" in i, z = (i) => "href" in i, F = (i, l) => !!l && i.items.some((t) => z(t) ? t.href === l : L(t) ? F(t, l) : !1);
136
+ function ee({ items: i, current: l, collapsed: t, railLabels: p, accordion: k, size: y = "md", onNavigate: x, className: b, label: h }) {
137
+ const N = I(), f = $(null), [w, r] = O(() => {
138
+ const o = /* @__PURE__ */ new Set(), s = (g, u) => g.forEach((M) => {
139
+ L(M) && F(M, l) && (o.add(`${u}/${M.label}`), s(M.items, `${u}/${M.label}`));
139
140
  });
140
- return t || c(d, ""), s;
141
+ return t || s(i, ""), o;
141
142
  });
142
143
  R(() => {
143
144
  t && r(/* @__PURE__ */ new Set());
144
145
  }, [t]), R(() => {
145
- if (!t || !g.size) return;
146
- const s = (c) => {
147
- var o;
148
- (o = f.current) != null && o.contains(c.target) || r(/* @__PURE__ */ new Set());
146
+ if (!t || !w.size) return;
147
+ const o = (s) => {
148
+ var g;
149
+ (g = f.current) != null && g.contains(s.target) || r(/* @__PURE__ */ new Set());
149
150
  };
150
- return document.addEventListener("pointerdown", s), () => document.removeEventListener("pointerdown", s);
151
- }, [t, g]);
152
- const n = (s) => r((c) => {
153
- const o = new Set(c);
154
- return o.has(s) ? ([...o].forEach((l) => {
155
- (l === s || l.startsWith(s + "/")) && o.delete(l);
156
- }), o) : ((x || t) && [...o].forEach((l) => {
157
- s.startsWith(l + "/") || o.delete(l);
158
- }), o.add(s), o);
151
+ return document.addEventListener("pointerdown", o), () => document.removeEventListener("pointerdown", o);
152
+ }, [t, w]);
153
+ const n = (o) => r((s) => {
154
+ const g = new Set(s);
155
+ return g.has(o) ? ([...g].forEach((u) => {
156
+ (u === o || u.startsWith(o + "/")) && g.delete(u);
157
+ }), g) : ((k || t) && [...g].forEach((u) => {
158
+ o.startsWith(u + "/") || g.delete(u);
159
+ }), g.add(o), g);
159
160
  }), e = () => {
160
- var s;
161
- return Array.from(((s = f.current) == null ? void 0 : s.querySelectorAll(".alea-vnav-item")) || []).filter((c) => !c.closest(".alea-vnav-sub:not([data-open])") && !c.hasAttribute("aria-disabled"));
162
- }, u = (s) => {
163
- var w, $, D;
164
- const c = e(), o = c.indexOf(document.activeElement), l = (v) => {
165
- var M;
166
- s.preventDefault(), (M = c[(v + c.length) % c.length]) == null || M.focus();
161
+ var o;
162
+ return Array.from(((o = f.current) == null ? void 0 : o.querySelectorAll(".alea-vnav-item")) || []).filter((s) => !s.closest(".alea-vnav-sub:not([data-open])") && !s.hasAttribute("aria-disabled"));
163
+ }, c = (o) => {
164
+ var M, d, v;
165
+ const s = e(), g = s.indexOf(document.activeElement), u = (m) => {
166
+ var S;
167
+ o.preventDefault(), (S = s[(m + s.length) % s.length]) == null || S.focus();
167
168
  };
168
- if (s.key === "ArrowDown") l(o + 1);
169
- else if (s.key === "ArrowUp") l(o - 1);
170
- else if (s.key === "Home") l(0);
171
- else if (s.key === "End") l(c.length - 1);
172
- else if (s.key === "ArrowRight" || s.key === "ArrowLeft") {
173
- const v = document.activeElement, M = v == null ? void 0 : v.dataset.path;
174
- if (s.key === "ArrowRight" && M && v.getAttribute("aria-expanded") === "false")
175
- s.preventDefault(), n(M);
176
- else if (s.key === "ArrowLeft")
177
- if (M && v.getAttribute("aria-expanded") === "true")
178
- s.preventDefault(), n(M);
169
+ if (o.key === "ArrowDown") u(g + 1);
170
+ else if (o.key === "ArrowUp") u(g - 1);
171
+ else if (o.key === "Home") u(0);
172
+ else if (o.key === "End") u(s.length - 1);
173
+ else if (o.key === "ArrowRight" || o.key === "ArrowLeft") {
174
+ const m = document.activeElement, S = m == null ? void 0 : m.dataset.path;
175
+ if (o.key === "ArrowRight" && S && m.getAttribute("aria-expanded") === "false")
176
+ o.preventDefault(), n(S);
177
+ else if (o.key === "ArrowLeft")
178
+ if (S && m.getAttribute("aria-expanded") === "true")
179
+ o.preventDefault(), n(S);
179
180
  else {
180
- const O = (w = v.closest(".alea-vnav-sub")) == null ? void 0 : w.previousElementSibling;
181
- O && (s.preventDefault(), O.focus());
181
+ const A = (M = m.closest(".alea-vnav-sub")) == null ? void 0 : M.previousElementSibling;
182
+ A && (o.preventDefault(), A.focus());
182
183
  }
183
- } else if (s.key === "Escape" && t && g.size) {
184
- const v = [...g][0];
185
- (D = ($ = f.current) == null ? void 0 : $.querySelector(`[data-path="${CSS.escape(v)}"]`)) == null || D.focus(), r(/* @__PURE__ */ new Set());
184
+ } else if (o.key === "Escape" && t && w.size) {
185
+ const m = [...w][0];
186
+ (v = (d = f.current) == null ? void 0 : d.querySelector(`[data-path="${CSS.escape(m)}"]`)) == null || v.focus(), r(/* @__PURE__ */ new Set());
186
187
  }
187
- }, E = (s, c, o) => /* @__PURE__ */ a("ul", { className: "alea-vnav-list", "data-level": c, children: s.map((l, w) => {
188
- if ("divider" in l) return /* @__PURE__ */ a("li", { "aria-hidden": "true", className: "alea-vnav-divider" }, `d${w}`);
189
- if ("section" in l) return /* @__PURE__ */ a("li", { className: "alea-vnav-section", children: /* @__PURE__ */ a("span", { children: l.section }) }, `s${w}`);
190
- const $ = (v, M, O, X) => /* @__PURE__ */ k(z, { children: [
191
- v ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon", "aria-hidden": "true", children: v }) : c === 0 && t ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon alea-vnav-initial", "aria-hidden": "true", children: M.slice(0, 1) }) : null,
192
- /* @__PURE__ */ a("span", { className: "alea-vnav-label", children: M }),
193
- O != null && /* @__PURE__ */ a("span", { className: "alea-vnav-badge", children: O }),
188
+ }, D = (o, s, g) => /* @__PURE__ */ a("ul", { className: "alea-vnav-list", "data-level": s, children: o.map((u, M) => {
189
+ if ("divider" in u) return /* @__PURE__ */ a("li", { "aria-hidden": "true", className: "alea-vnav-divider" }, `d${M}`);
190
+ if ("section" in u) return /* @__PURE__ */ a("li", { className: "alea-vnav-section", children: /* @__PURE__ */ a("span", { children: u.section }) }, `s${M}`);
191
+ const d = (m, S, A, X) => /* @__PURE__ */ E(B, { children: [
192
+ m ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon", "aria-hidden": "true", children: m }) : s === 0 && t ? /* @__PURE__ */ a("span", { className: "alea-vnav-icon alea-vnav-initial", "aria-hidden": "true", children: S.slice(0, 1) }) : null,
193
+ /* @__PURE__ */ a("span", { className: "alea-vnav-label", children: S }),
194
+ A != null && /* @__PURE__ */ a("span", { className: "alea-vnav-badge", children: A }),
194
195
  X
195
196
  ] });
196
- if (C(l)) {
197
- const v = `${o}/${l.label}`, M = g.has(v), O = `${b}${v.replace(/[^a-z0-9]/gi, "-")}`;
198
- return /* @__PURE__ */ k("li", { className: "alea-vnav-li", children: [
197
+ if (L(u)) {
198
+ const m = `${g}/${u.label}`, S = w.has(m), A = `${N}${m.replace(/[^a-z0-9]/gi, "-")}`;
199
+ return /* @__PURE__ */ E("li", { className: "alea-vnav-li", children: [
199
200
  /* @__PURE__ */ a(
200
201
  "button",
201
202
  {
202
203
  type: "button",
203
204
  className: "alea-vnav-item alea-focus-ring",
204
- "data-path": v,
205
- "aria-expanded": M,
206
- "aria-controls": O,
207
- "data-current": B(l, i) || void 0,
208
- "data-tip": t && c === 0 ? l.label : void 0,
209
- style: { "--lvl": c },
210
- onClick: () => n(v),
211
- children: $(l.icon, l.label, l.badge, /* @__PURE__ */ a(q, { size: 14, "aria-hidden": "true", className: "alea-vnav-chevron" }))
205
+ "data-path": m,
206
+ "aria-expanded": S,
207
+ "aria-controls": A,
208
+ "data-current": F(u, l) || void 0,
209
+ "data-tip": t && s === 0 ? u.label : void 0,
210
+ style: { "--lvl": s },
211
+ onClick: () => n(m),
212
+ children: d(u.icon, u.label, u.badge, /* @__PURE__ */ a(j, { size: 14, "aria-hidden": "true", className: "alea-vnav-chevron" }))
212
213
  }
213
214
  ),
214
- /* @__PURE__ */ a("div", { id: O, className: "alea-vnav-sub", "data-open": M || void 0, "data-flyout": t && c === 0 ? !0 : void 0, children: /* @__PURE__ */ k("div", { className: "alea-vnav-sub-inner", children: [
215
- t && c === 0 && /* @__PURE__ */ a("p", { className: "alea-vnav-flyout-title", children: l.label }),
216
- E(l.items, t && c === 0 ? 0 : c + 1, v),
217
- l.footer && /* @__PURE__ */ a("div", { className: "alea-vnav-footer", children: l.footer })
215
+ /* @__PURE__ */ a("div", { id: A, className: "alea-vnav-sub", "data-open": S || void 0, "data-flyout": t && s === 0 ? !0 : void 0, children: /* @__PURE__ */ E("div", { className: "alea-vnav-sub-inner", children: [
216
+ t && s === 0 && /* @__PURE__ */ a("p", { className: "alea-vnav-flyout-title", children: u.label }),
217
+ D(u.items, t && s === 0 ? 0 : s + 1, m),
218
+ u.footer && /* @__PURE__ */ a("div", { className: "alea-vnav-footer", children: u.footer })
218
219
  ] }) })
219
- ] }, v);
220
+ ] }, m);
220
221
  }
221
- const D = l;
222
+ const v = u;
222
223
  return /* @__PURE__ */ a("li", { className: "alea-vnav-li", children: /* @__PURE__ */ a(
223
224
  "a",
224
225
  {
225
- href: D.isDisabled ? void 0 : D.href,
226
+ href: v.isDisabled ? void 0 : v.href,
226
227
  className: "alea-vnav-item alea-focus-ring",
227
- "aria-current": D.href === i ? "page" : void 0,
228
- "aria-disabled": D.isDisabled || void 0,
229
- tabIndex: D.isDisabled ? -1 : void 0,
230
- "data-tip": t && c === 0 ? D.label : void 0,
231
- style: { "--lvl": c },
232
- onClick: (v) => {
233
- if (D.isDisabled) {
234
- v.preventDefault();
228
+ "aria-current": v.href === l ? "page" : void 0,
229
+ "aria-disabled": v.isDisabled || void 0,
230
+ tabIndex: v.isDisabled ? -1 : void 0,
231
+ "data-tip": t && s === 0 ? v.label : void 0,
232
+ style: { "--lvl": s },
233
+ onClick: (m) => {
234
+ if (v.isDisabled) {
235
+ m.preventDefault();
235
236
  return;
236
237
  }
237
- y == null || y(D.href, v), t && r(/* @__PURE__ */ new Set());
238
+ x == null || x(v.href, m), t && r(/* @__PURE__ */ new Set());
238
239
  },
239
- children: $(D.icon, D.label, D.badge)
240
+ children: d(v.icon, v.label, v.badge)
240
241
  }
241
- ) }, `${o}/${D.href}`);
242
+ ) }, `${g}/${v.href}`);
242
243
  }) });
243
244
  return /* @__PURE__ */ a(
244
245
  "nav",
245
246
  {
246
247
  ref: f,
247
- "aria-label": m,
248
- className: L("alea-vnav", h),
248
+ "aria-label": h,
249
+ className: C("alea-vnav", b),
249
250
  "data-collapsed": t || void 0,
250
251
  "data-rail-labels": t && p ? !0 : void 0,
251
- "data-size": N !== "md" ? N : void 0,
252
- onKeyDown: u,
253
- onBlur: (s) => {
254
- var c;
255
- t && !((c = f.current) != null && c.contains(s.relatedTarget)) && r(/* @__PURE__ */ new Set());
252
+ "data-size": y !== "md" ? y : void 0,
253
+ onKeyDown: c,
254
+ onBlur: (o) => {
255
+ var s;
256
+ t && !((s = f.current) != null && s.contains(o.relatedTarget)) && r(/* @__PURE__ */ new Set());
256
257
  },
257
- children: E(d, 0, "")
258
+ children: D(i, 0, "")
258
259
  }
259
260
  );
260
261
  }
261
- function ve(d) {
262
- const i = T();
263
- return d.orientation === "vertical" ? /* @__PURE__ */ a(_, { ...d, label: d["aria-label"] ?? i.mainNav }) : /* @__PURE__ */ a(ee, { ...d });
262
+ function be(i) {
263
+ const l = T();
264
+ return i.orientation === "vertical" ? /* @__PURE__ */ a(ee, { ...i, label: i["aria-label"] ?? l.mainNav }) : /* @__PURE__ */ a(ae, { ...i });
264
265
  }
265
- function ee({ items: d, current: i, className: t, onNavigate: p, "aria-label": x }) {
266
- const N = T();
267
- x ?? (x = N.mainNav);
268
- const y = d.filter((r) => F(r) || C(r)), [h, m] = A(null), b = S(null), f = S([]), g = K();
266
+ function ae({ items: i, current: l, className: t, onNavigate: p, "aria-label": k }) {
267
+ const y = T();
268
+ k ?? (k = y.mainNav);
269
+ const x = i.filter((r) => z(r) || L(r)), [b, h] = O(null), N = $(null), f = $([]), w = I();
269
270
  return R(() => {
270
- if (h == null) return;
271
+ if (b == null) return;
271
272
  const r = (n) => {
272
273
  var e;
273
- (e = b.current) != null && e.contains(n.target) || m(null);
274
+ (e = N.current) != null && e.contains(n.target) || h(null);
274
275
  };
275
276
  return document.addEventListener("pointerdown", r), () => document.removeEventListener("pointerdown", r);
276
- }, [h]), /* @__PURE__ */ a(
277
+ }, [b]), /* @__PURE__ */ a(
277
278
  "nav",
278
279
  {
279
- ref: b,
280
- "aria-label": x,
281
- className: L("alea-navmenu", t),
280
+ ref: N,
281
+ "aria-label": k,
282
+ className: C("alea-navmenu", t),
282
283
  onKeyDown: (r) => {
283
284
  var n;
284
- r.key === "Escape" && h != null && ((n = f.current[h]) == null || n.focus(), m(null));
285
+ r.key === "Escape" && b != null && ((n = f.current[b]) == null || n.focus(), h(null));
285
286
  },
286
287
  onBlur: (r) => {
287
288
  var n;
288
- (n = b.current) != null && n.contains(r.relatedTarget) || m(null);
289
+ (n = N.current) != null && n.contains(r.relatedTarget) || h(null);
289
290
  },
290
- children: /* @__PURE__ */ a("ul", { className: "alea-navmenu-list", children: y.map((r, n) => /* @__PURE__ */ a("li", { className: "alea-navmenu-li", children: "items" in r ? /* @__PURE__ */ k(z, { children: [
291
- /* @__PURE__ */ k(
291
+ children: /* @__PURE__ */ a("ul", { className: "alea-navmenu-list", children: x.map((r, n) => /* @__PURE__ */ a("li", { className: "alea-navmenu-li", children: "items" in r ? /* @__PURE__ */ E(B, { children: [
292
+ /* @__PURE__ */ E(
292
293
  "button",
293
294
  {
294
295
  ref: (e) => {
@@ -296,74 +297,81 @@ function ee({ items: d, current: i, className: t, onNavigate: p, "aria-label": x
296
297
  },
297
298
  type: "button",
298
299
  className: "alea-navmenu-item alea-focus-ring",
299
- "aria-expanded": h === n,
300
- "aria-controls": `${g}-${n}`,
301
- onClick: () => m(h === n ? null : n),
302
- "data-current": B(r, i) || void 0,
300
+ "aria-expanded": b === n,
301
+ "aria-controls": `${w}-${n}`,
302
+ onClick: () => h(b === n ? null : n),
303
+ "data-current": F(r, l) || void 0,
303
304
  children: [
304
305
  r.label,
305
- /* @__PURE__ */ a(q, { size: 14, "aria-hidden": "true", className: "alea-navmenu-chevron" })
306
+ /* @__PURE__ */ a(j, { size: 14, "aria-hidden": "true", className: "alea-navmenu-chevron" })
306
307
  ]
307
308
  }
308
309
  ),
309
- /* @__PURE__ */ k("div", { id: `${g}-${n}`, className: "alea-navmenu-panel", hidden: h !== n, children: [
310
- /* @__PURE__ */ a("ul", { className: "alea-navmenu-links", "data-cols": r.items.length > 3 ? 2 : 1, children: r.items.filter(F).map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ k("a", { href: e.href, className: "alea-navmenu-link alea-focus-ring", "aria-current": e.href === i ? "page" : void 0, onClick: (u) => p == null ? void 0 : p(e.href, u), children: [
310
+ /* @__PURE__ */ E("div", { id: `${w}-${n}`, className: "alea-navmenu-panel", hidden: b !== n, children: [
311
+ /* @__PURE__ */ a("ul", { className: "alea-navmenu-links", "data-cols": r.items.length > 3 ? 2 : 1, children: r.items.filter(z).map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ E("a", { href: e.href, className: "alea-navmenu-link alea-focus-ring", "aria-current": e.href === l ? "page" : void 0, onClick: (c) => p == null ? void 0 : p(e.href, c), children: [
311
312
  e.icon && /* @__PURE__ */ a("span", { className: "alea-navmenu-icon", "aria-hidden": "true", children: e.icon }),
312
- /* @__PURE__ */ k("span", { children: [
313
+ /* @__PURE__ */ E("span", { children: [
313
314
  /* @__PURE__ */ a("span", { className: "alea-navmenu-title", children: e.label }),
314
315
  e.description && /* @__PURE__ */ a("span", { className: "alea-navmenu-desc", children: e.description })
315
316
  ] })
316
317
  ] }) }, e.href)) }),
317
318
  r.footer && /* @__PURE__ */ a("div", { className: "alea-navmenu-footer", children: r.footer })
318
319
  ] })
319
- ] }) : /* @__PURE__ */ a("a", { href: r.href, className: "alea-navmenu-item alea-focus-ring", "aria-current": r.href === i ? "page" : void 0, onClick: (e) => p == null ? void 0 : p(r.href, e), children: r.label }) }, r.label)) })
320
+ ] }) : /* @__PURE__ */ a("a", { href: r.href, className: "alea-navmenu-item alea-focus-ring", "aria-current": r.href === l ? "page" : void 0, onClick: (e) => p == null ? void 0 : p(r.href, e), children: r.label }) }, r.label)) })
320
321
  }
321
322
  );
322
323
  }
323
- function he({ items: d, value: i, onChange: t, fixed: p = !0, maxItems: x, moreLabel: N, moreIcon: y, className: h, "aria-label": m }) {
324
- const b = T();
325
- m ?? (m = b.mainNav), N ?? (N = b.more);
326
- const [f, g] = A(!1), r = x === void 0 ? 1 / 0 : Math.max(2, Math.floor(x)), n = d.length > r, e = n ? d.slice(0, r - 1) : d, u = n ? d.slice(r - 1) : [], E = u.reduce((o, l) => o + (l.badge || 0), 0), s = u.some((o) => o.id === i), c = (o) => /* @__PURE__ */ k(z, { children: [
327
- /* @__PURE__ */ k("span", { className: "alea-bottomnav-icon", "aria-hidden": "true", children: [
328
- o.icon,
329
- o.badge ? /* @__PURE__ */ a("span", { className: "alea-bottomnav-badge", children: o.badge > 99 ? "99+" : o.badge }) : null
324
+ function ne(i) {
325
+ const l = i.querySelector(":scope > ul > li > .alea-bottomnav-item");
326
+ if (!l) return !0;
327
+ const t = getComputedStyle(l), p = l.clientWidth - (parseFloat(t.paddingInlineStart) || 0) - (parseFloat(t.paddingInlineEnd) || 0);
328
+ return p > 0 ? Array.from(i.querySelectorAll(":scope > ul .alea-bottomnav-label")).every((k) => k.scrollWidth <= p) : !0;
329
+ }
330
+ function ge({ items: i, value: l, onChange: t, fixed: p = !0, maxItems: k, moreLabel: y, moreIcon: x, labels: b = "always", className: h, "aria-label": N }) {
331
+ const f = T();
332
+ N ?? (N = f.mainNav), y ?? (y = f.more);
333
+ const [w, r] = O(!1), n = $(null), e = V(n, (d) => b !== "auto" || ne(d), !0, [b, y, i.map((d) => d.label).join(`
334
+ `)]), c = k === void 0 ? 1 / 0 : Math.max(2, Math.floor(k)), D = i.length > c, o = D ? i.slice(0, c - 1) : i, s = D ? i.slice(c - 1) : [], g = s.reduce((d, v) => d + (v.badge || 0), 0), u = s.some((d) => d.id === l), M = (d) => /* @__PURE__ */ E(B, { children: [
335
+ /* @__PURE__ */ E("span", { className: "alea-bottomnav-icon", "aria-hidden": "true", children: [
336
+ d.icon,
337
+ d.badge ? /* @__PURE__ */ a("span", { className: "alea-bottomnav-badge", children: d.badge > 99 ? "99+" : d.badge }) : null
330
338
  ] }),
331
- /* @__PURE__ */ a("span", { className: "alea-bottomnav-label", children: o.label }),
332
- o.badge ? /* @__PURE__ */ k("span", { className: "alea-visually-hidden", children: [
339
+ /* @__PURE__ */ a("span", { className: "alea-bottomnav-label", children: d.label }),
340
+ d.badge ? /* @__PURE__ */ E("span", { className: "alea-visually-hidden", children: [
333
341
  ", ",
334
- o.badge,
342
+ d.badge,
335
343
  " new"
336
344
  ] }) : null
337
345
  ] });
338
- return /* @__PURE__ */ k("nav", { "aria-label": m, className: L("alea-bottomnav", h), "data-fixed": p || void 0, children: [
339
- /* @__PURE__ */ k("ul", { children: [
340
- e.map((o) => {
341
- const l = c(o), w = o.id === i;
342
- return /* @__PURE__ */ a("li", { children: o.href ? /* @__PURE__ */ a(P, { href: o.href, className: "alea-bottomnav-item alea-focus-ring", "aria-current": w ? "page" : void 0, onPress: () => t == null ? void 0 : t(o.id), children: l }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-current": w ? "page" : void 0, onClick: () => t == null ? void 0 : t(o.id), children: l }) }, o.id);
346
+ return /* @__PURE__ */ E("nav", { ref: n, "aria-label": N, className: C("alea-bottomnav", h), "data-fixed": p || void 0, "data-labels": e ? void 0 : "icons", children: [
347
+ /* @__PURE__ */ E("ul", { children: [
348
+ o.map((d) => {
349
+ const v = M(d), m = d.id === l;
350
+ return /* @__PURE__ */ a("li", { children: d.href ? /* @__PURE__ */ a(q, { href: d.href, className: "alea-bottomnav-item alea-focus-ring", "aria-current": m ? "page" : void 0, onPress: () => t == null ? void 0 : t(d.id), children: v }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-current": m ? "page" : void 0, onClick: () => t == null ? void 0 : t(d.id), children: v }) }, d.id);
343
351
  }),
344
- n && /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-haspopup": "dialog", "aria-expanded": f, "aria-current": s ? "page" : void 0, onClick: () => g(!0), children: c({ label: N, icon: y ?? /* @__PURE__ */ a(G, {}), badge: E || void 0 }) }) })
352
+ D && /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-item alea-focus-ring", "aria-haspopup": "dialog", "aria-expanded": w, "aria-current": u ? "page" : void 0, onClick: () => r(!0), children: M({ label: y, icon: x ?? /* @__PURE__ */ a(G, {}), badge: g || void 0 }) }) })
345
353
  ] }),
346
- n && /* @__PURE__ */ a(Q, { isOpen: f, onOpenChange: g, placement: "bottom", children: /* @__PURE__ */ a(Z, { title: N, children: ({ close: o }) => /* @__PURE__ */ a("ul", { className: "alea-bottomnav-more", children: u.map((l) => {
347
- const w = l.id === i, $ = () => {
348
- t == null || t(l.id), o();
354
+ D && /* @__PURE__ */ a(Z, { isOpen: w, onOpenChange: r, placement: "bottom", children: /* @__PURE__ */ a(_, { title: y, children: ({ close: d }) => /* @__PURE__ */ a("ul", { className: "alea-bottomnav-more", children: s.map((v) => {
355
+ const m = v.id === l, S = () => {
356
+ t == null || t(v.id), d();
349
357
  };
350
- return /* @__PURE__ */ a("li", { children: l.href ? /* @__PURE__ */ a(P, { href: l.href, className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": w ? "page" : void 0, onPress: $, children: c(l) }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": w ? "page" : void 0, onClick: $, children: c(l) }) }, l.id);
358
+ return /* @__PURE__ */ a("li", { children: v.href ? /* @__PURE__ */ a(q, { href: v.href, className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": m ? "page" : void 0, onPress: S, children: M(v) }) : /* @__PURE__ */ a("button", { type: "button", className: "alea-bottomnav-more-item alea-focus-ring", "aria-current": m ? "page" : void 0, onClick: S, children: M(v) }) }, v.id);
351
359
  }) }) }) })
352
360
  ] });
353
361
  }
354
- function pe({ isOpen: d, onChange: i, size: t = "md", className: p, "aria-controls": x, "aria-label": N }) {
355
- const y = T();
356
- return N ?? (N = y.menu), /* @__PURE__ */ k("button", { type: "button", className: L("alea-burger alea-focus-ring", p), "data-size": t, "data-open": d || void 0, "aria-expanded": d, "aria-controls": x, "aria-label": N, onClick: () => i(!d), children: [
362
+ function ye({ isOpen: i, onChange: l, size: t = "md", className: p, "aria-controls": k, "aria-label": y }) {
363
+ const x = T();
364
+ return y ?? (y = x.menu), /* @__PURE__ */ E("button", { type: "button", className: C("alea-burger alea-focus-ring", p), "data-size": t, "data-open": i || void 0, "aria-expanded": i, "aria-controls": k, "aria-label": y, onClick: () => l(!i), children: [
357
365
  /* @__PURE__ */ a("span", { "aria-hidden": "true" }),
358
366
  /* @__PURE__ */ a("span", { "aria-hidden": "true" }),
359
367
  /* @__PURE__ */ a("span", { "aria-hidden": "true" })
360
368
  ] });
361
369
  }
362
370
  export {
363
- he as BottomNavigation,
364
- pe as Burger,
365
- de as ContextMenu,
366
- me as HoverCard,
367
- fe as Menubar,
368
- ve as NavigationMenu
371
+ ge as BottomNavigation,
372
+ ye as Burger,
373
+ ve as ContextMenu,
374
+ pe as HoverCard,
375
+ he as Menubar,
376
+ be as NavigationMenu
369
377
  };