@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,120 +1,120 @@
1
1
  "use client";
2
- import { jsxs as i, jsx as a, Fragment as S } from "react/jsx-runtime";
3
- import { useContext as $ } from "react";
4
- import { Calendar as x, DateField as z, DatePicker as B, Group as b, Button as m, Dialog as P, DateRangePicker as G, DateInput as p, DateSegment as v, RangeCalendar as H, TimeField as T, CalendarMonthPicker as j, CalendarYearPicker as A, Heading as E, DateRangePickerStateContext as I, CalendarGrid as O, CalendarGridHeader as V, CalendarHeaderCell as Y, CalendarGridBody as _, CalendarCell as J } from "react-aria-components";
5
- import { CalendarDays as k, ChevronLeft as K, ChevronRight as Q } from "lucide-react";
2
+ import { jsxs as i, jsx as a, Fragment as $ } from "react/jsx-runtime";
3
+ import { useContext as x } from "react";
4
+ import { Calendar as z, DateField as B, DatePicker as G, Group as k, Button as o, Dialog as w, DateRangePicker as T, DateInput as p, DateSegment as v, RangeCalendar as H, TimeField as j, CalendarMonthPicker as A, CalendarYearPicker as E, Heading as I, DateRangePickerStateContext as O, CalendarGrid as V, CalendarGridHeader as Y, CalendarHeaderCell as _, CalendarGridBody as J, CalendarCell as K } from "react-aria-components";
5
+ import { CalendarDays as y, ChevronLeft as Q, ChevronRight as U } from "lucide-react";
6
6
  import { withBase as s } from "../../utils/cx.js";
7
- import { Label as U, Description as W, FieldError as X } from "../field/Field.js";
8
- import { Popover as w } from "../overlay/Overlay.js";
9
- import { Button as Z } from "../button/Button.js";
10
- import { FieldSpinner as u, loadingAttrs as h } from "../field/FieldLoading.js";
7
+ import { Label as W, Description as X, FieldError as Z } from "../field/Field.js";
8
+ import { Popover as F } from "../overlay/Overlay.js";
9
+ import { Button as L } from "../button/Button.js";
10
+ import { FieldSpinner as m, loadingAttrs as u } from "../field/FieldLoading.js";
11
11
  import { useStrings as C } from "../../i18n/strings.js";
12
- function y({ pickers: r }) {
12
+ function q({ pickers: r }) {
13
13
  return /* @__PURE__ */ i("header", { className: "alea-cal-head", children: [
14
- /* @__PURE__ */ a(m, { slot: "previous", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(K, { size: 16 }) }),
14
+ /* @__PURE__ */ a(o, { slot: "previous", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(Q, { size: 16 }) }),
15
15
  r ? /* @__PURE__ */ i("div", { className: "alea-cal-pickers", children: [
16
- /* @__PURE__ */ a(j, { children: (l) => /* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", "aria-label": l["aria-label"], value: String(l.value), onChange: (e) => l.onChange(Number(e.target.value)), children: l.items.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.formatted }, e.id)) }) }),
17
- /* @__PURE__ */ a(A, { children: (l) => /* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", "aria-label": l["aria-label"], value: String(l.value), onChange: (e) => l.onChange(Number(e.target.value)), children: l.items.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.formatted }, e.id)) }) })
18
- ] }) : /* @__PURE__ */ a(E, { className: "alea-cal-title" }),
19
- /* @__PURE__ */ a(m, { slot: "next", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(Q, { size: 16 }) })
16
+ /* @__PURE__ */ a(A, { children: (l) => /* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", "aria-label": l["aria-label"], value: String(l.value), onChange: (e) => l.onChange(Number(e.target.value)), children: l.items.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.formatted }, e.id)) }) }),
17
+ /* @__PURE__ */ a(E, { children: (l) => /* @__PURE__ */ a("select", { className: "alea-cal-select alea-focus-ring", "aria-label": l["aria-label"], value: String(l.value), onChange: (e) => l.onChange(Number(e.target.value)), children: l.items.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.formatted }, e.id)) }) })
18
+ ] }) : /* @__PURE__ */ a(I, { className: "alea-cal-title" }),
19
+ /* @__PURE__ */ a(o, { slot: "next", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(U, { size: 16 }) })
20
20
  ] });
21
21
  }
22
- function R({ offset: r = 0 }) {
23
- return /* @__PURE__ */ i(O, { className: "alea-cal-grid", weekdayStyle: "short", offset: r ? { months: r } : void 0, children: [
24
- /* @__PURE__ */ a(V, { children: (l) => /* @__PURE__ */ a(Y, { className: "alea-cal-weekday", children: l }) }),
25
- /* @__PURE__ */ a(_, { children: (l) => /* @__PURE__ */ a(J, { date: l, className: "alea-cal-cell alea-focus-ring" }) })
22
+ function P({ offset: r = 0 }) {
23
+ return /* @__PURE__ */ i(V, { className: "alea-cal-grid", weekdayStyle: "short", offset: r ? { months: r } : void 0, children: [
24
+ /* @__PURE__ */ a(Y, { children: (l) => /* @__PURE__ */ a(_, { className: "alea-cal-weekday", children: l }) }),
25
+ /* @__PURE__ */ a(J, { children: (l) => /* @__PURE__ */ a(K, { date: l, className: "alea-cal-cell alea-focus-ring" }) })
26
26
  ] });
27
27
  }
28
- const F = ({ count: r }) => r > 1 ? /* @__PURE__ */ a("div", { className: "alea-cal-months", children: Array.from({ length: r }, (l, e) => /* @__PURE__ */ a(R, { offset: e }, e)) }) : /* @__PURE__ */ a(R, {});
29
- function L({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
30
- return /* @__PURE__ */ i(x, { ...n, visibleDuration: e > 1 ? { months: e } : n.visibleDuration, className: s("alea-calendar", r), "data-months": e > 1 ? e : void 0, children: [
31
- /* @__PURE__ */ a(y, { pickers: l }),
32
- /* @__PURE__ */ a(F, { count: e })
28
+ const S = ({ count: r }) => r > 1 ? /* @__PURE__ */ a("div", { className: "alea-cal-months", children: Array.from({ length: r }, (l, e) => /* @__PURE__ */ a(P, { offset: e }, e)) }) : /* @__PURE__ */ a(P, {});
29
+ function M({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
30
+ return /* @__PURE__ */ i(z, { ...n, visibleDuration: e > 1 ? { months: e } : n.visibleDuration, className: s("alea-calendar", r), "data-months": e > 1 ? e : void 0, children: [
31
+ /* @__PURE__ */ a(q, { pickers: l }),
32
+ /* @__PURE__ */ a(S, { count: e })
33
33
  ] });
34
34
  }
35
- function M({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
35
+ function aa({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
36
36
  return /* @__PURE__ */ i(H, { ...n, visibleDuration: e > 1 ? { months: e } : n.visibleDuration, className: s("alea-calendar alea-range-calendar", r), "data-months": e > 1 ? e : void 0, children: [
37
- /* @__PURE__ */ a(y, { pickers: l }),
38
- /* @__PURE__ */ a(F, { count: e })
37
+ /* @__PURE__ */ a(q, { pickers: l }),
38
+ /* @__PURE__ */ a(S, { count: e })
39
39
  ] });
40
40
  }
41
- function f({ label: r, isRequired: l }) {
42
- return r ? /* @__PURE__ */ i(U, { children: [
41
+ function h({ label: r, isRequired: l }) {
42
+ return r ? /* @__PURE__ */ i(W, { children: [
43
43
  r,
44
44
  l && /* @__PURE__ */ a("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" })
45
45
  ] }) : null;
46
46
  }
47
- function N({ description: r, errorMessage: l }) {
48
- return /* @__PURE__ */ i(S, { children: [
49
- r && /* @__PURE__ */ a(W, { children: r }),
50
- /* @__PURE__ */ a(X, { children: l })
47
+ function f({ description: r, errorMessage: l }) {
48
+ return /* @__PURE__ */ i($, { children: [
49
+ r && /* @__PURE__ */ a(X, { children: r }),
50
+ /* @__PURE__ */ a(Z, { children: l })
51
51
  ] });
52
52
  }
53
53
  function D() {
54
54
  return /* @__PURE__ */ a(p, { className: "alea-date-input", children: (r) => /* @__PURE__ */ a(v, { segment: r, className: "alea-date-segment" }) });
55
55
  }
56
- function ma({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
57
- return /* @__PURE__ */ i(z, { ...c, className: s("alea-field", t), ...h(n), children: [
58
- /* @__PURE__ */ a(f, { label: r, isRequired: c.isRequired }),
56
+ function ua({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
57
+ return /* @__PURE__ */ i(B, { ...c, className: s("alea-field", t), ...u(n), children: [
58
+ /* @__PURE__ */ a(h, { label: r, isRequired: c.isRequired }),
59
59
  /* @__PURE__ */ i("div", { className: "alea-input-wrap alea-date-wrap", "aria-busy": n || void 0, children: [
60
60
  /* @__PURE__ */ a(D, {}),
61
- n && /* @__PURE__ */ a(u, {})
61
+ n && /* @__PURE__ */ a(m, {})
62
62
  ] }),
63
- /* @__PURE__ */ a(N, { description: l, errorMessage: e })
63
+ /* @__PURE__ */ a(f, { description: l, errorMessage: e })
64
64
  ] });
65
65
  }
66
- function ua({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
67
- return /* @__PURE__ */ i(T, { ...c, className: s("alea-field", t), ...h(n), children: [
68
- /* @__PURE__ */ a(f, { label: r, isRequired: c.isRequired }),
66
+ function ha({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
67
+ return /* @__PURE__ */ i(j, { ...c, className: s("alea-field", t), ...u(n), children: [
68
+ /* @__PURE__ */ a(h, { label: r, isRequired: c.isRequired }),
69
69
  /* @__PURE__ */ i("div", { className: "alea-input-wrap alea-date-wrap", "aria-busy": n || void 0, children: [
70
70
  /* @__PURE__ */ a(D, {}),
71
- n && /* @__PURE__ */ a(u, {})
71
+ n && /* @__PURE__ */ a(m, {})
72
72
  ] }),
73
- /* @__PURE__ */ a(N, { description: l, errorMessage: e })
73
+ /* @__PURE__ */ a(f, { description: l, errorMessage: e })
74
74
  ] });
75
75
  }
76
- function ha({ motion: r, label: l, description: e, errorMessage: n, isLoading: t, className: c, ...d }) {
77
- const o = C();
78
- return /* @__PURE__ */ i(B, { ...d, className: s("alea-field", c), ...h(t), children: [
79
- /* @__PURE__ */ a(f, { label: l, isRequired: d.isRequired }),
80
- /* @__PURE__ */ i(b, { className: "alea-input-wrap alea-date-wrap", "aria-busy": t || void 0, children: [
76
+ function fa({ motion: r, label: l, description: e, errorMessage: n, isLoading: t, className: c, ...d }) {
77
+ const g = C();
78
+ return /* @__PURE__ */ i(G, { ...d, className: s("alea-field", c), ...u(t), children: [
79
+ /* @__PURE__ */ a(h, { label: l, isRequired: d.isRequired }),
80
+ /* @__PURE__ */ i(k, { className: "alea-input-wrap alea-date-wrap", "aria-busy": t || void 0, children: [
81
81
  /* @__PURE__ */ a(D, {}),
82
- t && /* @__PURE__ */ a(u, {}),
83
- /* @__PURE__ */ a(m, { className: "alea-input-clear alea-focus-ring", "aria-label": o.openCalendar, children: /* @__PURE__ */ a(k, { size: 16 }) })
82
+ t && /* @__PURE__ */ a(m, {}),
83
+ /* @__PURE__ */ a(o, { className: "alea-input-clear alea-focus-ring", "aria-label": g.openCalendar, children: /* @__PURE__ */ a(y, { size: 16 }) })
84
84
  ] }),
85
- /* @__PURE__ */ a(N, { description: e, errorMessage: n }),
86
- /* @__PURE__ */ a(w, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ a(P, { className: "alea-cal-dialog", children: /* @__PURE__ */ a(L, {}) }) })
85
+ /* @__PURE__ */ a(f, { description: e, errorMessage: n }),
86
+ /* @__PURE__ */ a(F, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ a(w, { className: "alea-cal-dialog", children: /* @__PURE__ */ a(M, {}) }) })
87
87
  ] });
88
88
  }
89
- function aa({ presets: r }) {
90
- const l = C(), e = $(I);
91
- return /* @__PURE__ */ a("div", { className: "alea-cal-presets", role: "group", "aria-label": l.dateRangePresets, children: r.map((n, t) => /* @__PURE__ */ a(Z, { size: "sm", variant: "soft", onPress: () => {
89
+ function ea({ presets: r }) {
90
+ const l = C(), e = x(O);
91
+ return /* @__PURE__ */ a("div", { className: "alea-cal-presets", role: "group", "aria-label": l.dateRangePresets, children: r.map((n, t) => /* @__PURE__ */ a(L, { size: "sm", variant: "soft", onPress: () => {
92
92
  e == null || e.setValue(n.range()), e == null || e.setOpen(!1);
93
93
  }, children: n.label }, n.id ?? (typeof n.label == "string" ? n.label : t))) });
94
94
  }
95
- function fa({ motion: r, presets: l, label: e, description: n, errorMessage: t, isLoading: c, className: d, ...o }) {
96
- const q = C();
97
- return /* @__PURE__ */ i(G, { ...o, className: s("alea-field", d), ...h(c), children: [
98
- /* @__PURE__ */ a(f, { label: e, isRequired: o.isRequired }),
99
- /* @__PURE__ */ i(b, { className: "alea-input-wrap alea-date-wrap", "aria-busy": c || void 0, children: [
100
- /* @__PURE__ */ a(p, { slot: "start", className: "alea-date-input", children: (g) => /* @__PURE__ */ a(v, { segment: g, className: "alea-date-segment" }) }),
101
- /* @__PURE__ */ a("span", { className: "alea-date-dash", "aria-hidden": "true", children: "to" }),
102
- /* @__PURE__ */ a(p, { slot: "end", className: "alea-date-input", children: (g) => /* @__PURE__ */ a(v, { segment: g, className: "alea-date-segment" }) }),
103
- c && /* @__PURE__ */ a(u, {}),
104
- /* @__PURE__ */ a(m, { className: "alea-input-clear alea-focus-ring", "aria-label": q.openCalendar, children: /* @__PURE__ */ a(k, { size: 16 }) })
95
+ function ga({ motion: r, presets: l, separator: e, label: n, description: t, errorMessage: c, isLoading: d, className: g, ...R }) {
96
+ const b = C();
97
+ return /* @__PURE__ */ i(T, { ...R, className: s("alea-field", g), ...u(d), children: [
98
+ /* @__PURE__ */ a(h, { label: n, isRequired: R.isRequired }),
99
+ /* @__PURE__ */ i(k, { className: "alea-input-wrap alea-date-wrap alea-date-range", "aria-busy": d || void 0, children: [
100
+ /* @__PURE__ */ a(p, { slot: "start", className: "alea-date-input", children: (N) => /* @__PURE__ */ a(v, { segment: N, className: "alea-date-segment" }) }),
101
+ /* @__PURE__ */ a("span", { className: "alea-date-dash", "aria-hidden": "true", children: e ?? b.dateRangeTo }),
102
+ /* @__PURE__ */ a(p, { slot: "end", className: "alea-date-input", children: (N) => /* @__PURE__ */ a(v, { segment: N, className: "alea-date-segment" }) }),
103
+ d && /* @__PURE__ */ a(m, {}),
104
+ /* @__PURE__ */ a(o, { className: "alea-input-clear alea-focus-ring", "aria-label": b.openCalendar, children: /* @__PURE__ */ a(y, { size: 16 }) })
105
105
  ] }),
106
- /* @__PURE__ */ a(N, { description: n, errorMessage: t }),
107
- /* @__PURE__ */ a(w, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ i(P, { className: "alea-cal-dialog", children: [
108
- l && l.length > 0 && /* @__PURE__ */ a(aa, { presets: l }),
109
- /* @__PURE__ */ a(M, {})
106
+ /* @__PURE__ */ a(f, { description: t, errorMessage: c }),
107
+ /* @__PURE__ */ a(F, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ i(w, { className: "alea-cal-dialog", children: [
108
+ l && l.length > 0 && /* @__PURE__ */ a(ea, { presets: l }),
109
+ /* @__PURE__ */ a(aa, {})
110
110
  ] }) })
111
111
  ] });
112
112
  }
113
113
  export {
114
- L as Calendar,
115
- ma as DateField,
116
- ha as DatePicker,
117
- fa as DateRangePicker,
118
- M as RangeCalendar,
119
- ua as TimeField
114
+ M as Calendar,
115
+ ua as DateField,
116
+ fa as DatePicker,
117
+ ga as DateRangePicker,
118
+ aa as RangeCalendar,
119
+ ha as TimeField
120
120
  };
@@ -7,10 +7,12 @@ export interface FormProps extends Omit<RACFormProps, 'onSubmit'> {
7
7
  gap?: number;
8
8
  /** After the server returns field errors, moves focus to the first field marked invalid (inputs, pickers, date fields). Default true. Fields that fail validation before submit already take focus on their own. */
9
9
  focusInvalid?: boolean;
10
+ /** Keeps controls from being announced as invalid on arrival (Chrome does that for any field that fails native validation, such as an empty required one). The error still shows and is announced once it is displayed. Default true. */
11
+ quietValidity?: boolean;
10
12
  children: ReactNode;
11
13
  }
12
14
  /** A form that validates on submit, moves focus to the first problem, and shows server errors on their fields. */
13
- export declare function Form({ onSubmit, gap, focusInvalid, children, className, validationBehavior, style, ...props }: FormProps): import("react").JSX.Element;
15
+ export declare function Form({ onSubmit, gap, focusInvalid, quietValidity, children, className, validationBehavior, style, ...props }: FormProps): import("react").JSX.Element;
14
16
  export interface FormActionsProps extends HTMLAttributes<HTMLDivElement> {
15
17
  /** The submit button text. Default "Save". */
16
18
  submitLabel?: ReactNode;
@@ -1,66 +1,58 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as S } from "react/jsx-runtime";
3
- import { forwardRef as E, useState as v, useRef as b, useEffect as j } from "react";
4
- import { Form as N } from "react-aria-components";
5
- import { cx as F } from "../../utils/cx.js";
6
- import { spaceFromPx as w } from "../../utils/space.js";
7
- import { Alert as A } from "../feedback/Feedback.js";
8
- import { Button as O } from "../button/Button.js";
9
- import { useStrings as g } from "../../i18n/strings.js";
10
- function T(e) {
11
- var t;
12
- if (!e) return;
13
- const r = e.querySelector('[aria-invalid="true"]:not([disabled]):not([type="hidden"])');
14
- if (r) {
15
- r.focus();
16
- return;
17
- }
18
- (t = e.querySelector('[data-invalid] :is(input, button, [tabindex="0"]):not([disabled]):not([type="hidden"])')) == null || t.focus();
19
- }
20
- function P({ onSubmit: e, gap: r = 20, focusInvalid: t = !0, children: u, className: s, validationBehavior: n = "native", style: i, ...o }) {
21
- const [c, m] = v({}), [l, y] = v(!1), h = b(null), d = b(!1);
22
- return j(() => {
23
- d.current && (d.current = !1, T(h.current));
24
- }, [c]), /* @__PURE__ */ a(
25
- N,
2
+ import { jsx as t, jsxs as N } from "react/jsx-runtime";
3
+ import { forwardRef as g, useState as E, useRef as F, useEffect as S } from "react";
4
+ import { Form as w } from "react-aria-components";
5
+ import { cx as x } from "../../utils/cx.js";
6
+ import { spaceFromPx as A } from "../../utils/space.js";
7
+ import { Alert as O } from "../feedback/Feedback.js";
8
+ import { Button as B } from "../button/Button.js";
9
+ import { useStrings as b } from "../../i18n/strings.js";
10
+ import { useQuietNativeValidity as D, focusFirstInvalid as R } from "./validity.js";
11
+ function q({ onSubmit: l, gap: e = 20, focusInvalid: o = !0, quietValidity: c = !0, children: s, className: r, validationBehavior: n = "native", style: a, ...i }) {
12
+ const [m, u] = E({}), [h, v] = E(!1), f = F(null), d = F(!1);
13
+ return D(f, c), S(() => {
14
+ d.current && (d.current = !1, R(f.current));
15
+ }, [m]), /* @__PURE__ */ t(
16
+ w,
26
17
  {
27
- ...o,
18
+ ...i,
19
+ ref: f,
28
20
  validationBehavior: n,
29
- validationErrors: { ...c, ...o.validationErrors || {} },
30
- className: F("alea-form", s),
31
- style: { gap: w(r), ...i },
32
- "data-busy": l || void 0,
33
- "aria-busy": l || void 0,
34
- onSubmit: async (f) => {
35
- if (f.preventDefault(), !e) return;
36
- const x = Object.fromEntries(new FormData(f.currentTarget));
37
- y(!0), h.current = f.currentTarget;
21
+ validationErrors: { ...m, ...i.validationErrors || {} },
22
+ className: x("alea-form", r),
23
+ style: { gap: A(e), ...a },
24
+ "data-busy": h || void 0,
25
+ "aria-busy": h || void 0,
26
+ onSubmit: async (p) => {
27
+ if (p.preventDefault(), !l) return;
28
+ const j = Object.fromEntries(new FormData(p.currentTarget));
29
+ v(!0);
38
30
  try {
39
- const p = await e(x, f);
40
- d.current = t && !!p && Object.keys(p).length > 0, m(p || {});
31
+ const y = await l(j, p);
32
+ d.current = o && !!y && Object.keys(y).length > 0, u(y || {});
41
33
  } finally {
42
- y(!1);
34
+ v(!1);
43
35
  }
44
36
  },
45
- children: u
37
+ children: s
46
38
  }
47
39
  );
48
40
  }
49
- const W = E(function({ submitLabel: r, secondary: t, isLoading: u, align: s = "start", destructive: n, form: i, className: o, ...c }, m) {
50
- const l = g();
51
- return r ?? (r = l.save), /* @__PURE__ */ S("div", { ref: m, ...c, className: F("alea-form-actions", o), "data-align": n ? "end" : s, "data-split": n ? !0 : void 0, children: [
52
- n && /* @__PURE__ */ a("span", { className: "alea-form-actions-start", children: n }),
53
- t,
54
- /* @__PURE__ */ a(O, { type: "submit", form: i, isLoading: u, fullWidth: s === "stretch", children: r })
41
+ const z = g(function({ submitLabel: e, secondary: o, isLoading: c, align: s = "start", destructive: r, form: n, className: a, ...i }, m) {
42
+ const u = b();
43
+ return e ?? (e = u.save), /* @__PURE__ */ N("div", { ref: m, ...i, className: x("alea-form-actions", a), "data-align": r ? "end" : s, "data-split": r ? !0 : void 0, children: [
44
+ r && /* @__PURE__ */ t("span", { className: "alea-form-actions-start", children: r }),
45
+ o,
46
+ /* @__PURE__ */ t(B, { type: "submit", form: n, isLoading: c, fullWidth: s === "stretch", children: e })
55
47
  ] });
56
- }), z = E(function({ errors: r, title: t, ...u }, s) {
57
- const n = g();
58
- t ?? (t = n.fixToContinue);
59
- const i = Object.entries(r);
60
- return i.length ? /* @__PURE__ */ a(A, { ref: s, ...u, tone: "danger", title: t, live: !0, children: /* @__PURE__ */ a("ul", { className: "alea-error-summary", children: i.map(([o, c]) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("a", { href: `#${o}`, children: c }) }, o)) }) }) : null;
48
+ }), G = g(function({ errors: e, title: o, ...c }, s) {
49
+ const r = b();
50
+ o ?? (o = r.fixToContinue);
51
+ const n = Object.entries(e);
52
+ return n.length ? /* @__PURE__ */ t(O, { ref: s, ...c, tone: "danger", title: o, live: !0, children: /* @__PURE__ */ t("ul", { className: "alea-error-summary", children: n.map(([a, i]) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t("a", { href: `#${a}`, children: i }) }, a)) }) }) : null;
61
53
  });
62
54
  export {
63
- z as ErrorSummary,
64
- P as Form,
65
- W as FormActions
55
+ G as ErrorSummary,
56
+ q as Form,
57
+ z as FormActions
66
58
  };
@@ -0,0 +1,22 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Moves focus to the first invalid control inside `root`: the control itself (aria-invalid) or, failing that, the first
4
+ * focusable thing inside an invalid field. If focus is already on it (Enter pressed inside the field) it is released
5
+ * and taken again, because focus that does not move announces nothing and the reader would never hear the error.
6
+ */
7
+ export declare function focusFirstInvalid(root: ParentNode | null | undefined): void;
8
+ /**
9
+ * For validating by hand on submit: store your messages, then call `request()` and focus goes to the first invalid
10
+ * control inside the element that has `ref`. Every call counts, even when the errors are the same as last time.
11
+ */
12
+ export declare function useFirstInvalidFocus<T extends HTMLElement = HTMLDivElement>(): {
13
+ ref: RefObject<T | null>;
14
+ request: () => void;
15
+ };
16
+ /**
17
+ * Chrome exposes every control that fails native validation as invalid, before anyone touches it: an empty required
18
+ * field is read "invalid entry" on arrival. While no error is on screen the control is marked aria-invalid="false";
19
+ * when the interface shows the error React sets "true" and that wins. Pass the element that contains the controls
20
+ * (a form, a dialog); new controls added later are covered too.
21
+ */
22
+ export declare function useQuietNativeValidity(ref: RefObject<HTMLElement | null>, enabled?: boolean): void;
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useRef as l, useState as f, useEffect as d, useCallback as b } from "react";
3
+ const c = 'input:not([type="hidden"]), textarea, select', v = '[aria-invalid="true"]:not([disabled]):not([type="hidden"])', h = '[data-invalid] :is(input, button, [tabindex="0"]):not([disabled]):not([type="hidden"])';
4
+ function p(e) {
5
+ if (!e) return;
6
+ const t = e.querySelector(v) ?? e.querySelector(h);
7
+ t && (document.activeElement === t && t.blur(), t.focus());
8
+ }
9
+ function I() {
10
+ const e = l(null), [t, n] = f(0);
11
+ d(() => {
12
+ t > 0 && p(e.current);
13
+ }, [t]);
14
+ const r = b(() => n((s) => s + 1), []);
15
+ return { ref: e, request: r };
16
+ }
17
+ function m(e, t = !0) {
18
+ d(() => {
19
+ const n = e.current;
20
+ if (!n || !t) return;
21
+ const r = (i) => {
22
+ i.matches(c) && !i.hasAttribute("aria-invalid") && i.setAttribute("aria-invalid", "false");
23
+ }, s = (i) => i.querySelectorAll(c).forEach(r);
24
+ s(n);
25
+ const o = new MutationObserver((i) => {
26
+ for (const u of i)
27
+ u.type === "attributes" ? r(u.target) : u.addedNodes.forEach((a) => {
28
+ a instanceof Element && (r(a), s(a));
29
+ });
30
+ });
31
+ return o.observe(n, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["aria-invalid"] }), () => o.disconnect();
32
+ }, [e, t]);
33
+ }
34
+ export {
35
+ p as focusFirstInvalid,
36
+ I as useFirstInvalidFocus,
37
+ m as useQuietNativeValidity
38
+ };
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { type GridListProps, type GridListItemProps, type Key, type DropIndicatorProps } from 'react-aria-components';
3
3
  import { type SurfaceProps } from '../surface/Surface.js';
4
+ import type { RowMotion } from '@alea-design/motion';
4
5
  type WithId = {
5
6
  id: Key;
6
7
  };
@@ -18,8 +19,8 @@ export interface ListViewProps<T extends object> extends GridListProps<T>, Surfa
18
19
  onItemsChange?: (items: T[]) => void;
19
20
  /** Lists with the same dragGroup accept each other's rows. Items must be plain data (they travel as JSON). */
20
21
  dragGroup?: string;
21
- /** Rows added to `items` rise in (staggered), and rows removed dissolve and give their space back before they leave. Needs items with an id. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. */
22
- animateRows?: boolean;
22
+ /** Rows added to `items` rise in (staggered), and rows removed dissolve and give their space back before they leave. Needs items with an id. The removed row is disabled while it leaves. Off by default; reduced motion keeps only the fades. Pass an object to decide when: `max` rows above which nothing animates, `resetOn` values (search, filter, page) whose change is not news, `enter` and `leave` to animate only one of the two. */
23
+ animateRows?: RowMotion;
23
24
  }
24
25
  /** A list of rich items people can select, open or act on, with keyboard navigation. Rows can be dragged to reorder, or between lists; cards can sit in a grid. */
25
26
  export declare function ListView<T extends object>({ variant, layout, onItemsChange, dragGroup, animateRows, items: itemsIn, surface, radius, className, children: childrenIn, dependencies: depsIn, ...props }: ListViewProps<T>): import("react").JSX.Element;
@@ -164,6 +164,8 @@ export interface BannerProps {
164
164
  children: ReactNode;
165
165
  /** accent (default, gradient), neutral, success, info, warning or danger. */
166
166
  tone?: 'accent' | 'neutral' | 'success' | 'info' | 'warning' | 'danger';
167
+ /** md (default) or sm: a compact bar with smaller text and padding, for notes that sit above a page without pushing it down (an environment notice). */
168
+ size?: 'sm' | 'md';
167
169
  /** A link or button after the message. */
168
170
  action?: ReactNode;
169
171
  /** Shows a close button; called when closed. */
@@ -173,4 +175,4 @@ export interface BannerProps {
173
175
  className?: string;
174
176
  }
175
177
  /** A site-wide announcement bar above the header: launches, sales, outages. */
176
- export declare function Banner({ children, tone, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
178
+ export declare function Banner({ children, tone, size, action, onDismiss, className, 'aria-label': label }: BannerProps): import("react").JSX.Element | null;
@@ -8,14 +8,14 @@ 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, ...c }, r) {
11
+ const aa = M(function({ target: t = "main", children: l, className: s, ...i }, r) {
12
12
  const o = $();
13
- return l ?? (l = o.skipToContent), /* @__PURE__ */ a("a", { ref: r, href: `#${t}`, ...c, className: m("alea-skip-link", s), children: l });
14
- }), ea = M(function({ children: t, as: l = "span", className: s, ...c }, r) {
15
- return /* @__PURE__ */ a(l, { ref: r, ...c, className: m("alea-visually-hidden", s), children: t });
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 });
16
16
  });
17
- function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange: c, className: r }) {
18
- return /* @__PURE__ */ u(A, { isExpanded: l, defaultExpanded: s, onExpandedChange: c, className: m("alea-collapsible", r), children: [
17
+ function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpandedChange: i, className: r }) {
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
@@ -23,32 +23,32 @@ function la({ title: e, children: t, isExpanded: l, defaultExpanded: s, onExpand
23
23
  /* @__PURE__ */ a(K, { className: "alea-collapsible-panel", children: /* @__PURE__ */ a("div", { className: "alea-collapsible-content", children: t }) })
24
24
  ] });
25
25
  }
26
- function ta({ value: e, defaultValue: t = "", onSave: l, label: s, placeholder: c = "Empty", multiline: r, className: o }) {
27
- const p = $(), [h, g] = k(t), n = e ?? h, [i, f] = k(!1), [N, C] = k(n), [v, w] = k(!1), x = D(null), b = D(null);
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);
28
28
  z(() => {
29
29
  var d, q;
30
- i && ((d = x.current) == null || d.focus(), (q = x.current) == null || q.select());
31
- }, [i]);
30
+ c && ((d = x.current) == null || d.focus(), (q = x.current) == null || q.select());
31
+ }, [c]);
32
32
  const y = () => {
33
33
  if ((l == null ? void 0 : l(N)) === !1) {
34
34
  w(!0);
35
35
  return;
36
36
  }
37
- e === void 0 && g(N), f(!1), w(!1), requestAnimationFrame(() => {
37
+ e === void 0 && h(N), b(!1), w(!1), requestAnimationFrame(() => {
38
38
  var d;
39
- return (d = b.current) == null ? void 0 : d.focus();
39
+ return (d = g.current) == null ? void 0 : d.focus();
40
40
  });
41
41
  }, S = () => {
42
- f(!1), w(!1), requestAnimationFrame(() => {
42
+ b(!1), w(!1), requestAnimationFrame(() => {
43
43
  var d;
44
- return (d = b.current) == null ? void 0 : d.focus();
44
+ return (d = g.current) == null ? void 0 : d.focus();
45
45
  });
46
46
  };
47
- if (!i)
48
- return /* @__PURE__ */ u("button", { ref: b, type: "button", className: m("alea-editable alea-focus-ring", o), "data-empty": !n || void 0, "aria-label": `${s}: ${n || c}. Edit`, onClick: () => {
49
- C(n), f(!0);
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);
50
50
  }, children: [
51
- /* @__PURE__ */ a("span", { className: "alea-editable-text", children: n || c }),
51
+ /* @__PURE__ */ a("span", { className: "alea-editable-text", children: n || i }),
52
52
  /* @__PURE__ */ a(F, { size: 14, "aria-hidden": "true", className: "alea-editable-icon" })
53
53
  ] });
54
54
  const E = r ? "textarea" : "input";
@@ -78,21 +78,21 @@ function na({ value: e, format: t, locale: l }) {
78
78
  return /* @__PURE__ */ a(T, { children: H(e, l, t) });
79
79
  }
80
80
  const V = (e) => String(e).padStart(2, "0");
81
- function sa({ to: e, label: t, onEnd: l, showDays: s, className: c }) {
82
- const r = $(), o = typeof e == "number" ? e : e.getTime(), [p, h] = k(() => Date.now()), g = D(!1);
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);
83
83
  z(() => {
84
- const b = setInterval(() => h(Date.now()), 1e3);
85
- return () => clearInterval(b);
84
+ const g = setInterval(() => f(Date.now()), 1e3);
85
+ return () => clearInterval(g);
86
86
  }, []);
87
87
  const n = Math.max(0, o - p);
88
88
  z(() => {
89
- n === 0 && !g.current && (g.current = !0, l == null || l());
89
+ n === 0 && !h.current && (h.current = !0, l == null || l());
90
90
  }, [n, l]);
91
- const i = Math.floor(n / 864e5), f = Math.floor(n / 36e5) % 24, N = Math.floor(n / 6e4) % 60, C = Math.floor(n / 1e3) % 60, v = s ?? i > 0, w = [...v ? [[i, "d"]] : [], [v ? f : f + i * 24, "h"], [N, "m"], [C, "s"]], x = `${v ? `${i} days, ` : ""}${v ? f : f + i * 24} hours, ${N} minutes`;
92
- return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", c), children: [
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`;
92
+ return /* @__PURE__ */ u("div", { className: m("alea-stat alea-countdown", i), children: [
93
93
  /* @__PURE__ */ a("span", { className: "alea-stat-label", children: t }),
94
- /* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([b, y]) => /* @__PURE__ */ u("span", { children: [
95
- /* @__PURE__ */ a("b", { children: y === "d" ? b : V(b) }),
94
+ /* @__PURE__ */ a("span", { className: "alea-stat-value alea-countdown-value", "aria-hidden": "true", children: w.map(([g, y]) => /* @__PURE__ */ u("span", { children: [
95
+ /* @__PURE__ */ a("b", { children: y === "d" ? g : V(g) }),
96
96
  /* @__PURE__ */ a("small", { children: y })
97
97
  ] }, y)) }),
98
98
  /* @__PURE__ */ a("span", { className: "alea-visually-hidden", "aria-live": "polite", children: n === 0 ? r.ended : x })
@@ -104,35 +104,35 @@ function ra({ tone: e = "neutral", children: t, pulse: l, className: s }) {
104
104
  t
105
105
  ] });
106
106
  }
107
- function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue: c, className: r, style: o }) {
107
+ function ia({ color: e, label: t, size: l = 28, shape: s = "circle", showValue: i, className: r, style: o }) {
108
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 } });
109
- return c ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", r), "data-labeled": !0, children: [
109
+ return i ? /* @__PURE__ */ u("span", { className: m("alea-swatch-wrap", r), "data-labeled": !0, children: [
110
110
  p,
111
111
  /* @__PURE__ */ a("span", { className: "alea-swatch-name", "aria-hidden": "true", children: t }),
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: c }) {
115
+ function ca({ isLoading: e, children: t, label: l, blur: s = !0, className: i }) {
116
116
  const r = $();
117
- return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", c), "aria-busy": e || void 0, children: [
117
+ return l ?? (l = r.loading), /* @__PURE__ */ u("div", { className: m("alea-loading", i), "aria-busy": e || void 0, children: [
118
118
  /* @__PURE__ */ a("div", { className: "alea-loading-content", ...R(e), children: t }),
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: c = !0, className: r }) {
123
- const o = j(), p = t ?? e.reduce((n, i) => n + i.value, 0), h = (n, i) => n.color || `var(--alea-chart-${i % 8 + 1})`, g = e.reduce((n, i) => n + i.value, 0);
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);
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(g),
128
+ s(h),
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": g, "aria-valuetext": e.map((n) => `${n.label} ${s(n.value)}`).join(", "), children: e.map((n, i) => /* @__PURE__ */ a("span", { className: "alea-progress-seg-part", style: { width: `${n.value / (p || 1) * 100}%`, background: h(n, i), animationDelay: `${i * 60}ms` } }, n.label)) }),
134
- c && /* @__PURE__ */ a("ul", { className: "alea-progress-seg-legend", "aria-hidden": "true", children: e.map((n, i) => /* @__PURE__ */ u("li", { children: [
135
- /* @__PURE__ */ a("span", { style: { background: h(n, i) } }),
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
136
  n.label,
137
137
  /* @__PURE__ */ a("b", { children: s(n.value) })
138
138
  ] }, n.label)) })
@@ -153,15 +153,15 @@ function ua({ items: e, marker: t = "bullet", spacing: l = "md", className: s })
153
153
  function ma({ children: e, size: t = "base", className: l }) {
154
154
  return /* @__PURE__ */ a("div", { className: m("alea-prose alea-markdown", l), "data-size": t, children: e });
155
155
  }
156
- function pa({ children: e, tone: t = "accent", action: l, onDismiss: s, className: c, "aria-label": r }) {
157
- const o = $();
158
- r ?? (r = o.announcement);
159
- const [p, h] = k(!0);
160
- return p ? /* @__PURE__ */ u("div", { className: m("alea-banner", c), "data-tone": t, role: "region", "aria-label": r, children: [
161
- /* @__PURE__ */ a("p", { className: "alea-banner-text", children: e }),
162
- l && /* @__PURE__ */ a("span", { className: "alea-banner-action", children: l }),
163
- s && /* @__PURE__ */ a("button", { type: "button", className: "alea-banner-close alea-focus-ring", "aria-label": o.dismissAnnouncement, onClick: () => {
164
- h(!1), s();
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: [
161
+ /* @__PURE__ */ a("div", { className: "alea-banner-text", children: e }),
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();
165
165
  }, children: /* @__PURE__ */ a(P, { size: 16 }) })
166
166
  ] }) : null;
167
167
  }