@leonardaustin/ui 0.27.0 → 0.29.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 (56) hide show
  1. package/dist/components/charts/AreaChart.js +113 -114
  2. package/dist/components/charts/BarChart.d.ts +4 -2
  3. package/dist/components/charts/BarChart.js +69 -49
  4. package/dist/components/charts/Heatmap.d.ts +20 -0
  5. package/dist/components/charts/Heatmap.js +46 -0
  6. package/dist/components/charts/StackedBarChart.d.ts +3 -1
  7. package/dist/components/charts/StackedBarChart.js +103 -95
  8. package/dist/components/charts/VerticalBarChart.d.ts +3 -1
  9. package/dist/components/charts/VerticalBarChart.js +94 -83
  10. package/dist/components/charts/barChartUtils.d.ts +16 -0
  11. package/dist/components/charts/barChartUtils.js +24 -0
  12. package/dist/components/charts/chartUtils.d.ts +2 -0
  13. package/dist/components/charts/chartUtils.js +14 -9
  14. package/dist/components/charts/useChartSize.d.ts +13 -0
  15. package/dist/components/charts/useChartSize.js +27 -0
  16. package/dist/components/tables/Pagination.d.ts +3 -1
  17. package/dist/components/tables/Pagination.js +12 -12
  18. package/dist/components/tables/ResourceTable.d.ts +5 -0
  19. package/dist/components/tables/ResourceTable.js +11 -9
  20. package/dist/components/tables/Table.d.ts +22 -3
  21. package/dist/components/tables/Table.js +41 -35
  22. package/dist/components/ui/ActionLink.d.ts +14 -0
  23. package/dist/components/ui/ActionLink.js +12 -0
  24. package/dist/components/ui/DateRangePicker.js +107 -76
  25. package/dist/components/ui/EmptyState.d.ts +8 -6
  26. package/dist/components/ui/EmptyState.js +11 -10
  27. package/dist/components/ui/ErrorBoundary.d.ts +6 -0
  28. package/dist/components/ui/ErrorBoundary.js +11 -5
  29. package/dist/components/ui/Grid.d.ts +1 -1
  30. package/dist/components/ui/Icon.d.ts +91 -0
  31. package/dist/components/ui/Icon.js +98 -0
  32. package/dist/components/ui/Inline.d.ts +1 -1
  33. package/dist/components/ui/LoadingSpinner.d.ts +7 -3
  34. package/dist/components/ui/LoadingSpinner.js +19 -11
  35. package/dist/components/ui/MainAsideLayout.d.ts +10 -0
  36. package/dist/components/ui/MainAsideLayout.js +18 -0
  37. package/dist/components/ui/Meter.d.ts +11 -0
  38. package/dist/components/ui/Meter.js +7 -0
  39. package/dist/components/ui/MetricCard.d.ts +11 -8
  40. package/dist/components/ui/MetricCard.js +18 -15
  41. package/dist/components/ui/PaginationBar.d.ts +3 -3
  42. package/dist/components/ui/PaginationBar.js +35 -33
  43. package/dist/components/ui/SideSheet.d.ts +4 -2
  44. package/dist/components/ui/SideSheet.js +64 -52
  45. package/dist/components/ui/Stack.d.ts +1 -1
  46. package/dist/components/ui/Tabs.d.ts +5 -1
  47. package/dist/components/ui/Tabs.js +23 -21
  48. package/dist/components/ui/Text.d.ts +19 -0
  49. package/dist/components/ui/Text.js +20 -0
  50. package/dist/components/ui/Toolbar.js +13 -13
  51. package/dist/core.css +122 -0
  52. package/dist/hooks/useFocusTrap.js +1 -1
  53. package/dist/index.d.ts +6 -0
  54. package/dist/index.js +135 -129
  55. package/dist/styles.css +123 -0
  56. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region src/components/ui/MainAsideLayout.tsx
4
+ function r({ children: r, aside: i, divider: a = !1, className: o, ...s }) {
5
+ return /* @__PURE__ */ t("div", {
6
+ ...s,
7
+ className: e("ui-main-aside", o),
8
+ children: /* @__PURE__ */ n("div", {
9
+ className: "ui-main-aside-grid",
10
+ children: [/* @__PURE__ */ t("div", { children: r }), /* @__PURE__ */ t("aside", {
11
+ className: a ? "ui-main-aside-divider" : void 0,
12
+ children: i
13
+ })]
14
+ })
15
+ });
16
+ }
17
+ //#endregion
18
+ export { r as MainAsideLayout };
@@ -0,0 +1,11 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export interface MeterProps extends ComponentPropsWithRef<"meter"> {
3
+ /** Current measurement within the native meter range. */
4
+ value: number;
5
+ /** Lower bound. Defaults to 0. */
6
+ min?: number;
7
+ /** Upper bound. Defaults to 1. */
8
+ max?: number;
9
+ }
10
+ /** Name the measurement with a label element, aria-label or aria-labelledby. */
11
+ export declare function Meter(props: MeterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/components/ui/Meter.tsx
3
+ function t(t) {
4
+ return /* @__PURE__ */ e("meter", { ...t });
5
+ }
6
+ //#endregion
7
+ export { t as Meter };
@@ -1,11 +1,14 @@
1
- import type { ComponentPropsWithRef, ElementType } from "react";
1
+ import type { ComponentPropsWithRef, ElementType, ReactNode } from "react";
2
+ import { type SemanticTone } from "../../lib/tones";
2
3
  export interface MetricCardProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
3
- /** Small uppercase caption naming the metric. */
4
- label: string;
5
- /** The headline figure. */
6
- value: string | number;
7
- /** Secondary line of muted text below the value. */
8
- sub?: string;
4
+ /** Small uppercase caption naming the metric. Accepts inline content. */
5
+ label: ReactNode;
6
+ /** The headline figure or inline content. */
7
+ value: ReactNode;
8
+ /** Secondary line of muted inline content below the value. */
9
+ sub?: ReactNode;
10
+ /** Semantic text tone for the headline value. Defaults to primary text. */
11
+ valueTone?: SemanticTone;
9
12
  /**
10
13
  * Optional trend indicator rendered below the value. `value` is the change
11
14
  * string (e.g. "+12.5%"), `label` is the supporting context (e.g. "vs last
@@ -26,4 +29,4 @@ export interface MetricCardProps extends Omit<ComponentPropsWithRef<"div">, "chi
26
29
  /** Additional utility classes appended to the root element. */
27
30
  className?: string;
28
31
  }
29
- export declare function MetricCard({ label, value, sub, trend, bar, icon: Icon, iconColor, className, ref, ...rest }: MetricCardProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function MetricCard({ label, value, valueTone, sub, trend, bar, icon: Icon, iconColor, className, ref, ...rest }: MetricCardProps): import("react/jsx-runtime").JSX.Element;
@@ -7,41 +7,44 @@ var a = {
7
7
  negative: "danger",
8
8
  neutral: "neutral"
9
9
  };
10
- function o({ label: o, value: s, sub: c, trend: l, bar: u, icon: d, iconColor: f, className: p, ref: m, ...h }) {
11
- let g = l && a[l.tone], _ = n(t(g) ? g : "neutral").text;
10
+ function o({ label: o, value: s, valueTone: c, sub: l, trend: u, bar: d, icon: f, iconColor: p, className: m, ref: h, ...g }) {
11
+ let _ = t(c) ? n(c).text : "text-text-primary", v = l != null && typeof l != "boolean" && l !== "", y = u && a[u.tone], b = n(t(y) ? y : "neutral").text;
12
12
  return /* @__PURE__ */ i("div", {
13
- ...h,
14
- ref: m,
15
- className: e("ui-glass bg-bg-card border-border relative overflow-hidden rounded-md border p-3", p),
13
+ ...g,
14
+ ref: h,
15
+ className: e("ui-glass bg-bg-card border-border relative overflow-hidden rounded-md border p-3", m),
16
16
  children: [
17
- d && /* @__PURE__ */ r(d, { className: e("absolute -right-9 -bottom-9 h-44 w-44 -rotate-45 opacity-[0.06]", f) }),
17
+ f && /* @__PURE__ */ r(f, {
18
+ "aria-hidden": "true",
19
+ className: e("pointer-events-none absolute -right-9 -bottom-9 h-44 w-44 -rotate-45 opacity-[0.06]", p)
20
+ }),
18
21
  /* @__PURE__ */ r("p", {
19
22
  className: "text-2xs-f text-text-tertiary font-label mb-1 font-medium tracking-wider uppercase",
20
23
  children: o
21
24
  }),
22
25
  /* @__PURE__ */ r("p", {
23
- className: "text-text-primary font-data text-xl font-bold tabular-nums",
26
+ className: e(_, "font-data text-xl font-bold tabular-nums"),
24
27
  children: s
25
28
  }),
26
- c && /* @__PURE__ */ r("p", {
29
+ v && /* @__PURE__ */ r("p", {
27
30
  className: "text-2xs text-text-tertiary font-label mt-0.5",
28
- children: c
31
+ children: l
29
32
  }),
30
- l && /* @__PURE__ */ i("p", {
33
+ u && /* @__PURE__ */ i("p", {
31
34
  className: "text-2xs font-label mt-1 flex items-center gap-1",
32
35
  children: [/* @__PURE__ */ r("span", {
33
- className: e("font-medium tabular-nums", _),
34
- children: l.value
36
+ className: e("font-medium tabular-nums", b),
37
+ children: u.value
35
38
  }), /* @__PURE__ */ r("span", {
36
39
  className: "text-text-tertiary",
37
- children: l.label
40
+ children: u.label
38
41
  })]
39
42
  }),
40
- u !== void 0 && /* @__PURE__ */ r("div", {
43
+ d !== void 0 && /* @__PURE__ */ r("div", {
41
44
  className: "bg-bg-tertiary mt-2 h-[3px] overflow-hidden rounded-md",
42
45
  children: /* @__PURE__ */ r("div", {
43
46
  className: "bg-accent h-full rounded-md transition-all duration-[250ms] ease-out",
44
- style: { width: `${Math.min(100, Math.max(0, u))}%` }
47
+ style: { width: `${Math.min(100, Math.max(0, d))}%` }
45
48
  })
46
49
  })
47
50
  ]
@@ -26,7 +26,7 @@
26
26
  * />
27
27
  * ```
28
28
  */
29
- import type { ComponentPropsWithRef, ReactNode } from "react";
29
+ import { type ComponentPropsWithRef, type ReactNode } from "react";
30
30
  export interface PageSizeOption {
31
31
  value: string;
32
32
  label: string;
@@ -36,8 +36,8 @@ export interface PaginationBarProps extends Omit<ComponentPropsWithRef<"div">, "
36
36
  page: number;
37
37
  /** Number of items per page. */
38
38
  pageSize: number;
39
- /** Total number of items across all pages. */
40
- total: number;
39
+ /** Total across all pages. Omit or pass null while the count is unknown. */
40
+ total?: number | null;
41
41
  /** Replace the default range text with custom content or a total formatter. */
42
42
  summary?: ReactNode | ((total: number) => ReactNode);
43
43
  /** Show a short total caption after the range or custom summary. */
@@ -1,9 +1,10 @@
1
1
  import { cn as e } from "../../lib/cn.js";
2
2
  import { SelectDropdown as t } from "./SelectDropdown.js";
3
3
  import { Pagination as n } from "../tables/Pagination.js";
4
- import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
4
+ import { useState as r } from "react";
5
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
5
6
  //#region src/components/ui/PaginationBar.tsx
6
- var o = [
7
+ var s = [
7
8
  {
8
9
  value: "10",
9
10
  label: "10 per page"
@@ -17,45 +18,46 @@ var o = [
17
18
  label: "50 per page"
18
19
  }
19
20
  ];
20
- function s({ page: s, pageSize: c, total: l, summary: u, showTotal: d = !1, loading: f = !1, pageSizeOptions: p = o, onPageChange: m, onPageSizeChange: h, className: g, ref: _, ...v }) {
21
- let y = Math.ceil(l / c), b = Math.min((s - 1) * c + 1, l), x = Math.min(s * c, l);
22
- return /* @__PURE__ */ a("div", {
23
- ref: _,
24
- ...v,
25
- className: e("flex items-center justify-between", g),
26
- children: [/* @__PURE__ */ a("div", {
21
+ function c({ page: c, pageSize: l, total: u, summary: d, showTotal: f = !1, loading: p = !1, pageSizeOptions: m = s, onPageChange: h, onPageSizeChange: g, className: _, ref: v, ...y }) {
22
+ let [b, x] = r(u), S = p ? u ?? b : u;
23
+ Object.is(S, b) || x(S);
24
+ let C = S == null ? 0 : Math.ceil(S / l), w = (c - 1) * l + 1, T = S == null ? 0 : Math.min(c * l, S), E = c > 1 && c > C, D = f && S != null && !(d === void 0 && E), O = typeof d == "function" ? S == null ? null : d(S) : d;
25
+ return d === void 0 && S != null && (O = E ? `${S} in total` : `${Math.min(w, S)}–${T} of ${S}`), /* @__PURE__ */ o("div", {
26
+ ref: v,
27
+ ...y,
28
+ className: e("flex items-center justify-between", _),
29
+ children: [/* @__PURE__ */ o("div", {
27
30
  className: "flex items-center gap-3",
28
- children: [h && /* @__PURE__ */ i(t, {
31
+ children: [g && /* @__PURE__ */ a(t, {
29
32
  size: "sm",
30
- value: String(c),
31
- onValueChange: (e) => h(Number(e)),
32
- options: p,
33
+ value: String(l),
34
+ onValueChange: (e) => g(Number(e)),
35
+ options: m,
33
36
  className: "w-28",
34
37
  role: "group",
35
- "aria-busy": f || void 0
36
- }), /* @__PURE__ */ a("span", {
38
+ "aria-busy": p || void 0
39
+ }), /* @__PURE__ */ o("span", {
37
40
  role: "status",
38
- className: e("text-text-tertiary text-xs", !f && "ui-pagination-count"),
39
- children: [f ? "Loading results..." : u === void 0 ? /* @__PURE__ */ a(r, { children: [
40
- b,
41
- "–",
42
- x,
43
- " of ",
44
- l
45
- ] }) : typeof u == "function" ? u(l) : u, !f && d && /* @__PURE__ */ a(r, { children: [
46
- " · ",
47
- l,
48
- " in total"
49
- ] })]
41
+ className: e("text-text-tertiary text-xs", !p && "ui-pagination-count"),
42
+ children: [
43
+ O,
44
+ D && /* @__PURE__ */ o(i, { children: [
45
+ O != null && " · ",
46
+ S,
47
+ " in total"
48
+ ] }),
49
+ p && /* @__PURE__ */ o(i, { children: [(O != null || D) && " · ", "Loading results..."] })
50
+ ]
50
51
  })]
51
- }), /* @__PURE__ */ i(n, {
52
- page: s,
53
- totalPages: y,
54
- onPageChange: m,
55
- loading: f,
52
+ }), /* @__PURE__ */ a(n, {
53
+ keepNavigation: !0,
54
+ page: c,
55
+ totalPages: C,
56
+ onPageChange: h,
57
+ loading: p,
56
58
  summary: null
57
59
  })]
58
60
  });
59
61
  }
60
62
  //#endregion
61
- export { s as PaginationBar };
63
+ export { c as PaginationBar };
@@ -10,7 +10,7 @@ export interface SideSheetProps extends Omit<ComponentPropsWithRef<"div">, "titl
10
10
  onClose: () => void;
11
11
  /**
12
12
  * Heading shown in the header. A string also names the dialog
13
- * (`aria-label`); otherwise it is named "Panel".
13
+ * unless you supply an explicit `aria-label`. Rich titles default to "Panel".
14
14
  */
15
15
  title?: ReactNode;
16
16
  /** The sheet body, which scrolls when taller than the sheet. */
@@ -26,9 +26,11 @@ export interface SideSheetProps extends Omit<ComponentPropsWithRef<"div">, "titl
26
26
  widthClassName?: string;
27
27
  /** Enable pointer and keyboard resizing at viewport widths of 640px and up. Defaults to `false`. */
28
28
  resizable?: boolean;
29
+ /** Fill the viewport below 640px, including when the desktop sheet was resized. */
30
+ fullWidthOnNarrow?: boolean;
29
31
  /** Additional utility classes for the sheet panel. */
30
32
  className?: string;
31
33
  /** Additional utility classes for the scrolling body. */
32
34
  contentClassName?: string;
33
35
  }
34
- export declare function SideSheet({ open, onClose, title, children, footer, side, widthClassName, resizable, className, contentClassName, ref, style, id, ...rest }: SideSheetProps): import("react").ReactPortal | null;
36
+ export declare function SideSheet({ open, onClose, title, children, footer, side, widthClassName, resizable, fullWidthOnNarrow, "aria-label": ariaLabel, className, contentClassName, ref, style, id, ...rest }: SideSheetProps): import("react").ReactPortal | null;
@@ -11,34 +11,34 @@ import { jsx as _, jsxs as v } from "react/jsx-runtime";
11
11
  import { X as y } from "lucide-react";
12
12
  import { createPortal as b } from "react-dom";
13
13
  //#region src/components/ui/SideSheet.tsx
14
- function x({ open: u, onClose: d, title: f, children: g, footer: x, side: S = "right", widthClassName: C = "w-[360px]", resizable: w = !1, className: T, contentClassName: D, ref: O, style: k, id: A, ...j }) {
15
- let M = p(), N = c(), P = h(null), [F, I] = s(P), L = m(() => t(O, I), [O, I]);
16
- n(P, u);
17
- let R = a(u, () => d());
14
+ function x({ open: u, onClose: d, title: f, children: g, footer: x, side: S = "right", widthClassName: C = "w-[360px]", resizable: w = !1, fullWidthOnNarrow: T = !1, "aria-label": D, className: O, contentClassName: k, ref: A, style: j, id: M, ...N }) {
15
+ let P = p(), F = c(), I = h(null), [L, R] = s(I), z = m(() => t(A, R), [A, R]);
16
+ n(I, u);
17
+ let B = a(u, () => d());
18
18
  return i(u), u ? b(/* @__PURE__ */ _(r.Provider, {
19
- value: R,
19
+ value: B,
20
20
  children: /* @__PURE__ */ _(o.Provider, {
21
- value: F,
21
+ value: L,
22
22
  children: /* @__PURE__ */ v("div", {
23
23
  className: "fixed inset-0 z-50",
24
24
  children: [/* @__PURE__ */ _("div", {
25
25
  className: "bg-bg-overlay animate-fade-in absolute inset-0",
26
26
  onClick: d
27
27
  }), /* @__PURE__ */ v("div", {
28
- ...j,
29
- ref: L,
30
- id: A ?? (w ? M : void 0),
31
- className: e("ui-glass bg-bg-secondary border-border absolute inset-y-0 flex flex-col shadow-lg", C, S === "right" ? "animate-slide-in-right right-0 border-l" : "animate-slide-in-left left-0 border-r", T),
28
+ ...N,
29
+ ref: z,
30
+ id: M ?? (w ? P : void 0),
31
+ className: e("ui-glass bg-bg-secondary border-border absolute inset-y-0 flex flex-col shadow-lg", C, T && "ui-sheet-full-narrow", S === "right" ? "animate-slide-in-right right-0 border-l" : "animate-slide-in-left left-0 border-r", O),
32
32
  style: {
33
33
  maxWidth: "calc(100vw - 2rem)",
34
- ...k
34
+ ...j
35
35
  },
36
36
  role: "dialog",
37
37
  "aria-modal": "true",
38
- "aria-label": typeof f == "string" ? f : "Panel",
38
+ "aria-label": D ?? (typeof f == "string" ? f : "Panel"),
39
39
  children: [
40
40
  /* @__PURE__ */ v("div", {
41
- "data-control-size": N,
41
+ "data-control-size": F,
42
42
  className: "ui-bar border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2.5",
43
43
  children: [f && /* @__PURE__ */ _("h3", {
44
44
  className: "text-text-primary truncate text-sm font-medium",
@@ -54,17 +54,18 @@ function x({ open: u, onClose: d, title: f, children: g, footer: x, side: S = "r
54
54
  })]
55
55
  }),
56
56
  /* @__PURE__ */ _("div", {
57
- className: e("ui-surface-body flex-1 overflow-y-auto p-3", D),
57
+ className: e("ui-surface-body flex-1 overflow-y-auto p-3", k),
58
58
  children: g
59
59
  }),
60
60
  x && /* @__PURE__ */ _("div", {
61
- "data-control-size": N,
61
+ "data-control-size": F,
62
62
  className: "ui-bar border-border bg-bg-primary/50 flex shrink-0 items-center gap-2 border-t px-3 py-2.5",
63
63
  children: x
64
64
  }),
65
- w && F && /* @__PURE__ */ _(E, {
66
- sheet: F,
67
- side: S
65
+ w && L && /* @__PURE__ */ _(E, {
66
+ sheet: L,
67
+ side: S,
68
+ fullWidthOnNarrow: T
68
69
  })
69
70
  ]
70
71
  })]
@@ -91,72 +92,83 @@ function T(e) {
91
92
  let t = e.ownerDocument.defaultView, n = parseFloat(t.getComputedStyle(e.ownerDocument.documentElement).fontSize);
92
93
  return Math.max(0, t.innerWidth - 2 * n);
93
94
  }
94
- function E({ sheet: t, side: n }) {
95
- let r = t.ownerDocument.defaultView, [i, a] = g(() => ({
95
+ function E({ sheet: t, side: n, fullWidthOnNarrow: r }) {
96
+ let i = t.ownerDocument.defaultView, [a, o] = g(() => ({
96
97
  width: t.getBoundingClientRect().width,
97
98
  min: t.getBoundingClientRect().width,
98
99
  max: T(t),
99
- desktop: r.innerWidth >= 640
100
- })), o = h(null), s = h(null), c = h(null);
101
- function l() {
102
- s.current = null, c.current?.(), c.current = null;
100
+ desktop: i.innerWidth >= 640
101
+ })), s = h(null), c = h(null), l = h(null);
102
+ function p() {
103
+ c.current = null, l.current?.(), l.current = null;
103
104
  }
104
- let p = d((e) => {
105
- let n = T(t), i = Math.min(w(t), n), s = r.innerWidth >= 640;
106
- o.current = s && e !== null ? Math.min(n, Math.max(i, e)) : null, o.current !== null && o.current <= i && (o.current = null), S(t, o.current), a({
105
+ let m = d((e) => {
106
+ if (r && i.innerWidth < 640) {
107
+ o((e) => e.desktop ? {
108
+ ...e,
109
+ desktop: !1
110
+ } : e);
111
+ return;
112
+ }
113
+ let n = T(t), a = Math.min(w(t), n), c = i.innerWidth >= 640;
114
+ s.current = c && e !== null ? Math.min(n, Math.max(a, e)) : null, s.current !== null && s.current <= a && (s.current = null), S(t, s.current), o({
107
115
  width: t.getBoundingClientRect().width,
108
- min: i,
116
+ min: a,
109
117
  max: n,
110
- desktop: s
118
+ desktop: c
111
119
  });
112
- }, [t, r]);
120
+ }, [
121
+ r,
122
+ t,
123
+ i
124
+ ]);
113
125
  return f(() => {
114
126
  let e = () => {
115
- l(), p(o.current);
116
- }, n = new ResizeObserver(() => p(o.current));
117
- return n.observe(t), r.addEventListener("resize", e), () => {
118
- n.disconnect(), r.removeEventListener("resize", e), l(), S(t, null);
127
+ p(), m(s.current);
128
+ }, n = new ResizeObserver(() => m(s.current));
129
+ return n.observe(t), i.addEventListener("resize", e), () => {
130
+ n.disconnect(), i.removeEventListener("resize", e), p(), S(t, null);
119
131
  };
120
132
  }, [
121
- p,
133
+ m,
122
134
  t,
123
- r
124
- ]), i.desktop ? /* @__PURE__ */ _("div", {
135
+ i
136
+ ]), a.desktop ? /* @__PURE__ */ _("div", {
125
137
  role: "separator",
126
138
  tabIndex: 0,
127
139
  "aria-orientation": "vertical",
128
140
  "aria-label": "Resize panel",
129
141
  "aria-controls": t.id,
130
- "aria-valuenow": Math.round(i.width),
131
- "aria-valuemin": Math.round(i.min),
132
- "aria-valuemax": Math.round(i.max),
142
+ "aria-valuenow": Math.round(a.width),
143
+ "aria-valuemin": Math.round(a.min),
144
+ "aria-valuemax": Math.round(a.max),
133
145
  className: e("hover:bg-accent/30 active:bg-accent/50 focus-visible:outline-accent absolute inset-y-0 z-10 w-1 cursor-col-resize select-none focus-visible:outline-2 focus-visible:outline-offset-0", n === "right" ? "left-0" : "right-0"),
134
146
  style: { touchAction: "none" },
135
147
  onPointerDown: (e) => {
136
- if (!e.isPrimary || e.button !== 0 || s.current) return;
148
+ if (!e.isPrimary || e.button !== 0 || c.current) return;
137
149
  e.preventDefault(), e.currentTarget.focus(), e.currentTarget.setPointerCapture(e.pointerId);
138
150
  let n = w(t);
139
- s.current = {
151
+ c.current = {
140
152
  pointerId: e.pointerId,
141
153
  x: e.clientX,
142
- width: o.current ?? n
143
- }, c.current = C(t);
154
+ width: s.current ?? n
155
+ }, l.current = C(t);
144
156
  },
145
157
  onPointerMove: (e) => {
146
- let t = s.current;
147
- !t || t.pointerId !== e.pointerId || p(t.width + (e.clientX - t.x) * (n === "right" ? -1 : 1));
158
+ let t = c.current;
159
+ !t || t.pointerId !== e.pointerId || m(t.width + (e.clientX - t.x) * (n === "right" ? -1 : 1));
148
160
  },
149
161
  onPointerUp: (e) => {
150
- s.current?.pointerId === e.pointerId && (l(), e.currentTarget.releasePointerCapture(e.pointerId));
162
+ c.current?.pointerId === e.pointerId && (p(), e.currentTarget.releasePointerCapture(e.pointerId));
151
163
  },
152
164
  onPointerCancel: (e) => {
153
- s.current?.pointerId === e.pointerId && l();
165
+ c.current?.pointerId === e.pointerId && p();
154
166
  },
155
- onLostPointerCapture: l,
156
- onDoubleClick: () => p(null),
167
+ onLostPointerCapture: p,
168
+ onDoubleClick: () => m(null),
157
169
  onKeyDown: (e) => {
158
- let r = u(e.key, o.current ?? w(t), 16, n);
159
- r !== void 0 && (e.preventDefault(), p(r));
170
+ let r = u(e.key, s.current ?? w(t), 16, n);
171
+ r !== void 0 && (e.preventDefault(), m(r));
160
172
  }
161
173
  }) : null;
162
174
  }
@@ -8,7 +8,7 @@ export interface StackOptions {
8
8
  justify?: LayoutJustify;
9
9
  }
10
10
  export type StackProps<E extends LayoutElement = "div"> = LayoutProps<E, StackOptions>;
11
- export declare function Stack<E extends LayoutElement = "div">({ as, gap, align, justify, className, style, ...props }: StackProps<E>): import("react").DetailedReactHTMLElement<Omit<StackProps<E>, "style" | "className" | "gap" | "justify" | "align" | "as"> & {
11
+ export declare function Stack<E extends LayoutElement = "div">({ as, gap, align, justify, className, style, ...props }: StackProps<E>): import("react").DetailedReactHTMLElement<Omit<StackProps<E>, "style" | "className" | "gap" | "align" | "justify" | "as"> & {
12
12
  className: string;
13
13
  style: LayoutStyle;
14
14
  }, HTMLElement>;
@@ -23,5 +23,9 @@ export interface TabsProps extends Omit<ComponentPropsWithRef<"div">, "defaultVa
23
23
  className?: string;
24
24
  /** Extra classes for the active panel. */
25
25
  panelClassName?: string;
26
+ /** Accessible name for the tablist. */
27
+ tabListAriaLabel?: string;
28
+ /** Space-separated IDs of elements that label the tablist. */
29
+ tabListAriaLabelledBy?: string;
26
30
  }
27
- export declare function Tabs({ tabs, defaultValue, value, onValueChange, className, panelClassName, ref, ...rest }: TabsProps): import("react/jsx-runtime").JSX.Element;
31
+ export declare function Tabs({ tabs, defaultValue, value, onValueChange, className, panelClassName, tabListAriaLabel, tabListAriaLabelledBy, ref, ...rest }: TabsProps): import("react/jsx-runtime").JSX.Element;
@@ -3,34 +3,36 @@ import { useControllableState as t } from "../../hooks/useControllableState.js";
3
3
  import { useId as n, useRef as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  //#region src/components/ui/Tabs.tsx
6
- function o({ tabs: o, defaultValue: s, value: c, onValueChange: l, className: u, panelClassName: d, ref: f, ...p }) {
7
- let [m, h] = t({
6
+ function o({ tabs: o, defaultValue: s, value: c, onValueChange: l, className: u, panelClassName: d, tabListAriaLabel: f, tabListAriaLabelledBy: p, ref: m, ...h }) {
7
+ let [g, _] = t({
8
8
  value: c,
9
9
  defaultValue: s || o[0]?.key || "",
10
10
  onChange: l
11
- }), g = o.some((e) => e.key === m) ? m : o[0]?.key ?? "", _ = o.find((e) => e.key === g), v = n(), y = r(null);
12
- function b(e) {
13
- let t = o.map((e) => e.key), n = t.indexOf(g), r = null;
14
- e.key === "ArrowRight" ? r = (n + 1) % o.length : e.key === "ArrowLeft" ? r = (n - 1 + o.length) % o.length : e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || (e.key === "Home" && (r = 0), e.key === "End" && (r = o.length - 1)), r !== null && (e.preventDefault(), h(t[r]), (y.current?.querySelectorAll("[role=\"tab\"]"))?.[r]?.focus());
11
+ }), v = o.some((e) => e.key === g) ? g : o[0]?.key ?? "", y = o.find((e) => e.key === v), b = n(), x = r(null);
12
+ function S(e) {
13
+ let t = o.map((e) => e.key), n = t.indexOf(v), r = null;
14
+ e.key === "ArrowRight" ? r = (n + 1) % o.length : e.key === "ArrowLeft" ? r = (n - 1 + o.length) % o.length : e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || (e.key === "Home" && (r = 0), e.key === "End" && (r = o.length - 1)), r !== null && (e.preventDefault(), _(t[r]), (x.current?.querySelectorAll("[role=\"tab\"]"))?.[r]?.focus());
15
15
  }
16
16
  return /* @__PURE__ */ a("div", {
17
- ref: f,
18
- ...p,
17
+ ref: m,
18
+ ...h,
19
19
  className: u,
20
20
  children: [/* @__PURE__ */ i("div", {
21
21
  className: "border-border flex shrink-0 overflow-x-auto border-b",
22
22
  role: "tablist",
23
- ref: y,
23
+ "aria-label": f,
24
+ "aria-labelledby": p,
25
+ ref: x,
24
26
  children: o.map((t) => /* @__PURE__ */ a("button", {
25
27
  type: "button",
26
- id: `${v}-tab-${t.key}`,
28
+ id: `${b}-tab-${t.key}`,
27
29
  role: "tab",
28
- tabIndex: t.key === g ? 0 : -1,
29
- "aria-selected": t.key === g,
30
- "aria-controls": `${v}-panel`,
31
- onClick: () => h(t.key),
32
- onKeyDown: b,
33
- className: e("font-control relative flex shrink-0 cursor-pointer items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors duration-[100ms] focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent", "hover:text-text-primary", t.key === g ? "text-accent-fg" : "text-text-tertiary"),
30
+ tabIndex: t.key === v ? 0 : -1,
31
+ "aria-selected": t.key === v,
32
+ "aria-controls": `${b}-panel`,
33
+ onClick: () => _(t.key),
34
+ onKeyDown: S,
35
+ className: e("font-control relative flex shrink-0 cursor-pointer items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors duration-[100ms] focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-accent", "hover:text-text-primary", t.key === v ? "text-accent-fg" : "text-text-tertiary"),
34
36
  children: [
35
37
  t.icon && /* @__PURE__ */ i("span", {
36
38
  "aria-hidden": "true",
@@ -38,7 +40,7 @@ function o({ tabs: o, defaultValue: s, value: c, onValueChange: l, className: u,
38
40
  }),
39
41
  /* @__PURE__ */ i("span", { children: t.label }),
40
42
  t.count != null && /* @__PURE__ */ a("span", {
41
- className: e("min-w-[18px] rounded-md px-1.5 py-0.5 text-center text-2xs leading-none font-medium", t.key === g ? "bg-accent/15 text-accent-fg" : "bg-bg-hover text-text-tertiary"),
43
+ className: e("min-w-[18px] rounded-md px-1.5 py-0.5 text-center text-2xs leading-none font-medium", t.key === v ? "bg-accent/15 text-accent-fg" : "bg-bg-hover text-text-tertiary"),
42
44
  children: [/* @__PURE__ */ i("span", {
43
45
  "aria-hidden": "true",
44
46
  children: t.count
@@ -47,15 +49,15 @@ function o({ tabs: o, defaultValue: s, value: c, onValueChange: l, className: u,
47
49
  children: t.countLabel ?? `${t.count} ${t.count === 1 ? "item" : "items"}`
48
50
  })]
49
51
  }),
50
- t.key === g && /* @__PURE__ */ i("div", { className: "bg-accent absolute right-0 bottom-0 left-0 h-0.5 rounded-md" })
52
+ t.key === v && /* @__PURE__ */ i("div", { className: "bg-accent absolute right-0 bottom-0 left-0 h-0.5 rounded-md" })
51
53
  ]
52
54
  }, t.key))
53
55
  }), /* @__PURE__ */ i("div", {
54
- id: `${v}-panel`,
56
+ id: `${b}-panel`,
55
57
  role: "tabpanel",
56
- "aria-labelledby": `${v}-tab-${g}`,
58
+ "aria-labelledby": `${b}-tab-${v}`,
57
59
  className: e("pt-4", d),
58
- children: _?.content
60
+ children: y?.content
59
61
  })]
60
62
  });
61
63
  }
@@ -0,0 +1,19 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ declare const tones: {
3
+ primary: string;
4
+ secondary: string;
5
+ muted: string;
6
+ };
7
+ declare const sizes: {
8
+ "2xs": string;
9
+ xs: string;
10
+ sm: string;
11
+ };
12
+ export interface TextProps extends ComponentPropsWithRef<"span"> {
13
+ /** Semantic text colour. */
14
+ tone?: keyof typeof tones;
15
+ /** Theme type size for metadata, body copy or titles. */
16
+ size?: keyof typeof sizes;
17
+ }
18
+ export declare function Text({ tone, size, className, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,20 @@
1
+ import { cn as e } from "../../lib/cn.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ //#region src/components/ui/Text.tsx
4
+ var n = {
5
+ primary: "text-text-primary",
6
+ secondary: "text-text-secondary",
7
+ muted: "text-text-tertiary"
8
+ }, r = {
9
+ "2xs": "text-2xs",
10
+ xs: "text-xs",
11
+ sm: "text-sm"
12
+ };
13
+ function i({ tone: i = "primary", size: a = "xs", className: o, ...s }) {
14
+ return /* @__PURE__ */ t("span", {
15
+ ...s,
16
+ className: e(n[i], r[a], o)
17
+ });
18
+ }
19
+ //#endregion
20
+ export { i as Text };