@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
@@ -22,22 +22,27 @@ function i(e, t) {
22
22
  for (let e = 0; e < n; e += 1) i.add(Math.round(e * r));
23
23
  return i.add(e - 1), Array.from(i).sort((e, t) => e - t);
24
24
  }
25
- function a(e) {
25
+ function a(e, t, n) {
26
+ if (e < 2) return e;
27
+ let r = t / (e - 1), i = Math.max(1, Math.ceil((n + 12) / r));
28
+ return 1 + Math.floor((e - 1) / i);
29
+ }
30
+ function o(e) {
26
31
  return Number.isFinite(e) ? Math.max(0, e) : 0;
27
32
  }
28
- function o(e, t) {
33
+ function s(e, t) {
29
34
  let n = String(e ?? "");
30
35
  return t === void 0 || t <= 0 || n.length <= t ? n : t <= 3 ? n.slice(0, t) : `${n.slice(0, t - 3)}...`;
31
36
  }
32
- function s(e, t = 10) {
37
+ function c(e, t = 10) {
33
38
  let n = 0;
34
39
  for (let r of e) r === " " ? n += t * .32 : /[A-Z0-9]/.test(r) ? n += t * .62 : /[il.,:;|'`]/.test(r) ? n += t * .28 : /[MW@#%&]/.test(r) ? n += t * .82 : n += t * .54;
35
40
  return Math.ceil(n);
36
41
  }
37
- function c(t, { maxWidth: n = 220, minWidth: r = 72, paddingX: i = 20 } = {}) {
38
- return e(t.reduce((e, t) => Math.max(e, s(t, 11)), 0) + i, r, n);
42
+ function l(t, { maxWidth: n = 220, minWidth: r = 72, paddingX: i = 20 } = {}) {
43
+ return e(t.reduce((e, t) => Math.max(e, c(t, 11)), 0) + i, r, n);
39
44
  }
40
- function l(t, n, { boundsHeight: r, boundsWidth: i, height: a, margin: o = 0, offset: s = 8, width: c }) {
45
+ function u(t, n, { boundsHeight: r, boundsWidth: i, height: a, margin: o = 0, offset: s = 8, width: c }) {
41
46
  let l = Math.max(1, Math.min(c, i - o * 2)), u = Math.max(1, Math.min(a, r - o * 2)), d = Math.max(o, i - l - o), f = Math.max(o, r - u - o), p = e(t - l / 2, o, d), m = n - u - s, h = m >= o ? "above" : "below";
42
47
  return {
43
48
  height: u,
@@ -47,8 +52,8 @@ function l(t, n, { boundsHeight: r, boundsWidth: i, height: a, margin: o = 0, of
47
52
  y: h === "above" ? m : e(n + s, o, f)
48
53
  };
49
54
  }
50
- function u({ anchorX: e, anchorY: t, boundsHeight: n, boundsWidth: r, height: i, margin: a = 0, offset: o = 8, width: s }) {
51
- let c = l(e, t, {
55
+ function d({ anchorX: e, anchorY: t, boundsHeight: n, boundsWidth: r, height: i, margin: a = 0, offset: o = 8, width: s }) {
56
+ let c = u(e, t, {
52
57
  boundsHeight: n,
53
58
  boundsWidth: r,
54
59
  height: i,
@@ -65,4 +70,4 @@ function u({ anchorX: e, anchorY: t, boundsHeight: n, boundsWidth: r, height: i,
65
70
  };
66
71
  }
67
72
  //#endregion
68
- export { c as estimateTooltipWidth, n as formatCompactValue, u as getFloatingTooltipStyle, i as getLabelIndices, a as getPositiveValue, l as getSvgTooltipPosition, r as resolveChartColor, o as truncateChartLabel };
73
+ export { c as estimateTextWidth, l as estimateTooltipWidth, n as formatCompactValue, a as getFittingLabelCount, d as getFloatingTooltipStyle, i as getLabelIndices, o as getPositiveValue, u as getSvgTooltipPosition, r as resolveChartColor, s as truncateChartLabel };
@@ -0,0 +1,13 @@
1
+ import { type Ref, type RefCallback, type RefObject } from "react";
2
+ export declare function useChartSize(ref: RefObject<SVGSVGElement | null>): {
3
+ width: number;
4
+ height: number;
5
+ } | undefined;
6
+ export declare function useBarChartSize(ref: Ref<SVGSVGElement> | undefined): {
7
+ rootRef: RefCallback<SVGSVGElement>;
8
+ size: {
9
+ width: number;
10
+ height: number;
11
+ } | undefined;
12
+ viewBoxWidth: number;
13
+ };
@@ -0,0 +1,27 @@
1
+ import { mergeRefs as e } from "../../lib/mergeRefs.js";
2
+ import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
+ //#region src/components/charts/useChartSize.ts
4
+ function a(e) {
5
+ let [t, r] = i();
6
+ return n(() => {
7
+ if (!e.current || typeof ResizeObserver > "u") return;
8
+ let t = new ResizeObserver(([e]) => {
9
+ let { width: t, height: n } = e.contentRect;
10
+ t > 0 && n > 0 && r({
11
+ width: t,
12
+ height: n
13
+ });
14
+ });
15
+ return t.observe(e.current), () => t.disconnect();
16
+ }, [e]), t;
17
+ }
18
+ function o(n) {
19
+ let i = r(null), o = t((t) => e(i, n)(t), [n]), s = a(i);
20
+ return {
21
+ rootRef: o,
22
+ size: s,
23
+ viewBoxWidth: s?.width ?? 600
24
+ };
25
+ }
26
+ //#endregion
27
+ export { o as useBarChartSize, a as useChartSize };
@@ -8,6 +8,8 @@ export interface PaginationProps extends Omit<ComponentPropsWithRef<"div">, "chi
8
8
  onPageChange: (page: number) => void;
9
9
  /** Disable navigation while the next page is loading. */
10
10
  loading?: boolean;
11
+ /** Keep arrows visible past the last page and focusable during a refetch. */
12
+ keepNavigation?: boolean;
11
13
  /** Optional item total, displayed as “N in total”. */
12
14
  total?: number;
13
15
  /**
@@ -16,4 +18,4 @@ export interface PaginationProps extends Omit<ComponentPropsWithRef<"div">, "chi
16
18
  */
17
19
  summary?: ReactNode | ((total: number | undefined) => ReactNode);
18
20
  }
19
- export declare function Pagination({ page, totalPages, onPageChange, loading, total, summary, className, ref, ...rest }: PaginationProps): import("react/jsx-runtime").JSX.Element;
21
+ export declare function Pagination({ page, totalPages, onPageChange, loading, keepNavigation, total, summary, className, ref, ...rest }: PaginationProps): import("react/jsx-runtime").JSX.Element;
@@ -2,21 +2,21 @@ import { cn as e } from "../../lib/cn.js";
2
2
  import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
3
  import { ChevronLeft as i, ChevronRight as a } from "lucide-react";
4
4
  //#region src/components/tables/Pagination.tsx
5
- function o({ page: o, totalPages: s, onPageChange: c, loading: l = !1, total: u, summary: d, className: f, ref: p, ...m }) {
6
- let h = s <= 1 && !l && u === void 0 && d == null, g = d !== null && (l || u !== void 0 || d !== void 0), _ = [];
7
- for (let e = 1; e <= s; e++) e === 1 || e === s || e >= o - 1 && e <= o + 1 ? _.push(e) : _[_.length - 1] !== "ellipsis" && _.push("ellipsis");
5
+ function o({ page: o, totalPages: s, onPageChange: c, loading: l = !1, keepNavigation: u = !1, total: d, summary: f, className: p, ref: m, ...h }) {
6
+ let g = s > 1 || u && o > 1, _ = !g && !l && d === void 0 && f == null, v = f !== null && (l || d !== void 0 || f !== void 0), y = [];
7
+ for (let e = 1; e <= s; e++) e === 1 || e === s || e >= o - 1 && e <= o + 1 ? y.push(e) : y[y.length - 1] !== "ellipsis" && y.push("ellipsis");
8
8
  return /* @__PURE__ */ r("div", {
9
- ref: p,
10
- ...m,
11
- className: h ? "contents" : e("flex items-center gap-1", f),
9
+ ref: m,
10
+ ...h,
11
+ className: _ ? "contents" : e("flex items-center gap-1", p),
12
12
  children: [/* @__PURE__ */ n("span", {
13
13
  role: "status",
14
- className: g ? "text-text-tertiary text-xs" : "sr-only",
15
- children: g && (l ? "Loading results..." : d === void 0 ? `${u} in total` : typeof d == "function" ? d(u) : d)
16
- }), s > 1 && /* @__PURE__ */ r(t, { children: [
14
+ className: v ? "text-text-tertiary text-xs" : "sr-only",
15
+ children: v && (l ? "Loading results..." : f === void 0 ? `${d} in total` : typeof f == "function" ? f(d) : f)
16
+ }), g && /* @__PURE__ */ r(t, { children: [
17
17
  /* @__PURE__ */ n("button", {
18
18
  type: "button",
19
- disabled: o === 1,
19
+ disabled: !(u && l) && o === 1,
20
20
  "aria-disabled": l || void 0,
21
21
  onClick: () => {
22
22
  l || c(o - 1);
@@ -25,7 +25,7 @@ function o({ page: o, totalPages: s, onPageChange: c, loading: l = !1, total: u,
25
25
  "aria-label": "Previous page",
26
26
  children: /* @__PURE__ */ n(i, { className: "h-3.5 w-3.5" })
27
27
  }),
28
- _.map((t, r) => t === "ellipsis" ? /* @__PURE__ */ n("span", {
28
+ y.map((t, r) => t === "ellipsis" ? /* @__PURE__ */ n("span", {
29
29
  className: "text-text-tertiary flex h-7 w-7 items-center justify-center text-xs",
30
30
  children: "..."
31
31
  }, `e${r}`) : /* @__PURE__ */ n("button", {
@@ -39,7 +39,7 @@ function o({ page: o, totalPages: s, onPageChange: c, loading: l = !1, total: u,
39
39
  }, t)),
40
40
  /* @__PURE__ */ n("button", {
41
41
  type: "button",
42
- disabled: o >= s,
42
+ disabled: !(u && l) && o >= s,
43
43
  "aria-disabled": l || void 0,
44
44
  onClick: () => {
45
45
  l || c(o + 1);
@@ -10,6 +10,11 @@ export interface Column<T> {
10
10
  * screen readers (for example "Sort by name"). Only used when `sortable`.
11
11
  */
12
12
  sortLabel?: string;
13
+ /**
14
+ * Hide this column at wrapper widths of 32rem or less.
15
+ * Hiding uses a container query, so place the table in a block-level parent; shrink-to-fit parents such as inline-block collapse it.
16
+ */
17
+ lowPriority?: boolean;
13
18
  /** CSS width of the column, such as "120px" or "20%". */
14
19
  width?: string;
15
20
  /**
@@ -1,13 +1,13 @@
1
1
  import { cn as e } from "../../lib/cn.js";
2
- import { sortRows as t } from "./sortRows.js";
3
- import { Table as n, TableBody as r, TableCell as i, TableEmptyRow as a, TableHead as o, TableHeaderCell as s, TableRow as c } from "./Table.js";
2
+ import { Table as t, TableBody as n, TableCell as r, TableEmptyRow as i, TableHead as a, TableHeaderCell as o, TableRow as s } from "./Table.js";
3
+ import { sortRows as c } from "./sortRows.js";
4
4
  import { createElement as l, useMemo as u, useState as d } from "react";
5
5
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
6
6
  import { ArrowDown as m, ArrowUp as h } from "lucide-react";
7
7
  //#region src/components/tables/ResourceTable.tsx
8
8
  var g = { "--ui-table-cell-padding-y": "0px" };
9
9
  function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x = "No data", sortKey: S, sortDir: C, onSortChange: w, caption: T, loading: E = !1, loadingMessage: D = "Loading…", className: O, tableProps: k, getRowProps: A, isRowSelected: j, ref: M, ...N }) {
10
- let P = w !== void 0, [F, I] = d(null), [L, R] = d("asc"), z = P ? S ?? null : F, B = P ? C ?? "asc" : L, V = u(() => P ? _ : t(_, v, z, B), [
10
+ let P = w !== void 0, [F, I] = d(null), [L, R] = d("asc"), z = P ? S ?? null : F, B = P ? C ?? "asc" : L, V = u(() => P ? _ : c(_, v, z, B), [
11
11
  P,
12
12
  _,
13
13
  v,
@@ -22,7 +22,7 @@ function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x =
22
22
  }
23
23
  I(e), R(t);
24
24
  }
25
- return /* @__PURE__ */ p(n, {
25
+ return /* @__PURE__ */ p(t, {
26
26
  ...k,
27
27
  wrapperProps: {
28
28
  ...N,
@@ -42,7 +42,8 @@ function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x =
42
42
  ...g,
43
43
  ...k?.style
44
44
  },
45
- children: [/* @__PURE__ */ f(o, { children: /* @__PURE__ */ f(c, { children: v.map((t) => /* @__PURE__ */ f(s, {
45
+ children: [/* @__PURE__ */ f(a, { children: /* @__PURE__ */ f(s, { children: v.map((t) => /* @__PURE__ */ f(o, {
46
+ lowPriority: t.lowPriority,
46
47
  className: e("text-2xs h-7", t.sortable && "hover:text-text-table-header-hover cursor-pointer select-none"),
47
48
  style: { width: t.width },
48
49
  sort: t.sortable ? z === t.key ? B === "asc" ? "ascending" : "descending" : "none" : void 0,
@@ -56,13 +57,13 @@ function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x =
56
57
  className: "h-3 w-3"
57
58
  })]
58
59
  }) : t.header
59
- }, t.key)) }) }), /* @__PURE__ */ f(r, { children: V.length === 0 ? /* @__PURE__ */ f(a, {
60
+ }, t.key)) }) }), /* @__PURE__ */ f(n, { children: V.length === 0 ? /* @__PURE__ */ f(i, {
60
61
  colSpan: v.length,
61
62
  cellClassName: "h-32 px-0 text-center",
62
63
  children: E ? D : x
63
64
  }) : V.map((t) => {
64
- let n = A?.(t) ?? {}, r = j?.(t) ?? n["aria-selected"], a = r === !0 || r === "true";
65
- return /* @__PURE__ */ l(c, {
65
+ let n = A?.(t) ?? {}, i = j?.(t) ?? n["aria-selected"], a = i === !0 || i === "true";
66
+ return /* @__PURE__ */ l(s, {
66
67
  tabIndex: b ? 0 : void 0,
67
68
  ...n,
68
69
  key: y(t),
@@ -75,7 +76,8 @@ function _({ data: _, columns: v, getRowId: y, onRowClick: b, emptyMessage: x =
75
76
  onKeyDown: (e) => {
76
77
  n.onKeyDown?.(e), !(!b || e.defaultPrevented || e.repeat || e.target !== e.currentTarget || e.key !== "Enter" && e.key !== " ") && (e.preventDefault(), b(t));
77
78
  }
78
- }, v.map((e) => /* @__PURE__ */ f(i, {
79
+ }, v.map((e) => /* @__PURE__ */ f(r, {
80
+ lowPriority: e.lowPriority,
79
81
  nowrap: !0,
80
82
  className: e.cellClassName,
81
83
  onClick: e.interactive ? (e) => e.stopPropagation() : void 0,
@@ -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 };