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