@leonardaustin/ui 0.26.2 → 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 (53) 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/CalendarGrid.js +10 -10
  17. package/dist/components/ui/DatePicker.d.ts +1 -1
  18. package/dist/components/ui/DatePicker.js +5 -10
  19. package/dist/components/ui/DateRangePicker.d.ts +3 -1
  20. package/dist/components/ui/DateRangePicker.js +105 -80
  21. package/dist/components/ui/DateTimePicker.js +20 -20
  22. package/dist/components/ui/EmptyState.d.ts +8 -6
  23. package/dist/components/ui/EmptyState.js +11 -10
  24. package/dist/components/ui/ErrorBoundary.d.ts +6 -0
  25. package/dist/components/ui/ErrorBoundary.js +11 -5
  26. package/dist/components/ui/Grid.d.ts +1 -1
  27. package/dist/components/ui/Icon.d.ts +91 -0
  28. package/dist/components/ui/Icon.js +98 -0
  29. package/dist/components/ui/Inline.d.ts +1 -1
  30. package/dist/components/ui/LoadingSpinner.d.ts +7 -3
  31. package/dist/components/ui/LoadingSpinner.js +19 -11
  32. package/dist/components/ui/Meter.d.ts +11 -0
  33. package/dist/components/ui/Meter.js +7 -0
  34. package/dist/components/ui/MetricCard.d.ts +11 -8
  35. package/dist/components/ui/MetricCard.js +18 -15
  36. package/dist/components/ui/PaginationBar.d.ts +3 -3
  37. package/dist/components/ui/PaginationBar.js +35 -33
  38. package/dist/components/ui/SideSheet.d.ts +4 -2
  39. package/dist/components/ui/SideSheet.js +64 -52
  40. package/dist/components/ui/Stack.d.ts +1 -1
  41. package/dist/components/ui/Tabs.d.ts +5 -1
  42. package/dist/components/ui/Tabs.js +23 -21
  43. package/dist/components/ui/Text.d.ts +19 -0
  44. package/dist/components/ui/Text.js +20 -0
  45. package/dist/components/ui/Toolbar.js +13 -13
  46. package/dist/core.css +105 -0
  47. package/dist/hooks/useFocusTrap.js +1 -1
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.js +134 -129
  50. package/dist/lib/calendar.d.ts +2 -0
  51. package/dist/lib/calendar.js +234 -229
  52. package/dist/styles.css +106 -0
  53. package/package.json +1 -1
@@ -4,8 +4,8 @@ import { clamp as n } from "../../lib/math.js";
4
4
  import { useControlSize as r } from "../../providers/ControlSizeContext.js";
5
5
  import { useControllableState as i } from "../../hooks/useControllableState.js";
6
6
  import { usePopover as a } from "../../hooks/usePopover.js";
7
- import { calendarDateFromParts as o, calendarDateParts as s } from "../../lib/calendar.js";
8
- import { MONTHS_SHORT as c } from "../../lib/months.js";
7
+ import { MONTHS_SHORT as o } from "../../lib/months.js";
8
+ import { calendarDateFromParts as s, calendarDateParts as c } from "../../lib/calendar.js";
9
9
  import { CalendarGrid as l } from "./CalendarGrid.js";
10
10
  import { useId as u, useMemo as d, useState as f } from "react";
11
11
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -40,8 +40,8 @@ function v(e, t) {
40
40
  timeZoneName: "short",
41
41
  hourCycle: "h23"
42
42
  }).format(e);
43
- let n = c[e.getMonth()], r = e.getDate(), i = e.getFullYear(), { hour12: a, period: o } = g(e.getHours());
44
- return `${n} ${r}, ${i} ${a}:${String(e.getMinutes()).padStart(2, "0")} ${o}`;
43
+ let n = o[e.getMonth()], r = e.getDate(), i = e.getFullYear(), { hour12: a, period: s } = g(e.getHours());
44
+ return `${n} ${r}, ${i} ${a}:${String(e.getMinutes()).padStart(2, "0")} ${s}`;
45
45
  }
46
46
  function y(e) {
47
47
  return String(e).padStart(2, "0");
@@ -58,14 +58,14 @@ function b({ value: e, defaultValue: t = null, onValueChange: n, ...r }) {
58
58
  onValueChange: o
59
59
  }, r.timeZone ?? "browser-local");
60
60
  }
61
- function x({ controlSize: i, label: c, timeZone: b, value: x, onValueChange: S, placeholder: C = "Select date & time...", ref: w, className: T, ...E }) {
61
+ function x({ controlSize: i, label: o, timeZone: b, value: x, onValueChange: S, placeholder: C = "Select date & time...", ref: w, className: T, ...E }) {
62
62
  let D = r(i), { open: O, show: k, close: A, rootRef: j, anchorRef: ee, triggerRef: te, popupRef: ne, labelId: re, popupId: ie, triggerAria: ae } = a({
63
63
  haspopup: "dialog",
64
- labelled: !!c
65
- }), oe = d(() => t(w, j), [w, j]), [M, N] = f(null), [P, F] = f(!1), [I, L] = f("reject"), R = u(), z = s(x ?? /* @__PURE__ */ new Date(), b), B = x ? g(s(x, b).hour) : {
64
+ labelled: !!o
65
+ }), oe = d(() => t(w, j), [w, j]), [M, N] = f(null), [P, F] = f(!1), [I, L] = f("reject"), R = u(), z = c(x ?? /* @__PURE__ */ new Date(), b), B = x ? g(c(x, b).hour) : {
66
66
  hour12: 12,
67
67
  period: "PM"
68
- }, [V, H] = f(z.year), [U, W] = f(z.month - 1), [G, K] = f(String(B.hour12)), [q, J] = f(x ? y(s(x, b).minute) : "00"), [Y, X] = f(B.period), [Z, Q] = f(x);
68
+ }, [V, H] = f(z.year), [U, W] = f(z.month - 1), [G, K] = f(String(B.hour12)), [q, J] = f(x ? y(c(x, b).minute) : "00"), [Y, X] = f(B.period), [Z, Q] = f(x);
69
69
  function se(e) {
70
70
  Q(e);
71
71
  }
@@ -78,28 +78,28 @@ function x({ controlSize: i, label: c, timeZone: b, value: x, onValueChange: S,
78
78
  function le() {
79
79
  if (!Z) return;
80
80
  let e = n(parseInt(G, 10) || 12, 1, 12), t = n(parseInt(q, 10) || 0, 0, 59), r = _(e, Y), i = {
81
- ...s(Z, b),
81
+ ...c(Z, b),
82
82
  hour: r,
83
83
  minute: t,
84
84
  second: 0,
85
85
  millisecond: 0
86
- }, a = x ? s(x, b) : null, c;
86
+ }, a = x ? c(x, b) : null, o;
87
87
  try {
88
- c = I === "reject" && x && a && [
88
+ o = I === "reject" && x && a && [
89
89
  "year",
90
90
  "month",
91
91
  "day",
92
92
  "hour",
93
93
  "minute"
94
- ].every((e) => a[e] === i[e]) ? new Date(x) : o(i, b, I);
95
- let e = s(c, b);
94
+ ].every((e) => a[e] === i[e]) ? new Date(x) : s(i, b, I);
95
+ let e = c(o, b);
96
96
  if (e.hour !== r || e.minute !== t || e.day !== i.day) throw RangeError("This time does not exist in the selected timezone");
97
97
  } catch (e) {
98
98
  let t = e instanceof Error ? e.message : "Invalid date and time";
99
99
  N(t), F(t.includes("twice"));
100
100
  return;
101
101
  }
102
- N(null), S(c), A("select");
102
+ N(null), S(o), A("select");
103
103
  }
104
104
  function $() {
105
105
  if (O) {
@@ -107,14 +107,14 @@ function x({ controlSize: i, label: c, timeZone: b, value: x, onValueChange: S,
107
107
  return;
108
108
  }
109
109
  if (x) {
110
- H(s(x, b).year), W(s(x, b).month - 1), Q(x);
111
- let e = g(s(x, b).hour);
112
- K(String(e.hour12)), X(e.period), J(y(s(x, b).minute));
110
+ H(c(x, b).year), W(c(x, b).month - 1), Q(x);
111
+ let e = g(c(x, b).hour);
112
+ K(String(e.hour12)), X(e.period), J(y(c(x, b).minute));
113
113
  }
114
114
  N(null);
115
115
  let e = !1;
116
116
  if (x && b) try {
117
- o(s(x, b), b, "reject");
117
+ s(c(x, b), b, "reject");
118
118
  } catch (t) {
119
119
  e = t instanceof Error && t.message.includes("twice");
120
120
  }
@@ -124,10 +124,10 @@ function x({ controlSize: i, label: c, timeZone: b, value: x, onValueChange: S,
124
124
  ...E,
125
125
  ref: oe,
126
126
  className: e("flex flex-col gap-1.5", T),
127
- children: [c && /* @__PURE__ */ p("span", {
127
+ children: [o && /* @__PURE__ */ p("span", {
128
128
  id: re,
129
129
  className: "ui-field-label text-xs font-medium",
130
- children: c
130
+ children: o
131
131
  }), /* @__PURE__ */ m("div", {
132
132
  className: "relative",
133
133
  ref: ee,
@@ -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>;
@@ -0,0 +1,91 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ declare const glyphs: {
3
+ activity: import("lucide-react").LucideIcon;
4
+ alert: import("lucide-react").LucideIcon;
5
+ archive: import("lucide-react").LucideIcon;
6
+ "arrow-down-wide-narrow": import("lucide-react").LucideIcon;
7
+ "arrow-left": import("lucide-react").LucideIcon;
8
+ "arrow-right": import("lucide-react").LucideIcon;
9
+ "arrow-up-narrow-wide": import("lucide-react").LucideIcon;
10
+ bell: import("lucide-react").LucideIcon;
11
+ bot: import("lucide-react").LucideIcon;
12
+ brain: import("lucide-react").LucideIcon;
13
+ calendar: import("lucide-react").LucideIcon;
14
+ "calendar-clock": import("lucide-react").LucideIcon;
15
+ "calendar-plus": import("lucide-react").LucideIcon;
16
+ "chart-no-axes-column": import("lucide-react").LucideIcon;
17
+ "check-circle": import("lucide-react").LucideIcon;
18
+ "chevron-down": import("lucide-react").LucideIcon;
19
+ "chevron-left": import("lucide-react").LucideIcon;
20
+ "chevron-right": import("lucide-react").LucideIcon;
21
+ "chevrons-up-down": import("lucide-react").LucideIcon;
22
+ "circle-check": import("lucide-react").LucideIcon;
23
+ clipboard: import("lucide-react").LucideIcon;
24
+ "clipboard-list": import("lucide-react").LucideIcon;
25
+ clock: import("lucide-react").LucideIcon;
26
+ code: import("lucide-react").LucideIcon;
27
+ "credit-card": import("lucide-react").LucideIcon;
28
+ database: import("lucide-react").LucideIcon;
29
+ download: import("lucide-react").LucideIcon;
30
+ "external-link": import("lucide-react").LucideIcon;
31
+ eye: import("lucide-react").LucideIcon;
32
+ "eye-off": import("lucide-react").LucideIcon;
33
+ "file-chart-column-increasing": import("lucide-react").LucideIcon;
34
+ "file-check": import("lucide-react").LucideIcon;
35
+ "file-text": import("lucide-react").LucideIcon;
36
+ form: import("lucide-react").LucideIcon;
37
+ "git-branch": import("lucide-react").LucideIcon;
38
+ "git-merge": import("lucide-react").LucideIcon;
39
+ globe: import("lucide-react").LucideIcon;
40
+ history: import("lucide-react").LucideIcon;
41
+ house: import("lucide-react").LucideIcon;
42
+ inbox: import("lucide-react").LucideIcon;
43
+ key: import("lucide-react").LucideIcon;
44
+ layers: import("lucide-react").LucideIcon;
45
+ link: import("lucide-react").LucideIcon;
46
+ list: import("lucide-react").LucideIcon;
47
+ "log-out": import("lucide-react").LucideIcon;
48
+ "map-pin": import("lucide-react").LucideIcon;
49
+ menu: import("lucide-react").LucideIcon;
50
+ "message-square": import("lucide-react").LucideIcon;
51
+ mic: import("lucide-react").LucideIcon;
52
+ moon: import("lucide-react").LucideIcon;
53
+ network: import("lucide-react").LucideIcon;
54
+ package: import("lucide-react").LucideIcon;
55
+ paperclip: import("lucide-react").LucideIcon;
56
+ pause: import("lucide-react").LucideIcon;
57
+ phone: import("lucide-react").LucideIcon;
58
+ pill: import("lucide-react").LucideIcon;
59
+ play: import("lucide-react").LucideIcon;
60
+ plus: import("lucide-react").LucideIcon;
61
+ "refresh-cw": import("lucide-react").LucideIcon;
62
+ reply: import("lucide-react").LucideIcon;
63
+ route: import("lucide-react").LucideIcon;
64
+ save: import("lucide-react").LucideIcon;
65
+ scale: import("lucide-react").LucideIcon;
66
+ search: import("lucide-react").LucideIcon;
67
+ send: import("lucide-react").LucideIcon;
68
+ settings: import("lucide-react").LucideIcon;
69
+ "shield-check": import("lucide-react").LucideIcon;
70
+ smartphone: import("lucide-react").LucideIcon;
71
+ star: import("lucide-react").LucideIcon;
72
+ store: import("lucide-react").LucideIcon;
73
+ sun: import("lucide-react").LucideIcon;
74
+ tag: import("lucide-react").LucideIcon;
75
+ trash: import("lucide-react").LucideIcon;
76
+ "trending-up": import("lucide-react").LucideIcon;
77
+ "triangle-alert": import("lucide-react").LucideIcon;
78
+ user: import("lucide-react").LucideIcon;
79
+ users: import("lucide-react").LucideIcon;
80
+ video: import("lucide-react").LucideIcon;
81
+ x: import("lucide-react").LucideIcon;
82
+ };
83
+ export type IconName = keyof typeof glyphs;
84
+ export interface IconProps extends Omit<ComponentPropsWithRef<"svg">, "children"> {
85
+ /** Common action or status glyph. */
86
+ name: IconName;
87
+ /** Width and height; defaults to 20 pixels. */
88
+ size?: number | string;
89
+ }
90
+ export declare function Icon({ name, size, className, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
91
+ export {};
@@ -0,0 +1,98 @@
1
+ import { cn as ee } from "../../lib/cn.js";
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { Activity as t, Archive as n, ArrowDownWideNarrow as r, ArrowLeft as i, ArrowRight as a, ArrowUpNarrowWide as o, Bell as s, Bot as te, Brain as c, Calendar as l, CalendarClock as u, CalendarPlus as d, ChartNoAxesColumn as f, ChevronDown as p, ChevronLeft as m, ChevronRight as h, ChevronsUpDown as g, CircleCheck as _, Clipboard as v, ClipboardList as y, Clock as b, Code as x, CreditCard as S, Database as C, Download as w, ExternalLink as T, Eye as E, EyeOff as D, FileChartColumnIncreasing as O, FileCheck as k, FileText as A, Form as j, GitBranch as M, GitMerge as N, Globe as P, History as F, House as I, Inbox as L, Key as R, Layers as z, Link as B, List as V, LogOut as H, MapPin as U, Menu as W, MessageSquare as G, Mic as K, Moon as ne, Network as q, Package as J, Paperclip as Y, Pause as X, Phone as Z, Pill as re, Play as ie, Plus as ae, RefreshCw as oe, Reply as se, Route as ce, Save as le, Scale as ue, Search as de, Send as fe, Settings as pe, ShieldCheck as me, Smartphone as he, Star as ge, Store as _e, Sun as ve, Tag as ye, Trash as be, TrendingUp as xe, TriangleAlert as Q, User as Se, Users as Ce, Video as $, X as we } from "lucide-react";
4
+ //#region src/components/ui/Icon.tsx
5
+ var Te = {
6
+ activity: t,
7
+ alert: Q,
8
+ archive: n,
9
+ "arrow-down-wide-narrow": r,
10
+ "arrow-left": i,
11
+ "arrow-right": a,
12
+ "arrow-up-narrow-wide": o,
13
+ bell: s,
14
+ bot: te,
15
+ brain: c,
16
+ calendar: l,
17
+ "calendar-clock": u,
18
+ "calendar-plus": d,
19
+ "chart-no-axes-column": f,
20
+ "check-circle": _,
21
+ "chevron-down": p,
22
+ "chevron-left": m,
23
+ "chevron-right": h,
24
+ "chevrons-up-down": g,
25
+ "circle-check": _,
26
+ clipboard: v,
27
+ "clipboard-list": y,
28
+ clock: b,
29
+ code: x,
30
+ "credit-card": S,
31
+ database: C,
32
+ download: w,
33
+ "external-link": T,
34
+ eye: E,
35
+ "eye-off": D,
36
+ "file-chart-column-increasing": O,
37
+ "file-check": k,
38
+ "file-text": A,
39
+ form: j,
40
+ "git-branch": M,
41
+ "git-merge": N,
42
+ globe: P,
43
+ history: F,
44
+ house: I,
45
+ inbox: L,
46
+ key: R,
47
+ layers: z,
48
+ link: B,
49
+ list: V,
50
+ "log-out": H,
51
+ "map-pin": U,
52
+ menu: W,
53
+ "message-square": G,
54
+ mic: K,
55
+ moon: ne,
56
+ network: q,
57
+ package: J,
58
+ paperclip: Y,
59
+ pause: X,
60
+ phone: Z,
61
+ pill: re,
62
+ play: ie,
63
+ plus: ae,
64
+ "refresh-cw": oe,
65
+ reply: se,
66
+ route: ce,
67
+ save: le,
68
+ scale: ue,
69
+ search: de,
70
+ send: fe,
71
+ settings: pe,
72
+ "shield-check": me,
73
+ smartphone: he,
74
+ star: ge,
75
+ store: _e,
76
+ sun: ve,
77
+ tag: ye,
78
+ trash: be,
79
+ "trending-up": xe,
80
+ "triangle-alert": Q,
81
+ user: Se,
82
+ users: Ce,
83
+ video: $,
84
+ x: we
85
+ };
86
+ function Ee({ name: t, size: n = 20, className: r, ...i }) {
87
+ let a = Te[t], o = i["aria-label"] || i["aria-labelledby"];
88
+ return /* @__PURE__ */ e(a, {
89
+ size: n,
90
+ className: ee("inline-block shrink-0", r),
91
+ color: "currentColor",
92
+ role: o ? "img" : void 0,
93
+ "aria-hidden": o ? void 0 : !0,
94
+ ...i
95
+ });
96
+ }
97
+ //#endregion
98
+ export { Ee as Icon };
@@ -18,7 +18,7 @@ export interface InlineOptions {
18
18
  stackBelow?: LayoutBreakpoint;
19
19
  }
20
20
  export type InlineProps<E extends LayoutElement = "div"> = LayoutProps<E, InlineOptions>;
21
- export declare function Inline<E extends LayoutElement = "div">({ as, gap, gapX, gapY, align, justify, wrap, inline, stackBelow, className, style, ...props }: InlineProps<E>): import("react").DetailedReactHTMLElement<Omit<InlineProps<E>, "inline" | "style" | "className" | "gap" | "wrap" | "justify" | "align" | "as" | "gapX" | "gapY" | "stackBelow"> & {
21
+ export declare function Inline<E extends LayoutElement = "div">({ as, gap, gapX, gapY, align, justify, wrap, inline, stackBelow, className, style, ...props }: InlineProps<E>): import("react").DetailedReactHTMLElement<Omit<InlineProps<E>, "inline" | "style" | "className" | "gap" | "align" | "justify" | "wrap" | "as" | "gapX" | "gapY" | "stackBelow"> & {
22
22
  className: string;
23
23
  style: LayoutStyle;
24
24
  }, HTMLElement>;
@@ -1,9 +1,13 @@
1
1
  import type { ComponentPropsWithRef } from "react";
2
- export type LoadingSpinnerSize = "sm" | "md" | "lg";
2
+ export type LoadingSpinnerSize = "sm" | "md" | "lg" | "inline";
3
3
  export interface LoadingSpinnerProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
4
4
  /** Additional utility classes appended to the centering wrapper. */
5
5
  className?: string;
6
- /** Size of the spinner icon. Defaults to `md`. */
6
+ /** Icon size. Defaults to `md`. Use `inline` for a small spinner without the 200px wrapper. */
7
7
  size?: LoadingSpinnerSize;
8
+ /** Text announced by the status region. Defaults to “Loading…” for inline or visible labels. */
9
+ label?: string;
10
+ /** Display the status text next to the spinner. Defaults to false. */
11
+ showLabel?: boolean;
8
12
  }
9
- export declare function LoadingSpinner({ className, size, ref, ...rest }: LoadingSpinnerProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function LoadingSpinner({ className, size, showLabel, label, ref, ...rest }: LoadingSpinnerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,27 @@
1
1
  import { cn as e } from "../../lib/cn.js";
2
- import { jsx as t } from "react/jsx-runtime";
3
- import { Loader2 as n } from "lucide-react";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import { Loader2 as r } from "lucide-react";
4
4
  //#region src/components/ui/LoadingSpinner.tsx
5
- var r = {
5
+ var i = {
6
6
  sm: "w-4 h-4",
7
7
  md: "w-6 h-6",
8
- lg: "w-8 h-8"
8
+ lg: "w-8 h-8",
9
+ inline: "w-4 h-4"
9
10
  };
10
- function i({ className: i, size: a = "md", ref: o, ...s }) {
11
- return /* @__PURE__ */ t("div", {
12
- ...s,
13
- ref: o,
14
- className: e("flex min-h-[200px] items-center justify-center", i),
15
- children: /* @__PURE__ */ t(n, { className: e("text-accent animate-spin", r[a]) })
11
+ function a({ className: a, size: o = "md", showLabel: s = !1, label: c = o === "inline" || s ? "Loading…" : void 0, ref: l, ...u }) {
12
+ return /* @__PURE__ */ n(o === "inline" ? "span" : "div", {
13
+ role: c ? "status" : void 0,
14
+ ...u,
15
+ ref: l,
16
+ className: e(o === "inline" ? "inline-flex" : "flex min-h-[200px]", "items-center justify-center", s && c && "gap-2", a),
17
+ children: [/* @__PURE__ */ t(r, {
18
+ "aria-hidden": "true",
19
+ className: e("text-accent animate-spin", i[o])
20
+ }), c && /* @__PURE__ */ t("span", {
21
+ className: s ? "text-text-secondary text-xs" : "sr-only",
22
+ children: c
23
+ })]
16
24
  });
17
25
  }
18
26
  //#endregion
19
- export { i as LoadingSpinner };
27
+ export { a as LoadingSpinner };
@@ -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. */