@alea-design/ui 0.6.1 → 0.7.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 (46) 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/navigation/Navigation.d.ts +4 -4
  14. package/dist/components/navigation/Navigation.js +94 -94
  15. package/dist/components/navigation/Navigation2.d.ts +3 -1
  16. package/dist/components/navigation/Navigation2.js +218 -210
  17. package/dist/components/page/PageParts.d.ts +3 -1
  18. package/dist/components/page/PageParts.js +86 -86
  19. package/dist/components/shell/AppShell.d.ts +3 -1
  20. package/dist/components/shell/AppShell.js +33 -32
  21. package/dist/components/table/Table.d.ts +6 -3
  22. package/dist/components/table/Table.js +45 -45
  23. package/dist/components/theme/Theme.d.ts +5 -1
  24. package/dist/components/theme/Theme.js +63 -63
  25. package/dist/css/base.css +1 -1
  26. package/dist/css/button.css +1 -1
  27. package/dist/css/data.css +1 -1
  28. package/dist/css/date.css +1 -1
  29. package/dist/css/feedback.css +1 -1
  30. package/dist/css/groups.json +11 -11
  31. package/dist/css/more.css +1 -1
  32. package/dist/css/navigation.css +1 -1
  33. package/dist/css/page.css +1 -1
  34. package/dist/css/shell.css +1 -1
  35. package/dist/css/table.css +1 -1
  36. package/dist/css/typography.css +1 -1
  37. package/dist/i18n/strings.d.ts +1 -0
  38. package/dist/i18n/strings.js +2 -0
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.js +279 -275
  41. package/dist/styles.css +1 -1
  42. package/dist/utils/animateRows.d.ts +3 -2
  43. package/dist/utils/animateRows.js +15 -15
  44. package/dist/utils/measure.d.ts +12 -0
  45. package/dist/utils/measure.js +20 -0
  46. package/package.json +3 -3
@@ -74,11 +74,13 @@ export interface SegmentedControlProps extends Omit<ToggleButtonGroupProps, 'sel
74
74
  onChange?: (value: Key) => void;
75
75
  /** sm (28 px) or md (34 px, default). */
76
76
  size?: 'sm' | 'md';
77
+ /** Lets the options flow onto more lines when they do not fit (a preference switch with long words, large text), instead of scrolling sideways inside the control. */
78
+ wrap?: boolean;
77
79
  /** Label for screen readers. */
78
80
  'aria-label'?: string;
79
81
  }
80
82
  /** One choice among a few, as a row of pills. */
81
- export declare function SegmentedControl({ items, value, defaultValue, onChange, size, className, ...props }: SegmentedControlProps): import("react").JSX.Element;
83
+ export declare function SegmentedControl({ items, value, defaultValue, onChange, size, wrap, className, ...props }: SegmentedControlProps): import("react").JSX.Element;
82
84
  export interface ToggleButtonProps extends RACToggleButtonProps {
83
85
  /** sm (32 px) or md (40 px, default). */
84
86
  size?: 'sm' | 'md';
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as h, Fragment as Y } from "react/jsx-runtime";
3
3
  import { forwardRef as G, useRef as A, useEffect as I, useState as _ } from "react";
4
4
  import { useRipple as C } from "@alea-design/motion";
5
5
  import { Link as V, Button as ee, composeRenderProps as te, ToggleButtonGroup as ne, ToggleButton as W, SelectionIndicator as ae } from "react-aria-components";
@@ -10,50 +10,50 @@ import { useStrings as q } from "../../i18n/strings.js";
10
10
  import { responsiveAttrs as X } from "../../utils/responsive.js";
11
11
  import { TooltipTrigger as re, Tooltip as le } from "../overlay/Overlay.js";
12
12
  import { buttonIcon as M } from "../icon/icon-contexts.js";
13
- const J = G(function({ variant: a = "primary", tone: n, size: c, shape: u, iconStart: d, iconEnd: i, isLoading: o, loadingLabel: r, loadingPosition: m = "center", fullWidth: N, justify: v, wrap: g, shortcut: f, href: y, target: L, rel: O, isSuccess: R, successLabel: B, ripple: k, className: j, children: x, ...S }, Q) {
13
+ const J = G(function({ variant: o = "primary", tone: a, size: d, shape: m, iconStart: c, iconEnd: l, isLoading: u, loadingLabel: t, loadingPosition: i = "center", fullWidth: N, justify: v, wrap: g, shortcut: f, href: y, target: L, rel: O, isSuccess: R, successLabel: B, ripple: k, className: j, children: x, ...S }, Q) {
14
14
  const T = q();
15
15
  B ?? (B = T.done);
16
16
  const E = A(null), D = oe(Q, E), { onPointerDown: $ } = C();
17
17
  I(() => {
18
- const t = E.current;
19
- if (!k || !t) return;
20
- const s = (w) => $({ currentTarget: t, clientX: w.clientX, clientY: w.clientY });
21
- return t.addEventListener("pointerdown", s), () => t.removeEventListener("pointerdown", s);
18
+ const n = E.current;
19
+ if (!k || !n) return;
20
+ const s = (w) => $({ currentTarget: n, clientX: w.clientX, clientY: w.clientY });
21
+ return n.addEventListener("pointerdown", s), () => n.removeEventListener("pointerdown", s);
22
22
  }, [k, $]);
23
- const h = o && (r != null || m !== "center"), H = /* @__PURE__ */ e("span", { className: "alea-button-icon alea-button-inline-spinner", children: /* @__PURE__ */ e(P, { size: "sm", "aria-label": T.loading }) }), F = (t, s) => /* @__PURE__ */ p(Y, { children: [
24
- s && !h && /* @__PURE__ */ e("span", { className: "alea-button-spinner", children: /* @__PURE__ */ e(P, { size: "sm", "aria-label": T.loading }) }),
25
- R && !s ? /* @__PURE__ */ p("span", { className: "alea-button-content alea-success-in", "aria-live": "polite", children: [
23
+ const p = u && (t != null || i !== "center"), H = /* @__PURE__ */ e("span", { className: "alea-button-icon alea-button-inline-spinner", children: /* @__PURE__ */ e(P, { size: "sm", "aria-label": T.loading }) }), F = (n, s) => /* @__PURE__ */ h(Y, { children: [
24
+ s && !p && /* @__PURE__ */ e("span", { className: "alea-button-spinner", children: /* @__PURE__ */ e(P, { size: "sm", "aria-label": T.loading }) }),
25
+ R && !s ? /* @__PURE__ */ h("span", { className: "alea-button-content alea-success-in", "aria-live": "polite", children: [
26
26
  /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", children: /* @__PURE__ */ e("svg", { className: "alea-success-check", viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ e("path", { d: "M5 12.5l4.5 4.5L19 7.5" }) }) }),
27
27
  B != null && B !== !1 && /* @__PURE__ */ e("span", { className: "alea-button-label", children: B })
28
- ] }) : /* @__PURE__ */ p("span", { className: "alea-button-content", "data-hidden": s && !h || void 0, children: [
29
- h && m !== "end" ? H : d && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(a, n), children: d }),
30
- (h && r != null ? r : t) != null && t !== !1 && /* @__PURE__ */ e("span", { className: "alea-button-label", children: h && r != null ? r : t }),
31
- h && m === "end" ? H : i && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(a, n), children: i }),
28
+ ] }) : /* @__PURE__ */ h("span", { className: "alea-button-content", "data-hidden": s && !p || void 0, children: [
29
+ p && i !== "end" ? H : c && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(o, a), children: c }),
30
+ (p && t != null ? t : n) != null && n !== !1 && /* @__PURE__ */ e("span", { className: "alea-button-label", children: p && t != null ? t : n }),
31
+ p && i === "end" ? H : l && /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(o, a), children: l }),
32
32
  f && /* @__PURE__ */ e("kbd", { className: "alea-button-kbd", "aria-hidden": "true", children: f })
33
33
  ] })
34
34
  ] }), K = {
35
35
  "data-success": R || void 0,
36
36
  "data-ripple": k || void 0,
37
- "data-variant": a,
38
- "data-tone": n,
39
- ...X("size", c, "md"),
37
+ "data-variant": o,
38
+ "data-tone": a,
39
+ ...X("size", d, "md"),
40
40
  ...X("full-width", N),
41
- "data-shape": u,
41
+ "data-shape": m,
42
42
  "data-justify": v,
43
43
  "data-wrap": g || void 0
44
44
  }, z = typeof f == "string" ? f.replace("⌘", "Meta+").replace("⇧", "Shift+").replace("⌥", "Alt+").replace("⌃", "Control+") : void 0;
45
45
  if (I(() => {
46
- const t = E.current;
47
- t && (z ? t.setAttribute("aria-keyshortcuts", z) : t.removeAttribute("aria-keyshortcuts"));
46
+ const n = E.current;
47
+ n && (z ? n.setAttribute("aria-keyshortcuts", z) : n.removeAttribute("aria-keyshortcuts"));
48
48
  }, [z]), y) {
49
- const { onPress: t, isDisabled: s, autoFocus: w, id: U, style: Z } = S;
49
+ const { onPress: n, isDisabled: s, autoFocus: w, id: U, style: Z } = S;
50
50
  return /* @__PURE__ */ e(
51
51
  V,
52
52
  {
53
53
  href: y,
54
54
  target: L,
55
55
  rel: O,
56
- onPress: t,
56
+ onPress: n,
57
57
  isDisabled: s,
58
58
  autoFocus: w,
59
59
  id: U,
@@ -66,67 +66,68 @@ const J = G(function({ variant: a = "primary", tone: n, size: c, shape: u, iconS
66
66
  }
67
67
  );
68
68
  }
69
- return /* @__PURE__ */ e(ee, { ...S, ...K, ref: D, isPending: o, className: b("alea-button alea-focus-ring", j), children: te(x, (t, { isPending: s }) => F(t, s)) });
70
- }), Ne = G(function({ shape: a = "circle", variant: n = "ghost", tooltip: c, children: u, className: d, ...i }, o) {
71
- const r = /* @__PURE__ */ e(J, { ...i, ref: o, variant: n, "data-icon-shape": a, "data-icon-only": !0, className: b("alea-icon-button", d), children: /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(n, i.tone), children: u }) });
72
- return c ? /* @__PURE__ */ p(re, { delay: 400, children: [
73
- r,
74
- /* @__PURE__ */ e(le, { children: i["aria-label"] })
75
- ] }) : r;
69
+ return /* @__PURE__ */ e(ee, { ...S, ...K, ref: D, isPending: u, className: b("alea-button alea-focus-ring", j), children: te(x, (n, { isPending: s }) => F(n, s)) });
70
+ }), Ne = G(function({ shape: o = "circle", variant: a = "ghost", tooltip: d, children: m, className: c, ...l }, u) {
71
+ const t = /* @__PURE__ */ e(J, { ...l, ref: u, variant: a, "data-icon-shape": o, "data-icon-only": !0, className: b("alea-icon-button", c), children: /* @__PURE__ */ e("span", { className: "alea-button-icon", "aria-hidden": "true", ...M(a, l.tone), children: m }) });
72
+ return d ? /* @__PURE__ */ h(re, { delay: 400, children: [
73
+ t,
74
+ /* @__PURE__ */ e(le, { children: l["aria-label"] })
75
+ ] }) : t;
76
76
  });
77
- function ve({ items: l, value: a, defaultValue: n, onChange: c, size: u = "md", className: d, ...i }) {
77
+ function ve({ items: r, value: o, defaultValue: a, onChange: d, size: m = "md", wrap: c, className: l, ...u }) {
78
78
  return /* @__PURE__ */ e(
79
79
  ne,
80
80
  {
81
- ...i,
81
+ ...u,
82
82
  selectionMode: "single",
83
83
  disallowEmptySelection: !0,
84
- selectedKeys: a !== void 0 ? [a] : void 0,
85
- defaultSelectedKeys: n !== void 0 ? [n] : a === void 0 && l[0] ? [l[0].id] : void 0,
86
- onSelectionChange: (o) => {
87
- const r = [...o][0];
88
- r !== void 0 && (c == null || c(r));
84
+ selectedKeys: o !== void 0 ? [o] : void 0,
85
+ defaultSelectedKeys: a !== void 0 ? [a] : o === void 0 && r[0] ? [r[0].id] : void 0,
86
+ onSelectionChange: (t) => {
87
+ const i = [...t][0];
88
+ i !== void 0 && (d == null || d(i));
89
89
  },
90
- "data-size": u,
91
- className: b("alea-segmented", d),
92
- children: l.map((o) => /* @__PURE__ */ p(W, { id: o.id, isDisabled: o.isDisabled, className: "alea-segmented-item alea-focus-ring", children: [
93
- /* @__PURE__ */ e("span", { className: "alea-segmented-label", children: o.label }),
90
+ "data-size": m,
91
+ "data-wrap": c || void 0,
92
+ className: b("alea-segmented", l),
93
+ children: r.map((t) => /* @__PURE__ */ h(W, { id: t.id, isDisabled: t.isDisabled, className: "alea-segmented-item alea-focus-ring", children: [
94
+ /* @__PURE__ */ e("span", { className: "alea-segmented-label", children: t.label }),
94
95
  /* @__PURE__ */ e(ae, { className: "alea-sel-indicator" })
95
- ] }, String(o.id)))
96
+ ] }, String(t.id)))
96
97
  }
97
98
  );
98
99
  }
99
- function ye({ size: l = "md", className: a, ...n }) {
100
- return /* @__PURE__ */ e(W, { ...n, "data-size": l, className: b("alea-toggle-button alea-focus-ring", a) });
100
+ function ye({ size: r = "md", className: o, ...a }) {
101
+ return /* @__PURE__ */ e(W, { ...a, "data-size": r, className: b("alea-toggle-button alea-focus-ring", o) });
101
102
  }
102
- function Be({ onConfirm: l, duration: a = 1200, hint: n, variant: c = "danger", className: u, children: d, ...i }) {
103
- const o = q();
104
- n ?? (n = o.pressAndHold);
105
- const [r, m] = _(!1), N = A(null), v = A(`alea-hold-${Math.random().toString(36).slice(2, 8)}`).current;
103
+ function Be({ onConfirm: r, duration: o = 1200, hint: a, variant: d = "danger", className: m, children: c, ...l }) {
104
+ const u = q();
105
+ a ?? (a = u.pressAndHold);
106
+ const [t, i] = _(!1), N = A(null), v = A(`alea-hold-${Math.random().toString(36).slice(2, 8)}`).current;
106
107
  return I(() => {
107
108
  const g = N.current;
108
109
  if (!g) return;
109
110
  const f = (y) => {
110
- y.animationName === "alea-hold" && (m(!1), l());
111
+ y.animationName === "alea-hold" && (i(!1), r());
111
112
  };
112
113
  return g.addEventListener("animationend", f), () => g.removeEventListener("animationend", f);
113
- }, [l]), /* @__PURE__ */ p(Y, { children: [
114
+ }, [r]), /* @__PURE__ */ h(Y, { children: [
114
115
  /* @__PURE__ */ e(
115
116
  J,
116
117
  {
117
- ...i,
118
+ ...l,
118
119
  ref: N,
119
- variant: c,
120
- "data-holding": r || void 0,
120
+ variant: d,
121
+ "data-holding": t || void 0,
121
122
  "aria-describedby": v,
122
- onPressStart: () => m(!0),
123
- onPressEnd: () => m(!1),
124
- className: b("alea-hold", u),
125
- style: { "--alea-hold-duration": `${a}ms` },
126
- children: d
123
+ onPressStart: () => i(!0),
124
+ onPressEnd: () => i(!1),
125
+ className: b("alea-hold", m),
126
+ style: { "--alea-hold-duration": `${o}ms` },
127
+ children: c
127
128
  }
128
129
  ),
129
- /* @__PURE__ */ e("span", { id: v, className: "alea-visually-hidden", children: n })
130
+ /* @__PURE__ */ e("span", { id: v, className: "alea-visually-hidden", children: a })
130
131
  ] });
131
132
  }
132
133
  export {
@@ -1,26 +1,26 @@
1
1
  "use client";
2
2
  import { jsx as r, jsxs as S } from "react/jsx-runtime";
3
- import { useState as P, useRef as F, useLayoutEffect as I, useEffect as K, Fragment as O } from "react";
3
+ import { useState as P, useRef as F, Fragment as K } from "react";
4
+ import { useIsoLayoutEffect as O } from "../../utils/measure.js";
4
5
  import { Group as R, ToggleButtonGroup as j, Toolbar as z, ToggleButton as k, SelectionIndicator as q } from "react-aria-components";
5
- import { ChevronDown as W, MoreHorizontal as H } from "lucide-react";
6
+ import { ChevronDown as W, MoreHorizontal as E } from "lucide-react";
6
7
  import { cx as N, withBase as x } from "../../utils/cx.js";
7
8
  import { Button as w, IconButton as D } from "./Button.js";
8
9
  import { DropdownMenu as A, MenuItem as G } from "../menu/Menu.js";
9
- import { useStrings as M } from "../../i18n/strings.js";
10
- import { inertProps as $ } from "../../utils/inert.js";
11
- const J = typeof document < "u" ? I : K;
12
- function L({ children: i, attached: l = !0, orientation: n = "horizontal", className: s, "aria-label": t }) {
13
- return /* @__PURE__ */ r(R, { "aria-label": t, className: N("alea-btn-group", s), "data-attached": l || void 0, "data-orientation": n, children: i });
10
+ import { useStrings as I } from "../../i18n/strings.js";
11
+ import { inertProps as H } from "../../utils/inert.js";
12
+ function $({ children: n, attached: l = !0, orientation: i = "horizontal", className: s, "aria-label": t }) {
13
+ return /* @__PURE__ */ r(R, { "aria-label": t, className: N("alea-btn-group", s), "data-attached": l || void 0, "data-orientation": i, children: n });
14
14
  }
15
- function ae({ children: i, actions: l, onAction: n, menuLabel: s, variant: t = "primary", size: d = "md", className: u, ...m }) {
16
- const f = M();
17
- return s ?? (s = f.moreOptions), /* @__PURE__ */ S(L, { className: N("alea-split-btn", u), children: [
18
- /* @__PURE__ */ r(w, { variant: t, size: d, ...m, children: i }),
19
- /* @__PURE__ */ r(A, { trigger: /* @__PURE__ */ r(D, { variant: t, size: d, shape: "square", "aria-label": s, isDisabled: m.isDisabled, children: /* @__PURE__ */ r(W, {}) }), placement: "bottom end", menuProps: { onAction: (c) => n == null ? void 0 : n(c) }, "aria-label": s, children: l.map((c) => /* @__PURE__ */ r(G, { id: c.id, icon: c.icon, description: c.description, children: c.label }, String(c.id))) })
15
+ function ee({ children: n, actions: l, onAction: i, menuLabel: s, variant: t = "primary", size: d = "md", className: u, ...m }) {
16
+ const f = I();
17
+ return s ?? (s = f.moreOptions), /* @__PURE__ */ S($, { className: N("alea-split-btn", u), children: [
18
+ /* @__PURE__ */ r(w, { variant: t, size: d, ...m, children: n }),
19
+ /* @__PURE__ */ r(A, { trigger: /* @__PURE__ */ r(D, { variant: t, size: d, shape: "square", "aria-label": s, isDisabled: m.isDisabled, children: /* @__PURE__ */ r(W, {}) }), placement: "bottom end", menuProps: { onAction: (c) => i == null ? void 0 : i(c) }, "aria-label": s, children: l.map((c) => /* @__PURE__ */ r(G, { id: c.id, icon: c.icon, description: c.description, children: c.label }, String(c.id))) })
20
20
  ] });
21
21
  }
22
- function re({ items: i, selectionMode: l = "single", value: n, defaultValue: s, onChange: t, iconOnly: d, size: u = "md", className: m, "aria-label": f }) {
23
- const [c, v] = P(s ?? []), p = n ?? c, e = (a, o) => /* @__PURE__ */ S(k, { id: a.id, isDisabled: a.isDisabled, "aria-label": d ? a.label : void 0, className: "alea-toggle-item alea-focus-ring", "data-icon-only": d || void 0, ...o, children: [
22
+ function ae({ items: n, selectionMode: l = "single", value: i, defaultValue: s, onChange: t, iconOnly: d, size: u = "md", className: m, "aria-label": f }) {
23
+ const [c, v] = P(s ?? []), p = i ?? c, e = (a, o) => /* @__PURE__ */ S(k, { id: a.id, isDisabled: a.isDisabled, "aria-label": d ? a.label : void 0, className: "alea-toggle-item alea-focus-ring", "data-icon-only": d || void 0, ...o, children: [
24
24
  a.icon && /* @__PURE__ */ r("span", { className: "alea-toggle-icon", "aria-hidden": "true", children: a.icon }),
25
25
  !d && /* @__PURE__ */ r("span", { className: "alea-toggle-label", children: a.label }),
26
26
  !o && /* @__PURE__ */ r(q, { className: "alea-sel-indicator" })
@@ -28,65 +28,65 @@ function re({ items: i, selectionMode: l = "single", value: n, defaultValue: s,
28
28
  if (l === "multiple") {
29
29
  const a = (o, b) => {
30
30
  const g = b ? [...p, o] : p.filter((B) => B !== o);
31
- n === void 0 && v(g), t == null || t(g);
31
+ i === void 0 && v(g), t == null || t(g);
32
32
  };
33
- return /* @__PURE__ */ r("div", { role: "group", "aria-label": f, className: N("alea-toggle-group", m), "data-size": u, "data-multiple": !0, children: i.map((o) => e(o, { isSelected: p.includes(o.id), onChange: (b) => a(o.id, b) })) });
33
+ return /* @__PURE__ */ r("div", { role: "group", "aria-label": f, className: N("alea-toggle-group", m), "data-size": u, "data-multiple": !0, children: n.map((o) => e(o, { isSelected: p.includes(o.id), onChange: (b) => a(o.id, b) })) });
34
34
  }
35
35
  return /* @__PURE__ */ r(
36
36
  j,
37
37
  {
38
38
  "aria-label": f,
39
39
  selectionMode: "single",
40
- selectedKeys: n,
40
+ selectedKeys: i,
41
41
  defaultSelectedKeys: s,
42
- onSelectionChange: (a) => t == null ? void 0 : t(a === "all" ? i.map((o) => o.id) : [...a]),
42
+ onSelectionChange: (a) => t == null ? void 0 : t(a === "all" ? n.map((o) => o.id) : [...a]),
43
43
  className: x("alea-toggle-group", m),
44
44
  "data-size": u,
45
- children: i.map((a) => e(a))
45
+ children: n.map((a) => e(a))
46
46
  }
47
47
  );
48
48
  }
49
- function oe({ className: i, items: l, itemStyle: n = "icon", children: s, ...t }) {
50
- const d = M(), u = F(null), [m, f] = P((l == null ? void 0 : l.length) ?? 0);
51
- if (J(() => {
49
+ function re({ className: n, items: l, itemStyle: i = "icon", children: s, ...t }) {
50
+ const d = I(), u = F(null), [m, f] = P((l == null ? void 0 : l.length) ?? 0);
51
+ if (O(() => {
52
52
  const e = u.current;
53
53
  if (!l || !e) return;
54
54
  const a = () => {
55
55
  const b = e.querySelector(".alea-toolbar-probe");
56
56
  if (!b) return;
57
57
  const g = Array.from(b.children).map((h) => h.getBoundingClientRect().width + 4);
58
- if (g.reduce((h, E) => h + E, 0) <= e.clientWidth) {
58
+ if (g.reduce((h, M) => h + M, 0) <= e.clientWidth) {
59
59
  f(g.length);
60
60
  return;
61
61
  }
62
- let y = 0, T = 0;
62
+ let T = 0, y = 0;
63
63
  for (const h of g) {
64
- if (y + h > e.clientWidth - 44) break;
65
- y += h, T++;
64
+ if (T + h > e.clientWidth - 44) break;
65
+ T += h, y++;
66
66
  }
67
- f(T);
67
+ f(y);
68
68
  };
69
69
  a();
70
70
  const o = new ResizeObserver(a);
71
71
  return o.observe(e), () => o.disconnect();
72
- }, [l]), !l) return /* @__PURE__ */ r(z, { ...t, className: x("alea-toolbar", i), children: s });
72
+ }, [l]), !l) return /* @__PURE__ */ r(z, { ...t, className: x("alea-toolbar", n), children: s });
73
73
  const c = (e, a = !1) => {
74
- const o = n === "label" ? /* @__PURE__ */ r(w, { size: "sm", variant: e.isSelected ? "soft" : "text", iconStart: e.icon, isDisabled: e.isDisabled, onPress: e.onAction, "aria-pressed": e.isSelected, excludeFromTabOrder: a, children: e.label }, String(e.id)) : /* @__PURE__ */ r(D, { size: "sm", variant: e.isSelected ? "soft" : "text", "aria-label": e.label, tooltip: !a, isDisabled: e.isDisabled, onPress: e.onAction, "aria-pressed": e.isSelected, excludeFromTabOrder: a, children: e.icon }, String(e.id));
75
- return e.separatorBefore ? /* @__PURE__ */ S(O, { children: [
74
+ const o = i === "label" ? /* @__PURE__ */ r(w, { size: "sm", variant: e.isSelected ? "soft" : "text", iconStart: e.icon, isDisabled: e.isDisabled, onPress: e.onAction, "aria-pressed": e.isSelected, excludeFromTabOrder: a, children: e.label }, String(e.id)) : /* @__PURE__ */ r(D, { size: "sm", variant: e.isSelected ? "soft" : "text", "aria-label": e.label, tooltip: !a, isDisabled: e.isDisabled, onPress: e.onAction, "aria-pressed": e.isSelected, excludeFromTabOrder: a, children: e.icon }, String(e.id));
75
+ return e.separatorBefore ? /* @__PURE__ */ S(K, { children: [
76
76
  /* @__PURE__ */ r("span", { className: "alea-toolbar-sep", "aria-hidden": "true" }),
77
77
  o
78
78
  ] }, String(e.id)) : o;
79
79
  }, v = l.slice(0, m), p = l.slice(m);
80
80
  return /* @__PURE__ */ S("div", { ref: u, className: "alea-toolbar-fit", children: [
81
- /* @__PURE__ */ r("div", { className: "alea-toolbar-probe", "aria-hidden": "true", ...$(!0), children: l.map((e) => c(e, !0)) }),
82
- /* @__PURE__ */ S(z, { ...t, className: x("alea-toolbar", i), children: [
81
+ /* @__PURE__ */ r("div", { className: "alea-toolbar-probe", "aria-hidden": "true", ...H(!0), children: l.map((e) => c(e, !0)) }),
82
+ /* @__PURE__ */ S(z, { ...t, className: x("alea-toolbar", n), children: [
83
83
  v.map((e) => c(e)),
84
84
  p.length > 0 && /* @__PURE__ */ r(
85
85
  A,
86
86
  {
87
87
  "aria-label": d.moreActions,
88
88
  placement: "bottom end",
89
- trigger: /* @__PURE__ */ r(D, { size: "sm", variant: "text", "aria-label": d.moreActions, children: /* @__PURE__ */ r(H, {}) }),
89
+ trigger: /* @__PURE__ */ r(D, { size: "sm", variant: "text", "aria-label": d.moreActions, children: /* @__PURE__ */ r(E, {}) }),
90
90
  menuProps: { onAction: (e) => {
91
91
  var a, o;
92
92
  return (o = (a = p.find((b) => b.id === e)) == null ? void 0 : a.onAction) == null ? void 0 : o.call(a);
@@ -97,16 +97,16 @@ function oe({ className: i, items: l, itemStyle: n = "icon", children: s, ...t }
97
97
  ] })
98
98
  ] });
99
99
  }
100
- function le({ children: i, description: l, icon: n, className: s, size: t = "lg", variant: d = "ghost", ...u }) {
101
- return /* @__PURE__ */ r(w, { ...u, size: t, variant: d, className: N("alea-compound-button", s), iconStart: n, children: /* @__PURE__ */ S("span", { className: "alea-compound-text", children: [
102
- /* @__PURE__ */ r("span", { className: "alea-compound-title", children: i }),
100
+ function oe({ children: n, description: l, icon: i, className: s, size: t = "lg", variant: d = "ghost", ...u }) {
101
+ return /* @__PURE__ */ r(w, { ...u, size: t, variant: d, className: N("alea-compound-button", s), iconStart: i, children: /* @__PURE__ */ S("span", { className: "alea-compound-text", children: [
102
+ /* @__PURE__ */ r("span", { className: "alea-compound-title", children: n }),
103
103
  l && /* @__PURE__ */ r("span", { className: "alea-compound-desc", children: l })
104
104
  ] }) });
105
105
  }
106
106
  export {
107
- L as ButtonGroup,
108
- le as CompoundButton,
109
- ae as SplitButton,
110
- re as ToggleGroup,
111
- oe as Toolbar
107
+ $ as ButtonGroup,
108
+ oe as CompoundButton,
109
+ ee as SplitButton,
110
+ ae as ToggleGroup,
111
+ re as Toolbar
112
112
  };
@@ -13,10 +13,12 @@ export interface DescriptionsProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
13
13
  hideEmpty?: boolean;
14
14
  /** stacked (label above the value, default) or inline (label and value side by side). */
15
15
  layout?: 'stacked' | 'inline';
16
- /** Draws lines between items. */
16
+ /** Draws a box around the items, with a line between them. */
17
17
  bordered?: boolean;
18
- /** sm (tighter, 13 px values) or md (default). */
19
- size?: 'sm' | 'md';
18
+ /** plain (default) or lines: a thin rule under each row, with no box around the list, like a statement or a receipt. */
19
+ variant?: 'plain' | 'lines';
20
+ /** sm (tighter, 13 px values), md (default) or lg (larger text, for a page people read rather than scan). */
21
+ size?: 'sm' | 'md' | 'lg';
20
22
  /** A title above the list (an h3). */
21
23
  title?: ReactNode;
22
24
  /** Something at the end of the title row: an Edit button or link. */
@@ -25,7 +27,7 @@ export interface DescriptionsProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
25
27
  labelWidth?: string;
26
28
  }
27
29
  /** Key and value pairs: order details, profile facts, settings summaries. A title with an action, one to four columns, item spans, stacked or inline, two sizes. */
28
- export declare function Descriptions({ items, columns, hideEmpty, layout, bordered, size, title, extra, labelWidth, className, style, ...props }: DescriptionsProps): import("react").JSX.Element;
30
+ export declare function Descriptions({ items, columns, hideEmpty, layout, bordered, variant, size, title, extra, labelWidth, className, style, ...props }: DescriptionsProps): import("react").JSX.Element;
29
31
  export interface StatisticProps extends Omit<HTMLAttributes<HTMLDivElement>, 'prefix'> {
30
32
  /** What the number is. */
31
33
  label: ReactNode;
@@ -1,85 +1,85 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as r, Fragment as L } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as s, Fragment as L } from "react/jsx-runtime";
3
3
  import { createElement as U, useState as G, useRef as D, useEffect as O } from "react";
4
4
  import { Inbox as E, ServerCrash as X, Lock as _, SearchX as B, CircleAlert as H, CircleCheck as J, TrendingUp as K, TrendingDown as P } from "lucide-react";
5
- import { cx as v } from "../../utils/cx.js";
5
+ import { cx as w } from "../../utils/cx.js";
6
6
  import { isDecimalString as Q } from "../../utils/decimal.js";
7
7
  import { useReducedMotion as V, TextSwap as Y } from "@alea-design/motion";
8
- function ie({ items: c, columns: a = 2, hideEmpty: d, layout: m = "stacked", bordered: n, size: u, title: s, extra: l, labelWidth: h, className: p, style: f, ...i }) {
9
- const o = d ? c.filter((t) => t.value != null && t.value !== !1 && t.value !== "") : c, N = /* @__PURE__ */ e("dl", { className: "alea-descriptions", "data-columns": a, "data-layout": m, "data-bordered": n || void 0, "data-size": u, style: h ? { "--alea-desc-label": h } : void 0, children: o.map((t, S) => /* @__PURE__ */ r("div", { className: "alea-desc-item", "data-wide": t.wide || void 0, "data-span": t.span && t.span > 1 ? t.span : void 0, children: [
10
- /* @__PURE__ */ e("dt", { children: t.label }),
11
- /* @__PURE__ */ e("dd", { children: t.value })
12
- ] }, S)) });
13
- return !s && !l ? /* @__PURE__ */ e("div", { ...i, style: f, className: v("alea-descriptions-wrap", p), children: N }) : /* @__PURE__ */ r("section", { ...i, style: f, className: v("alea-descriptions-wrap", p), children: [
14
- /* @__PURE__ */ r("header", { className: "alea-descriptions-head", children: [
15
- s && /* @__PURE__ */ e("h3", { className: "alea-descriptions-title", children: s }),
16
- l && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: l })
8
+ function ie({ items: c, columns: a = 2, hideEmpty: o, layout: u = "stacked", bordered: t, variant: p, size: r, title: m, extra: h, labelWidth: f, className: N, style: i, ...d }) {
9
+ const y = o ? c.filter((n) => n.value != null && n.value !== !1 && n.value !== "") : c, l = /* @__PURE__ */ e("dl", { className: "alea-descriptions", "data-columns": a, "data-layout": u, "data-bordered": t || void 0, "data-variant": p !== "plain" ? p : void 0, "data-size": r, style: f ? { "--alea-desc-label": f } : void 0, children: y.map((n, v) => /* @__PURE__ */ s("div", { className: "alea-desc-item", "data-wide": n.wide || void 0, "data-span": n.span && n.span > 1 ? n.span : void 0, children: [
10
+ /* @__PURE__ */ e("dt", { children: n.label }),
11
+ /* @__PURE__ */ e("dd", { children: n.value })
12
+ ] }, v)) });
13
+ return !m && !h ? /* @__PURE__ */ e("div", { ...d, style: i, className: w("alea-descriptions-wrap", N), children: l }) : /* @__PURE__ */ s("section", { ...d, style: i, className: w("alea-descriptions-wrap", N), children: [
14
+ /* @__PURE__ */ s("header", { className: "alea-descriptions-head", children: [
15
+ m && /* @__PURE__ */ e("h3", { className: "alea-descriptions-title", children: m }),
16
+ h && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: h })
17
17
  ] }),
18
- N
18
+ l
19
19
  ] });
20
20
  }
21
- function ce({ label: c, value: a, isDecimal: d, formatOptions: m, delta: n, higherIsBetter: u = !0, animate: s, prefix: l, suffix: h, className: p, ...f }) {
21
+ function ce({ label: c, value: a, isDecimal: o, formatOptions: u, delta: t, higherIsBetter: p = !0, animate: r, prefix: m, suffix: h, className: f, ...N }) {
22
22
  var R;
23
- const i = !!d && Q(a), o = typeof a == "string" && !i, N = V(), t = o ? 0 : i ? Number(a) : a, S = i ? ((R = a.trim().split(".")[1]) == null ? void 0 : R.length) ?? 0 : 0, [w, I] = G(s && !o ? 0 : t), F = D(w), b = D(0);
23
+ const i = !!o && Q(a), d = typeof a == "string" && !i, y = V(), l = d ? 0 : i ? Number(a) : a, n = i ? ((R = a.trim().split(".")[1]) == null ? void 0 : R.length) ?? 0 : 0, [v, I] = G(r && !d ? 0 : l), F = D(v), b = D(0);
24
24
  O(() => {
25
- if (o) return;
26
- const y = (g) => {
27
- F.current = g, I(g);
25
+ if (d) return;
26
+ const g = (S) => {
27
+ F.current = S, I(S);
28
28
  };
29
- if (!s || N || typeof window > "u") {
30
- y(t);
29
+ if (!r || y || typeof window > "u") {
30
+ g(l);
31
31
  return;
32
32
  }
33
- const k = F.current, j = performance.now(), q = 900, z = (g) => {
34
- const x = Math.min(1, (g - j) / q);
35
- y(x < 1 ? k + (t - k) * (1 - Math.pow(1 - x, 3)) : t), x < 1 && (b.current = requestAnimationFrame(z));
33
+ const k = F.current, j = performance.now(), q = 900, z = (S) => {
34
+ const x = Math.min(1, (S - j) / q);
35
+ g(x < 1 ? k + (l - k) * (1 - Math.pow(1 - x, 3)) : l), x < 1 && (b.current = requestAnimationFrame(z));
36
36
  };
37
37
  return b.current = requestAnimationFrame(z), () => cancelAnimationFrame(b.current);
38
- }, [t, s, N, o]);
39
- const M = new Intl.NumberFormat(void 0, m), A = (y) => M.format(y), T = o || w === t || !s ? a : i ? w.toFixed(S) : Math.round(w * 100) / 100, C = n === void 0 ? null : n >= 0 === u;
40
- return /* @__PURE__ */ r("div", { ...f, className: v("alea-stat", p), children: [
38
+ }, [l, r, y, d]);
39
+ const M = new Intl.NumberFormat(void 0, u), A = (g) => M.format(g), T = d || v === l || !r ? a : i ? v.toFixed(n) : Math.round(v * 100) / 100, C = t === void 0 ? null : t >= 0 === p;
40
+ return /* @__PURE__ */ s("div", { ...N, className: w("alea-stat", f), children: [
41
41
  /* @__PURE__ */ e("div", { className: "alea-stat-label", children: c }),
42
- /* @__PURE__ */ e("div", { className: "alea-stat-value", children: o ? /* @__PURE__ */ r("span", { children: [
43
- l,
44
- s ? /* @__PURE__ */ e(Y, { children: String(a) }) : a,
42
+ /* @__PURE__ */ e("div", { className: "alea-stat-value", children: d ? /* @__PURE__ */ s("span", { children: [
43
+ m,
44
+ r ? /* @__PURE__ */ e(Y, { children: String(a) }) : a,
45
45
  h
46
- ] }) : /* @__PURE__ */ r(L, { children: [
47
- /* @__PURE__ */ r("span", { "aria-hidden": "true", children: [
48
- l,
46
+ ] }) : /* @__PURE__ */ s(L, { children: [
47
+ /* @__PURE__ */ s("span", { "aria-hidden": "true", children: [
48
+ m,
49
49
  A(T),
50
50
  h
51
51
  ] }),
52
52
  /* @__PURE__ */ e("span", { className: "alea-visually-hidden", children: A(a) })
53
53
  ] }) }),
54
- n !== void 0 && /* @__PURE__ */ r("div", { className: "alea-stat-delta", "data-good": C ? !0 : void 0, "data-bad": C === !1 ? !0 : void 0, children: [
55
- n >= 0 ? /* @__PURE__ */ e(K, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ e(P, { size: 14, "aria-hidden": "true" }),
56
- /* @__PURE__ */ r("span", { children: [
57
- n >= 0 ? "+" : "",
58
- new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(n)
54
+ t !== void 0 && /* @__PURE__ */ s("div", { className: "alea-stat-delta", "data-good": C ? !0 : void 0, "data-bad": C === !1 ? !0 : void 0, children: [
55
+ t >= 0 ? /* @__PURE__ */ e(K, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ e(P, { size: 14, "aria-hidden": "true" }),
56
+ /* @__PURE__ */ s("span", { children: [
57
+ t >= 0 ? "+" : "",
58
+ new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(t)
59
59
  ] }),
60
- /* @__PURE__ */ r("span", { className: "alea-visually-hidden", children: [
61
- n >= 0 ? "up" : "down",
60
+ /* @__PURE__ */ s("span", { className: "alea-visually-hidden", children: [
61
+ t >= 0 ? "up" : "down",
62
62
  " from before"
63
63
  ] })
64
64
  ] })
65
65
  ] });
66
66
  }
67
- function Z({ title: c, description: a, icon: d, illustration: m, action: n, secondaryAction: u, footer: s, size: l, variant: h, headingAs: p = "h3", className: f, ...i }) {
68
- return /* @__PURE__ */ r("div", { ...i, className: v("alea-empty", f), "data-size": l, "data-variant": h, children: [
69
- /* @__PURE__ */ e("span", { className: m ? "alea-empty-art" : "alea-empty-icon", "aria-hidden": "true", children: d ?? /* @__PURE__ */ e(E, {}) }),
70
- U(p, { className: "alea-empty-title" }, c),
67
+ function Z({ title: c, description: a, icon: o, illustration: u, action: t, secondaryAction: p, footer: r, size: m, variant: h, headingAs: f = "h3", className: N, ...i }) {
68
+ return /* @__PURE__ */ s("div", { ...i, className: w("alea-empty", N), "data-size": m, "data-variant": h, children: [
69
+ /* @__PURE__ */ e("span", { className: u ? "alea-empty-art" : "alea-empty-icon", "aria-hidden": "true", children: o ?? /* @__PURE__ */ e(E, {}) }),
70
+ U(f, { className: "alea-empty-title" }, c),
71
71
  a && /* @__PURE__ */ e("p", { className: "alea-empty-text", children: a }),
72
- (n || u) && /* @__PURE__ */ r("div", { className: "alea-empty-action", children: [
73
- n,
74
- u
72
+ (t || p) && /* @__PURE__ */ s("div", { className: "alea-empty-action", children: [
73
+ t,
74
+ p
75
75
  ] }),
76
- s && /* @__PURE__ */ e("p", { className: "alea-empty-footer", children: s })
76
+ r && /* @__PURE__ */ e("p", { className: "alea-empty-footer", children: r })
77
77
  ] });
78
78
  }
79
79
  const $ = { success: J, error: H, 404: B, 403: _, 500: X, info: E };
80
- function de({ status: c, className: a, ...d }) {
81
- const m = $[c];
82
- return /* @__PURE__ */ e(Z, { ...d, headingAs: d.headingAs ?? "h2", icon: /* @__PURE__ */ e(m, {}), className: v("alea-result", a), "data-status": c });
80
+ function de({ status: c, className: a, ...o }) {
81
+ const u = $[c];
82
+ return /* @__PURE__ */ e(Z, { ...o, headingAs: o.headingAs ?? "h2", icon: /* @__PURE__ */ e(u, {}), className: w("alea-result", a), "data-status": c });
83
83
  }
84
84
  export {
85
85
  ie as Descriptions,
@@ -56,7 +56,9 @@ export interface DateRangePickerProps<T extends DateValue> extends RACDateRangeP
56
56
  presets?: DateRangePreset[];
57
57
  /** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
58
58
  motion?: MotionProp;
59
+ /** What sits between the two dates. Default: the word "to" in the language of the interface ("a" in Spanish). */
60
+ separator?: ReactNode;
59
61
  }
60
62
  /** Type or pick a start and end date. */
61
- export declare function DateRangePicker<T extends DateValue>({ motion, presets, label, description, errorMessage, isLoading, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
63
+ export declare function DateRangePicker<T extends DateValue>({ motion, presets, separator, label, description, errorMessage, isLoading, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
62
64
  export {};