@alea-design/ui 0.5.1 → 0.6.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 (103) 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 +82 -56
  9. package/dist/components/data/Data.d.ts +11 -7
  10. package/dist/components/data/Data.js +65 -55
  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.d.ts +5 -1
  34. package/dist/components/media/Media.js +115 -113
  35. package/dist/components/more/More.d.ts +2 -2
  36. package/dist/components/more/More.js +46 -45
  37. package/dist/components/navigation/Navigation.d.ts +11 -5
  38. package/dist/components/navigation/Navigation.js +97 -80
  39. package/dist/components/navigation/Navigation2.d.ts +9 -3
  40. package/dist/components/navigation/Navigation2.js +208 -194
  41. package/dist/components/notification/NotificationCenter.js +70 -70
  42. package/dist/components/overlay/Drawer.d.ts +6 -1
  43. package/dist/components/overlay/Drawer.js +27 -25
  44. package/dist/components/overlay/Modal.d.ts +5 -0
  45. package/dist/components/overlay/Modal.js +16 -15
  46. package/dist/components/overlay/Overlay.d.ts +14 -1
  47. package/dist/components/overlay/Overlay.js +52 -50
  48. package/dist/components/overlay/Sheet.d.ts +2 -0
  49. package/dist/components/overlay/Sheet.js +30 -30
  50. package/dist/components/page/PageParts.d.ts +6 -2
  51. package/dist/components/page/PageParts.js +92 -84
  52. package/dist/components/select/Select.js +75 -70
  53. package/dist/components/settings/Settings.d.ts +29 -0
  54. package/dist/components/settings/Settings.js +31 -0
  55. package/dist/components/shell/AccountMenu.d.ts +20 -0
  56. package/dist/components/shell/AccountMenu.js +32 -0
  57. package/dist/components/shell/AppShell.d.ts +9 -2
  58. package/dist/components/shell/AppShell.js +37 -37
  59. package/dist/components/shell/AppSidebar.d.ts +9 -3
  60. package/dist/components/shell/AppSidebar.js +45 -39
  61. package/dist/components/table/Table.d.ts +18 -4
  62. package/dist/components/table/Table.js +70 -46
  63. package/dist/components/tabs/Tabs.js +105 -94
  64. package/dist/components/theme/Theme.d.ts +7 -4
  65. package/dist/components/theme/Theme.js +127 -130
  66. package/dist/components/upload/Upload.js +62 -54
  67. package/dist/css/base.css +1 -1
  68. package/dist/css/button.css +1 -1
  69. package/dist/css/card.css +1 -1
  70. package/dist/css/command.css +1 -1
  71. package/dist/css/data.css +1 -1
  72. package/dist/css/date.css +1 -1
  73. package/dist/css/display.css +1 -1
  74. package/dist/css/feedback.css +1 -1
  75. package/dist/css/field.css +1 -1
  76. package/dist/css/form.css +1 -1
  77. package/dist/css/groups.json +37 -21
  78. package/dist/css/list.css +1 -1
  79. package/dist/css/menu.css +1 -1
  80. package/dist/css/navigation.css +1 -1
  81. package/dist/css/notification.css +1 -1
  82. package/dist/css/overlay.css +1 -1
  83. package/dist/css/page.css +1 -1
  84. package/dist/css/select.css +1 -1
  85. package/dist/css/settings.css +1 -0
  86. package/dist/css/shell.css +1 -1
  87. package/dist/css/table.css +1 -1
  88. package/dist/css/tabs.css +1 -1
  89. package/dist/css/upload.css +1 -1
  90. package/dist/i18n/strings.d.ts +9 -0
  91. package/dist/i18n/strings.js +18 -0
  92. package/dist/index.d.ts +4 -0
  93. package/dist/index.js +318 -306
  94. package/dist/styles.css +1 -1
  95. package/dist/utils/animateRows.d.ts +11 -0
  96. package/dist/utils/animateRows.js +23 -0
  97. package/dist/utils/decimal.d.ts +12 -0
  98. package/dist/utils/decimal.js +48 -0
  99. package/dist/utils/initialFocus.d.ts +6 -0
  100. package/dist/utils/initialFocus.js +24 -0
  101. package/dist/utils/refs.d.ts +2 -0
  102. package/dist/utils/refs.js +14 -6
  103. package/package.json +3 -3
@@ -1,67 +1,93 @@
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(() => {
13
- const i = o.current;
14
- 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 });
2
+ import { jsx as n, jsxs as m } from "react/jsx-runtime";
3
+ import { forwardRef as B, useState as N, useEffect as D, useMemo as j, useRef as J } from "react";
4
+ import { cx as P } from "../../utils/cx.js";
5
+ import { useFilter as Y, Autocomplete as Z, SearchField as Q, Input as G, Menu as ee, MenuSection as te, Header as ne, Collection as se, MenuItem as z, Keyboard as ie } from "react-aria-components";
6
+ import { Search as ae } from "lucide-react";
7
+ import { DialogModal as le, Dialog as oe } from "../overlay/Overlay.js";
8
+ import { Kbd as re } from "../typography/Typography.js";
9
+ import { useStrings as ce } from "../../i18n/strings.js";
10
+ const M = "__more:";
11
+ function de({ children: K }) {
12
+ const o = J(null), [h, w] = N(!1);
13
+ return D(() => {
14
+ const a = o.current;
15
+ if (!a) return;
16
+ const f = () => w(a.scrollHeight > a.clientHeight + 1);
17
+ if (f(), typeof ResizeObserver > "u") return;
18
+ const c = new ResizeObserver(f);
19
+ return c.observe(a), a.firstElementChild && c.observe(a.firstElementChild), () => c.disconnect();
20
+ }, []), /* @__PURE__ */ n("div", { ref: o, className: "alea-command-scroll", tabIndex: h ? 0 : void 0, children: K });
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 ve = B(function({ commands: o, isOpen: h, defaultOpen: w, onOpenChange: a, motion: f, hotkey: c = !0, slashHotkey: R, onQueryChange: b, filter: p, isLoading: v, maxPerGroup: d, placeholder: I, emptyText: k, className: F, style: L, surface: T, radius: V }, H) {
23
+ const l = ce();
24
+ I ?? (I = l.commandPlaceholder), k ?? (k = l.noResults);
25
+ const [O, _] = N(w ?? !1), g = h ?? O, [r, U] = N(""), [x, A] = N(/* @__PURE__ */ new Set()), C = (i) => {
26
+ U(i), b == null || b(i);
27
+ }, S = (i) => {
28
+ i || (r && C(""), A(/* @__PURE__ */ new Set())), h === void 0 && _(i), a == null || a(i);
26
29
  };
27
- y(() => {
28
- if (!a) return;
29
- const s = (t) => {
30
- t.key.toLowerCase() === "k" && (t.metaKey || t.ctrlKey) && (t.preventDefault(), N(!b));
30
+ D(() => {
31
+ if (!c && !R) return;
32
+ const i = (t) => {
33
+ if (c && t.key.toLowerCase() === "k" && (t.metaKey || t.ctrlKey)) {
34
+ t.preventDefault(), S(!g);
35
+ return;
36
+ }
37
+ if (R && !g && 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
- return window.addEventListener("keydown", s), () => window.removeEventListener("keydown", s);
43
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
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: W } = Y({ sensitivity: "base" }), { groups: y, total: X } = j(() => {
46
+ const i = (s) => p === !1 || !r ? !0 : p ? p(s, r) : W([s.label, ...s.keywords || []].join(" "), r), t = [];
47
+ let e = 0;
48
+ for (const s of o) {
49
+ if (!i(s)) continue;
50
+ e++;
51
+ const u = s.group || "";
52
+ let E = t.find((q) => q.id === u);
53
+ E || t.push(E = { id: u, title: u, items: [] }), E.items.push(s);
54
+ }
55
+ if (d && d > 0) for (const s of t) {
56
+ if (x.has(s.id) || s.items.length <= d) continue;
57
+ const u = s.items.length - d;
58
+ s.items = [...s.items.slice(0, d), { id: M + s.id, more: u, group: s.id }];
40
59
  }
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 })
60
+ return { groups: t, total: e };
61
+ }, [o, r, p, d, x]), $ = j(() => new Map(o.map((i) => [i.id, i])), [o]);
62
+ return /* @__PURE__ */ n(le, { isOpen: g, onOpenChange: S, size: "md", className: "alea-command-overlay", motion: f, surface: T, radius: V, children: /* @__PURE__ */ n(oe, { ref: H, style: L, "aria-label": l.commandPalette, hideClose: !0, className: P("alea-command", F), children: ({ close: i }) => /* @__PURE__ */ m(Z, { inputValue: r, onInputChange: C, filter: () => !0, children: [
63
+ /* @__PURE__ */ m(Q, { "aria-label": l.searchCommands, autoFocus: !0, className: "alea-command-search", children: [
64
+ /* @__PURE__ */ n(ae, { size: 18, "aria-hidden": "true" }),
65
+ /* @__PURE__ */ n(G, { placeholder: I, className: "alea-command-input" }),
66
+ /* @__PURE__ */ n(re, { children: l.esc })
48
67
  ] }),
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
- ] }) }) })
68
+ /* @__PURE__ */ m(de, { children: [
69
+ y.length > 0 && /* @__PURE__ */ n(ee, { items: y, className: "alea-command-list", "aria-busy": v || void 0, onAction: (t) => {
70
+ if (String(t).startsWith(M)) {
71
+ A((s) => new Set(s).add(String(t).slice(M.length)));
72
+ return;
73
+ }
74
+ const e = $.get(t);
75
+ i(), e == null || e.onAction();
76
+ }, children: (t) => /* @__PURE__ */ m(te, { id: t.id, className: "alea-option-section", children: [
77
+ t.title && /* @__PURE__ */ n(ne, { className: "alea-option-header", children: t.title }),
78
+ /* @__PURE__ */ n(se, { items: t.items, children: (e) => "more" in e ? /* @__PURE__ */ n(z, { id: e.id, textValue: l.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: l.showNMore(e.more) }) }) }) : /* @__PURE__ */ m(z, { id: e.id, textValue: [e.label, ...e.keywords || []].join(" "), className: "alea-option alea-command-item", children: [
79
+ e.icon && /* @__PURE__ */ n("span", { className: "alea-option-icon", "aria-hidden": "true", children: e.icon }),
80
+ /* @__PURE__ */ m("span", { className: "alea-option-text", children: [
81
+ /* @__PURE__ */ n("span", { slot: "label", children: e.label }),
82
+ e.description && /* @__PURE__ */ n("span", { className: "alea-option-desc", slot: "description", children: e.description })
83
+ ] }),
84
+ e.shortcut && /* @__PURE__ */ n(ie, { className: "alea-menu-shortcut", children: e.shortcut })
85
+ ] }) })
86
+ ] }) }),
87
+ /* @__PURE__ */ n("div", { role: "status", children: y.length === 0 ? /* @__PURE__ */ n("p", { className: "alea-command-empty", children: v ? l.loading : k }) : v ? /* @__PURE__ */ n("p", { className: "alea-command-loading", children: l.loading }) : r ? /* @__PURE__ */ n("span", { className: "alea-visually-hidden", children: l.resultsCount(X) }) : null })
88
+ ] })
63
89
  ] }) }) });
64
90
  });
65
91
  export {
66
- oe as CommandPalette
92
+ ve as CommandPalette
67
93
  };
@@ -7,8 +7,10 @@ export interface DescriptionsProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
7
7
  span?: 1 | 2 | 3 | 4; /** Spans the whole row. */
8
8
  wide?: boolean;
9
9
  }>;
10
- /** Columns on wide screens: 1 to 4. Default 2. Three and four columns drop to two below 1024 px; everything is one column on phones. */
11
- columns?: 1 | 2 | 3 | 4;
10
+ /** Columns on wide screens: 1 to 4. Default 2. Three and four columns drop to two below 1024 px; everything is one column on phones. 'auto' fits as many columns of at least 14 rem as the width allows (item spans count as one). */
11
+ columns?: 1 | 2 | 3 | 4 | 'auto';
12
+ /** Leaves out the items whose value is empty (null, undefined, false or an empty string), so a record with optional facts shows no blank rows. */
13
+ hideEmpty?: boolean;
12
14
  /** stacked (label above the value, default) or inline (label and value side by side). */
13
15
  layout?: 'stacked' | 'inline';
14
16
  /** Draws lines between items. */
@@ -23,19 +25,21 @@ export interface DescriptionsProps extends Omit<HTMLAttributes<HTMLElement>, 'ti
23
25
  labelWidth?: string;
24
26
  }
25
27
  /** 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. */
26
- export declare function Descriptions({ items, columns, layout, bordered, size, title, extra, labelWidth, className, style, ...props }: DescriptionsProps): import("react").JSX.Element;
28
+ export declare function Descriptions({ items, columns, hideEmpty, layout, bordered, size, title, extra, labelWidth, className, style, ...props }: DescriptionsProps): import("react").JSX.Element;
27
29
  export interface StatisticProps extends Omit<HTMLAttributes<HTMLDivElement>, 'prefix'> {
28
30
  /** What the number is. */
29
31
  label: ReactNode;
30
- /** The number. */
31
- value: number;
32
+ /** 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. */
33
+ value: number | string;
34
+ /** 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. */
35
+ isDecimal?: boolean;
32
36
  /** Intl number format (currency, percent, compact). */
33
37
  formatOptions?: Intl.NumberFormatOptions;
34
38
  /** Change versus before, e.g. 0.12 for +12%. */
35
39
  delta?: number;
36
40
  /** Is up good? Default true (turns green); false flips the colors (costs, errors). */
37
41
  higherIsBetter?: boolean;
38
- /** Counts up from 0 when it appears (skipped with reduced motion). */
42
+ /** 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
43
  animate?: boolean;
40
44
  /** Before the number, e.g. "$". */
41
45
  prefix?: ReactNode;
@@ -43,7 +47,7 @@ export interface StatisticProps extends Omit<HTMLAttributes<HTMLDivElement>, 'pr
43
47
  suffix?: ReactNode;
44
48
  }
45
49
  /** 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;
50
+ export declare function Statistic({ label, value, isDecimal, formatOptions, delta, higherIsBetter, animate, prefix, suffix, className, ...props }: StatisticProps): import("react").JSX.Element;
47
51
  export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
48
52
  /** What is empty, in a few words. */
49
53
  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 D, useEffect as O } from "react";
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";
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, 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: [
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: [
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: [
13
15
  s && /* @__PURE__ */ e("h3", { className: "alea-descriptions-title", children: s }),
14
- c && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: c })
16
+ l && /* @__PURE__ */ e("div", { className: "alea-descriptions-extra", children: l })
15
17
  ] }),
16
- l
18
+ N
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: m, delta: n, higherIsBetter: u = !0, animate: s, prefix: l, suffix: h, className: p, ...f }) {
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);
24
+ O(() => {
25
+ if (o) return;
26
+ const y = (g) => {
27
+ F.current = g, I(g);
28
+ };
29
+ if (!s || N || typeof window > "u") {
30
+ y(t);
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 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));
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 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: [
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,
45
+ h
46
+ ] }) : /* @__PURE__ */ r(L, { children: [
47
+ /* @__PURE__ */ r("span", { "aria-hidden": "true", children: [
48
+ l,
49
+ A(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: A(a) })
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)
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: 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),
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 || u) && /* @__PURE__ */ r("div", { className: "alea-empty-action", children: [
73
+ n,
74
+ u
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: 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 });
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
  };