@leonardaustin/ui 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/components/charts/AreaChart.js +113 -114
  2. package/dist/components/charts/Heatmap.d.ts +20 -0
  3. package/dist/components/charts/Heatmap.js +46 -0
  4. package/dist/components/charts/chartUtils.d.ts +2 -0
  5. package/dist/components/charts/chartUtils.js +14 -9
  6. package/dist/components/charts/useChartSize.d.ts +5 -0
  7. package/dist/components/charts/useChartSize.js +18 -0
  8. package/dist/components/tables/Pagination.d.ts +3 -1
  9. package/dist/components/tables/Pagination.js +12 -12
  10. package/dist/components/tables/ResourceTable.d.ts +5 -0
  11. package/dist/components/tables/ResourceTable.js +11 -9
  12. package/dist/components/tables/Table.d.ts +22 -3
  13. package/dist/components/tables/Table.js +41 -35
  14. package/dist/components/ui/ActionLink.d.ts +14 -0
  15. package/dist/components/ui/ActionLink.js +12 -0
  16. package/dist/components/ui/DateRangePicker.js +107 -76
  17. package/dist/components/ui/EmptyState.d.ts +8 -6
  18. package/dist/components/ui/EmptyState.js +11 -10
  19. package/dist/components/ui/ErrorBoundary.d.ts +6 -0
  20. package/dist/components/ui/ErrorBoundary.js +11 -5
  21. package/dist/components/ui/Grid.d.ts +1 -1
  22. package/dist/components/ui/Icon.d.ts +91 -0
  23. package/dist/components/ui/Icon.js +98 -0
  24. package/dist/components/ui/Inline.d.ts +1 -1
  25. package/dist/components/ui/LoadingSpinner.d.ts +7 -3
  26. package/dist/components/ui/LoadingSpinner.js +19 -11
  27. package/dist/components/ui/Meter.d.ts +11 -0
  28. package/dist/components/ui/Meter.js +7 -0
  29. package/dist/components/ui/MetricCard.d.ts +11 -8
  30. package/dist/components/ui/MetricCard.js +18 -15
  31. package/dist/components/ui/PaginationBar.d.ts +3 -3
  32. package/dist/components/ui/PaginationBar.js +35 -33
  33. package/dist/components/ui/SideSheet.d.ts +4 -2
  34. package/dist/components/ui/SideSheet.js +64 -52
  35. package/dist/components/ui/Stack.d.ts +1 -1
  36. package/dist/components/ui/Tabs.d.ts +5 -1
  37. package/dist/components/ui/Tabs.js +23 -21
  38. package/dist/components/ui/Text.d.ts +19 -0
  39. package/dist/components/ui/Text.js +20 -0
  40. package/dist/components/ui/Toolbar.js +13 -13
  41. package/dist/core.css +105 -0
  42. package/dist/hooks/useFocusTrap.js +1 -1
  43. package/dist/index.d.ts +5 -0
  44. package/dist/index.js +134 -129
  45. package/dist/styles.css +106 -0
  46. package/package.json +1 -1
@@ -1,5 +1,13 @@
1
1
  import type { ComponentPropsWithRef, CSSProperties, ReactNode } from "react";
2
2
  export interface TableProps extends ComponentPropsWithRef<"table"> {
3
+ /** Use a borderless table inside an existing card. Defaults to "framed". */
4
+ appearance?: "framed" | "embedded";
5
+ /** Reduce horizontal and vertical cell padding. Defaults to false. */
6
+ compact?: boolean;
7
+ /** Tint alternating body rows. Defaults to false. */
8
+ striped?: boolean;
9
+ /** Use a tinted header with body-sized labels in their original case. */
10
+ headerAppearance?: "default" | "band";
3
11
  /** Table caption, rendered as a `<caption>`. */
4
12
  caption?: ReactNode;
5
13
  /** Visually hide the caption while keeping it available to screen readers. Defaults to `false`. */
@@ -17,9 +25,10 @@ export interface TableProps extends ComponentPropsWithRef<"table"> {
17
25
  /** Content rendered inside the wrapper `<div>` before the `<table>`, for example a visually hidden `role="status"` loading message. */
18
26
  beforeTable?: ReactNode;
19
27
  }
20
- export declare function Table({ caption, captionHidden, captionClassName, stickyHeader, maxHeight, wrapperClassName, wrapperProps, beforeTable, className, children, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare function Table({ appearance, compact, striped, headerAppearance, caption, captionHidden, captionClassName, stickyHeader, maxHeight, wrapperClassName, wrapperProps, beforeTable, className, children, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
21
29
  export declare function TableHead({ className, ...props }: ComponentPropsWithRef<"thead">): import("react/jsx-runtime").JSX.Element;
22
30
  export declare function TableBody({ className, ...props }: ComponentPropsWithRef<"tbody">): import("react/jsx-runtime").JSX.Element;
31
+ export declare function TableFoot({ className, ...props }: ComponentPropsWithRef<"tfoot">): import("react/jsx-runtime").JSX.Element;
23
32
  export interface TableRowProps extends ComponentPropsWithRef<"tr"> {
24
33
  /** Marks the row selected via `data-selected`, which applies the selected background. `aria-selected` is not set; pass it yourself only where it is valid (grid/treegrid rows). */
25
34
  selected?: boolean;
@@ -28,6 +37,11 @@ export interface TableRowProps extends ComponentPropsWithRef<"tr"> {
28
37
  }
29
38
  export declare function TableRow({ selected, interactive, className, ...props }: TableRowProps): import("react/jsx-runtime").JSX.Element;
30
39
  export interface TableHeaderCellProps extends Omit<ComponentPropsWithRef<"th">, "align"> {
40
+ /**
41
+ * Hide at wrapper widths of 32rem or less.
42
+ * Hiding uses a container query, so place the table in a block-level parent; shrink-to-fit parents such as inline-block collapse it.
43
+ */
44
+ lowPriority?: boolean;
31
45
  /** Horizontal text alignment of the cell. */
32
46
  align?: CSSProperties["textAlign"];
33
47
  /** Right-align with tabular figures for numeric columns. Defaults to `false`. */
@@ -37,8 +51,13 @@ export interface TableHeaderCellProps extends Omit<ComponentPropsWithRef<"th">,
37
51
  /** Reports the requested next direction. Sorting and state updates belong to the caller. */
38
52
  onSort?: (direction: "ascending" | "descending") => void;
39
53
  }
40
- export declare function TableHeaderCell({ numeric, align, sort, onSort, scope, className, style, children, ...props }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare function TableHeaderCell({ lowPriority, numeric, align, sort, onSort, scope, className, style, children, ...props }: TableHeaderCellProps): import("react/jsx-runtime").JSX.Element;
41
55
  export interface TableCellProps extends Omit<ComponentPropsWithRef<"td">, "align"> {
56
+ /**
57
+ * Hide at wrapper widths of 32rem or less.
58
+ * Hiding uses a container query, so place the table in a block-level parent; shrink-to-fit parents such as inline-block collapse it.
59
+ */
60
+ lowPriority?: boolean;
42
61
  /** Horizontal text alignment of the cell. */
43
62
  align?: CSSProperties["textAlign"];
44
63
  /** Right-align with tabular figures for numeric columns. Defaults to `false`. */
@@ -46,7 +65,7 @@ export interface TableCellProps extends Omit<ComponentPropsWithRef<"td">, "align
46
65
  /** Prevent the cell content from wrapping. Defaults to `false`. */
47
66
  nowrap?: boolean;
48
67
  }
49
- export declare function TableCell({ numeric, align, nowrap, className, style, ...props }: TableCellProps): import("react/jsx-runtime").JSX.Element;
68
+ export declare function TableCell({ lowPriority, numeric, align, nowrap, className, style, ...props }: TableCellProps): import("react/jsx-runtime").JSX.Element;
50
69
  export interface TableEmptyRowProps extends ComponentPropsWithRef<"tr"> {
51
70
  /** Number of columns the empty-state cell spans; set to the table's column count. */
52
71
  colSpan: number;
@@ -2,22 +2,22 @@ import { cn as e } from "../../lib/cn.js";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import { ArrowDown as r, ArrowUp as i, ArrowUpDown as a } from "lucide-react";
4
4
  //#region src/components/tables/Table.tsx
5
- function o({ caption: r, captionHidden: i = !1, captionClassName: a, stickyHeader: o = !1, maxHeight: s, wrapperClassName: c, wrapperProps: l, beforeTable: u, className: d, children: f, ...p }) {
5
+ function o({ appearance: r = "framed", compact: i = !1, striped: a = !1, headerAppearance: o = "default", caption: s, captionHidden: c = !1, captionClassName: l, stickyHeader: u = !1, maxHeight: d, wrapperClassName: f, wrapperProps: p, beforeTable: m, className: h, children: g, ..._ }) {
6
6
  return /* @__PURE__ */ n("div", {
7
- ...l,
8
- className: e("ui-table-wrap", l?.className, c),
7
+ ...p,
8
+ className: e("ui-table-wrap", r === "embedded" && "ui-table-wrap-embedded", p?.className, f),
9
9
  style: {
10
- maxHeight: s,
11
- ...s ? { overflow: "auto" } : {},
12
- ...l?.style
10
+ maxHeight: d,
11
+ ...d ? { overflow: "auto" } : {},
12
+ ...p?.style
13
13
  },
14
- children: [u, /* @__PURE__ */ n("table", {
15
- ...p,
16
- className: e("ui-table", o && "ui-table-sticky", d),
17
- children: [r != null && /* @__PURE__ */ t("caption", {
18
- className: e(i && "sr-only", a),
19
- children: r
20
- }), f]
14
+ children: [m, /* @__PURE__ */ n("table", {
15
+ ..._,
16
+ className: e("ui-table", i && "ui-table-compact", a && "ui-table-striped", o === "band" && "ui-table-header-band", u && "ui-table-sticky", h),
17
+ children: [s != null && /* @__PURE__ */ t("caption", {
18
+ className: e(c && "sr-only", l),
19
+ children: s
20
+ }), g]
21
21
  })]
22
22
  });
23
23
  }
@@ -33,54 +33,60 @@ function c({ className: n, ...r }) {
33
33
  className: e("ui-table-body", n)
34
34
  });
35
35
  }
36
- function l({ selected: n, interactive: r = !1, className: i, ...a }) {
36
+ function l({ className: n, ...r }) {
37
+ return /* @__PURE__ */ t("tfoot", {
38
+ ...r,
39
+ className: e("ui-table-foot", n)
40
+ });
41
+ }
42
+ function u({ selected: n, interactive: r = !1, className: i, ...a }) {
37
43
  return /* @__PURE__ */ t("tr", {
38
44
  ...a,
39
45
  "data-selected": n ? "" : void 0,
40
46
  className: e("ui-table-row", r && "ui-table-interactive", i)
41
47
  });
42
48
  }
43
- function u({ numeric: o = !1, align: s, sort: c, onSort: l, scope: u = "col", className: d, style: f, children: p, ...m }) {
44
- let h = c ?? m["aria-sort"], g = h === "ascending" ? "descending" : "ascending";
49
+ function d({ lowPriority: o = !1, numeric: s = !1, align: c, sort: l, onSort: u, scope: d = "col", className: f, style: p, children: m, ...h }) {
50
+ let g = l ?? h["aria-sort"], _ = g === "ascending" ? "descending" : "ascending";
45
51
  return /* @__PURE__ */ t("th", {
46
- ...m,
47
- scope: u,
48
- "aria-sort": h ?? (l ? "none" : void 0),
49
- className: e("ui-table-header-cell", o && "ui-table-numeric", d),
52
+ ...h,
53
+ scope: d,
54
+ "aria-sort": g ?? (u ? "none" : void 0),
55
+ className: e("ui-table-header-cell", o && "ui-table-low-priority", s && "ui-table-numeric", f),
50
56
  style: {
51
- ...s ? { textAlign: s } : {},
52
- ...f
57
+ ...c ? { textAlign: c } : {},
58
+ ...p
53
59
  },
54
- children: l ? /* @__PURE__ */ n("button", {
60
+ children: u ? /* @__PURE__ */ n("button", {
55
61
  type: "button",
56
62
  className: "ui-table-sort-button",
57
- onClick: () => l(g),
63
+ onClick: () => u(_),
58
64
  children: [
59
- p,
65
+ m,
60
66
  /* @__PURE__ */ n("span", {
61
67
  className: "sr-only",
62
- children: [" Sort ", g]
68
+ children: [" Sort ", _]
63
69
  }),
64
70
  /* @__PURE__ */ t("span", {
65
71
  className: "ui-table-sort-indicator",
66
72
  "aria-hidden": "true",
67
- children: t(h === "ascending" ? i : h === "descending" ? r : a, {})
73
+ children: t(g === "ascending" ? i : g === "descending" ? r : a, {})
68
74
  })
69
75
  ]
70
- }) : p
76
+ }) : m
71
77
  });
72
78
  }
73
- function d({ numeric: n = !1, align: r, nowrap: i = !1, className: a, style: o, ...s }) {
79
+ function f({ lowPriority: n = !1, numeric: r = !1, align: i, nowrap: a = !1, className: o, style: s, ...c }) {
74
80
  return /* @__PURE__ */ t("td", {
75
- ...s,
76
- className: e("ui-table-cell", n && "ui-table-numeric", i && "ui-table-nowrap", a),
81
+ ...c,
82
+ className: e("ui-table-cell", n && "ui-table-low-priority", r && "ui-table-numeric", a && "ui-table-nowrap", o),
77
83
  style: {
78
- ...r ? { textAlign: r } : {},
79
- ...o
84
+ ...i ? { textAlign: i } : {},
85
+ ...s
80
86
  }
81
87
  });
82
88
  }
83
- function f({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
89
+ function p({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
84
90
  return /* @__PURE__ */ t("tr", {
85
91
  ...o,
86
92
  className: e("ui-table-empty-row", a),
@@ -92,4 +98,4 @@ function f({ colSpan: n, cellClassName: r, children: i, className: a, ...o }) {
92
98
  });
93
99
  }
94
100
  //#endregion
95
- export { o as Table, c as TableBody, d as TableCell, f as TableEmptyRow, s as TableHead, u as TableHeaderCell, l as TableRow };
101
+ export { o as Table, c as TableBody, f as TableCell, p as TableEmptyRow, l as TableFoot, s as TableHead, d as TableHeaderCell, u as TableRow };
@@ -0,0 +1,14 @@
1
+ import type { ComponentPropsWithRef, ReactNode } from "react";
2
+ type AnchorProps = ComponentPropsWithRef<"a"> & {
3
+ href: string;
4
+ };
5
+ export interface ActionLinkProps extends AnchorProps {
6
+ /** Destination for native navigation, including opening in a new tab. */
7
+ href: string;
8
+ /** Inline text link or bordered secondary action. */
9
+ appearance?: "inline" | "secondary";
10
+ /** Render a router anchor, forwarding the supplied attributes, children and ref. */
11
+ renderLink?: (props: AnchorProps) => ReactNode;
12
+ }
13
+ export declare function ActionLink({ appearance, renderLink, className, ...props }: ActionLinkProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
14
+ export {};
@@ -0,0 +1,12 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region src/components/ui/ActionLink.tsx
4
+ function n({ appearance: n = "inline", renderLink: r, className: i, ...a }) {
5
+ let o = {
6
+ ...a,
7
+ className: e("focus-visible:outline-accent focus-visible:outline-2 focus-visible:outline-offset-2", n === "secondary" ? "bg-bg-secondary text-text-primary border-border hover:bg-bg-hover inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors duration-[100ms]" : "text-accent-fg underline underline-offset-2", i)
8
+ };
9
+ return r ? r(o) : /* @__PURE__ */ t("a", { ...o });
10
+ }
11
+ //#endregion
12
+ export { n as ActionLink };
@@ -5,127 +5,158 @@ import { useControllableState as r } from "../../hooks/useControllableState.js";
5
5
  import { usePopover as i } from "../../hooks/usePopover.js";
6
6
  import { formatPickerDate as a } from "../../lib/calendar.js";
7
7
  import { CalendarGrid as o } from "./CalendarGrid.js";
8
- import { useMemo as s, useState as c } from "react";
9
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
- import { Calendar as d } from "lucide-react";
8
+ import { useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
9
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ import { Calendar as p } from "lucide-react";
11
11
  //#region src/components/ui/DateRangePicker.tsx
12
- var f = {
12
+ var ee = {
13
13
  start: null,
14
14
  end: null
15
15
  };
16
- function p({ controlSize: p, label: m, value: h, defaultValue: g = f, onValueChange: _, placeholder: v = "Select date range...", format: y = a, ref: b, className: x, ...S }) {
17
- let C = n(p), [w, T] = r({
18
- value: h,
19
- defaultValue: g,
20
- onChange: _
21
- }), { open: E, show: D, close: O, rootRef: k, anchorRef: ee, triggerRef: te, popupRef: A, labelId: j, popupId: M, triggerAria: N } = i({
16
+ function m({ controlSize: m, label: h, value: g, defaultValue: _ = ee, onValueChange: v, placeholder: y = "Select date range...", format: b = a, ref: x, className: te, ...ne }) {
17
+ let re = n(m), [S, ie] = r({
18
+ value: g,
19
+ defaultValue: _,
20
+ onChange: v
21
+ }), { open: C, show: ae, close: w, rootRef: T, anchorRef: oe, triggerRef: E, popupRef: D, labelId: O, popupId: k, triggerAria: A } = i({
22
22
  haspopup: "dialog",
23
- labelled: !!m
24
- }), P = s(() => t(b, k), [b, k]), F = /* @__PURE__ */ new Date(), [I, L] = c(w.start?.getFullYear() ?? F.getFullYear()), [R, z] = c(w.start?.getMonth() ?? F.getMonth()), [B, V] = c(null), [H, U] = c("start"), [W, G] = c(w.start), [K, q] = c(w.end), J = R === 11 ? I + 1 : I, Y = R === 11 ? 0 : R + 1;
25
- function X() {
26
- if (E) {
27
- O("toggle");
23
+ labelled: !!h
24
+ }), j = c(() => t(x, T), [x, T]), M = l(null), N = l(null), [P, F] = u(!0), I = /* @__PURE__ */ new Date(), [L, R] = u(S.start?.getFullYear() ?? I.getFullYear()), [z, B] = u(S.start?.getMonth() ?? I.getMonth()), V = z === 11 ? L + 1 : L, H = z === 11 ? 0 : z + 1;
25
+ s(() => {
26
+ let e = D.current, t = M.current, n = t?.parentElement, r = e?.ownerDocument.defaultView;
27
+ if (!C || !e || !t || !n || !r) return;
28
+ let i = e.ownerDocument, a = () => {
29
+ let a = parseFloat(r.getComputedStyle(n).columnGap), o = e.offsetWidth - n.offsetWidth, s = 2 * t.offsetWidth + a + o + 16 > i.documentElement.clientWidth, c = i.activeElement;
30
+ if (s && e.contains(c) && !t.contains(c)) {
31
+ let e = c?.getAttribute("data-day");
32
+ if (e) N.current = e, R(V), B(H);
33
+ else {
34
+ let e = c?.getAttribute("aria-label");
35
+ Array.from(t.querySelectorAll("button")).find((t) => t.getAttribute("aria-label") === e)?.focus({ preventScroll: !0 });
36
+ }
37
+ }
38
+ F(s);
39
+ }, o = typeof ResizeObserver > "u" ? null : new ResizeObserver(a);
40
+ o?.observe(e);
41
+ let s = o ? 0 : r.requestAnimationFrame(a);
42
+ return r.addEventListener("resize", a), () => {
43
+ o?.disconnect(), r.cancelAnimationFrame(s), r.removeEventListener("resize", a);
44
+ };
45
+ }, [
46
+ C,
47
+ D,
48
+ H,
49
+ V
50
+ ]), s(() => {
51
+ let e = N.current;
52
+ !P || !e || (N.current = null, M.current?.querySelector(`[data-day="${e}"]`)?.focus({ preventScroll: !0 }));
53
+ }, [P]);
54
+ let [U, W] = u(null), [G, K] = u("start"), [q, J] = u(S.start), [Y, X] = u(S.end);
55
+ function se() {
56
+ if (C) {
57
+ w("toggle");
28
58
  return;
29
59
  }
30
- G(w.start), q(w.end), U("start"), w.start && (L(w.start.getFullYear()), z(w.start.getMonth())), D();
60
+ J(S.start), X(S.end), K("start"), F(!0), S.start && (R(S.start.getFullYear()), B(S.start.getMonth())), ae();
31
61
  }
32
62
  function Z(e) {
33
- H === "start" ? (G(e), q(null), U("end")) : (W && e < W ? (q(W), G(e)) : q(e), U("start"), T({
34
- start: W && e < W ? e : W,
35
- end: W && e < W ? W : e
36
- }), O("select"));
63
+ G === "start" ? (J(e), X(null), K("end")) : (q && e < q ? (X(q), J(e)) : X(e), K("start"), ie({
64
+ start: q && e < q ? e : q,
65
+ end: q && e < q ? q : e
66
+ }), w("select"));
37
67
  }
38
- function ne() {
39
- R === 0 ? (L(I - 1), z(11)) : z(R - 1);
68
+ function ce() {
69
+ z === 0 ? (R(L - 1), B(11)) : B(z - 1);
40
70
  }
41
- function re() {
42
- R === 11 ? (L(I + 1), z(0)) : z(R + 1);
71
+ function le() {
72
+ z === 11 ? (R(L + 1), B(0)) : B(z + 1);
43
73
  }
44
- let { start: Q, end: $ } = w;
45
- return /* @__PURE__ */ u("div", {
46
- ...S,
47
- ref: P,
48
- className: e("flex flex-col gap-1.5", x),
49
- children: [m && /* @__PURE__ */ l("span", {
50
- id: j,
74
+ let { start: Q, end: $ } = S;
75
+ return /* @__PURE__ */ f("div", {
76
+ ...ne,
77
+ ref: j,
78
+ className: e("flex flex-col gap-1.5", te),
79
+ children: [h && /* @__PURE__ */ d("span", {
80
+ id: O,
51
81
  className: "ui-field-label text-xs font-medium",
52
- children: m
53
- }), /* @__PURE__ */ u("div", {
82
+ children: h
83
+ }), /* @__PURE__ */ f("div", {
54
84
  className: "relative",
55
- ref: ee,
85
+ ref: oe,
56
86
  children: [
57
- /* @__PURE__ */ l("button", {
87
+ /* @__PURE__ */ d("button", {
58
88
  type: "button",
59
- ref: te,
60
- ...N,
61
- onClick: X,
62
- "data-control-size": C,
89
+ ref: E,
90
+ ...A,
91
+ onClick: se,
92
+ "data-control-size": re,
63
93
  className: e("ui-sized-control flex h-7 w-full cursor-pointer items-center rounded-md text-xs", "bg-bg-secondary border-border text-text-primary border", "hover:bg-bg-hover hover:border-border-strong", "transition-colors duration-[100ms]", "px-2 pr-7"),
64
- children: Q ? $ ? `${y(Q)} – ${y($)}` : y(Q) : /* @__PURE__ */ l("span", {
94
+ children: Q ? $ ? `${b(Q)} – ${b($)}` : b(Q) : /* @__PURE__ */ d("span", {
65
95
  className: "text-text-placeholder",
66
- children: v
96
+ children: y
67
97
  })
68
98
  }),
69
- /* @__PURE__ */ l(d, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
70
- E && /* @__PURE__ */ u("div", {
71
- ref: A,
72
- id: M,
99
+ /* @__PURE__ */ d(p, { className: "text-text-tertiary pointer-events-none absolute top-1/2 right-2 h-3 w-3 -translate-y-1/2" }),
100
+ C && /* @__PURE__ */ f("div", {
101
+ ref: D,
102
+ id: k,
73
103
  role: "dialog",
74
104
  "aria-label": "Choose date range",
75
105
  className: e("ui-glass ui-glass-popover bg-bg-tertiary border-border-strong animate-scale-in fixed top-0 left-0 z-[100] rounded-md border shadow-lg", "p-3"),
76
- children: [/* @__PURE__ */ u("div", {
106
+ children: [/* @__PURE__ */ f("div", {
77
107
  className: "mb-2 flex items-center justify-between",
78
108
  children: [
79
- /* @__PURE__ */ l("button", {
109
+ /* @__PURE__ */ d("button", {
80
110
  type: "button",
81
- onClick: ne,
111
+ onClick: ce,
82
112
  "aria-label": "Previous month",
83
- className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
84
- children: /* @__PURE__ */ l("span", {
113
+ className: e("text-text-tertiary hover:text-text-primary hover:bg-bg-hover h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]", P ? "hidden" : "flex"),
114
+ children: /* @__PURE__ */ d("span", {
85
115
  className: "text-xs",
86
116
  children: "‹"
87
117
  })
88
118
  }),
89
- /* @__PURE__ */ l("span", {
90
- className: "text-text-tertiary text-2xs",
119
+ /* @__PURE__ */ d("span", {
120
+ className: "text-text-tertiary text-2xs flex-1 text-center",
91
121
  "aria-live": "polite",
92
- children: H === "start" ? "Select start date" : "Select end date"
122
+ children: G === "start" ? "Select start date" : "Select end date"
93
123
  }),
94
- /* @__PURE__ */ l("button", {
124
+ /* @__PURE__ */ d("button", {
95
125
  type: "button",
96
- onClick: re,
126
+ onClick: le,
97
127
  "aria-label": "Next month",
98
- className: "text-text-tertiary hover:text-text-primary hover:bg-bg-hover flex h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]",
99
- children: /* @__PURE__ */ l("span", {
128
+ className: e("text-text-tertiary hover:text-text-primary hover:bg-bg-hover h-6 w-6 cursor-pointer items-center justify-center rounded-md transition-colors duration-[100ms]", P ? "hidden" : "flex"),
129
+ children: /* @__PURE__ */ d("span", {
100
130
  className: "text-xs",
101
131
  children: "›"
102
132
  })
103
133
  })
104
134
  ]
105
- }), /* @__PURE__ */ u("div", {
106
- className: "flex gap-4",
107
- children: [/* @__PURE__ */ l(o, {
108
- year: I,
109
- month: R,
110
- rangeStart: W,
111
- rangeEnd: K,
112
- hoverDate: H === "end" ? B : null,
135
+ }), /* @__PURE__ */ f("div", {
136
+ className: "flex w-max gap-4",
137
+ children: [/* @__PURE__ */ d(o, {
138
+ ref: M,
139
+ year: L,
140
+ month: z,
141
+ rangeStart: q,
142
+ rangeEnd: Y,
143
+ hoverDate: G === "end" ? U : null,
113
144
  onSelect: Z,
114
145
  onMonthChange: (e, t) => {
115
- L(e), z(t);
146
+ R(e), B(t);
116
147
  },
117
- onHover: V
118
- }), /* @__PURE__ */ l(o, {
119
- year: J,
120
- month: Y,
121
- rangeStart: W,
122
- rangeEnd: K,
123
- hoverDate: H === "end" ? B : null,
148
+ onHover: W
149
+ }), !P && /* @__PURE__ */ d(o, {
150
+ year: V,
151
+ month: H,
152
+ rangeStart: q,
153
+ rangeEnd: Y,
154
+ hoverDate: G === "end" ? U : null,
124
155
  onSelect: Z,
125
156
  onMonthChange: (e, t) => {
126
- t === 0 ? (L(e - 1), z(11)) : (L(e), z(t - 1));
157
+ t === 0 ? (R(e - 1), B(11)) : (R(e), B(t - 1));
127
158
  },
128
- onHover: V
159
+ onHover: W
129
160
  })]
130
161
  })]
131
162
  })
@@ -134,4 +165,4 @@ function p({ controlSize: p, label: m, value: h, defaultValue: g = f, onValueCha
134
165
  });
135
166
  }
136
167
  //#endregion
137
- export { p as DateRangePicker };
168
+ export { m as DateRangePicker };
@@ -1,14 +1,16 @@
1
1
  import type { ComponentPropsWithRef, ReactNode } from "react";
2
- export interface EmptyStateProps extends ComponentPropsWithRef<"div"> {
2
+ export interface EmptyStateProps extends Omit<ComponentPropsWithRef<"div">, "title"> {
3
3
  /** Icon shown in the tile above the title. Defaults to an inbox icon. */
4
4
  icon?: ReactNode;
5
- /** Heading text. */
6
- title: string;
7
- /** Supporting text below the title. */
8
- description?: string;
5
+ /** Title content. */
6
+ title: ReactNode;
7
+ /** Renders the title as a heading at this level. String titles otherwise render as paragraphs. */
8
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
9
+ /** Supporting content below the title, including multiple paragraphs. */
10
+ description?: ReactNode;
9
11
  /** Call-to-action, e.g. a Button, shown below the description. */
10
12
  action?: ReactNode;
11
13
  /** Additional utility classes for the root element. */
12
14
  className?: string;
13
15
  }
14
- export declare function EmptyState({ icon, title, description, action, className, ref, ...rest }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function EmptyState({ icon, title, headingLevel, description, action, className, ref, ...rest }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
@@ -2,27 +2,28 @@ import { cn as e } from "../../lib/cn.js";
2
2
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
3
  import { Inbox as r } from "lucide-react";
4
4
  //#region src/components/ui/EmptyState.tsx
5
- function i({ icon: i, title: a, description: o, action: s, className: c, ref: l, ...u }) {
5
+ function i({ icon: i, title: a, headingLevel: o, description: s, action: c, className: l, ref: u, ...d }) {
6
+ let f = o ? `h${o}` : typeof a == "string" ? "p" : "div", p = typeof s == "string" ? "p" : "div";
6
7
  return /* @__PURE__ */ n("div", {
7
- ...u,
8
- ref: l,
9
- className: e("flex flex-col items-center justify-center px-4 py-12", c),
8
+ ...d,
9
+ ref: u,
10
+ className: e("flex flex-col items-center justify-center px-4 py-12", l),
10
11
  children: [
11
12
  /* @__PURE__ */ t("div", {
12
13
  className: "bg-bg-tertiary text-text-tertiary mb-3 flex h-10 w-10 items-center justify-center rounded-md",
13
14
  children: i || /* @__PURE__ */ t(r, { className: "h-5 w-5" })
14
15
  }),
15
- /* @__PURE__ */ t("p", {
16
+ /* @__PURE__ */ t(f, {
16
17
  className: "text-text-primary mb-1 text-sm font-medium",
17
18
  children: a
18
19
  }),
19
- o && /* @__PURE__ */ t("p", {
20
+ s || s === 0 ? /* @__PURE__ */ t(p, {
20
21
  className: "text-text-secondary max-w-[300px] text-center text-xs",
21
- children: o
22
- }),
23
- s && /* @__PURE__ */ t("div", {
24
- className: "mt-4",
25
22
  children: s
23
+ }) : null,
24
+ c && /* @__PURE__ */ t("div", {
25
+ className: "mt-4",
26
+ children: c
26
27
  })
27
28
  ]
28
29
  });
@@ -2,6 +2,11 @@ import { Component, type ErrorInfo, type ReactNode } from "react";
2
2
  /** Props for ErrorBoundary. */
3
3
  export interface ErrorBoundaryProps {
4
4
  children: ReactNode;
5
+ /** Render a custom recovery UI. Call reset to retry rendering the children. */
6
+ fallback?: (props: {
7
+ error: unknown;
8
+ reset: () => void;
9
+ }) => ReactNode;
5
10
  }
6
11
  interface State {
7
12
  hasError: boolean;
@@ -11,6 +16,7 @@ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, State>
11
16
  state: State;
12
17
  static getDerivedStateFromError(error: Error): State;
13
18
  componentDidCatch(error: Error, info: ErrorInfo): void;
19
+ private reset;
14
20
  render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
15
21
  }
16
22
  export {};
@@ -16,8 +16,17 @@ var i = class extends t {
16
16
  componentDidCatch(e, t) {
17
17
  console.error("[ErrorBoundary] Uncaught error:", e, t.componentStack);
18
18
  }
19
+ reset = () => {
20
+ this.setState({
21
+ hasError: !1,
22
+ error: null
23
+ });
24
+ };
19
25
  render() {
20
- return this.state.hasError ? /* @__PURE__ */ r("div", {
26
+ return this.state.hasError ? this.props.fallback ? this.props.fallback({
27
+ error: this.state.error,
28
+ reset: this.reset
29
+ }) : /* @__PURE__ */ r("div", {
21
30
  className: "ui-glass-shell bg-bg-primary flex min-h-svh flex-col items-center justify-center p-8 text-center",
22
31
  children: [
23
32
  /* @__PURE__ */ n("p", {
@@ -31,10 +40,7 @@ var i = class extends t {
31
40
  /* @__PURE__ */ n(e, {
32
41
  variant: "secondary",
33
42
  onClick: () => {
34
- this.setState({
35
- hasError: !1,
36
- error: null
37
- }), window.location.href = "/";
43
+ this.reset(), window.location.href = "/";
38
44
  },
39
45
  children: "Go home"
40
46
  })
@@ -14,7 +14,7 @@ export interface GridOptions {
14
14
  justify?: "start" | "center" | "end" | "stretch";
15
15
  }
16
16
  export type GridProps<E extends LayoutElement = "div"> = LayoutProps<E, GridOptions>;
17
- export declare function Grid<E extends LayoutElement = "div">({ as, columns, gap, gapX, gapY, align, justify, className, style, ...props }: GridProps<E>): import("react").DetailedReactHTMLElement<Omit<GridProps<E>, "columns" | "style" | "className" | "gap" | "justify" | "align" | "as" | "gapX" | "gapY"> & {
17
+ export declare function Grid<E extends LayoutElement = "div">({ as, columns, gap, gapX, gapY, align, justify, className, style, ...props }: GridProps<E>): import("react").DetailedReactHTMLElement<Omit<GridProps<E>, "columns" | "style" | "className" | "gap" | "align" | "justify" | "as" | "gapX" | "gapY"> & {
18
18
  className: string;
19
19
  style: LayoutStyle;
20
20
  }, HTMLElement>;