@alea-design/ui 0.7.2 → 0.8.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 (41) hide show
  1. package/dist/components/button/Button.d.ts +13 -2
  2. package/dist/components/button/Button.js +144 -111
  3. package/dist/components/celebrate/Celebrate.d.ts +31 -0
  4. package/dist/components/celebrate/Celebrate.js +50 -0
  5. package/dist/components/display/Display.d.ts +6 -1
  6. package/dist/components/display/Display.js +64 -63
  7. package/dist/components/feedback/Feedback.js +23 -23
  8. package/dist/components/field/Field.d.ts +15 -2
  9. package/dist/components/field/Field.js +165 -134
  10. package/dist/components/more/More.d.ts +3 -1
  11. package/dist/components/more/More.js +53 -53
  12. package/dist/components/notification/NotificationCenter.js +15 -15
  13. package/dist/components/picker/Picker.d.ts +5 -1
  14. package/dist/components/picker/Picker.js +212 -209
  15. package/dist/components/print/PrintSheet.d.ts +18 -0
  16. package/dist/components/print/PrintSheet.js +14 -0
  17. package/dist/components/shell/AccountFooter.d.ts +31 -0
  18. package/dist/components/shell/AccountFooter.js +43 -0
  19. package/dist/components/shell/AppShell.js +18 -18
  20. package/dist/components/shell/AppSidebar.js +31 -31
  21. package/dist/components/shell/sidebar-context.d.ts +5 -0
  22. package/dist/components/shell/sidebar-context.js +6 -0
  23. package/dist/css/base.css +1 -1
  24. package/dist/css/button.css +1 -1
  25. package/dist/css/celebrate.css +1 -0
  26. package/dist/css/choice.css +1 -1
  27. package/dist/css/display.css +1 -1
  28. package/dist/css/feedback.css +1 -1
  29. package/dist/css/field.css +1 -1
  30. package/dist/css/groups.json +28 -8
  31. package/dist/css/picker.css +1 -1
  32. package/dist/css/print.css +1 -0
  33. package/dist/css/shell.css +1 -1
  34. package/dist/i18n/strings.d.ts +17 -0
  35. package/dist/i18n/strings.js +41 -7
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.js +276 -267
  38. package/dist/styles.css +1 -1
  39. package/dist/utils/announcer.d.ts +21 -0
  40. package/dist/utils/announcer.js +30 -0
  41. package/package.json +3 -3
@@ -8,23 +8,23 @@ import { formatDecimal as H } from "../../utils/decimal.js";
8
8
  import { Spinner as L } from "../feedback/Spinner.js";
9
9
  import { useStrings as $ } from "../../i18n/strings.js";
10
10
  import { inertProps as R } from "../../utils/inert.js";
11
- const aa = M(function({ target: t = "main", children: l, className: s, ...i }, r) {
11
+ const aa = M(function({ target: n = "main", children: l, className: s, ...i }, r) {
12
12
  const o = $();
13
- return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${t}`, ...i, className: m("alea-skip-link", s), children: l });
14
- }), ea = M(function({ children: t, as: l = "span", className: s, ...i }, r) {
15
- return /* @__PURE__ */ a(l, { ref: r, ...i, className: m("alea-visually-hidden", s), children: t });
13
+ return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${n}`, ...i, className: m("alea-skip-link", s), children: l });
14
+ }), ea = M(function({ children: n, as: l = "span", className: s, ...i }, r) {
15
+ return /* @__PURE__ */ a(l, { ref: r, ...i, className: m("alea-visually-hidden", s), children: n });
16
16
  });
17
- function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: r }) {
17
+ function la({ title: e, children: n, isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: r }) {
18
18
  return /* @__PURE__ */ u(A, { isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: m("alea-collapsible", r), children: [
19
19
  /* @__PURE__ */ u(I, { slot: "trigger", className: "alea-collapsible-trigger alea-focus-ring", children: [
20
20
  /* @__PURE__ */ a(O, { size: 16, "aria-hidden": "true", className: "alea-collapsible-chevron" }),
21
21
  e
22
22
  ] }),
23
- /* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: t }) })
23
+ /* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: n }) })
24
24
  ] });
25
25
  }
26
- function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder: i = "Empty", multiline: r, className: o }) {
27
- const p = $(), [f, h] = k(t), n = e ?? f, [c, b] = k(!1), [N, C] = k(n), [v, w] = k(!1), x = D(null), g = D(null);
26
+ function ta({ value: e, defaultValue: n = "", onSave: l, label: s, placeholder: i = "Empty", multiline: r, className: o }) {
27
+ const p = $(), [h, f] = k(n), t = e ?? h, [c, b] = k(!1), [N, C] = k(t), [v, w] = k(!1), x = D(null), g = D(null);
28
28
  z(() => {
29
29
  var d, q;
30
30
  c && ((d = x.current) == null || d.focus(), (q = x.current) == null || q.select());
@@ -34,7 +34,7 @@ function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
34
34
  w(!0);
35
35
  return;
36
36
  }
37
- e === void 0 && h(N), b(!1), w(!1), requestAnimationFrame(() => {
37
+ e === void 0 && f(N), b(!1), w(!1), requestAnimationFrame(() => {
38
38
  var d;
39
39
  return (d = g.current) == null ? void 0 : d.focus();
40
40
  });
@@ -45,10 +45,10 @@ function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
45
45
  });
46
46
  };
47
47
  if (!c)
48
- return /* @__PURE__ */ u("button", { ref: g, type: "button", className: m("alea-editable alea-focus-ring", o), "data-empty": !n || void 0, "aria-label": `${s}: ${n || i}. Edit`, onClick: () => {
49
- C(n), b(!0);
48
+ return /* @__PURE__ */ u("button", { ref: g, type: "button", className: m("alea-editable alea-focus-ring", o), "data-empty": !t || void 0, "aria-label": `${s}: ${t || i}. Edit`, onClick: () => {
49
+ C(t), b(!0);
50
50
  }, children: [
51
- /* @__PURE__ */ a("span", { className: "alea-editable-text", children: n || i }),
51
+ /* @__PURE__ */ a("span", { className: "alea-editable-text", children: t || i }),
52
52
  /* @__PURE__ */ a(F, { size: 14, "aria-hidden": "true", className: "alea-editable-icon" })
53
53
  ] });
54
54
  const E = r ? "textarea" : "input";
@@ -74,94 +74,94 @@ function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder:
74
74
  /* @__PURE__ */ a("button", { type: "button", className: "alea-editable-btn alea-focus-ring", "aria-label": p.cancel, onClick: S, children: /* @__PURE__ */ a(P, { size: 14 }) })
75
75
  ] });
76
76
  }
77
- function na({ value: e, format: t, locale: l }) {
78
- return /* @__PURE__ */ a(T, { children: H(e, l, t) });
77
+ function na({ value: e, format: n, locale: l }) {
78
+ return /* @__PURE__ */ a(T, { children: H(e, l, n) });
79
79
  }
80
80
  const V = (e) => String(e).padStart(2, "0");
81
- function sa({ to: e, label: t, onEnd: l, showDays: s, className: i }) {
82
- const r = $(), o = typeof e == "number" ? e : e.getTime(), [p, f] = k(() => Date.now()), h = D(!1);
81
+ function sa({ to: e, label: n, onEnd: l, showDays: s, className: i }) {
82
+ const r = $(), o = typeof e == "number" ? e : e.getTime(), [p, h] = k(() => Date.now()), f = D(!1);
83
83
  z(() => {
84
- const g = setInterval(() => f(Date.now()), 1e3);
84
+ const g = setInterval(() => h(Date.now()), 1e3);
85
85
  return () => clearInterval(g);
86
86
  }, []);
87
- const n = Math.max(0, o - p);
87
+ const t = Math.max(0, o - p);
88
88
  z(() => {
89
- n === 0 && !h.current && (h.current = !0, l == null || l());
90
- }, [n, l]);
91
- const c = Math.floor(n / 864e5), b = Math.floor(n / 36e5) % 24, N = Math.floor(n / 6e4) % 60, C = Math.floor(n / 1e3) % 60, v = s ?? c > 0, w = [...v ? [[c, "d"]] : [], [v ? b : b + c * 24, "h"], [N, "m"], [C, "s"]], x = `${v ? `${c} days, ` : ""}${v ? b : b + c * 24} hours, ${N} minutes`;
89
+ t === 0 && !f.current && (f.current = !0, l == null || l());
90
+ }, [t, l]);
91
+ const c = Math.floor(t / 864e5), b = Math.floor(t / 36e5) % 24, N = Math.floor(t / 6e4) % 60, C = Math.floor(t / 1e3) % 60, v = s ?? c > 0, w = [...v ? [[c, "d"]] : [], [v ? b : b + c * 24, "h"], [N, "m"], [C, "s"]], x = `${v ? `${c} days, ` : ""}${v ? b : b + c * 24} hours, ${N} minutes`;
92
92
  return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", i), children: [
93
- /* @__PURE__ */ a("span", { className: "alea-stat-label", children: t }),
93
+ /* @__PURE__ */ a("span", { className: "alea-stat-label", children: n }),
94
94
  /* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([g, y]) => /* @__PURE__ */ u("span", { children: [
95
95
  /* @__PURE__ */ a("b", { children: y === "d" ? g : V(g) }),
96
96
  /* @__PURE__ */ a("small", { children: y })
97
97
  ] }, y)) }),
98
- /* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n === 0 ? r.ended : x })
98
+ /* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: t === 0 ? r.ended : x })
99
99
  ] });
100
100
  }
101
- function ra({ tone: e = "neutral", children: t, pulse: l, className: s }) {
101
+ function ra({ tone: e = "neutral", children: n, pulse: l, className: s }) {
102
102
  return /* @__PURE__ */ u("span", { className: m("alea-status", s), "data-tone": e, children: [
103
103
  /* @__PURE__ */ a("span", { className: "alea-status-dot", "data-pulse": l || void 0, "aria-hidden": "true" }),
104
- t
104
+ n
105
105
  ] });
106
106
  }
107
- function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue: i, className: r, style: o }) {
108
- const p = /* @__PURE__ */ a("span", { className: "alea-swatch", "data-shape": s, role: "img", "aria-label": t, style: { width: l, height: l, "--alea-swatch": e, ...o } });
107
+ function ia({ color: e, label: n, size: l = 28, shape: s = "circle", showValue: i, className: r, style: o }) {
108
+ const p = /* @__PURE__ */ a("span", { className: "alea-swatch", "data-shape": s, role: "img", "aria-label": n, style: { width: l, height: l, "--alea-swatch": e, ...o } });
109
109
  return i ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", r), "data-labeled": !0, children: [
110
110
  p,
111
- /* @__PURE__ */ a("span", { className: "alea-swatch-name", "aria-hidden": "true", children: t }),
111
+ /* @__PURE__ */ a("span", { className: "alea-swatch-name", "aria-hidden": "true", children: n }),
112
112
  /* @__PURE__ */ a("code", { className: "alea-swatch-value", children: e })
113
113
  ] }) : /* @__PURE__ */ a("span", { className: m("alea-swatch-wrap", r), children: p });
114
114
  }
115
- function ca({ isLoading: e, children: t, label: l, blur: s = !0, className: i }) {
115
+ function ca({ isLoading: e, children: n, label: l, blur: s = !0, className: i }) {
116
116
  const r = $();
117
117
  return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", i), "aria-busy": e || void 0, children: [
118
- /* @__PURE__ */ a("div", { className: "alea-loading-content", ...R(e), children: t }),
118
+ /* @__PURE__ */ a("div", { className: "alea-loading-content", ...R(e), children: n }),
119
119
  e && /* @__PURE__ */ a("div", { className: "alea-loading-overlay", "data-blur": s || void 0, children: /* @__PURE__ */ a(L, { size: "md", "aria-label": l }) })
120
120
  ] });
121
121
  }
122
- function oa({ segments: e, total: t, label: l, valueFormat: s = (o) => String(o), showLegend: i = !0, className: r }) {
123
- const o = j(), p = t ?? e.reduce((n, c) => n + c.value, 0), f = (n, c) => n.color || `var(--alea-chart-${c % 8 + 1})`, h = e.reduce((n, c) => n + c.value, 0);
122
+ function oa({ segments: e, total: n, label: l, valueFormat: s = (o) => String(o), showLegend: i = !0, className: r }) {
123
+ const o = j(), p = n ?? e.reduce((t, c) => t + c.value, 0), h = (t, c) => t.color || `var(--alea-chart-${c % 8 + 1})`, f = e.reduce((t, c) => t + c.value, 0);
124
124
  return /* @__PURE__ */ u("div", { className: m("alea-progress-seg", r), children: [
125
125
  /* @__PURE__ */ u("div", { className: "alea-progress-seg-head", children: [
126
126
  /* @__PURE__ */ a("span", { id: o, className: "alea-label", children: l }),
127
127
  /* @__PURE__ */ u("span", { className: "alea-progress-seg-total", children: [
128
- s(h),
128
+ s(f),
129
129
  " of ",
130
130
  s(p)
131
131
  ] })
132
132
  ] }),
133
- /* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow": h, "aria-valuetext": e.map((n) => `${n.label} ${s(n.value)}`).join(", "), children: e.map((n, c) => /* @__PURE__ */ a("span", { className: "alea-progress-seg-part", style: { width: `${n.value / (p || 1) * 100}%`, background: f(n, c), animationDelay: `${c * 60}ms` } }, n.label)) }),
134
- i && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((n, c) => /* @__PURE__ */ u("li", { children: [
135
- /* @__PURE__ */ a("span", { style: { background: f(n, c) } }),
136
- n.label,
137
- /* @__PURE__ */ a("b", { children: s(n.value) })
138
- ] }, n.label)) })
133
+ /* @__PURE__ */ a("div", { className: "alea-progress-seg-bar", role: "meter", "aria-labelledby": o, "aria-valuemin": 0, "aria-valuemax": p, "aria-valuenow": f, "aria-valuetext": e.map((t) => `${t.label} ${s(t.value)}`).join(", "), children: e.map((t, c) => /* @__PURE__ */ a("span", { className: "alea-progress-seg-part", style: { width: `${t.value / (p || 1) * 100}%`, background: h(t, c), animationDelay: `${c * 60}ms` } }, t.label)) }),
134
+ i && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((t, c) => /* @__PURE__ */ u("li", { children: [
135
+ /* @__PURE__ */ a("span", { style: { background: h(t, c) } }),
136
+ t.label,
137
+ /* @__PURE__ */ a("b", { children: s(t.value) })
138
+ ] }, t.label)) })
139
139
  ] });
140
140
  }
141
- function da({ children: e, cite: t, source: l, className: s }) {
141
+ function da({ children: e, cite: n, source: l, className: s }) {
142
142
  return /* @__PURE__ */ u("figure", { className: m("alea-blockquote", s), children: [
143
143
  /* @__PURE__ */ a("blockquote", { cite: l, children: e }),
144
- t && /* @__PURE__ */ a("figcaption", { children: t })
144
+ n && /* @__PURE__ */ a("figcaption", { children: n })
145
145
  ] });
146
146
  }
147
- function ua({ items: e, marker: t = "bullet", spacing: l = "md", className: s }) {
148
- return /* @__PURE__ */ a(t === "number" ? "ol" : "ul", { className: m("alea-text-list", s), "data-marker": t, "data-spacing": l, children: e.map((r, o) => /* @__PURE__ */ u("li", { children: [
149
- t === "check" && /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true", className: "alea-text-list-check" }),
147
+ function ua({ items: e, marker: n = "bullet", spacing: l = "md", className: s }) {
148
+ return /* @__PURE__ */ a(n === "number" ? "ol" : "ul", { className: m("alea-text-list", s), "data-marker": n, "data-spacing": l, children: e.map((r, o) => /* @__PURE__ */ u("li", { children: [
149
+ n === "check" && /* @__PURE__ */ a(B, { size: 16, "aria-hidden": "true", className: "alea-text-list-check" }),
150
150
  /* @__PURE__ */ a("span", { children: r })
151
151
  ] }, o)) });
152
152
  }
153
- function ma({ children: e, size: t = "base", className: l }) {
154
- return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", l), "data-size": t, children: e });
153
+ function ma({ children: e, size: n = "base", className: l }) {
154
+ return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", l), "data-size": n, children: e });
155
155
  }
156
- function pa({ children: e, tone: t = "accent", size: l = "md", action: s, onDismiss: i, className: r, "aria-label": o }) {
157
- const p = $();
158
- o ?? (o = p.announcement);
159
- const [f, h] = k(!0);
160
- return f ? /* @__PURE__ */ u("div", { className: m("alea-banner", r), "data-tone": t, "data-size": l === "sm" ? l : void 0, "data-dismissible": i ? !0 : void 0, role: "region", "aria-label": o, children: [
156
+ function pa({ children: e, tone: n = "accent", size: l = "md", action: s, onDismiss: i, className: r, "aria-label": o, role: p = "region" }) {
157
+ const h = $();
158
+ o ?? (o = h.announcement);
159
+ const [f, t] = k(!0);
160
+ return f ? /* @__PURE__ */ u("div", { className: m("alea-banner", r), "data-tone": n, "data-size": l === "sm" ? l : void 0, "data-dismissible": i ? !0 : void 0, role: p, "aria-label": o, children: [
161
161
  /* @__PURE__ */ a("div", { className: "alea-banner-text", children: e }),
162
162
  s && /* @__PURE__ */ a("span", { className: "alea-banner-action", children: s }),
163
- i && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label": p.dismissAnnouncement, onClick: () => {
164
- h(!1), i();
163
+ i && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label": h.dismissAnnouncement, onClick: () => {
164
+ t(!1), i();
165
165
  }, children: /* @__PURE__ */ a(P, { size: 16 }) })
166
166
  ] }) : null;
167
167
  }
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsxs as c, jsx as a, Fragment as de } from "react/jsx-runtime";
3
- import { useId as ue, useState as N, useRef as v, useEffect as Q, useMemo as fe, useLayoutEffect as me, useCallback as he, useSyncExternalStore as pe } from "react";
4
- import { useLocale as we, DialogTrigger as Ne, Dialog as xe, Heading as ye } from "react-aria-components";
5
- import { Bell as U, CheckCheck as ge, X, CircleAlert as ve, TriangleAlert as Se, CircleCheck as be, Info as Ie, Check as Te } from "lucide-react";
3
+ import { useId as ue, useState as N, useRef as g, useEffect as Q, useMemo as fe, useLayoutEffect as me, useCallback as he, useSyncExternalStore as pe } from "react";
4
+ import { useLocale as we, DialogTrigger as Ne, Dialog as xe, Heading as ve } from "react-aria-components";
5
+ import { Bell as U, CheckCheck as ye, X, CircleAlert as ge, TriangleAlert as Se, CircleCheck as be, Info as Ie, Check as Te } from "lucide-react";
6
6
  import { Presence as Ee, Reveal as ke } from "@alea-design/motion";
7
7
  import { cx as ze } from "../../utils/cx.js";
8
8
  import { useStrings as De } from "../../i18n/strings.js";
@@ -11,7 +11,7 @@ import { CountBadge as Le, Badge as Pe } from "../display/Display.js";
11
11
  import { EmptyState as Me } from "../data/Data.js";
12
12
  import { Popover as $e } from "../overlay/Overlay.js";
13
13
  import { Drawer as Ae } from "../overlay/Drawer.js";
14
- const Be = { info: Ie, success: be, warning: Se, danger: ve }, J = "(max-width: 639.98px)";
14
+ const Be = { info: Ie, success: be, warning: Se, danger: ge }, J = "(max-width: 639.98px)";
15
15
  function Fe() {
16
16
  const r = he((d) => {
17
17
  var s;
@@ -71,7 +71,7 @@ function Ye({
71
71
  tones: { ...u.notificationTones, ...x == null ? void 0 : x.tones }
72
72
  }, P = ue(), q = Fe(), M = k === "drawer" || k === "auto" && q, [ee, te] = N(W ?? !1), $ = z ?? ee, ne = (t) => {
73
73
  z === void 0 && te(t), b == null || b(t);
74
- }, ae = Ce($), p = r.filter((t) => !t.read).length, A = v(null), [re, B] = N({ text: "", n: 0 });
74
+ }, ae = Ce($), p = r.filter((t) => !t.read).length, A = g(null), [re, B] = N({ text: "", n: 0 });
75
75
  Q(() => {
76
76
  const t = A.current;
77
77
  if (A.current = new Set(r.map((i) => i.id)), !t || !Y) return;
@@ -85,22 +85,22 @@ function Ye({
85
85
  const t = r.map((n) => ({ item: n, leaving: !1 })), e = new Set(r.map((n) => n.id));
86
86
  for (const n of F) e.has(n.item.id) || t.splice(Math.min(n.index, t.length), 0, { item: n.item, leaving: !0 });
87
87
  return t;
88
- }, [r, F]), T = v(null), H = v(null), [R, y] = N(null), ie = r.some((t) => t.id === R) ? R : ((K = r[0]) == null ? void 0 : K.id) ?? null, g = v(null);
88
+ }, [r, F]), T = g(null), H = g(null), [R, v] = N(null), ie = r.some((t) => t.id === R) ? R : ((K = r[0]) == null ? void 0 : K.id) ?? null, y = g(null);
89
89
  me(() => {
90
90
  var n;
91
- const t = g.current;
91
+ const t = y.current;
92
92
  if (!t) return;
93
93
  const e = t === "empty" ? H.current : (n = T.current) == null ? void 0 : n.querySelector(`[data-nid="${CSS.escape(t)}"]`);
94
- e && (g.current = null, e.focus());
94
+ e && (y.current = null, e.focus());
95
95
  });
96
96
  const E = (t) => d == null ? void 0 : d(t), j = (t) => {
97
- g.current = t.id, y(t.id), o == null || o(t), E(r.map((e) => e.id === t.id ? { ...e, read: !0 } : e));
97
+ y.current = t.id, v(t.id), o == null || o(t), E(r.map((e) => e.id === t.id ? { ...e, read: !0 } : e));
98
98
  }, oe = () => {
99
99
  const t = r.filter((e) => !e.read);
100
100
  t.length && (s == null || s(t), E(r.map((e) => e.read ? e : { ...e, read: !0 })));
101
101
  }, se = (t) => {
102
102
  const e = r.findIndex((i) => i.id === t.id), n = r[e + 1] ?? r[e - 1];
103
- g.current = n ? n.id : "empty", n && y(n.id), C((i) => [...i, { item: t, index: e }]), window.setTimeout(() => C((i) => i.filter((h) => h.item.id !== t.id)), 400), l == null || l(t), E(r.filter((i) => i.id !== t.id));
103
+ y.current = n ? n.id : "empty", n && v(n.id), C((i) => [...i, { item: t, index: e }]), window.setTimeout(() => C((i) => i.filter((h) => h.item.id !== t.id)), 400), l == null || l(t), E(r.filter((i) => i.id !== t.id));
104
104
  }, le = (t) => {
105
105
  var e, n;
106
106
  (n = (e = t.action) == null ? void 0 : e.onPress) == null || n.call(e), m == null || m(t), t.read || j(t);
@@ -110,14 +110,14 @@ function Ye({
110
110
  const e = [...((h = T.current) == null ? void 0 : h.querySelectorAll("[data-nid]:not([data-leaving])")) ?? []];
111
111
  if (!e.length) return;
112
112
  const n = e.findIndex((w) => w.contains(t.target)), i = t.key === "Home" ? 0 : t.key === "End" ? e.length - 1 : t.key === "ArrowDown" ? Math.min(n + 1, e.length - 1) : Math.max(n - 1, 0);
113
- t.preventDefault(), y(e[i].dataset.nid ?? null), e[i].focus();
113
+ t.preventDefault(), v(e[i].dataset.nid ?? null), e[i].focus();
114
114
  }, G = /* @__PURE__ */ a(xe, { className: "alea-notifs", "aria-labelledby": P, children: ({ close: t }) => /* @__PURE__ */ c(de, { children: [
115
115
  /* @__PURE__ */ c("div", { className: "alea-notifs-head", children: [
116
- /* @__PURE__ */ c(ye, { slot: "title", id: P, className: "alea-notifs-title", children: [
116
+ /* @__PURE__ */ c(ve, { slot: "title", id: P, className: "alea-notifs-title", children: [
117
117
  f.title,
118
118
  p > 0 && /* @__PURE__ */ a(Pe, { tone: "accent", size: "sm", "aria-hidden": "true", children: p > I ? `${I}+` : p })
119
119
  ] }),
120
- /* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ge, {}), isDisabled: p === 0, onPress: oe, children: f.markAllRead }),
120
+ /* @__PURE__ */ a(_, { variant: "text", size: "xs", iconStart: /* @__PURE__ */ a(ye, {}), isDisabled: p === 0, onPress: oe, children: f.markAllRead }),
121
121
  M && /* @__PURE__ */ a(S, { "aria-label": u.close, size: "xs", onPress: t, children: /* @__PURE__ */ a(X, {}) })
122
122
  ] }),
123
123
  O.length === 0 ? /* @__PURE__ */ a("div", { className: "alea-notifs-empty", ref: H, tabIndex: -1, children: /* @__PURE__ */ a(Me, { size: "sm", title: f.emptyTitle, description: f.emptyDescription, icon: /* @__PURE__ */ a(U, {}) }) }) : /* @__PURE__ */ a("ul", { className: "alea-notifs-list", ref: T, onKeyDown: ce, children: O.map(({ item: e, leaving: n }, i) => {
@@ -131,7 +131,7 @@ function Ye({
131
131
  "data-unread": e.read ? void 0 : !0,
132
132
  "data-leaving": n || void 0,
133
133
  tabIndex: w ? 0 : -1,
134
- onFocus: () => !n && y(e.id),
134
+ onFocus: () => !n && v(e.id),
135
135
  children: /* @__PURE__ */ c(ke, { className: "alea-notif-inner", motion: "rise", delay: Math.min(i, 6) * 30, children: [
136
136
  /* @__PURE__ */ a("span", { className: "alea-notif-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(h, {}) }),
137
137
  /* @__PURE__ */ c("div", { className: "alea-notif-body", children: [
@@ -177,7 +177,7 @@ function Ye({
177
177
  ] }),
178
178
  M ? /* @__PURE__ */ a(Ae, { placement: "bottom", size: 640, motion: D, className: "alea-notifs-drawer", children: G }) : /* @__PURE__ */ a($e, { placement: V, size: "lg", motion: D, className: "alea-notifs-popover", children: G })
179
179
  ] }),
180
- /* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", children: re.text })
180
+ /* @__PURE__ */ a("span", { className: "alea-visually-hidden", role: "status", "aria-live": "polite", "aria-atomic": "true", "data-live-announcer": "true", children: re.text })
181
181
  ] });
182
182
  }
183
183
  export {
@@ -2,8 +2,12 @@ import { type ReactNode, type HTMLAttributes } from 'react';
2
2
  import { type Key } from 'react-aria-components';
3
3
  import type { MotionProp } from '@alea-design/motion';
4
4
  export interface OTPFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
5
- /** Number of characters. Default 6. */
5
+ /** Number of characters. Default 6 (or the sum of `groups` when that is a list). */
6
6
  length?: number;
7
+ /** Draws the boxes in blocks with a wider gap between them, for codes that are read and typed in pieces (`4` makes blocks of four, `[3, 3, 4]` sets each block). Screen readers hear "Block 2 of 3" when focus enters a block. On a narrow screen a block that does not fit goes to the next line, never splitting in the middle. */
8
+ groups?: number | number[];
9
+ /** One character at a time, tested after it is upper-cased (alphanumeric). Use it to leave letters out of an alphabet, for example `/[0-9A-HJKMNP-TV-Z]/` for a code people read aloud. Default: digits for numeric, letters and digits for alphanumeric. */
10
+ accept?: RegExp;
7
11
  /** The visible label ("Verification code"). */
8
12
  label?: ReactNode;
9
13
  /** The code (controlled). */