@alea-design/ui 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/components/button/Button.d.ts +3 -1
  2. package/dist/components/button/Button.js +64 -63
  3. package/dist/components/card/Card.d.ts +6 -2
  4. package/dist/components/card/Card.js +20 -20
  5. package/dist/components/combobox/Autocomplete.d.ts +4 -0
  6. package/dist/components/combobox/Autocomplete.js +89 -87
  7. package/dist/components/command/CommandPalette.d.ts +10 -0
  8. package/dist/components/command/CommandPalette.js +76 -52
  9. package/dist/components/data/Data.d.ts +6 -4
  10. package/dist/components/data/Data.js +66 -56
  11. package/dist/components/date/Date.d.ts +16 -2
  12. package/dist/components/date/Date.js +80 -69
  13. package/dist/components/display/Display.d.ts +3 -1
  14. package/dist/components/display/Display.js +27 -27
  15. package/dist/components/display/Display2.d.ts +2 -2
  16. package/dist/components/display/Display2.js +28 -27
  17. package/dist/components/feedback/Feedback.d.ts +3 -1
  18. package/dist/components/feedback/Feedback.js +102 -102
  19. package/dist/components/feedback/PageSkeleton.d.ts +19 -0
  20. package/dist/components/feedback/PageSkeleton.js +58 -0
  21. package/dist/components/field/Field.d.ts +3 -1
  22. package/dist/components/field/Field.js +82 -82
  23. package/dist/components/filter/FilterBar.d.ts +5 -2
  24. package/dist/components/filter/FilterBar.js +97 -66
  25. package/dist/components/form/Form.d.ts +8 -2
  26. package/dist/components/form/Form.js +53 -40
  27. package/dist/components/icon/icon-names.d.ts +2 -2
  28. package/dist/components/icon/icon-names.js +4 -2
  29. package/dist/components/list/List.d.ts +6 -2
  30. package/dist/components/list/List.js +65 -62
  31. package/dist/components/list/Lists2.d.ts +4 -0
  32. package/dist/components/list/Lists2.js +35 -35
  33. package/dist/components/media/Media.js +27 -27
  34. package/dist/components/more/More.d.ts +2 -2
  35. package/dist/components/more/More.js +46 -45
  36. package/dist/components/navigation/Navigation.d.ts +7 -5
  37. package/dist/components/navigation/Navigation.js +91 -74
  38. package/dist/components/navigation/Navigation2.d.ts +9 -3
  39. package/dist/components/navigation/Navigation2.js +209 -195
  40. package/dist/components/notification/NotificationCenter.js +70 -70
  41. package/dist/components/overlay/Drawer.d.ts +6 -1
  42. package/dist/components/overlay/Drawer.js +27 -25
  43. package/dist/components/overlay/Modal.d.ts +5 -0
  44. package/dist/components/overlay/Modal.js +16 -15
  45. package/dist/components/overlay/Overlay.d.ts +10 -1
  46. package/dist/components/overlay/Overlay.js +54 -52
  47. package/dist/components/overlay/Sheet.d.ts +2 -0
  48. package/dist/components/overlay/Sheet.js +30 -30
  49. package/dist/components/page/PageParts.js +20 -20
  50. package/dist/components/select/Select.js +75 -70
  51. package/dist/components/settings/Settings.d.ts +29 -0
  52. package/dist/components/settings/Settings.js +31 -0
  53. package/dist/components/shell/AccountMenu.d.ts +20 -0
  54. package/dist/components/shell/AccountMenu.js +32 -0
  55. package/dist/components/shell/AppShell.d.ts +9 -2
  56. package/dist/components/shell/AppShell.js +37 -37
  57. package/dist/components/shell/AppSidebar.d.ts +9 -3
  58. package/dist/components/shell/AppSidebar.js +45 -39
  59. package/dist/components/table/Table.d.ts +18 -4
  60. package/dist/components/table/Table.js +70 -46
  61. package/dist/components/tabs/Tabs.js +105 -94
  62. package/dist/components/theme/Theme.d.ts +7 -4
  63. package/dist/components/theme/Theme.js +127 -130
  64. package/dist/components/upload/Upload.js +62 -54
  65. package/dist/css/base.css +1 -1
  66. package/dist/css/button.css +1 -1
  67. package/dist/css/card.css +1 -1
  68. package/dist/css/command.css +1 -1
  69. package/dist/css/date.css +1 -1
  70. package/dist/css/display.css +1 -1
  71. package/dist/css/feedback.css +1 -1
  72. package/dist/css/field.css +1 -1
  73. package/dist/css/form.css +1 -1
  74. package/dist/css/groups.json +393 -21
  75. package/dist/css/list.css +1 -1
  76. package/dist/css/menu.css +1 -1
  77. package/dist/css/navigation.css +1 -1
  78. package/dist/css/notification.css +1 -1
  79. package/dist/css/overlay.css +1 -1
  80. package/dist/css/page.css +1 -1
  81. package/dist/css/select.css +1 -1
  82. package/dist/css/settings.css +1 -0
  83. package/dist/css/shell.css +1 -1
  84. package/dist/css/table.css +1 -1
  85. package/dist/css/tabs.css +1 -1
  86. package/dist/css/upload.css +1 -1
  87. package/dist/i18n/strings.d.ts +8 -0
  88. package/dist/i18n/strings.js +16 -0
  89. package/dist/index.d.ts +4 -0
  90. package/dist/index.js +318 -306
  91. package/dist/styles.css +1 -1
  92. package/dist/utils/animateRows.d.ts +11 -0
  93. package/dist/utils/animateRows.js +23 -0
  94. package/dist/utils/decimal.d.ts +12 -0
  95. package/dist/utils/decimal.js +48 -0
  96. package/dist/utils/initialFocus.d.ts +6 -0
  97. package/dist/utils/initialFocus.js +24 -0
  98. package/dist/utils/refs.d.ts +2 -0
  99. package/dist/utils/refs.js +14 -6
  100. package/package.json +3 -3
@@ -1,67 +1,91 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as l } from "react/jsx-runtime";
3
- import { forwardRef as L, useState as w, useEffect as y, useMemo as v, useRef as P } from "react";
4
- import { cx as j } from "../../utils/cx.js";
5
- import { useFilter as A, Autocomplete as D, SearchField as F, Input as H, Menu as O, MenuSection as V, Header as q, Collection as B, MenuItem as G, Keyboard as J } from "react-aria-components";
6
- import { Search as Q } from "lucide-react";
7
- import { DialogModal as U, Dialog as W } from "../overlay/Overlay.js";
8
- import { Kbd as X } from "../typography/Typography.js";
9
- import { useStrings as Y } from "../../i18n/strings.js";
10
- function Z({ children: f }) {
11
- const o = P(null), [c, m] = w(!1);
12
- return y(() => {
2
+ import { jsx as n, jsxs as m } from "react/jsx-runtime";
3
+ import { forwardRef as $, useState as N, useEffect as C, useMemo as j, useRef as q } from "react";
4
+ import { cx as B } from "../../utils/cx.js";
5
+ import { useFilter as J, Autocomplete as P, SearchField as Y, Input as Z, Menu as Q, MenuSection as G, Header as ee, Collection as te, MenuItem as z, Keyboard as ne } from "react-aria-components";
6
+ import { Search as se } from "lucide-react";
7
+ import { DialogModal as ie, Dialog as ae } from "../overlay/Overlay.js";
8
+ import { Kbd as oe } from "../typography/Typography.js";
9
+ import { useStrings as le } from "../../i18n/strings.js";
10
+ const E = "__more:";
11
+ function re({ children: g }) {
12
+ const o = q(null), [u, w] = N(!1);
13
+ return C(() => {
13
14
  const i = o.current;
14
15
  if (!i) return;
15
- const d = () => m(i.scrollHeight > i.clientHeight + 1);
16
- if (d(), typeof ResizeObserver > "u") return;
17
- const a = new ResizeObserver(d);
18
- return a.observe(i), i.firstElementChild && a.observe(i.firstElementChild), () => a.disconnect();
19
- }, []), /* @__PURE__ */ n("div", { ref: o, className: "alea-command-scroll", tabIndex: c ? 0 : void 0, children: f });
16
+ const f = () => w(i.scrollHeight > i.clientHeight + 1);
17
+ if (f(), typeof ResizeObserver > "u") return;
18
+ const r = new ResizeObserver(f);
19
+ return r.observe(i), i.firstElementChild && r.observe(i.firstElementChild), () => r.disconnect();
20
+ }, []), /* @__PURE__ */ n("div", { ref: o, className: "alea-command-scroll", tabIndex: u ? 0 : void 0, children: g });
20
21
  }
21
- const oe = L(function({ commands: o, isOpen: c, defaultOpen: m, onOpenChange: i, motion: d, hotkey: a = !0, placeholder: h, emptyText: p, className: S, style: k, surface: x, radius: E }, M) {
22
- const r = Y();
23
- h ?? (h = r.commandPlaceholder), p ?? (p = r.noResults);
24
- const [g, C] = w(m ?? !1), b = c ?? g, N = (s) => {
25
- c === void 0 && C(s), i == null || i(s);
22
+ const we = $(function({ commands: o, isOpen: u, defaultOpen: w, onOpenChange: i, motion: f, hotkey: r = !0, slashHotkey: M, onQueryChange: b, filter: h, isLoading: p, maxPerGroup: c, placeholder: K, emptyText: R, className: D, style: F, surface: T, radius: V }, H) {
23
+ const a = le();
24
+ K ?? (K = a.commandPlaceholder), R ?? (R = a.noResults);
25
+ const [L, O] = N(w ?? !1), v = u ?? L, [d, _] = N(""), [I, k] = N(/* @__PURE__ */ new Set()), x = (s) => {
26
+ _(s), b == null || b(s);
27
+ }, S = (s) => {
28
+ s || (d && x(""), k(/* @__PURE__ */ new Set())), u === void 0 && O(s), i == null || i(s);
26
29
  };
27
- y(() => {
28
- if (!a) return;
30
+ C(() => {
31
+ if (!r && !M) return;
29
32
  const s = (t) => {
30
- t.key.toLowerCase() === "k" && (t.metaKey || t.ctrlKey) && (t.preventDefault(), N(!b));
33
+ if (r && t.key.toLowerCase() === "k" && (t.metaKey || t.ctrlKey)) {
34
+ t.preventDefault(), S(!v);
35
+ return;
36
+ }
37
+ if (M && !v && t.key === "/" && !t.metaKey && !t.ctrlKey && !t.altKey) {
38
+ const e = t.target;
39
+ if (e && (e.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName))) return;
40
+ t.preventDefault(), S(!0);
41
+ }
31
42
  };
32
43
  return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
33
44
  });
34
- const { contains: R } = A({ sensitivity: "base" }), z = v(() => {
35
- const s = [];
36
- for (const t of o) {
37
- const e = t.group || "";
38
- let u = s.find((K) => K.id === e);
39
- u || s.push(u = { id: e, title: e, items: [] }), u.items.push(t);
45
+ const { contains: U } = J({ sensitivity: "base" }), A = j(() => {
46
+ const s = (e) => h === !1 || !d ? !0 : h ? h(e, d) : U([e.label, ...e.keywords || []].join(" "), d), t = [];
47
+ for (const e of o) {
48
+ if (!s(e)) continue;
49
+ const l = e.group || "";
50
+ let y = t.find((X) => X.id === l);
51
+ y || t.push(y = { id: l, title: l, items: [] }), y.items.push(e);
40
52
  }
41
- return s;
42
- }, [o]), I = v(() => new Map(o.map((s) => [s.id, s])), [o]);
43
- return /* @__PURE__ */ n(U, { isOpen: b, onOpenChange: N, size: "md", className: "alea-command-overlay", motion: d, surface: x, radius: E, children: /* @__PURE__ */ n(W, { ref: M, style: k, "aria-label": r.commandPalette, hideClose: !0, className: j("alea-command", S), children: ({ close: s }) => /* @__PURE__ */ l(D, { filter: (t, e) => R(t, e), children: [
44
- /* @__PURE__ */ l(F, { "aria-label": r.searchCommands, autoFocus: !0, className: "alea-command-search", children: [
45
- /* @__PURE__ */ n(Q, { size: 18, "aria-hidden": "true" }),
46
- /* @__PURE__ */ n(H, { placeholder: h, className: "alea-command-input" }),
47
- /* @__PURE__ */ n(X, { children: r.esc })
53
+ if (c && c > 0) for (const e of t) {
54
+ if (I.has(e.id) || e.items.length <= c) continue;
55
+ const l = e.items.length - c;
56
+ e.items = [...e.items.slice(0, c), { id: E + e.id, more: l, group: e.id }];
57
+ }
58
+ return t;
59
+ }, [o, d, h, c, I]), W = j(() => new Map(o.map((s) => [s.id, s])), [o]);
60
+ return /* @__PURE__ */ n(ie, { isOpen: v, onOpenChange: S, size: "md", className: "alea-command-overlay", motion: f, surface: T, radius: V, children: /* @__PURE__ */ n(ae, { ref: H, style: F, "aria-label": a.commandPalette, hideClose: !0, className: B("alea-command", D), children: ({ close: s }) => /* @__PURE__ */ m(P, { inputValue: d, onInputChange: x, filter: () => !0, children: [
61
+ /* @__PURE__ */ m(Y, { "aria-label": a.searchCommands, autoFocus: !0, className: "alea-command-search", children: [
62
+ /* @__PURE__ */ n(se, { size: 18, "aria-hidden": "true" }),
63
+ /* @__PURE__ */ n(Z, { placeholder: K, className: "alea-command-input" }),
64
+ /* @__PURE__ */ n(oe, { children: a.esc })
48
65
  ] }),
49
- /* @__PURE__ */ n(Z, { children: /* @__PURE__ */ n(O, { items: z, className: "alea-command-list", onAction: (t) => {
50
- const e = I.get(t);
51
- s(), e == null || e.onAction();
52
- }, renderEmptyState: () => /* @__PURE__ */ n("p", { className: "alea-command-empty", children: p }), children: (t) => /* @__PURE__ */ l(V, { id: t.id, className: "alea-option-section", children: [
53
- t.title && /* @__PURE__ */ n(q, { className: "alea-option-header", children: t.title }),
54
- /* @__PURE__ */ n(B, { items: t.items, children: (e) => /* @__PURE__ */ l(G, { id: e.id, textValue: [e.label, ...e.keywords || []].join(" "), className: "alea-option alea-command-item", children: [
55
- e.icon && /* @__PURE__ */ n("span", { className: "alea-option-icon", "aria-hidden": "true", children: e.icon }),
56
- /* @__PURE__ */ l("span", { className: "alea-option-text", children: [
57
- /* @__PURE__ */ n("span", { slot: "label", children: e.label }),
58
- e.description && /* @__PURE__ */ n("span", { className: "alea-option-desc", slot: "description", children: e.description })
59
- ] }),
60
- e.shortcut && /* @__PURE__ */ n(J, { className: "alea-menu-shortcut", children: e.shortcut })
61
- ] }) })
62
- ] }) }) })
66
+ /* @__PURE__ */ m(re, { children: [
67
+ /* @__PURE__ */ n(Q, { items: A, className: "alea-command-list", "aria-busy": p || void 0, onAction: (t) => {
68
+ if (String(t).startsWith(E)) {
69
+ k((l) => new Set(l).add(String(t).slice(E.length)));
70
+ return;
71
+ }
72
+ const e = W.get(t);
73
+ s(), e == null || e.onAction();
74
+ }, renderEmptyState: () => /* @__PURE__ */ n("p", { className: "alea-command-empty", role: p ? "status" : void 0, children: p ? a.loading : R }), children: (t) => /* @__PURE__ */ m(G, { id: t.id, className: "alea-option-section", children: [
75
+ t.title && /* @__PURE__ */ n(ee, { className: "alea-option-header", children: t.title }),
76
+ /* @__PURE__ */ n(te, { items: t.items, children: (e) => "more" in e ? /* @__PURE__ */ n(z, { id: e.id, textValue: a.showNMore(e.more), className: "alea-option alea-command-item alea-command-more", children: /* @__PURE__ */ n("span", { className: "alea-option-text", children: /* @__PURE__ */ n("span", { slot: "label", children: a.showNMore(e.more) }) }) }) : /* @__PURE__ */ m(z, { id: e.id, textValue: [e.label, ...e.keywords || []].join(" "), className: "alea-option alea-command-item", children: [
77
+ e.icon && /* @__PURE__ */ n("span", { className: "alea-option-icon", "aria-hidden": "true", children: e.icon }),
78
+ /* @__PURE__ */ m("span", { className: "alea-option-text", children: [
79
+ /* @__PURE__ */ n("span", { slot: "label", children: e.label }),
80
+ e.description && /* @__PURE__ */ n("span", { className: "alea-option-desc", slot: "description", children: e.description })
81
+ ] }),
82
+ e.shortcut && /* @__PURE__ */ n(ne, { className: "alea-menu-shortcut", children: e.shortcut })
83
+ ] }) })
84
+ ] }) }),
85
+ p && A.length > 0 && /* @__PURE__ */ n("p", { className: "alea-command-loading", role: "status", children: a.loading })
86
+ ] })
63
87
  ] }) }) });
64
88
  });
65
89
  export {
66
- oe as CommandPalette
90
+ we as CommandPalette
67
91
  };
@@ -27,15 +27,17 @@ export declare function Descriptions({ items, columns, layout, bordered, size, t
27
27
  export interface StatisticProps extends Omit<HTMLAttributes<HTMLDivElement>, 'prefix'> {
28
28
  /** What the number is. */
29
29
  label: ReactNode;
30
- /** The number. */
31
- value: number;
30
+ /** The number. Or ready-made text ("1.234,56 Bs", "n/a"), shown as it is: formatOptions does not apply to text, and animate swaps it with a short crossfade when it changes. With isDecimal, a string is an exact decimal that formatOptions formats. */
31
+ value: number | string;
32
+ /** Reads a string value as an exact decimal ("1234567.89") and formats it with formatOptions, without going through a float. With animate it counts up through the same number of decimals and ends on the exact string. */
33
+ isDecimal?: boolean;
32
34
  /** Intl number format (currency, percent, compact). */
33
35
  formatOptions?: Intl.NumberFormatOptions;
34
36
  /** Change versus before, e.g. 0.12 for +12%. */
35
37
  delta?: number;
36
38
  /** Is up good? Default true (turns green); false flips the colors (costs, errors). */
37
39
  higherIsBetter?: boolean;
38
- /** Counts up from 0 when it appears (skipped with reduced motion). */
40
+ /** Counts up from 0 when it appears, and from the old number to the new one when it changes (not with reduced motion: it shows the number at once). A decimal string counts up and ends exact; text crossfades instead. The screen reader text always holds the final value. */
39
41
  animate?: boolean;
40
42
  /** Before the number, e.g. "$". */
41
43
  prefix?: ReactNode;
@@ -43,7 +45,7 @@ export interface StatisticProps extends Omit<HTMLAttributes<HTMLDivElement>, 'pr
43
45
  suffix?: ReactNode;
44
46
  }
45
47
  /** A big number with its label and change. */
46
- export declare function Statistic({ label, value, formatOptions, delta, higherIsBetter, animate, prefix, suffix, className, ...props }: StatisticProps): import("react").JSX.Element;
48
+ export declare function Statistic({ label, value, isDecimal, formatOptions, delta, higherIsBetter, animate, prefix, suffix, className, ...props }: StatisticProps): import("react").JSX.Element;
47
49
  export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
48
50
  /** What is empty, in a few words. */
49
51
  title: ReactNode;
@@ -1,79 +1,89 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
3
- import { createElement as A, useState as C, useRef as k, useEffect as z } from "react";
4
- import { Inbox as g, ServerCrash as E, Lock as I, SearchX as M, CircleAlert as D, CircleCheck as R, TrendingUp as T, TrendingDown as j } from "lucide-react";
5
- import { cx as f } from "../../utils/cx.js";
6
- function _({ items: i, columns: a = 2, layout: d = "stacked", bordered: r, size: o, title: s, extra: c, labelWidth: m, className: h, style: u, ...p }) {
7
- const l = /* @__PURE__ */ e("dl", { className: "alea-descriptions", "data-columns": a, "data-layout": d, "data-bordered": r || void 0, "data-size": o, style: m ? { "--alea-desc-label": m } : void 0, children: i.map((t, N) => /* @__PURE__ */ n("div", { className: "alea-desc-item", "data-wide": t.wide || void 0, "data-span": t.span && t.span > 1 ? t.span : void 0, children: [
2
+ import { jsx as e, jsxs as r, Fragment as L } from "react/jsx-runtime";
3
+ import { createElement as U, useState as G, useRef as z, useEffect as O } from "react";
4
+ import { Inbox as D, 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 N } from "../../utils/cx.js";
6
+ import { isDecimalString as Q } from "../../utils/decimal.js";
7
+ import { useReducedMotion as V, TextSwap as Y } from "@alea-design/motion";
8
+ function ie({ items: c, columns: a = 2, layout: d = "stacked", bordered: l, size: n, title: o, extra: s, labelWidth: m, className: h, style: p, ...u }) {
9
+ const i = /* @__PURE__ */ e("dl", { className: "alea-descriptions", "data-columns": a, "data-layout": d, "data-bordered": l || void 0, "data-size": n, style: m ? { "--alea-desc-label": m } : void 0, children: c.map((t, v) => /* @__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: [
8
10
  /* @__PURE__ */ e("dt", { children: t.label }),
9
11
  /* @__PURE__ */ e("dd", { children: t.value })
10
- ] }, N)) });
11
- return !s && !c ? /* @__PURE__ */ e("div", { ...p, style: u, className: f("alea-descriptions-wrap", h), children: l }) : /* @__PURE__ */ n("section", { ...p, style: u, className: f("alea-descriptions-wrap", h), children: [
12
- /* @__PURE__ */ n("header", { className: "alea-descriptions-head", children: [
13
- s && /* @__PURE__ */ e("h3", { className: "alea-descriptions-title", children: s }),
14
- c && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: c })
12
+ ] }, v)) });
13
+ return !o && !s ? /* @__PURE__ */ e("div", { ...u, style: p, className: N("alea-descriptions-wrap", h), children: i }) : /* @__PURE__ */ r("section", { ...u, style: p, className: N("alea-descriptions-wrap", h), children: [
14
+ /* @__PURE__ */ r("header", { className: "alea-descriptions-head", children: [
15
+ o && /* @__PURE__ */ e("h3", { className: "alea-descriptions-title", children: o }),
16
+ s && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: s })
15
17
  ] }),
16
- l
18
+ i
17
19
  ] });
18
20
  }
19
- function B({ label: i, value: a, formatOptions: d, delta: r, higherIsBetter: o = !0, animate: s, prefix: c, suffix: m, className: h, ...u }) {
20
- const [p, l] = C(s ? 0 : a), t = k(0);
21
- z(() => {
22
- var y;
23
- if (!s || typeof window > "u" || (y = window.matchMedia) != null && y.call(window, "(prefers-reduced-motion: reduce)").matches) {
24
- l(a);
21
+ function ce({ label: c, value: a, isDecimal: d, formatOptions: l, delta: n, higherIsBetter: o = !0, animate: s, prefix: m, suffix: h, className: p, ...u }) {
22
+ var C;
23
+ const i = !!d && Q(a), t = typeof a == "string" && !i, v = V(), f = t ? 0 : i ? Number(a) : a, E = i ? ((C = a.trim().split(".")[1]) == null ? void 0 : C.length) ?? 0 : 0, [w, I] = G(s && !t ? 0 : f), x = z(w), S = z(0);
24
+ O(() => {
25
+ if (t) return;
26
+ const y = (g) => {
27
+ x.current = g, I(g);
28
+ };
29
+ if (!s || v || typeof window > "u") {
30
+ y(f);
25
31
  return;
26
32
  }
27
- const S = performance.now(), x = 900, w = (F) => {
28
- const b = Math.min(1, (F - S) / x);
29
- l(a * (1 - Math.pow(1 - b, 3))), b < 1 && (t.current = requestAnimationFrame(w));
33
+ const R = x.current, j = performance.now(), q = 900, k = (g) => {
34
+ const b = Math.min(1, (g - j) / q);
35
+ y(b < 1 ? R + (f - R) * (1 - Math.pow(1 - b, 3)) : f), b < 1 && (S.current = requestAnimationFrame(k));
30
36
  };
31
- return t.current = requestAnimationFrame(w), () => cancelAnimationFrame(t.current);
32
- }, [a, s]);
33
- const N = new Intl.NumberFormat(void 0, d), v = r === void 0 ? null : r >= 0 === o;
34
- return /* @__PURE__ */ n("div", { ...u, className: f("alea-stat", h), children: [
35
- /* @__PURE__ */ e("div", { className: "alea-stat-label", children: i }),
36
- /* @__PURE__ */ n("div", { className: "alea-stat-value", children: [
37
- /* @__PURE__ */ n("span", { "aria-hidden": "true", children: [
38
- c,
39
- N.format(s ? Math.round(p * 100) / 100 : a),
40
- m
37
+ return S.current = requestAnimationFrame(k), () => cancelAnimationFrame(S.current);
38
+ }, [f, s, v, t]);
39
+ const M = new Intl.NumberFormat(void 0, l), F = (y) => M.format(y), T = t || w === f || !s ? a : i ? w.toFixed(E) : Math.round(w * 100) / 100, A = n === void 0 ? null : n >= 0 === o;
40
+ return /* @__PURE__ */ r("div", { ...u, className: N("alea-stat", p), children: [
41
+ /* @__PURE__ */ e("div", { className: "alea-stat-label", children: c }),
42
+ /* @__PURE__ */ e("div", { className: "alea-stat-value", children: t ? /* @__PURE__ */ r("span", { children: [
43
+ m,
44
+ s ? /* @__PURE__ */ e(Y, { children: String(a) }) : a,
45
+ h
46
+ ] }) : /* @__PURE__ */ r(L, { children: [
47
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", children: [
48
+ m,
49
+ F(T),
50
+ h
41
51
  ] }),
42
- /* @__PURE__ */ e("span", { className: "alea-visually-hidden", children: N.format(a) })
43
- ] }),
44
- r !== void 0 && /* @__PURE__ */ n("div", { className: "alea-stat-delta", "data-good": v ? !0 : void 0, "data-bad": v === !1 ? !0 : void 0, children: [
45
- r >= 0 ? /* @__PURE__ */ e(T, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ e(j, { size: 14, "aria-hidden": "true" }),
46
- /* @__PURE__ */ n("span", { children: [
47
- r >= 0 ? "+" : "",
48
- new Intl.NumberFormat(void 0, { style: "percent", maximumFractionDigits: 1 }).format(r)
52
+ /* @__PURE__ */ e("span", { className: "alea-visually-hidden", children: F(a) })
53
+ ] }) }),
54
+ n !== void 0 && /* @__PURE__ */ r("div", { className: "alea-stat-delta", "data-good": A ? !0 : void 0, "data-bad": A === !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)
49
59
  ] }),
50
- /* @__PURE__ */ n("span", { className: "alea-visually-hidden", children: [
51
- r >= 0 ? "up" : "down",
60
+ /* @__PURE__ */ r("span", { className: "alea-visually-hidden", children: [
61
+ n >= 0 ? "up" : "down",
52
62
  " from before"
53
63
  ] })
54
64
  ] })
55
65
  ] });
56
66
  }
57
- function q({ title: i, description: a, icon: d, illustration: r, action: o, secondaryAction: s, footer: c, size: m, variant: h, headingAs: u = "h3", className: p, ...l }) {
58
- return /* @__PURE__ */ n("div", { ...l, className: f("alea-empty", p), "data-size": m, "data-variant": h, children: [
59
- /* @__PURE__ */ e("span", { className: r ? "alea-empty-art" : "alea-empty-icon", "aria-hidden": "true", children: d ?? /* @__PURE__ */ e(g, {}) }),
60
- A(u, { className: "alea-empty-title" }, i),
67
+ function Z({ title: c, description: a, icon: d, illustration: l, action: n, secondaryAction: o, footer: s, size: m, variant: h, headingAs: p = "h3", className: u, ...i }) {
68
+ return /* @__PURE__ */ r("div", { ...i, className: N("alea-empty", u), "data-size": m, "data-variant": h, children: [
69
+ /* @__PURE__ */ e("span", { className: l ? "alea-empty-art" : "alea-empty-icon", "aria-hidden": "true", children: d ?? /* @__PURE__ */ e(D, {}) }),
70
+ U(p, { className: "alea-empty-title" }, c),
61
71
  a && /* @__PURE__ */ e("p", { className: "alea-empty-text", children: a }),
62
- (o || s) && /* @__PURE__ */ n("div", { className: "alea-empty-action", children: [
63
- o,
64
- s
72
+ (n || o) && /* @__PURE__ */ r("div", { className: "alea-empty-action", children: [
73
+ n,
74
+ o
65
75
  ] }),
66
- c && /* @__PURE__ */ e("p", { className: "alea-empty-footer", children: c })
76
+ s && /* @__PURE__ */ e("p", { className: "alea-empty-footer", children: s })
67
77
  ] });
68
78
  }
69
- const L = { success: R, error: D, 404: M, 403: I, 500: E, info: g };
70
- function H({ status: i, className: a, ...d }) {
71
- const r = L[i];
72
- return /* @__PURE__ */ e(q, { ...d, headingAs: d.headingAs ?? "h2", icon: /* @__PURE__ */ e(r, {}), className: f("alea-result", a), "data-status": i });
79
+ const $ = { success: J, error: H, 404: B, 403: _, 500: X, info: D };
80
+ function de({ status: c, className: a, ...d }) {
81
+ const l = $[c];
82
+ return /* @__PURE__ */ e(Z, { ...d, headingAs: d.headingAs ?? "h2", icon: /* @__PURE__ */ e(l, {}), className: N("alea-result", a), "data-status": c });
73
83
  }
74
84
  export {
75
- _ as Descriptions,
76
- q as EmptyState,
77
- H as Result,
78
- B as Statistic
85
+ ie as Descriptions,
86
+ Z as EmptyState,
87
+ de as Result,
88
+ ce as Statistic
79
89
  };
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  import { type CalendarProps as RACCalendarProps, type RangeCalendarProps as RACRangeCalendarProps, type DatePickerProps as RACDatePickerProps, type DateRangePickerProps as RACDateRangePickerProps, type DateFieldProps as RACDateFieldProps, type TimeFieldProps as RACTimeFieldProps, type DateValue, type TimeValue, type ValidationResult } from 'react-aria-components';
3
3
  import type { MotionProp } from '@alea-design/motion';
4
4
  interface CalendarExtras {
@@ -39,10 +39,24 @@ export interface DatePickerProps<T extends DateValue> extends RACDatePickerProps
39
39
  }
40
40
  /** Type a date or pick it from a calendar. */
41
41
  export declare function DatePicker<T extends DateValue>({ motion, label, description, errorMessage, isLoading, className, ...props }: DatePickerProps<T>): import("react").JSX.Element;
42
+ /** A shortcut of a DateRangePicker: a label and a function that returns the range it sets. */
43
+ export interface DateRangePreset {
44
+ /** The text of the shortcut button ("Today", "Last 7 days"). Translate it yourself. */
45
+ label: ReactNode;
46
+ /** Called when the shortcut is pressed (so "today" is today, not the day the page loaded). Return the start and end dates. */
47
+ range: () => {
48
+ start: DateValue;
49
+ end: DateValue;
50
+ };
51
+ /** Stable key, when the label is not text. */
52
+ id?: string;
53
+ }
42
54
  export interface DateRangePickerProps<T extends DateValue> extends RACDateRangePickerProps<T>, Bits {
55
+ /** Shortcut buttons above the calendar that set the range in one press (Today, Last 7 days, This month). The popup closes after one is pressed. */
56
+ presets?: DateRangePreset[];
43
57
  /** How the popup enters and leaves: a preset (fade, scale, pop, slide-down, blur...), false for none, or options. */
44
58
  motion?: MotionProp;
45
59
  }
46
60
  /** Type or pick a start and end date. */
47
- export declare function DateRangePicker<T extends DateValue>({ motion, label, description, errorMessage, isLoading, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
61
+ export declare function DateRangePicker<T extends DateValue>({ motion, presets, label, description, errorMessage, isLoading, className, ...props }: DateRangePickerProps<T>): import("react").JSX.Element;
48
62
  export {};
@@ -1,109 +1,120 @@
1
1
  "use client";
2
- import { jsxs as i, jsx as a, Fragment as P } from "react/jsx-runtime";
3
- import { Calendar as S, DateField as $, DatePicker as G, Group as R, Button as o, Dialog as b, DateRangePicker as x, DateInput as g, DateSegment as v, RangeCalendar as z, TimeField as H, CalendarMonthPicker as T, CalendarYearPicker as B, Heading as j, CalendarGrid as A, CalendarGridHeader as E, CalendarHeaderCell as I, CalendarGridBody as Y, CalendarCell as _ } from "react-aria-components";
4
- import { CalendarDays as k, ChevronLeft as J, ChevronRight as K } from "lucide-react";
5
- import { withBase as d } from "../../utils/cx.js";
6
- import { Label as O, Description as Q, FieldError as U } from "../field/Field.js";
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";
6
+ import { withBase as s } from "../../utils/cx.js";
7
+ import { Label as U, Description as W, FieldError as X } from "../field/Field.js";
7
8
  import { Popover as w } from "../overlay/Overlay.js";
8
- import { FieldSpinner as m, loadingAttrs as u } from "../field/FieldLoading.js";
9
- import { useStrings as y } from "../../i18n/strings.js";
10
- function F({ pickers: r }) {
9
+ import { Button as Z } from "../button/Button.js";
10
+ import { FieldSpinner as u, loadingAttrs as h } from "../field/FieldLoading.js";
11
+ import { useStrings as C } from "../../i18n/strings.js";
12
+ function y({ pickers: r }) {
11
13
  return /* @__PURE__ */ i("header", { className: "alea-cal-head", children: [
12
- /* @__PURE__ */ a(o, { slot: "previous", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(J, { size: 16 }) }),
14
+ /* @__PURE__ */ a(m, { slot: "previous", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(K, { size: 16 }) }),
13
15
  r ? /* @__PURE__ */ i("div", { className: "alea-cal-pickers", children: [
14
- /* @__PURE__ */ a(T, { 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)) }) }),
15
- /* @__PURE__ */ a(B, { 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)) }) })
16
- ] }) : /* @__PURE__ */ a(j, { className: "alea-cal-title" }),
17
- /* @__PURE__ */ a(o, { slot: "next", className: "alea-cal-nav alea-focus-ring", children: /* @__PURE__ */ a(K, { size: 16 }) })
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 }) })
18
20
  ] });
19
21
  }
20
- function D({ offset: r = 0 }) {
21
- return /* @__PURE__ */ i(A, { className: "alea-cal-grid", weekdayStyle: "short", offset: r ? { months: r } : void 0, children: [
22
- /* @__PURE__ */ a(E, { children: (l) => /* @__PURE__ */ a(I, { className: "alea-cal-weekday", children: l }) }),
23
- /* @__PURE__ */ a(Y, { children: (l) => /* @__PURE__ */ a(_, { date: l, className: "alea-cal-cell alea-focus-ring" }) })
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" }) })
24
26
  ] });
25
27
  }
26
- const q = ({ count: r }) => r > 1 ? /* @__PURE__ */ a("div", { className: "alea-cal-months", children: Array.from({ length: r }, (l, e) => /* @__PURE__ */ a(D, { offset: e }, e)) }) : /* @__PURE__ */ a(D, {});
27
- function V({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
28
- return /* @__PURE__ */ i(S, { ...n, visibleDuration: e > 1 ? { months: e } : n.visibleDuration, className: d("alea-calendar", r), "data-months": e > 1 ? e : void 0, children: [
29
- /* @__PURE__ */ a(F, { pickers: l }),
30
- /* @__PURE__ */ a(q, { count: e })
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 })
31
33
  ] });
32
34
  }
33
- function W({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
34
- return /* @__PURE__ */ i(z, { ...n, visibleDuration: e > 1 ? { months: e } : n.visibleDuration, className: d("alea-calendar alea-range-calendar", r), "data-months": e > 1 ? e : void 0, children: [
35
- /* @__PURE__ */ a(F, { pickers: l }),
36
- /* @__PURE__ */ a(q, { count: e })
35
+ function M({ className: r, pickers: l, visibleMonths: e = 1, ...n }) {
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
39
  ] });
38
40
  }
39
- function h({ label: r, isRequired: l }) {
40
- return r ? /* @__PURE__ */ i(O, { children: [
41
+ function f({ label: r, isRequired: l }) {
42
+ return r ? /* @__PURE__ */ i(U, { children: [
41
43
  r,
42
44
  l && /* @__PURE__ */ a("span", { className: "alea-label-required", "aria-hidden": "true", children: " *" })
43
45
  ] }) : null;
44
46
  }
45
47
  function N({ description: r, errorMessage: l }) {
46
- return /* @__PURE__ */ i(P, { children: [
47
- r && /* @__PURE__ */ a(Q, { children: r }),
48
- /* @__PURE__ */ a(U, { children: l })
48
+ return /* @__PURE__ */ i(S, { children: [
49
+ r && /* @__PURE__ */ a(W, { children: r }),
50
+ /* @__PURE__ */ a(X, { children: l })
49
51
  ] });
50
52
  }
51
- function C() {
52
- return /* @__PURE__ */ a(g, { className: "alea-date-input", children: (r) => /* @__PURE__ */ a(v, { segment: r, className: "alea-date-segment" }) });
53
+ function D() {
54
+ return /* @__PURE__ */ a(p, { className: "alea-date-input", children: (r) => /* @__PURE__ */ a(v, { segment: r, className: "alea-date-segment" }) });
53
55
  }
54
- function na({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
55
- return /* @__PURE__ */ i($, { ...c, className: d("alea-field", t), ...u(n), children: [
56
- /* @__PURE__ */ a(h, { label: r, isRequired: c.isRequired }),
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 }),
57
59
  /* @__PURE__ */ i("div", { className: "alea-input-wrap alea-date-wrap", "aria-busy": n || void 0, children: [
58
- /* @__PURE__ */ a(C, {}),
59
- n && /* @__PURE__ */ a(m, {})
60
+ /* @__PURE__ */ a(D, {}),
61
+ n && /* @__PURE__ */ a(u, {})
60
62
  ] }),
61
63
  /* @__PURE__ */ a(N, { description: l, errorMessage: e })
62
64
  ] });
63
65
  }
64
- function ia({ label: r, description: l, errorMessage: e, isLoading: n, className: t, ...c }) {
65
- return /* @__PURE__ */ i(H, { ...c, className: d("alea-field", t), ...u(n), children: [
66
- /* @__PURE__ */ a(h, { label: r, isRequired: c.isRequired }),
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 }),
67
69
  /* @__PURE__ */ i("div", { className: "alea-input-wrap alea-date-wrap", "aria-busy": n || void 0, children: [
68
- /* @__PURE__ */ a(C, {}),
69
- n && /* @__PURE__ */ a(m, {})
70
+ /* @__PURE__ */ a(D, {}),
71
+ n && /* @__PURE__ */ a(u, {})
70
72
  ] }),
71
73
  /* @__PURE__ */ a(N, { description: l, errorMessage: e })
72
74
  ] });
73
75
  }
74
- function ta({ motion: r, label: l, description: e, errorMessage: n, isLoading: t, className: c, ...s }) {
75
- const f = y();
76
- return /* @__PURE__ */ i(G, { ...s, className: d("alea-field", c), ...u(t), children: [
77
- /* @__PURE__ */ a(h, { label: l, isRequired: s.isRequired }),
78
- /* @__PURE__ */ i(R, { className: "alea-input-wrap alea-date-wrap", "aria-busy": t || void 0, children: [
79
- /* @__PURE__ */ a(C, {}),
80
- t && /* @__PURE__ */ a(m, {}),
81
- /* @__PURE__ */ a(o, { className: "alea-input-clear alea-focus-ring", "aria-label": f.openCalendar, children: /* @__PURE__ */ a(k, { size: 16 }) })
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: [
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
84
  ] }),
83
85
  /* @__PURE__ */ a(N, { description: e, errorMessage: n }),
84
- /* @__PURE__ */ a(w, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ a(b, { className: "alea-cal-dialog", children: /* @__PURE__ */ a(V, {}) }) })
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
87
  ] });
86
88
  }
87
- function ca({ motion: r, label: l, description: e, errorMessage: n, isLoading: t, className: c, ...s }) {
88
- const f = y();
89
- return /* @__PURE__ */ i(x, { ...s, className: d("alea-field", c), ...u(t), children: [
90
- /* @__PURE__ */ a(h, { label: l, isRequired: s.isRequired }),
91
- /* @__PURE__ */ i(R, { className: "alea-input-wrap alea-date-wrap", "aria-busy": t || void 0, children: [
92
- /* @__PURE__ */ a(g, { slot: "start", className: "alea-date-input", children: (p) => /* @__PURE__ */ a(v, { segment: p, className: "alea-date-segment" }) }),
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: () => {
92
+ e == null || e.setValue(n.range()), e == null || e.setOpen(!1);
93
+ }, children: n.label }, n.id ?? (typeof n.label == "string" ? n.label : t))) });
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" }) }),
93
101
  /* @__PURE__ */ a("span", { className: "alea-date-dash", "aria-hidden": "true", children: "to" }),
94
- /* @__PURE__ */ a(g, { slot: "end", className: "alea-date-input", children: (p) => /* @__PURE__ */ a(v, { segment: p, className: "alea-date-segment" }) }),
95
- t && /* @__PURE__ */ a(m, {}),
96
- /* @__PURE__ */ a(o, { className: "alea-input-clear alea-focus-ring", "aria-label": f.openCalendar, children: /* @__PURE__ */ a(k, { size: 16 }) })
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 }) })
97
105
  ] }),
98
- /* @__PURE__ */ a(N, { description: e, errorMessage: n }),
99
- /* @__PURE__ */ a(w, { className: "alea-popover alea-cal-popover", placement: "bottom start", motion: r, children: /* @__PURE__ */ a(b, { className: "alea-cal-dialog", children: /* @__PURE__ */ a(W, {}) }) })
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, {})
110
+ ] }) })
100
111
  ] });
101
112
  }
102
113
  export {
103
- V as Calendar,
104
- na as DateField,
105
- ta as DatePicker,
106
- ca as DateRangePicker,
107
- W as RangeCalendar,
108
- ia as TimeField
114
+ L as Calendar,
115
+ ma as DateField,
116
+ ha as DatePicker,
117
+ fa as DateRangePicker,
118
+ M as RangeCalendar,
119
+ ua as TimeField
109
120
  };
@@ -6,6 +6,8 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
6
6
  tone?: Tone;
7
7
  /** soft (tinted, default), solid, or outline. */
8
8
  appearance?: 'soft' | 'solid' | 'outline';
9
+ /** Lets a long text break onto several lines (the badge grows from its normal height) instead of staying on one line and being cut. For narrow screens and large text. */
10
+ wrap?: boolean;
9
11
  /** A dot before the text, for statuses. pulse makes it breathe, for live things. */
10
12
  dot?: boolean | 'pulse';
11
13
  /** An icon before the text. */
@@ -17,7 +19,7 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
17
19
  children?: ReactNode;
18
20
  }
19
21
  /** A small status or count label: six tones, three looks, three sizes, a dot or an icon. Not interactive. */
20
- export declare function Badge({ tone, appearance, dot, icon, size, shape, className, children, ...props }: BadgeProps): import("react").JSX.Element;
22
+ export declare function Badge({ tone, appearance, dot, icon, size, shape, wrap, className, children, ...props }: BadgeProps): import("react").JSX.Element;
21
23
  /** The tone for common status words (lowercase). Extend or override it with StatusBadge's tones. */
22
24
  export declare const STATUS_TONES: Record<string, Tone>;
23
25
  export interface StatusBadgeProps extends Omit<BadgeProps, 'tone' | 'children'> {