@brightlocal/ui-components 3.3.0 → 3.5.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 (207) hide show
  1. package/AI_USAGE.md +22 -3
  2. package/README.md +177 -109
  3. package/component-meta.json +1307 -113
  4. package/dist/alert-dialog.cjs +1 -1
  5. package/dist/alert-dialog.d.ts +13 -2
  6. package/dist/alert-dialog.d.ts.map +1 -1
  7. package/dist/alert-dialog.js +4 -3
  8. package/dist/banner.cjs +1 -1
  9. package/dist/banner.d.ts +47 -11
  10. package/dist/banner.d.ts.map +1 -1
  11. package/dist/banner.js +156 -79
  12. package/dist/blocks/empty-state.cjs +1 -1
  13. package/dist/blocks/empty-state.d.ts +40 -5
  14. package/dist/blocks/empty-state.d.ts.map +1 -1
  15. package/dist/blocks/empty-state.js +59 -52
  16. package/dist/blocks/input-list.cjs +1 -1
  17. package/dist/blocks/input-list.d.ts +1 -0
  18. package/dist/blocks/input-list.d.ts.map +1 -1
  19. package/dist/blocks/input-list.js +39 -39
  20. package/dist/blocks/sidebar.cjs +1 -1
  21. package/dist/blocks/sidebar.d.ts +12 -6
  22. package/dist/blocks/sidebar.d.ts.map +1 -1
  23. package/dist/blocks/sidebar.js +64 -63
  24. package/dist/button.cjs +1 -1
  25. package/dist/button.d.ts.map +1 -1
  26. package/dist/button.js +47 -43
  27. package/dist/card.cjs +1 -1
  28. package/dist/card.d.ts +12 -0
  29. package/dist/card.d.ts.map +1 -1
  30. package/dist/card.js +115 -97
  31. package/dist/chart.cjs +6 -6
  32. package/dist/chart.d.ts +6 -10
  33. package/dist/chart.d.ts.map +1 -1
  34. package/dist/chart.js +281 -296
  35. package/dist/combobox.cjs +3 -3
  36. package/dist/combobox.d.ts.map +1 -1
  37. package/dist/combobox.js +430 -343
  38. package/dist/command.cjs +1 -1
  39. package/dist/command.d.ts +23 -2
  40. package/dist/command.d.ts.map +1 -1
  41. package/dist/command.js +212 -207
  42. package/dist/count-indicator.cjs +1 -0
  43. package/dist/count-indicator.d.ts +85 -0
  44. package/dist/count-indicator.d.ts.map +1 -0
  45. package/dist/count-indicator.js +72 -0
  46. package/dist/data-table.cjs +1 -1
  47. package/dist/data-table.d.ts +101 -11
  48. package/dist/data-table.d.ts.map +1 -1
  49. package/dist/data-table.js +593 -523
  50. package/dist/description-list.cjs +1 -0
  51. package/dist/description-list.d.ts +142 -0
  52. package/dist/description-list.d.ts.map +1 -0
  53. package/dist/description-list.js +173 -0
  54. package/dist/dialog.cjs +1 -1
  55. package/dist/dialog.d.ts +26 -3
  56. package/dist/dialog.d.ts.map +1 -1
  57. package/dist/dialog.js +62 -47
  58. package/dist/drawer.cjs +1 -1
  59. package/dist/drawer.d.ts +8 -4
  60. package/dist/drawer.d.ts.map +1 -1
  61. package/dist/drawer.js +37 -38
  62. package/dist/file-upload.cjs +1 -0
  63. package/dist/file-upload.d.ts +546 -0
  64. package/dist/file-upload.d.ts.map +1 -0
  65. package/dist/file-upload.js +1103 -0
  66. package/dist/global-layout.cjs +1 -1
  67. package/dist/global-layout.d.ts +7 -2
  68. package/dist/global-layout.d.ts.map +1 -1
  69. package/dist/global-layout.js +52 -52
  70. package/dist/hooks/use-file-dropzone.cjs +1 -0
  71. package/dist/hooks/use-file-dropzone.d.ts +75 -0
  72. package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
  73. package/dist/hooks/use-file-dropzone.js +133 -0
  74. package/dist/hover-card.cjs +1 -1
  75. package/dist/hover-card.d.ts +29 -16
  76. package/dist/hover-card.d.ts.map +1 -1
  77. package/dist/hover-card.js +153 -36
  78. package/dist/index.cjs +1 -1
  79. package/dist/index.d.ts +4 -0
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +681 -623
  82. package/dist/input-chip.cjs +1 -1
  83. package/dist/input-chip.d.ts +30 -1
  84. package/dist/input-chip.d.ts.map +1 -1
  85. package/dist/input-chip.js +131 -115
  86. package/dist/input-group.cjs +1 -1
  87. package/dist/input-group.d.ts +37 -2
  88. package/dist/input-group.d.ts.map +1 -1
  89. package/dist/input-group.js +131 -114
  90. package/dist/input-password.cjs +1 -1
  91. package/dist/input-password.js +6 -6
  92. package/dist/lib/empty-canvas.cjs +1 -1
  93. package/dist/lib/empty-canvas.d.ts +27 -1
  94. package/dist/lib/empty-canvas.d.ts.map +1 -1
  95. package/dist/lib/empty-canvas.js +27 -23
  96. package/dist/lib/empty-chip.cjs +1 -1
  97. package/dist/lib/empty-chip.d.ts +19 -2
  98. package/dist/lib/empty-chip.d.ts.map +1 -1
  99. package/dist/lib/empty-chip.js +14 -9
  100. package/dist/lib/field-aria.cjs +1 -1
  101. package/dist/lib/field-aria.d.ts +4 -4
  102. package/dist/lib/field-aria.d.ts.map +1 -1
  103. package/dist/lib/field-aria.js +7 -5
  104. package/dist/lib/media-viewer-content.cjs +1 -1
  105. package/dist/lib/media-viewer-content.js +1 -1
  106. package/dist/lib/motion.cjs +1 -1
  107. package/dist/lib/motion.js +15 -10
  108. package/dist/lib/table-internal.cjs +1 -1
  109. package/dist/lib/table-internal.d.ts +19 -0
  110. package/dist/lib/table-internal.d.ts.map +1 -1
  111. package/dist/lib/table-internal.js +22 -7
  112. package/dist/list.cjs +1 -1
  113. package/dist/list.d.ts +230 -40
  114. package/dist/list.d.ts.map +1 -1
  115. package/dist/list.js +301 -66
  116. package/dist/logo-mark.cjs +1 -1
  117. package/dist/logo-mark.d.ts +18 -2
  118. package/dist/logo-mark.d.ts.map +1 -1
  119. package/dist/logo-mark.js +159 -79
  120. package/dist/media-empty.cjs +1 -1
  121. package/dist/media-empty.d.ts +50 -7
  122. package/dist/media-empty.d.ts.map +1 -1
  123. package/dist/media-empty.js +14 -13
  124. package/dist/media-viewer.cjs +1 -1
  125. package/dist/media-viewer.js +6 -6
  126. package/dist/multi-select-filter.cjs +1 -1
  127. package/dist/multi-select-filter.d.ts.map +1 -1
  128. package/dist/multi-select-filter.js +92 -101
  129. package/dist/pagination.cjs +1 -1
  130. package/dist/pagination.d.ts +11 -0
  131. package/dist/pagination.d.ts.map +1 -1
  132. package/dist/pagination.js +17 -17
  133. package/dist/relative-date.d.ts +6 -0
  134. package/dist/relative-date.d.ts.map +1 -1
  135. package/dist/resizable.d.ts +1 -1
  136. package/dist/result-count.cjs +1 -1
  137. package/dist/result-count.d.ts +13 -16
  138. package/dist/result-count.d.ts.map +1 -1
  139. package/dist/result-count.js +24 -33
  140. package/dist/route-progress.cjs +1 -1
  141. package/dist/route-progress.js +24 -23
  142. package/dist/sheet.cjs +1 -1
  143. package/dist/sheet.d.ts +22 -3
  144. package/dist/sheet.d.ts.map +1 -1
  145. package/dist/sheet.js +152 -125
  146. package/dist/single-select-filter.cjs +1 -1
  147. package/dist/single-select-filter.d.ts.map +1 -1
  148. package/dist/single-select-filter.js +67 -76
  149. package/dist/table.cjs +1 -1
  150. package/dist/table.d.ts.map +1 -1
  151. package/dist/table.js +77 -76
  152. package/dist/tabs.cjs +1 -1
  153. package/dist/tabs.d.ts +39 -3
  154. package/dist/tabs.d.ts.map +1 -1
  155. package/dist/tabs.js +127 -76
  156. package/dist/textarea.cjs +1 -1
  157. package/dist/textarea.d.ts +34 -0
  158. package/dist/textarea.d.ts.map +1 -1
  159. package/dist/textarea.js +115 -19
  160. package/dist/tooltip.cjs +1 -1
  161. package/dist/tooltip.d.ts.map +1 -1
  162. package/dist/tooltip.js +137 -131
  163. package/dist/typography-text.cjs +1 -1
  164. package/dist/typography-text.d.ts +6 -2
  165. package/dist/typography-text.d.ts.map +1 -1
  166. package/dist/typography-text.js +14 -13
  167. package/package.json +2 -3
  168. package/src/blocks/empty-state.tsx +108 -48
  169. package/src/blocks/input-list.tsx +15 -9
  170. package/src/blocks/sidebar.tsx +39 -16
  171. package/src/components/alert-dialog.tsx +18 -2
  172. package/src/components/banner.tsx +247 -68
  173. package/src/components/button.tsx +27 -10
  174. package/src/components/card.tsx +89 -7
  175. package/src/components/chart.tsx +47 -67
  176. package/src/components/combobox.tsx +221 -12
  177. package/src/components/command.tsx +83 -37
  178. package/src/components/count-indicator.tsx +188 -0
  179. package/src/components/data-table.tsx +506 -159
  180. package/src/components/description-list.tsx +445 -0
  181. package/src/components/dialog.tsx +74 -5
  182. package/src/components/drawer.tsx +52 -32
  183. package/src/components/file-upload.tsx +2574 -0
  184. package/src/components/global-layout.tsx +18 -5
  185. package/src/components/hover-card.tsx +395 -65
  186. package/src/components/input-chip.tsx +67 -2
  187. package/src/components/input-group.tsx +89 -6
  188. package/src/components/list.tsx +720 -72
  189. package/src/components/logo-mark.tsx +109 -25
  190. package/src/components/media-empty.tsx +62 -7
  191. package/src/components/multi-select-filter.tsx +9 -16
  192. package/src/components/pagination.tsx +15 -2
  193. package/src/components/relative-date.tsx +6 -0
  194. package/src/components/result-count.tsx +27 -54
  195. package/src/components/sheet.tsx +86 -8
  196. package/src/components/single-select-filter.tsx +9 -16
  197. package/src/components/table.tsx +16 -1
  198. package/src/components/tabs.tsx +223 -41
  199. package/src/components/textarea.tsx +271 -4
  200. package/src/components/tooltip.tsx +29 -2
  201. package/src/components/typography-text.tsx +7 -2
  202. package/src/hooks/use-file-dropzone.ts +325 -0
  203. package/src/index.ts +4 -0
  204. package/src/lib/empty-canvas.tsx +47 -20
  205. package/src/lib/empty-chip.tsx +38 -3
  206. package/src/lib/field-aria.tsx +11 -6
  207. package/src/lib/table-internal.ts +38 -0
@@ -1,372 +1,444 @@
1
1
  "use client";
2
- import { Button as te } from "./button.js";
3
- import { Checkbox as ae } from "./checkbox.js";
4
- import { useControllable as _ } from "./lib/use-controllable.js";
5
- import { InputGroup as me, InputGroupAddon as he, InputGroupClear as ve, InputGroupInput as Se } from "./input-group.js";
6
- import { ResultCount as xe } from "./result-count.js";
7
- import { Pagination as we, PaginationContent as Ce, PaginationEllipsis as ye, PaginationItem as G, PaginationLink as ke, PaginationNext as Te, PaginationPrevious as De, usePagination as Pe } from "./pagination.js";
8
- import { Skeleton as X } from "./skeleton.js";
9
- import { Spinner as ne } from "./spinner.js";
10
- import { EmptyState as Re } from "./blocks/empty-state.js";
11
- import { TABLE_ROW_MIN_HEIGHT as Ne, scrollRegionProps as oe } from "./lib/table-internal.js";
12
- import { Table as le, TableBody as re, TableCell as L, TableEmpty as se, TableHead as Ee, TableHeader as Ie, TableRow as B } from "./table.js";
13
- import { TypographyMuted as Ae } from "./typography.js";
2
+ import { Button as ge } from "./button.js";
3
+ import { Checkbox as fe } from "./checkbox.js";
4
+ import { EmptyState as Ie } from "./blocks/empty-state.js";
5
+ import { useControllable as W } from "./lib/use-controllable.js";
6
+ import { InputGroup as ze, InputGroupAddon as Ae, InputGroupClear as Fe, InputGroupInput as Le } from "./input-group.js";
7
+ import { ResultCount as Me } from "./result-count.js";
8
+ import { Pagination as Be, PaginationContent as _e, PaginationEllipsis as $e, PaginationItem as X, PaginationLink as He, PaginationNext as Ve, PaginationPrevious as Oe, usePagination as je } from "./pagination.js";
9
+ import { Skeleton as ee } from "./skeleton.js";
10
+ import { Spinner as pe } from "./spinner.js";
11
+ import { TABLE_ROW_MIN_HEIGHT as Ge, TableSizeContext as qe, scrollRegionProps as be, useTableViewInlineSize as me } from "./lib/table-internal.js";
12
+ import { Table as he, TableBody as ve, TableCell as K, TableEmpty as Se, TableHead as Ue, TableHeader as We, TableRow as H } from "./table.js";
13
+ import { TypographyMuted as Ke } from "./typography.js";
14
14
  import * as d from "react";
15
- import { ArrowDown as ze, ArrowUp as Me, ArrowUpDown as Fe, ChevronRight as Be, Search as $e, SearchX as He } from "@brightlocal/icons";
16
- import { cn as h } from "@brightlocal/ui-components/lib/utils";
17
- import { Fragment as $, jsx as t, jsxs as T } from "react/jsx-runtime";
18
- import { useVirtualizer as _e } from "@tanstack/react-virtual";
19
- import { flexRender as ie, getCoreRowModel as Le, getExpandedRowModel as Oe, getFilteredRowModel as Ve, getPaginationRowModel as je, getSortedRowModel as Ge, useReactTable as qe } from "@tanstack/react-table";
20
- import { useIsBelowBreakpoint as Q } from "@brightlocal/ui-components/hooks/use-breakpoint";
21
- var ce = "sticky left-0 shadow-[inset_-1px_0_0_var(--border)]", We = h(ce, "z-2"), Ue = h(ce, "z-1 bg-(--dt-row-bg,var(--background))");
22
- function Mt(e) {
23
- const { columns: a, data: s, enableSorting: o = !0, enableGlobalFiltering: l = !1, enableRowSelection: r = !1, enablePagination: n = !1, pageSize: c = 20, manualSorting: u = !1, manualFiltering: g = !1, manualPagination: i = !1, rowCount: b, pageCount: p, enableExpanding: v = !1, getSubRows: f, getRowCanExpand: m, paginateExpandedRows: k = !1, getRowId: x, pagination: C, onPaginationChange: w, sorting: A, onSortingChange: z, globalFilter: S, onGlobalFilterChange: y, rowSelection: R, onRowSelectionChange: H, expanded: P, onExpandedChange: D } = e, [N, M] = _(C, {
15
+ import { ArrowDown as Xe, ArrowUp as Ye, ArrowUpDown as Je, ChevronRight as Qe, Search as Ze, SearchX as et } from "@brightlocal/icons";
16
+ import { cn as S } from "@brightlocal/ui-components/lib/utils";
17
+ import { Fragment as V, jsx as t, jsxs as R } from "react/jsx-runtime";
18
+ import { useDevWarning as xe } from "@brightlocal/ui-components/lib/use-dev-warning";
19
+ import { useVirtualizer as tt } from "@tanstack/react-virtual";
20
+ import { flexRender as we, getCoreRowModel as at, getExpandedRowModel as nt, getFilteredRowModel as ot, getPaginationRowModel as lt, getSortedRowModel as rt, useReactTable as it } from "@tanstack/react-table";
21
+ import { useIsBelowBreakpoint as oe } from "@brightlocal/ui-components/hooks/use-breakpoint";
22
+ var Ce = "sticky left-0 shadow-[inset_-1px_0_0_var(--border)]", st = S(Ce, "z-2"), dt = S(Ce, "z-1 bg-(--dt-row-bg,var(--background))");
23
+ function Jt(e) {
24
+ const { columns: a, data: l, enableSorting: r = !0, enableGlobalFiltering: i = !1, enableRowSelection: n = !1, enablePagination: o = !1, pageSize: s = 20, manualSorting: p = !1, manualFiltering: b = !1, manualPagination: u = !1, rowCount: g, pageCount: f, enableExpanding: m = !1, getSubRows: c, getRowCanExpand: h, paginateExpandedRows: v = !1, getRowId: w, pagination: C, onPaginationChange: y, sorting: N, onSortingChange: k, globalFilter: x, onGlobalFilterChange: T, rowSelection: O, onRowSelectionChange: E, expanded: I, onExpandedChange: j } = e, [B, G] = W(C, {
24
25
  pageIndex: 0,
25
- pageSize: c
26
- }, w), [E, F] = _(A, [], z), [I, W] = _(S, "", y), [O, V] = _(R, {}, H), [U, j] = _(P, {}, D);
27
- return qe({
28
- data: s,
26
+ pageSize: s
27
+ }, y), [A, q] = W(N, [], k), [z, D] = W(x, "", T), [_, P] = W(O, {}, E), [F, L] = W(I, {}, j);
28
+ return it({
29
+ data: l,
29
30
  columns: a,
30
- getCoreRowModel: Le(),
31
- ...x && { getRowId: x },
32
- ...(n || i) && { onPaginationChange: M },
33
- ...n && { ...!i && { getPaginationRowModel: je() } },
34
- ...i && {
31
+ getCoreRowModel: at(),
32
+ ...w && { getRowId: w },
33
+ ...(o || u) && { onPaginationChange: G },
34
+ ...o && { ...!u && { getPaginationRowModel: lt() } },
35
+ ...u && {
35
36
  manualPagination: !0,
36
- ...b != null && { rowCount: b },
37
- ...p != null && { pageCount: p }
37
+ ...g != null && { rowCount: g },
38
+ ...f != null && { pageCount: f }
38
39
  },
39
- enableSorting: o,
40
- ...o && {
41
- ...!u && { getSortedRowModel: Ge() },
42
- onSortingChange: F,
43
- ...u && { manualSorting: !0 }
40
+ enableSorting: r,
41
+ ...r && {
42
+ ...!p && { getSortedRowModel: rt() },
43
+ onSortingChange: q,
44
+ ...p && { manualSorting: !0 }
44
45
  },
45
- ...l && {
46
- ...!g && { getFilteredRowModel: Ve() },
47
- ...g && { manualFiltering: !0 },
48
- onGlobalFilterChange: W,
46
+ ...i && {
47
+ ...!b && { getFilteredRowModel: ot() },
48
+ ...b && { manualFiltering: !0 },
49
+ onGlobalFilterChange: D,
49
50
  globalFilterFn: "includesString"
50
51
  },
51
- enableRowSelection: r,
52
- ...r !== !1 && { onRowSelectionChange: V },
53
- enableExpanding: v,
54
- ...v && {
55
- getExpandedRowModel: Oe(),
56
- onExpandedChange: j,
57
- getSubRows: f,
58
- ...m && { getRowCanExpand: m },
59
- ...n && !i && { paginateExpandedRows: k }
52
+ enableRowSelection: n,
53
+ ...n !== !1 && { onRowSelectionChange: P },
54
+ enableExpanding: m,
55
+ ...m && {
56
+ getExpandedRowModel: nt(),
57
+ onExpandedChange: L,
58
+ getSubRows: c,
59
+ ...h && { getRowCanExpand: h },
60
+ ...o && !u && { paginateExpandedRows: v }
60
61
  },
61
62
  state: {
62
- pagination: N,
63
- sorting: E,
64
- globalFilter: I,
65
- rowSelection: O,
66
- expanded: U
63
+ pagination: B,
64
+ sorting: A,
65
+ globalFilter: z,
66
+ rowSelection: _,
67
+ expanded: F
67
68
  }
68
69
  });
69
70
  }
70
- var q = d.createContext(!1);
71
- function de({ table: e, dataHook: a, title: s, description: o }) {
72
- const l = e.getState().globalFilter, r = typeof l == "string" ? l.trim() : "", n = (s ?? (r ? 'No results for "{query}"' : "No results")).replace("{query}", r);
73
- return /* @__PURE__ */ t(Re, {
71
+ var Y = d.createContext(!1), le = d.createContext(!1);
72
+ function ye({ table: e, dataHook: a, title: l, description: r }) {
73
+ const i = e.getState().globalFilter, n = typeof i == "string" ? i.trim() : "", o = (l ?? (n ? 'No results for "{query}"' : "No results")).replace("{query}", n);
74
+ return /* @__PURE__ */ t(Ie, {
74
75
  dataHook: `${a}-no-results`,
75
- description: o ?? "Try a different search, or clear the filters.",
76
- icon: /* @__PURE__ */ t(He, {}),
77
- title: n
76
+ description: r ?? "Try a different search, or clear the filters.",
77
+ icon: /* @__PURE__ */ t(et, {}),
78
+ title: o
78
79
  });
79
80
  }
80
- function Xe(e, a) {
81
- const [s, o] = d.useState(!1);
81
+ var J = d.createContext(!1);
82
+ function Te(e, a) {
83
+ const [l, r] = d.useState(!1);
82
84
  return d.useLayoutEffect(() => {
83
- const l = e.current, r = l?.querySelector('[data-slot="table"]');
84
- if (!a || !l || !r) {
85
- o(!1);
85
+ const i = e.current, n = i?.querySelector('[data-slot="table"]');
86
+ if (!a || !i || !n) {
87
+ r(!1);
86
88
  return;
87
89
  }
88
- const n = () => o(r.offsetWidth > l.clientWidth + 1);
89
- n();
90
- const c = new ResizeObserver(n);
91
- return c.observe(l), c.observe(r), () => c.disconnect();
92
- }, [e, a]), s;
90
+ const o = () => r(n.offsetWidth > i.clientWidth + 1);
91
+ o();
92
+ const s = new ResizeObserver(o);
93
+ return s.observe(i), s.observe(n), () => s.disconnect();
94
+ }, [e, a]), l;
93
95
  }
94
- function Ye({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, size: l = "default", frame: r = "own", rowDividers: n = !1, isLoading: c = !1, refetching: u = !1, refetchingLabel: g, loadingLabel: i, skeletonRowCount: b, noResultsMessage: p, noResultsTitle: v, noResultsDescription: f, stickyHeader: m = !1, className: k, layout: x, minWidth: C, scrollRegionLabel: w, footer: A, getRowClassName: z, renderExpandedContent: S }, y) {
95
- const R = e.getVisibleLeafColumns().length, H = b ?? e.getState().pagination.pageSize ?? 20, P = m === "page", D = d.useRef(null);
96
- d.useImperativeHandle(y, () => D.current, []);
97
- const N = Xe(D, P), M = !P || N, E = P ? N : !!C || m === !0 || w !== void 0;
98
- return /* @__PURE__ */ T("div", {
96
+ function ct({ table: e, dataHook: a, trackingEl: l, trackingLabel: r, "aria-label": i, "aria-labelledby": n, size: o = "default", frame: s = "own", rowDividers: p = !1, isLoading: b = !1, refetching: u = !1, sortLoading: g = !1, refetchingLabel: f, loadingLabel: m, skeletonRowCount: c, noResultsMessage: h, noResultsTitle: v, noResultsDescription: w, stickyHeader: C = !1, className: y, layout: N, minWidth: k, scrollRegionLabel: x, footer: T, getRowClassName: O, onRowClick: E, getRowAriaLabel: I, activeRowId: j, renderExpandedContent: B }, G) {
97
+ const A = e.getVisibleLeafColumns().length, q = c ?? e.getState().pagination.pageSize ?? 20, z = C === "page", D = d.useRef(null);
98
+ d.useImperativeHandle(G, () => D.current, []);
99
+ const _ = e.getVisibleLeafColumns().some((M) => M.columnDef.meta?.pinned === "left"), P = Te(D, z || _), F = _ && P, L = !z || P;
100
+ me(D, L), xe(() => E !== void 0 && I === void 0, "DataTable: `onRowClick` without `getRowAriaLabel` — a clickable row needs an accessible name so screen readers announce what activating it does (DS-1123).", [E !== void 0, I !== void 0]);
101
+ const U = z ? P : !!k || C === !0 || x !== void 0;
102
+ return /* @__PURE__ */ R("div", {
99
103
  ref: D,
100
- className: h("relative", M ? "scrollbar overflow-auto" : "overflow-clip", r === "own" && "border-border rounded-md border", E && "focus-visible:shadow-default outline-none", k),
101
- "data-frame": r,
104
+ className: S("relative", L ? "scrollbar overflow-auto" : "overflow-clip", s === "own" && "border-border rounded-md border", U && "focus-visible:shadow-default outline-none", y),
105
+ "data-frame": s,
102
106
  "data-hook": a,
103
- "data-overflowing": P && N ? "" : void 0,
107
+ "data-overflowing": P ? "" : void 0,
104
108
  "data-slot": "data-table-view",
105
- "data-sticky-header": m === !1 ? void 0 : P ? "page" : "self",
106
- "data-tracking-el": s,
107
- "data-tracking-label": o,
108
- ...E ? oe(w) : void 0,
109
+ "data-sticky-header": C === !1 ? void 0 : z ? "page" : "self",
110
+ "data-tracking-el": l,
111
+ "data-tracking-label": r,
112
+ ...U ? be(x) : void 0,
109
113
  children: [/* @__PURE__ */ t("div", {
110
114
  "aria-live": "polite",
111
115
  className: "sr-only",
112
116
  role: "status",
113
- children: u ? g ?? "Loading results…" : null
114
- }), /* @__PURE__ */ t(q.Provider, {
117
+ children: u ? f ?? "Loading results…" : null
118
+ }), /* @__PURE__ */ t(Y.Provider, {
115
119
  value: u,
116
- children: /* @__PURE__ */ T(le, {
117
- "aria-busy": c || u || void 0,
118
- dataHook: `${a}-table`,
119
- frame: r,
120
- layout: x,
121
- minWidth: C,
122
- rowDividers: n,
123
- scrollOwner: "parent",
124
- size: l,
125
- children: [
126
- /* @__PURE__ */ t(ue, {
127
- sticky: P ? !N && "page" : m === !0 && "self",
128
- table: e
129
- }),
130
- /* @__PURE__ */ t(re, { children: c ? /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(fe, {
131
- colCount: R,
132
- rowCount: H
133
- }), /* @__PURE__ */ t(B, {
134
- className: "sr-only",
135
- children: /* @__PURE__ */ t(L, {
136
- colSpan: R,
137
- children: /* @__PURE__ */ t("div", {
138
- "aria-live": "polite",
139
- role: "status",
140
- children: i ?? "Loading data…"
141
- })
142
- })
143
- })] }) : /* @__PURE__ */ t($, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((F) => /* @__PURE__ */ t(ge, {
144
- columnCount: R,
145
- getRowClassName: z,
146
- renderExpandedContent: S,
147
- row: F
148
- }, F.id)) : /* @__PURE__ */ t(se, {
149
- colSpan: R,
150
- children: p ?? /* @__PURE__ */ t(de, {
151
- dataHook: a,
152
- description: f,
153
- table: e,
154
- title: v
155
- })
156
- }) }) }),
157
- A
158
- ]
120
+ children: /* @__PURE__ */ t(le.Provider, {
121
+ value: g,
122
+ children: /* @__PURE__ */ t(J.Provider, {
123
+ value: F,
124
+ children: /* @__PURE__ */ R(he, {
125
+ "aria-busy": b || u || void 0,
126
+ "aria-label": i,
127
+ "aria-labelledby": n,
128
+ dataHook: `${a}-table`,
129
+ frame: s,
130
+ layout: N,
131
+ minWidth: k,
132
+ rowDividers: p,
133
+ scrollOwner: "parent",
134
+ size: o,
135
+ children: [
136
+ /* @__PURE__ */ t(ke, {
137
+ sticky: z ? !P && "page" : C === !0 && "self",
138
+ table: e
139
+ }),
140
+ /* @__PURE__ */ t(ve, { children: b ? /* @__PURE__ */ R(V, { children: [/* @__PURE__ */ t(Pe, {
141
+ colCount: A,
142
+ rowCount: q
143
+ }), /* @__PURE__ */ t(H, {
144
+ className: "sr-only",
145
+ children: /* @__PURE__ */ t(K, {
146
+ colSpan: A,
147
+ children: /* @__PURE__ */ t("div", {
148
+ "aria-live": "polite",
149
+ role: "status",
150
+ children: m ?? "Loading data…"
151
+ })
152
+ })
153
+ })] }) : /* @__PURE__ */ t(V, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((M) => /* @__PURE__ */ t(De, {
154
+ active: M.id === j,
155
+ columnCount: A,
156
+ getRowAriaLabel: I,
157
+ getRowClassName: O,
158
+ renderExpandedContent: B,
159
+ row: M,
160
+ onRowClick: E
161
+ }, M.id)) : /* @__PURE__ */ t(Se, {
162
+ colSpan: A,
163
+ children: h ?? /* @__PURE__ */ t(ye, {
164
+ dataHook: a,
165
+ description: w,
166
+ table: e,
167
+ title: v
168
+ })
169
+ }) }) }),
170
+ T
171
+ ]
172
+ })
173
+ })
159
174
  })
160
175
  })]
161
176
  });
162
177
  }
163
- var Je = d.forwardRef(Ye);
164
- Je.displayName = "DataTable";
165
- var Z = d.createContext(null), Y = () => () => {
178
+ var ut = d.forwardRef(ct);
179
+ ut.displayName = "DataTable";
180
+ var re = d.createContext(null), te = () => () => {
166
181
  };
167
- function Ke() {
182
+ function gt() {
168
183
  const [e] = d.useState(() => {
169
- const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), o = (l) => a.get(l) ?? null;
184
+ const a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), r = (n) => a.get(n) ?? null;
185
+ let i = null;
170
186
  return {
171
- set: (l, r) => {
172
- const n = o(l);
173
- n === r || n !== null && r !== null && n.displayed === r.displayed && n.live === r.live || (r === null ? a.delete(l) : a.set(l, r), s.forEach((c) => c()));
187
+ set: (n, o) => {
188
+ const s = r(n);
189
+ s === o || s !== null && o !== null && s.displayed === o.displayed && s.live === o.live || (o === null ? a.delete(n) : a.set(n, o), l.forEach((p) => p()));
174
190
  },
175
- get: o,
191
+ get: r,
176
192
  anyHeld: () => {
177
- for (const l of a.values()) if (l.displayed !== l.live) return !0;
193
+ for (const n of a.values()) if (n.displayed !== n.live) return !0;
178
194
  return !1;
179
195
  },
180
- subscribe: (l) => (s.add(l), () => {
181
- s.delete(l);
182
- })
196
+ subscribe: (n) => (l.add(n), () => {
197
+ l.delete(n);
198
+ }),
199
+ get pendingFocusColumnId() {
200
+ return i;
201
+ },
202
+ setPendingFocus: (n) => {
203
+ i = n;
204
+ }
183
205
  };
184
206
  });
185
207
  return e;
186
208
  }
187
- function ue({ table: e, sticky: a }) {
188
- const s = Ke();
189
- return /* @__PURE__ */ t(Z.Provider, {
190
- value: s,
191
- children: /* @__PURE__ */ t(Ie, {
192
- className: h(a === "self" && "sticky top-0 z-10", a === "page" && "sticky top-[var(--content-sticky-top,0px)] z-9"),
193
- children: e.getHeaderGroups().map((o) => /* @__PURE__ */ t(B, { children: o.headers.map((l) => /* @__PURE__ */ t(Qe, { header: l }, l.id)) }, o.id))
209
+ function ke({ table: e, sticky: a }) {
210
+ const l = gt(), r = d.useRef(null), i = d.useCallback(() => {
211
+ const n = l.pendingFocusColumnId;
212
+ return n ? r.current?.querySelector(`[data-column-id="${CSS.escape(n)}"] [data-slot="button"]`) ?? null : null;
213
+ }, [l]);
214
+ return d.useLayoutEffect(() => {
215
+ const n = document.activeElement;
216
+ n && n !== document.body && n !== document.documentElement || i()?.focus();
217
+ }), d.useEffect(() => {
218
+ const n = (o) => {
219
+ if (!l.pendingFocusColumnId) return;
220
+ const s = o.target;
221
+ s instanceof Node && i()?.contains(s) || l.setPendingFocus(null);
222
+ };
223
+ return document.addEventListener("focusin", n), document.addEventListener("pointerdown", n), () => {
224
+ document.removeEventListener("focusin", n), document.removeEventListener("pointerdown", n);
225
+ };
226
+ }, [l, i]), /* @__PURE__ */ t(re.Provider, {
227
+ value: l,
228
+ children: /* @__PURE__ */ t(We, {
229
+ ref: r,
230
+ className: S(a === "self" && "sticky top-0 z-10", a === "page" && "sticky top-[var(--content-sticky-top,0px)] z-9"),
231
+ children: e.getHeaderGroups().map((n) => /* @__PURE__ */ t(H, { children: n.headers.map((o) => /* @__PURE__ */ t(ft, { header: o }, o.id)) }, n.id))
194
232
  })
195
233
  });
196
234
  }
197
- function Qe({ header: e }) {
198
- const a = d.useContext(Z), s = d.useSyncExternalStore(a ? a.subscribe : Y, () => a ? a.get(e.column.id)?.displayed ?? null : null, () => null), o = e.column.getCanSort(), l = o ? s ?? e.column.getIsSorted() : !1, r = l === "asc" ? "ascending" : l === "desc" ? "descending" : o ? "none" : void 0, n = e.column.columnDef.meta;
199
- return /* @__PURE__ */ t(Ee, {
200
- "aria-sort": r,
201
- className: n?.pinned === "left" ? We : void 0,
235
+ function ft({ header: e }) {
236
+ const a = d.useContext(re), l = d.useSyncExternalStore(a ? a.subscribe : te, () => a ? a.get(e.column.id)?.displayed ?? null : null, () => null), r = e.column.getCanSort(), i = r ? l ?? e.column.getIsSorted() : !1, n = i === "asc" ? "ascending" : i === "desc" ? "descending" : r ? "none" : void 0, o = e.column.columnDef.meta, s = d.useContext(J) && o?.pinned === "left";
237
+ return /* @__PURE__ */ t(Ue, {
238
+ "aria-sort": n,
239
+ className: s ? st : void 0,
202
240
  colSpan: e.colSpan,
203
- "data-pinned": n?.pinned === "left" ? "left" : void 0,
204
- minWidth: n?.minWidth,
205
- width: n?.width,
206
- children: e.isPlaceholder ? null : ie(e.column.columnDef.header, e.getContext())
241
+ "data-pinned": s ? "left" : void 0,
242
+ minWidth: o?.minWidth,
243
+ width: o?.width,
244
+ children: e.isPlaceholder ? null : we(e.column.columnDef.header, e.getContext())
207
245
  });
208
246
  }
209
- function ge({ row: e, columnCount: a, getRowClassName: s, renderExpandedContent: o }) {
210
- const l = e.getCanExpand(), r = e.getIsExpanded(), n = o && l && r ? o(e) : null;
211
- return /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(B, {
212
- className: h("[&_[data-slot=button].bg-transparent:hover]:bg-secondary", l && r ? "bg-muted" : e.depth > 0 && "bg-accent/50", "data-[state=selected]:[--dt-row-bg:var(--muted)]", l && r ? "[--dt-row-bg:var(--muted)]" : e.depth > 0 && "[--dt-row-bg:color-mix(in_oklab,var(--accent)_50%,var(--background))]", s?.(e)),
247
+ var pt = "a[href],button,input,select,textarea,label,summary,[tabindex],[role='button'],[role='link'],[role='checkbox'],[role='switch'],[role='menuitem'],[role='option'],[role='tab'],[data-slot='dropdown-menu-trigger'],[contenteditable]:not([contenteditable='false'])";
248
+ function ue(e, a) {
249
+ if (!(a instanceof Element) || !e.contains(a)) return !1;
250
+ const l = a.closest(pt);
251
+ return l === null || l === e;
252
+ }
253
+ function De({ row: e, columnCount: a, active: l = !1, getRowClassName: r, onRowClick: i, getRowAriaLabel: n, renderExpandedContent: o }) {
254
+ const s = e.getCanExpand(), p = e.getIsExpanded(), b = o && s && p ? o(e) : null, u = i !== void 0, g = d.useContext(J), f = i && ((c) => {
255
+ ue(c.currentTarget, c.target) && i(e, c);
256
+ }), m = i && ((c) => {
257
+ c.key !== "Enter" && c.key !== " " || ue(c.currentTarget, c.target) && (c.preventDefault(), !c.repeat && i(e, c));
258
+ });
259
+ return /* @__PURE__ */ R(V, { children: [/* @__PURE__ */ t(H, {
260
+ "aria-current": l ? "true" : void 0,
261
+ "aria-label": u ? n?.(e) : void 0,
262
+ className: S("[&_[data-slot=button].bg-transparent:hover]:bg-secondary", s && p ? "bg-muted" : e.depth > 0 && "bg-accent/50", "data-[state=selected]:[--dt-row-bg:var(--muted)]", s && p ? "[--dt-row-bg:var(--muted)]" : e.depth > 0 && "[--dt-row-bg:color-mix(in_oklab,var(--accent)_50%,var(--background))]", l && "bg-muted [--dt-row-bg:var(--muted)]", u && "focus-visible:shadow-default cursor-pointer outline-none", u && !l && !(s && p) && "[&:not([data-state=selected]):hover]:bg-muted/50 [&:not([data-state=selected]):hover]:[--dt-row-bg:color-mix(in_oklab,var(--muted)_50%,var(--background))]", r?.(e)),
263
+ "data-active": l ? "true" : void 0,
264
+ "data-clickable": u ? "" : void 0,
213
265
  "data-depth": e.depth,
214
- "data-expanded": l ? String(r) : void 0,
266
+ "data-expanded": s ? String(p) : void 0,
215
267
  "data-state": e.getIsSelected() ? "selected" : void 0,
268
+ tabIndex: u ? 0 : void 0,
269
+ onClick: f,
270
+ onKeyDown: m,
216
271
  children: e.getVisibleCells().map((c) => {
217
- const u = c.column.columnDef.meta?.pinned === "left";
218
- return /* @__PURE__ */ t(L, {
219
- className: u ? Ue : void 0,
220
- "data-pinned": u ? "left" : void 0,
272
+ const h = g && c.column.columnDef.meta?.pinned === "left";
273
+ return /* @__PURE__ */ t(K, {
274
+ className: h ? dt : void 0,
275
+ "data-pinned": h ? "left" : void 0,
221
276
  groupStart: c.column.columnDef.meta?.groupStart,
222
- children: ie(c.column.columnDef.cell, c.getContext())
277
+ children: we(c.column.columnDef.cell, c.getContext())
223
278
  }, c.id);
224
279
  })
225
- }), n != null && /* @__PURE__ */ t(B, {
280
+ }), b != null && /* @__PURE__ */ t(H, {
226
281
  className: "bg-accent/50 [&_[data-slot=button].bg-transparent:hover]:bg-secondary",
227
282
  "data-slot": "data-table-expanded-row",
228
- children: /* @__PURE__ */ t(L, {
283
+ children: /* @__PURE__ */ t(K, {
229
284
  colSpan: a,
230
- children: n
285
+ children: b
231
286
  })
232
287
  })] });
233
288
  }
234
- function fe({ rowCount: e, colCount: a }) {
235
- return /* @__PURE__ */ t($, { children: Array.from({ length: e }).map((s, o) => /* @__PURE__ */ t(B, { children: Array.from({ length: a }).map((l, r) => /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(X, { className: "h-4 w-full" }) }, `skeleton-${o}-${r}`)) }, `skeleton-${o}`)) });
289
+ function Pe({ rowCount: e, colCount: a }) {
290
+ return /* @__PURE__ */ t(V, { children: Array.from({ length: e }).map((l, r) => /* @__PURE__ */ t(H, { children: Array.from({ length: a }).map((i, n) => /* @__PURE__ */ t(K, { children: /* @__PURE__ */ t(ee, { className: "h-4 w-full" }) }, `skeleton-${r}-${n}`)) }, `skeleton-${r}`)) });
236
291
  }
237
- function Ze({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, size: l = "default", frame: r = "own", rowDividers: n = !1, isLoading: c = !1, refetching: u = !1, refetchingLabel: g, loadingLabel: i, skeletonRowCount: b, noResultsMessage: p, noResultsTitle: v, noResultsDescription: f, stickyHeader: m = !1, className: k, layout: x, minWidth: C, scrollRegionLabel: w, footer: A, getRowClassName: z, height: S, estimateSize: y, overscan: R = 5 }, H) {
238
- const P = y ?? Ne[l], D = e.getVisibleLeafColumns().length, N = b ?? e.getState().pagination.pageSize ?? 20, M = d.useRef(null);
239
- d.useImperativeHandle(H, () => M.current, []);
240
- const E = e.getRowModel().rows, F = _e({
241
- count: E.length,
242
- getScrollElement: () => M.current,
243
- estimateSize: () => P,
244
- overscan: R
245
- }), I = F.getVirtualItems(), W = F.getTotalSize(), O = I.length > 0 ? I[0].start : 0, V = I.length > 0 ? W - I[I.length - 1].end : 0;
246
- return /* @__PURE__ */ T("div", {
247
- ref: M,
248
- className: h("scrollbar relative overflow-auto", r === "own" && "border-border rounded-md border", "focus-visible:shadow-default outline-none", k),
249
- "data-frame": r,
292
+ function bt({ table: e, dataHook: a, trackingEl: l, trackingLabel: r, "aria-label": i, "aria-labelledby": n, size: o = "default", frame: s = "own", rowDividers: p = !1, isLoading: b = !1, refetching: u = !1, sortLoading: g = !1, refetchingLabel: f, loadingLabel: m, skeletonRowCount: c, noResultsMessage: h, noResultsTitle: v, noResultsDescription: w, stickyHeader: C = !1, className: y, layout: N, minWidth: k, scrollRegionLabel: x, footer: T, getRowClassName: O, onRowClick: E, getRowAriaLabel: I, activeRowId: j, height: B, estimateSize: G, overscan: A = 5 }, q) {
293
+ const z = G ?? Ge[o], D = e.getVisibleLeafColumns().length, _ = c ?? e.getState().pagination.pageSize ?? 20, P = d.useRef(null);
294
+ d.useImperativeHandle(q, () => P.current, []);
295
+ const F = e.getRowModel().rows;
296
+ me(P, !0);
297
+ const L = e.getVisibleLeafColumns().some((Q) => Q.columnDef.meta?.pinned === "left"), U = Te(P, L), M = L && U;
298
+ xe(() => E !== void 0 && I === void 0, "VirtualizedDataTable: `onRowClick` without `getRowAriaLabel` — a clickable row needs an accessible name so screen readers announce what activating it does (DS-1123).", [E !== void 0, I !== void 0]);
299
+ const se = tt({
300
+ count: F.length,
301
+ getScrollElement: () => P.current,
302
+ estimateSize: () => z,
303
+ overscan: A
304
+ }), $ = se.getVirtualItems(), Ee = se.getTotalSize(), de = $.length > 0 ? $[0].start : 0, ce = $.length > 0 ? Ee - $[$.length - 1].end : 0;
305
+ return /* @__PURE__ */ R("div", {
306
+ ref: P,
307
+ className: S("scrollbar relative overflow-auto", s === "own" && "border-border rounded-md border", "focus-visible:shadow-default outline-none", y),
308
+ "data-frame": s,
250
309
  "data-hook": a,
310
+ "data-overflowing": U ? "" : void 0,
251
311
  "data-slot": "data-table-view",
252
- "data-tracking-el": s,
253
- "data-tracking-label": o,
254
- style: S != null ? { height: S } : void 0,
255
- ...oe(w),
312
+ "data-tracking-el": l,
313
+ "data-tracking-label": r,
314
+ style: B != null ? { height: B } : void 0,
315
+ ...be(x),
256
316
  children: [/* @__PURE__ */ t("div", {
257
317
  "aria-live": "polite",
258
318
  className: "sr-only",
259
319
  role: "status",
260
- children: u ? g ?? "Loading results…" : null
261
- }), /* @__PURE__ */ t(q.Provider, {
320
+ children: u ? f ?? "Loading results…" : null
321
+ }), /* @__PURE__ */ t(Y.Provider, {
262
322
  value: u,
263
- children: /* @__PURE__ */ T(le, {
264
- "aria-busy": c || u || void 0,
265
- dataHook: `${a}-table`,
266
- frame: r,
267
- layout: x,
268
- minWidth: C,
269
- rowDividers: n,
270
- scrollOwner: "parent",
271
- size: l,
272
- children: [
273
- /* @__PURE__ */ t(ue, {
274
- sticky: m && "self",
275
- table: e
276
- }),
277
- /* @__PURE__ */ t(re, { children: c ? /* @__PURE__ */ T($, { children: [/* @__PURE__ */ t(fe, {
278
- colCount: D,
279
- rowCount: N
280
- }), /* @__PURE__ */ t(B, {
281
- className: "sr-only",
282
- children: /* @__PURE__ */ t(L, {
283
- colSpan: D,
284
- children: /* @__PURE__ */ t("div", {
285
- "aria-live": "polite",
286
- role: "status",
287
- children: i ?? "Loading data…"
288
- })
289
- })
290
- })] }) : E.length > 0 ? /* @__PURE__ */ T($, { children: [
291
- O > 0 && /* @__PURE__ */ t("tr", {
292
- "aria-hidden": "true",
293
- children: /* @__PURE__ */ t("td", {
294
- colSpan: D,
295
- style: { height: O }
296
- })
297
- }),
298
- I.map((U) => {
299
- const j = E[U.index];
300
- return /* @__PURE__ */ t(ge, {
301
- columnCount: D,
302
- getRowClassName: z,
303
- row: j
304
- }, j.id);
305
- }),
306
- V > 0 && /* @__PURE__ */ t("tr", {
307
- "aria-hidden": "true",
308
- children: /* @__PURE__ */ t("td", {
323
+ children: /* @__PURE__ */ t(le.Provider, {
324
+ value: g,
325
+ children: /* @__PURE__ */ t(J.Provider, {
326
+ value: M,
327
+ children: /* @__PURE__ */ R(he, {
328
+ "aria-busy": b || u || void 0,
329
+ "aria-label": i,
330
+ "aria-labelledby": n,
331
+ dataHook: `${a}-table`,
332
+ frame: s,
333
+ layout: N,
334
+ minWidth: k,
335
+ rowDividers: p,
336
+ scrollOwner: "parent",
337
+ size: o,
338
+ children: [
339
+ /* @__PURE__ */ t(ke, {
340
+ sticky: C && "self",
341
+ table: e
342
+ }),
343
+ /* @__PURE__ */ t(ve, { children: b ? /* @__PURE__ */ R(V, { children: [/* @__PURE__ */ t(Pe, {
344
+ colCount: D,
345
+ rowCount: _
346
+ }), /* @__PURE__ */ t(H, {
347
+ className: "sr-only",
348
+ children: /* @__PURE__ */ t(K, {
349
+ colSpan: D,
350
+ children: /* @__PURE__ */ t("div", {
351
+ "aria-live": "polite",
352
+ role: "status",
353
+ children: m ?? "Loading data…"
354
+ })
355
+ })
356
+ })] }) : F.length > 0 ? /* @__PURE__ */ R(V, { children: [
357
+ de > 0 && /* @__PURE__ */ t("tr", {
358
+ "aria-hidden": "true",
359
+ children: /* @__PURE__ */ t("td", {
360
+ colSpan: D,
361
+ style: { height: de }
362
+ })
363
+ }),
364
+ $.map((Q) => {
365
+ const Z = F[Q.index];
366
+ return /* @__PURE__ */ t(De, {
367
+ active: Z.id === j,
368
+ columnCount: D,
369
+ getRowAriaLabel: I,
370
+ getRowClassName: O,
371
+ row: Z,
372
+ onRowClick: E
373
+ }, Z.id);
374
+ }),
375
+ ce > 0 && /* @__PURE__ */ t("tr", {
376
+ "aria-hidden": "true",
377
+ children: /* @__PURE__ */ t("td", {
378
+ colSpan: D,
379
+ style: { height: ce }
380
+ })
381
+ })
382
+ ] }) : /* @__PURE__ */ t(Se, {
309
383
  colSpan: D,
310
- style: { height: V }
311
- })
312
- })
313
- ] }) : /* @__PURE__ */ t(se, {
314
- colSpan: D,
315
- children: p ?? /* @__PURE__ */ t(de, {
316
- dataHook: a,
317
- description: f,
318
- table: e,
319
- title: v
320
- })
321
- }) }),
322
- A
323
- ]
384
+ children: h ?? /* @__PURE__ */ t(ye, {
385
+ dataHook: a,
386
+ description: w,
387
+ table: e,
388
+ title: v
389
+ })
390
+ }) }),
391
+ T
392
+ ]
393
+ })
394
+ })
324
395
  })
325
396
  })]
326
397
  });
327
398
  }
328
- var et = d.forwardRef(Ze);
329
- et.displayName = "VirtualizedDataTable";
330
- function tt({ column: e, title: a, className: s, dataHook: o, trackingEl: l, trackingLabel: r, align: n = "left", getSortLabel: c, loading: u = !1 }) {
331
- const g = e.getIsSorted(), i = d.useContext(Z), b = d.useSyncExternalStore(i ? i.subscribe : Y, () => i ? i.get(e.id)?.displayed ?? null : null, () => null), [p, v] = d.useState(g);
332
- !i && !u && p !== g && v(g);
333
- const f = u ? i ? b ?? g : p : g, m = f !== g, k = d.useSyncExternalStore(i ? i.subscribe : Y, () => i ? i.anyHeld() : !1, () => !1), x = u && (m || !(i ? k : m) && g !== !1);
399
+ var mt = d.forwardRef(bt);
400
+ mt.displayName = "VirtualizedDataTable";
401
+ function ht({ column: e, title: a, className: l, dataHook: r, trackingEl: i, trackingLabel: n, align: o = "left", getSortLabel: s, loading: p }) {
402
+ const b = d.useContext(le), u = p ?? b, g = e.getIsSorted(), f = d.useContext(re), m = d.useSyncExternalStore(f ? f.subscribe : te, () => f ? f.get(e.id)?.displayed ?? null : null, () => null), [c, h] = d.useState(g);
403
+ !f && !u && c !== g && h(g);
404
+ const v = u ? f ? m ?? g : c : g, w = v !== g, C = d.useSyncExternalStore(f ? f.subscribe : te, () => f ? f.anyHeld() : !1, () => !1), y = u && (w || !(f ? C : w) && g !== !1);
334
405
  if (d.useLayoutEffect(() => {
335
- if (i)
336
- return i.set(e.id, {
337
- displayed: f,
406
+ if (f)
407
+ return f.set(e.id, {
408
+ displayed: v,
338
409
  live: g
339
410
  }), () => {
340
- i.set(e.id, null);
411
+ f.set(e.id, null);
341
412
  };
342
413
  }, [
343
- i,
344
- e.id,
345
414
  f,
415
+ e.id,
416
+ v,
346
417
  g
347
418
  ]), !e.getCanSort()) return /* @__PURE__ */ t("div", {
348
- className: h("text-muted-foreground text-label text-left font-semibold", n === "right" && "text-right", n === "center" && "text-center", s),
349
- "data-hook": o,
419
+ className: S("text-muted-foreground text-label text-left font-semibold", o === "right" && "text-right", o === "center" && "text-center", l),
420
+ "data-hook": r,
350
421
  "data-slot": "data-table-column-header",
351
- "data-tracking-el": l,
352
- "data-tracking-label": r,
422
+ "data-tracking-el": i,
423
+ "data-tracking-label": n,
353
424
  children: a
354
425
  });
355
- const C = g === !1 ? e.columnDef.sortDescFirst === !0 : g === "asc", w = c ? c(a, f) : f === "desc" ? `Sort by ${a}, currently descending` : f === "asc" ? `Sort by ${a}, currently ascending` : `Sort by ${a}`;
426
+ const N = g === !1 ? e.columnDef.sortDescFirst === !0 : g === "asc", k = s ? s(a, v) : v === "desc" ? `Sort by ${a}, currently descending` : v === "asc" ? `Sort by ${a}, currently ascending` : `Sort by ${a}`;
356
427
  return /* @__PURE__ */ t("div", {
357
- className: h("flex items-center", n === "right" && "justify-end", n === "center" && "justify-center", s),
428
+ className: S("flex items-center", o === "right" && "justify-end", o === "center" && "justify-center", l),
429
+ "data-column-id": e.id,
358
430
  "data-slot": "data-table-column-header",
359
- "data-tracking-el": l,
360
- "data-tracking-label": r,
361
- children: /* @__PURE__ */ T(te, {
431
+ "data-tracking-el": i,
432
+ "data-tracking-label": n,
433
+ children: /* @__PURE__ */ R(ge, {
362
434
  "aria-busy": u ? "true" : void 0,
363
- "aria-label": w,
435
+ "aria-label": k,
364
436
  className: "text-muted-foreground text-label h-auto p-0 font-semibold",
365
- dataHook: o || `column-header-${e.id}`,
437
+ dataHook: r || `column-header-${e.id}`,
366
438
  size: "sm",
367
439
  variant: "ghost",
368
- onClick: () => {
369
- u || e.toggleSorting(C);
440
+ onClick: (x) => {
441
+ u || (document.activeElement === x.currentTarget && f?.setPendingFocus(e.id), e.toggleSorting(N));
370
442
  },
371
443
  children: [/* @__PURE__ */ t("span", {
372
444
  "aria-hidden": "true",
@@ -374,386 +446,384 @@ function tt({ column: e, title: a, className: s, dataHook: o, trackingEl: l, tra
374
446
  }), /* @__PURE__ */ t("span", {
375
447
  "aria-hidden": "true",
376
448
  className: "flex size-3 items-center justify-center",
377
- children: x ? /* @__PURE__ */ t(ne, { size: "sm" }) : f === "desc" ? /* @__PURE__ */ t(ze, { size: 12 }) : f === "asc" ? /* @__PURE__ */ t(Me, { size: 12 }) : /* @__PURE__ */ t(Fe, { size: 12 })
449
+ children: y ? /* @__PURE__ */ t(pe, { size: "sm" }) : v === "desc" ? /* @__PURE__ */ t(Xe, { size: 12 }) : v === "asc" ? /* @__PURE__ */ t(Ye, { size: 12 }) : /* @__PURE__ */ t(Je, { size: 12 })
378
450
  })]
379
451
  })
380
452
  });
381
453
  }
382
- tt.displayName = "DataTableColumnHeader";
383
- var at = d.forwardRef(function({ table: a, ariaLabel: s, placeholder: o, clearSearchAriaLabel: l, disabled: r = !1, loading: n = !1, debounceMs: c, ...u }, g) {
384
- const i = a.getState().globalFilter ?? "", [b, p] = d.useState(i), v = c ?? (a.options.manualFiltering === !0 ? 300 : 0), f = d.useRef(null), m = d.useCallback(() => {
385
- f.current !== null && (clearTimeout(f.current), f.current = null);
454
+ ht.displayName = "DataTableColumnHeader";
455
+ var vt = d.forwardRef(function({ table: a, ariaLabel: l, placeholder: r, clearSearchAriaLabel: i, disabled: n = !1, loading: o = !1, debounceMs: s, ...p }, b) {
456
+ const u = a.getState().globalFilter ?? "", [g, f] = d.useState(u), m = s ?? (a.options.manualFiltering === !0 ? 300 : 0), c = d.useRef(null), h = d.useCallback(() => {
457
+ c.current !== null && (clearTimeout(c.current), c.current = null);
386
458
  }, []);
387
- d.useEffect(() => m, [m]), d.useEffect(() => {
388
- r && m();
389
- }, [r, m]);
390
- const k = d.useRef(b);
459
+ d.useEffect(() => h, [h]), d.useEffect(() => {
460
+ n && h();
461
+ }, [n, h]);
462
+ const v = d.useRef(g);
391
463
  d.useEffect(() => {
392
- k.current = b;
464
+ v.current = g;
393
465
  });
394
- const [x, C] = d.useState({
395
- filter: i,
466
+ const [w, C] = d.useState({
467
+ filter: u,
396
468
  pushed: []
397
- }), w = (S) => {
398
- (a.getState().globalFilter ?? "") !== S && (C((y) => ({
399
- filter: y.filter,
400
- pushed: [...y.pushed, S].slice(-10)
401
- })), a.setGlobalFilter(S));
402
- }, A = (S) => {
403
- m(), v > 0 ? f.current = setTimeout(() => {
404
- f.current = null, k.current === S && w(S);
405
- }, v) : w(S);
469
+ }), y = (x) => {
470
+ (a.getState().globalFilter ?? "") !== x && (C((T) => ({
471
+ filter: T.filter,
472
+ pushed: [...T.pushed, x].slice(-10)
473
+ })), a.setGlobalFilter(x));
474
+ }, N = (x) => {
475
+ h(), m > 0 ? c.current = setTimeout(() => {
476
+ c.current = null, v.current === x && y(x);
477
+ }, m) : y(x);
406
478
  };
407
- if (i !== x.filter) {
408
- const S = x.pushed.lastIndexOf(i), y = S !== -1;
479
+ if (u !== w.filter) {
480
+ const x = w.pushed.lastIndexOf(u), T = x !== -1;
409
481
  C({
410
- filter: i,
411
- pushed: y ? x.pushed.slice(S + 1) : x.pushed
412
- }), !y && i !== b && p(i);
482
+ filter: u,
483
+ pushed: T ? w.pushed.slice(x + 1) : w.pushed
484
+ }), !T && u !== g && f(u);
413
485
  }
414
- const z = () => {
415
- m(), p(""), w("");
486
+ const k = () => {
487
+ h(), f(""), y("");
416
488
  };
417
- return /* @__PURE__ */ T(me, {
418
- "aria-busy": n ? "true" : void 0,
489
+ return /* @__PURE__ */ R(ze, {
490
+ "aria-busy": o ? "true" : void 0,
419
491
  "data-slot": "data-table-search",
420
- ...u,
492
+ ...p,
421
493
  children: [
422
- /* @__PURE__ */ t(he, {
423
- className: "pl-3",
424
- children: n ? /* @__PURE__ */ t(ne, { dataHook: `${u.dataHook}-loading` }) : /* @__PURE__ */ t($e, {})
425
- }),
426
- /* @__PURE__ */ t(Se, {
427
- ref: g,
428
- "aria-label": s ?? "Search table",
429
- disabled: r,
430
- placeholder: o ?? "Search...",
494
+ /* @__PURE__ */ t(Ae, { children: o ? /* @__PURE__ */ t(pe, { dataHook: `${p.dataHook}-loading` }) : /* @__PURE__ */ t(Ze, {}) }),
495
+ /* @__PURE__ */ t(Le, {
496
+ ref: b,
497
+ "aria-label": l ?? "Search table",
498
+ disabled: n,
499
+ placeholder: r ?? "Search...",
431
500
  type: "text",
432
- value: b,
433
- onChange: (S) => {
434
- const y = S.target.value;
435
- p(y), A(y);
501
+ value: g,
502
+ onChange: (x) => {
503
+ const T = x.target.value;
504
+ f(T), N(T);
436
505
  }
437
506
  }),
438
- /* @__PURE__ */ t(ve, {
439
- clearSearchAriaLabel: l,
507
+ /* @__PURE__ */ t(Fe, {
508
+ clearSearchAriaLabel: i,
440
509
  "data-slot": "data-table-search-clear",
441
- dataHook: `${u.dataHook}-clear`,
442
- onClear: v > 0 ? z : void 0
510
+ dataHook: `${p.dataHook}-clear`,
511
+ onClear: m > 0 ? k : void 0
443
512
  })
444
513
  ]
445
514
  });
446
515
  });
447
- at.displayName = "DataTableSearch";
448
- function nt(e) {
449
- const { pageIndex: a, pageSize: s } = e.getState().pagination, o = e.getRowCount(), l = e.getPageCount(), r = e.getCanPreviousPage(), n = e.getCanNextPage(), c = a + 1, u = o === 0 ? 0 : a * s + 1, g = Math.min(c * s, o), i = d.useCallback((f) => e.setPageIndex(f - 1), [e]), b = d.useCallback(() => e.nextPage(), [e]), p = d.useCallback(() => e.previousPage(), [e]), v = d.useCallback((f) => e.setPageSize(f), [e]);
516
+ vt.displayName = "DataTableSearch";
517
+ function St(e) {
518
+ const { pageIndex: a, pageSize: l } = e.getState().pagination, r = e.getRowCount(), i = e.getPageCount(), n = e.getCanPreviousPage(), o = e.getCanNextPage(), s = a + 1, p = r === 0 ? 0 : a * l + 1, b = Math.min(s * l, r), u = d.useCallback((c) => e.setPageIndex(c - 1), [e]), g = d.useCallback(() => e.nextPage(), [e]), f = d.useCallback(() => e.previousPage(), [e]), m = d.useCallback((c) => e.setPageSize(c), [e]);
450
519
  return d.useMemo(() => ({
451
520
  pageIndex: a,
452
- pageSize: s,
453
- totalRows: o,
454
- totalPages: l,
455
- startRow: u,
456
- endRow: g,
457
- currentPage: c,
458
- canPrev: r,
459
- canNext: n,
460
- goToPage: i,
461
- nextPage: b,
462
- previousPage: p,
463
- setPageSize: v
521
+ pageSize: l,
522
+ totalRows: r,
523
+ totalPages: i,
524
+ startRow: p,
525
+ endRow: b,
526
+ currentPage: s,
527
+ canPrev: n,
528
+ canNext: o,
529
+ goToPage: u,
530
+ nextPage: g,
531
+ previousPage: f,
532
+ setPageSize: m
464
533
  }), [
465
534
  a,
466
- s,
467
- o,
468
535
  l,
469
- u,
470
- g,
471
- c,
472
536
  r,
473
- n,
474
537
  i,
475
- b,
476
538
  p,
477
- v
539
+ b,
540
+ s,
541
+ n,
542
+ o,
543
+ u,
544
+ g,
545
+ f,
546
+ m
478
547
  ]);
479
548
  }
480
- var J = d.createContext(null);
481
- function pe() {
482
- const e = d.useContext(J);
549
+ var ae = d.createContext(null);
550
+ function Re() {
551
+ const e = d.useContext(ae);
483
552
  if (!e) throw new Error("DataTablePagination sub-components must be used within <DataTablePagination>");
484
553
  return e;
485
554
  }
486
- function K({ label: e, labelOne: a, emptyLabel: s, renderText: o, dataHook: l, className: r }) {
487
- const { info: n, dataHook: c } = pe(), u = Q("sm"), { startRow: g, endRow: i, totalRows: b, pageIndex: p, pageSize: v } = n;
555
+ function ne({ label: e, labelOne: a, emptyLabel: l, renderText: r, updating: i, updatingLabel: n, dataHook: o, className: s }) {
556
+ const { info: p, dataHook: b } = Re(), u = oe("sm"), { startRow: g, endRow: f, totalRows: m, pageIndex: c, pageSize: h } = p;
488
557
  if (u) return null;
489
- if (o) {
490
- const f = o({
558
+ if (r) {
559
+ const v = r({
491
560
  startRow: g,
492
- endRow: i,
493
- totalRows: b,
494
- pageIndex: p,
495
- pageSize: v
561
+ endRow: f,
562
+ totalRows: m,
563
+ pageIndex: c,
564
+ pageSize: h
496
565
  });
497
- return f == null ? null : /* @__PURE__ */ t("span", {
498
- className: h("text-body-sm text-muted-foreground whitespace-nowrap", r),
499
- "data-hook": l ?? `${c}-row-count`,
566
+ return v == null ? null : /* @__PURE__ */ t("span", {
567
+ className: S("text-body-sm text-muted-foreground whitespace-nowrap", s),
568
+ "data-hook": o ?? `${b}-row-count`,
500
569
  "data-slot": "data-table-pagination-row-count",
501
- children: f
570
+ children: v
502
571
  });
503
572
  }
504
- return /* @__PURE__ */ t(xe, {
505
- className: h("whitespace-nowrap", r),
506
- dataHook: l ?? `${c}-row-count`,
507
- emptyLabel: s,
573
+ return /* @__PURE__ */ t(Me, {
574
+ className: S("whitespace-nowrap", s),
575
+ dataHook: o ?? `${b}-row-count`,
576
+ emptyLabel: l,
508
577
  from: g,
509
578
  rangeLabel: e,
510
579
  rangeLabelOne: a,
511
- to: i,
512
- total: b
580
+ to: f,
581
+ total: m
513
582
  });
514
583
  }
515
- K.displayName = "DataTablePaginationRowCount";
516
- function be({ ariaLabel: e = "Table pagination", dataHook: a, className: s }) {
517
- const { info: o } = pe(), l = Q("sm"), r = Pe({
518
- page: o.currentPage,
519
- totalPages: o.totalPages
584
+ ne.displayName = "DataTablePaginationRowCount";
585
+ function Ne({ ariaLabel: e = "Table pagination", dataHook: a, className: l }) {
586
+ const { info: r } = Re(), i = oe("sm"), n = je({
587
+ page: r.currentPage,
588
+ totalPages: r.totalPages
520
589
  });
521
- return o.totalPages <= 1 ? null : /* @__PURE__ */ t(we, {
590
+ return r.totalPages <= 1 ? null : /* @__PURE__ */ t(Be, {
522
591
  ariaLabel: e,
523
- className: h(!l && "mx-0 w-auto justify-end", s),
592
+ className: S(!i && "mx-0 w-auto justify-end", l),
524
593
  dataHook: a ?? "pagination-nav",
525
- children: /* @__PURE__ */ t(Ce, { children: r.map((n, c) => n === "previous" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(De, {
526
- disabled: !o.canPrev,
527
- onClick: () => o.previousPage()
528
- }) }, "previous") : n === "next" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(Te, {
529
- disabled: !o.canNext,
530
- onClick: () => o.nextPage()
531
- }) }, "next") : n === "ellipsis" ? /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(ye, {}) }, `ellipsis-${c}`) : /* @__PURE__ */ t(G, { children: /* @__PURE__ */ t(ke, {
532
- isActive: n === o.currentPage,
533
- page: n,
534
- onClick: () => o.goToPage(n)
535
- }) }, n)) })
594
+ children: /* @__PURE__ */ t(_e, { children: n.map((o, s) => o === "previous" ? /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(Oe, {
595
+ disabled: !r.canPrev,
596
+ onClick: () => r.previousPage()
597
+ }) }, "previous") : o === "next" ? /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(Ve, {
598
+ disabled: !r.canNext,
599
+ onClick: () => r.nextPage()
600
+ }) }, "next") : o === "ellipsis" ? /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t($e, {}) }, `ellipsis-${s}`) : /* @__PURE__ */ t(X, { children: /* @__PURE__ */ t(He, {
601
+ isActive: o === r.currentPage,
602
+ page: o,
603
+ onClick: () => r.goToPage(o)
604
+ }) }, o)) })
536
605
  });
537
606
  }
538
- be.displayName = "DataTablePaginationNav";
539
- function ot({ table: e, dataHook: a, showRowCount: s = !0, rowCountLabel: o, rowCountLabelOne: l, rowCountEmptyLabel: r, renderRowCount: n, trackingEl: c, trackingLabel: u, className: g, ariaLabel: i = "Table pagination", children: b }) {
540
- const p = nt(e), v = Q("sm"), f = d.useMemo(() => ({
541
- info: p,
607
+ Ne.displayName = "DataTablePaginationNav";
608
+ function xt({ table: e, dataHook: a, showRowCount: l = !0, rowCountLabel: r, rowCountLabelOne: i, rowCountEmptyLabel: n, renderRowCount: o, rowCountUpdating: s, rowCountUpdatingLabel: p, trackingEl: b, trackingLabel: u, className: g, ariaLabel: f = "Table pagination", children: m }) {
609
+ const c = St(e), h = oe("sm"), v = d.useMemo(() => ({
610
+ info: c,
542
611
  dataHook: a
543
- }), [p, a]), m = {
612
+ }), [c, a]), w = {
544
613
  "data-hook": a,
545
614
  "data-slot": "data-table-pagination",
546
- "data-tracking-el": c,
615
+ "data-tracking-el": b,
547
616
  "data-tracking-label": u
548
617
  };
549
- if (b) return /* @__PURE__ */ t(J.Provider, {
550
- value: f,
618
+ if (m) return /* @__PURE__ */ t(ae.Provider, {
619
+ value: v,
551
620
  children: /* @__PURE__ */ t("div", {
552
- className: h("flex w-full flex-wrap items-center gap-x-4 gap-y-2", g),
553
- ...m,
554
- children: b
621
+ className: S("flex w-full flex-wrap items-center gap-x-4 gap-y-2", g),
622
+ ...w,
623
+ children: m
555
624
  })
556
625
  });
557
- const k = n && s && !v ? n({
558
- startRow: p.startRow,
559
- endRow: p.endRow,
560
- totalRows: p.totalRows,
561
- pageIndex: p.pageIndex,
562
- pageSize: p.pageSize
563
- }) : null, x = !v && s && n !== null && (n ? k != null : !0), C = x && (!!n || p.totalRows > 0), w = p.totalPages > 1;
564
- return !x && !w ? null : /* @__PURE__ */ t(J.Provider, {
565
- value: f,
566
- children: /* @__PURE__ */ T("div", {
567
- className: h("flex w-full flex-wrap items-center gap-x-4 gap-y-2", (C || w) && "min-h-9", C ? "justify-between" : "justify-end", g),
568
- ...m,
569
- children: [x && (n ? /* @__PURE__ */ t(K, { renderText: () => k }) : /* @__PURE__ */ t(K, {
570
- emptyLabel: r,
571
- label: o,
572
- labelOne: l
573
- })), /* @__PURE__ */ t(be, {
574
- ariaLabel: i,
626
+ const C = o && l && !h ? o({
627
+ startRow: c.startRow,
628
+ endRow: c.endRow,
629
+ totalRows: c.totalRows,
630
+ pageIndex: c.pageIndex,
631
+ pageSize: c.pageSize
632
+ }) : null, y = !h && l && o !== null && (o ? C != null : !0), N = y && (!!o || c.totalRows > 0), k = c.totalPages > 1;
633
+ return !y && !k ? null : /* @__PURE__ */ t(ae.Provider, {
634
+ value: v,
635
+ children: /* @__PURE__ */ R("div", {
636
+ className: S("flex w-full flex-wrap items-center gap-x-4 gap-y-2", (N || k) && "min-h-9", N ? "justify-between" : "justify-end", g),
637
+ ...w,
638
+ children: [y && (o ? /* @__PURE__ */ t(ne, { renderText: () => C }) : /* @__PURE__ */ t(ne, {
639
+ emptyLabel: n,
640
+ label: r,
641
+ labelOne: i
642
+ })), /* @__PURE__ */ t(Ne, {
643
+ ariaLabel: f,
575
644
  className: "grow",
576
645
  dataHook: `${a}-nav`
577
646
  })]
578
647
  })
579
648
  });
580
649
  }
581
- ot.displayName = "DataTablePagination";
582
- function lt({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, selectAllAriaLabel: l }) {
583
- const r = d.useContext(q);
584
- return /* @__PURE__ */ t(ae, {
585
- "aria-disabled": r || void 0,
586
- "aria-label": l ?? "Select all",
650
+ xt.displayName = "DataTablePagination";
651
+ function wt({ table: e, dataHook: a, trackingEl: l, trackingLabel: r, selectAllAriaLabel: i }) {
652
+ const n = d.useContext(Y);
653
+ return /* @__PURE__ */ t(fe, {
654
+ "aria-disabled": n || void 0,
655
+ "aria-label": i ?? "Select all",
587
656
  checked: e.getIsAllPageRowsSelected(),
588
657
  dataHook: a || "select-all-checkbox",
589
- trackingEl: s,
590
- trackingLabel: o,
591
- onCheckedChange: (n) => {
592
- r || e.toggleAllPageRowsSelected(!!n);
658
+ trackingEl: l,
659
+ trackingLabel: r,
660
+ onCheckedChange: (o) => {
661
+ n || e.toggleAllPageRowsSelected(!!o);
593
662
  }
594
663
  });
595
664
  }
596
- lt.displayName = "DataTableSelectAllCheckbox";
597
- function rt({ row: e, dataHook: a, trackingEl: s, trackingLabel: o, selectRowAriaLabel: l }) {
598
- const r = d.useContext(q);
599
- return /* @__PURE__ */ t(ae, {
600
- "aria-disabled": r || void 0,
601
- "aria-label": l ?? "Select row",
665
+ wt.displayName = "DataTableSelectAllCheckbox";
666
+ function Ct({ row: e, dataHook: a, trackingEl: l, trackingLabel: r, selectRowAriaLabel: i }) {
667
+ const n = d.useContext(Y);
668
+ return /* @__PURE__ */ t(fe, {
669
+ "aria-disabled": n || void 0,
670
+ "aria-label": i ?? "Select row",
602
671
  checked: e.getIsSelected(),
603
672
  dataHook: a || `select-row-${e.id}`,
604
673
  disabled: !e.getCanSelect(),
605
- trackingEl: s,
606
- trackingLabel: o,
607
- onCheckedChange: (n) => {
608
- r || e.toggleSelected(!!n);
674
+ trackingEl: l,
675
+ trackingLabel: r,
676
+ onCheckedChange: (o) => {
677
+ n || e.toggleSelected(!!o);
609
678
  }
610
679
  });
611
680
  }
612
- rt.displayName = "DataTableSelectRowCheckbox";
613
- function st({ row: e, rowName: a, dataHook: s, trackingEl: o, trackingLabel: l, expandLabel: r, collapseLabel: n, className: c }) {
681
+ Ct.displayName = "DataTableSelectRowCheckbox";
682
+ function yt({ row: e, rowName: a, dataHook: l, trackingEl: r, trackingLabel: i, expandLabel: n, collapseLabel: o, className: s }) {
683
+ const p = d.useContext(qe) === "sm" ? "sm" : "default";
614
684
  if (!e.getCanExpand()) return /* @__PURE__ */ t("span", {
615
685
  "aria-hidden": "true",
616
- className: h("inline-block size-9", c),
686
+ className: S("inline-block", p === "sm" ? "size-8" : "size-9", s),
617
687
  "data-slot": "data-table-expand-row-spacer"
618
688
  });
619
- const u = e.getIsExpanded(), g = u ? n : r;
620
- let i;
621
- return g && (a !== void 0 || !g.includes("{name}")) ? i = g.replaceAll("{name}", a ?? "") : a !== void 0 ? i = u ? `Collapse details for ${a}` : `Expand details for ${a}` : i = u ? "Collapse row" : "Expand row", /* @__PURE__ */ t(te, {
689
+ const b = e.getIsExpanded(), u = b ? o : n;
690
+ let g;
691
+ return u && (a !== void 0 || !u.includes("{name}")) ? g = u.replaceAll("{name}", a ?? "") : a !== void 0 ? g = b ? `Collapse details for ${a}` : `Expand details for ${a}` : g = b ? "Collapse row" : "Expand row", /* @__PURE__ */ t(ge, {
622
692
  iconOnly: !0,
623
- "aria-expanded": u,
624
- "aria-label": i,
625
- className: c,
626
- "data-state": u ? "open" : "closed",
627
- dataHook: s || `expand-row-${e.id}`,
628
- size: "sm",
629
- trackingEl: o,
630
- trackingLabel: l,
693
+ "aria-expanded": b,
694
+ "aria-label": g,
695
+ className: s,
696
+ "data-state": b ? "open" : "closed",
697
+ dataHook: l || `expand-row-${e.id}`,
698
+ size: p,
699
+ trackingEl: r,
700
+ trackingLabel: i,
631
701
  variant: "ghost",
632
702
  onClick: e.getToggleExpandedHandler(),
633
- children: /* @__PURE__ */ t(Be, {
703
+ children: /* @__PURE__ */ t(Qe, {
634
704
  "aria-hidden": "true",
635
- className: h("duration-base transition-transform ease-in-out", u && "rotate-90")
705
+ className: S("duration-base transition-transform ease-in-out", b && "rotate-90")
636
706
  })
637
707
  });
638
708
  }
639
- st.displayName = "DataTableExpandRowButton";
640
- function it({ fields: e = 3, loadingLabel: a, dataHook: s, className: o }) {
641
- return /* @__PURE__ */ T("div", {
642
- className: h("relative flex flex-col gap-2 py-1", o),
643
- "data-hook": s || "data-table-expanded-skeleton",
709
+ yt.displayName = "DataTableExpandRowButton";
710
+ function Tt({ fields: e = 3, loadingLabel: a, dataHook: l, className: r }) {
711
+ return /* @__PURE__ */ R("div", {
712
+ className: S("relative flex flex-col gap-2 py-1", r),
713
+ "data-hook": l || "data-table-expanded-skeleton",
644
714
  "data-slot": "data-table-expanded-skeleton",
645
715
  role: "status",
646
716
  children: [/* @__PURE__ */ t("span", {
647
717
  className: "sr-only",
648
718
  children: a ?? "Loading details"
649
- }), Array.from({ length: e }, (l, r) => /* @__PURE__ */ T("div", {
719
+ }), Array.from({ length: e }, (i, n) => /* @__PURE__ */ R("div", {
650
720
  "aria-hidden": "true",
651
721
  className: "flex items-center gap-4",
652
- children: [/* @__PURE__ */ t(X, { className: "h-4 w-24 shrink-0" }), /* @__PURE__ */ t(X, { className: "h-4 w-48 max-w-full" })]
653
- }, r))]
722
+ children: [/* @__PURE__ */ t(ee, { className: "h-4 w-24 shrink-0" }), /* @__PURE__ */ t(ee, { className: "h-4 w-48 max-w-full" })]
723
+ }, n))]
654
724
  });
655
725
  }
656
- it.displayName = "DataTableExpandedSkeleton";
657
- var ee = d.createContext(null);
658
- function ct() {
659
- const e = d.useContext(ee);
726
+ Tt.displayName = "DataTableExpandedSkeleton";
727
+ var ie = d.createContext(null);
728
+ function kt() {
729
+ const e = d.useContext(ie);
660
730
  if (!e) throw new Error("DataTableBulkActions components must be used within <DataTableBulkActions>");
661
731
  return e;
662
732
  }
663
- function dt({ table: e, dataHook: a, trackingEl: s, trackingLabel: o, className: l, children: r, refetching: n = !1 }) {
664
- const c = e.getFilteredSelectedRowModel().rows.length, u = e.getRowCount(), g = d.useMemo(() => ({
665
- selectedCount: c,
666
- totalCount: u,
667
- refetching: n
733
+ function Dt({ table: e, dataHook: a, trackingEl: l, trackingLabel: r, className: i, children: n, refetching: o = !1 }) {
734
+ const s = e.getFilteredSelectedRowModel().rows.length, p = e.getRowCount(), b = d.useMemo(() => ({
735
+ selectedCount: s,
736
+ totalCount: p,
737
+ refetching: o
668
738
  }), [
669
- c,
670
- u,
671
- n
739
+ s,
740
+ p,
741
+ o
672
742
  ]);
673
- return c === 0 ? null : /* @__PURE__ */ t(ee.Provider, {
674
- value: g,
743
+ return s === 0 ? null : /* @__PURE__ */ t(ie.Provider, {
744
+ value: b,
675
745
  children: /* @__PURE__ */ t("div", {
676
- "aria-busy": n || void 0,
677
- className: h("flex items-center gap-2.5", l),
746
+ "aria-busy": o || void 0,
747
+ className: S("flex items-center gap-2.5", i),
678
748
  "data-hook": a,
679
749
  "data-slot": "data-table-bulk-actions",
680
- "data-tracking-el": s ?? "data-table-bulk-actions",
681
- "data-tracking-label": o,
682
- children: r
750
+ "data-tracking-el": l ?? "data-table-bulk-actions",
751
+ "data-tracking-label": r,
752
+ children: n
683
753
  })
684
754
  });
685
755
  }
686
- dt.displayName = "DataTableBulkActions";
687
- function ut({ dataHook: e = "data-table-bulk-actions-summary", className: a, children: s }) {
688
- const o = ct(), { selectedCount: l, totalCount: r } = o;
689
- let n;
690
- return typeof s == "function" ? n = s(o) : s != null ? n = s : n = `${l} of ${r} row(s) selected.`, /* @__PURE__ */ t(Ae, {
756
+ Dt.displayName = "DataTableBulkActions";
757
+ function Pt({ dataHook: e = "data-table-bulk-actions-summary", className: a, children: l }) {
758
+ const r = kt(), { selectedCount: i, totalCount: n } = r;
759
+ let o;
760
+ return typeof l == "function" ? o = l(r) : l != null ? o = l : o = `${i} of ${n} row(s) selected.`, /* @__PURE__ */ t(Ke, {
691
761
  asChild: !0,
692
- className: h("min-w-0", a),
762
+ className: S("min-w-0", a),
693
763
  dataHook: e,
694
764
  children: /* @__PURE__ */ t("span", {
695
765
  "data-slot": "data-table-bulk-actions-summary",
696
766
  role: "status",
697
- children: n
767
+ children: o
698
768
  })
699
769
  });
700
770
  }
701
- ut.displayName = "DataTableBulkActionsSummary";
702
- function gt({ dataHook: e = "data-table-bulk-actions-actions", className: a, children: s }) {
703
- const o = d.useContext(ee)?.refetching ?? !1;
771
+ Pt.displayName = "DataTableBulkActionsSummary";
772
+ function Rt({ dataHook: e = "data-table-bulk-actions-actions", className: a, children: l }) {
773
+ const r = d.useContext(ie)?.refetching ?? !1;
704
774
  return /* @__PURE__ */ t("div", {
705
- className: h("flex shrink-0 items-center gap-2", a),
775
+ className: S("flex shrink-0 items-center gap-2", a),
706
776
  "data-hook": e,
707
777
  "data-slot": "data-table-bulk-actions-actions",
708
- inert: o || void 0,
709
- children: s
778
+ inert: r || void 0,
779
+ children: l
710
780
  });
711
781
  }
712
- gt.displayName = "DataTableBulkActionsActions";
713
- function ft({ dataHook: e, className: a, children: s }) {
782
+ Rt.displayName = "DataTableBulkActionsActions";
783
+ function Nt({ dataHook: e, className: a, children: l }) {
714
784
  return /* @__PURE__ */ t("div", {
715
- className: h("flex flex-col gap-3 py-4 sm:flex-row sm:flex-wrap sm:items-center", a),
785
+ className: S("flex flex-col gap-3 py-4 sm:flex-row sm:flex-wrap sm:items-center", a),
716
786
  "data-hook": e,
717
787
  "data-slot": "data-table-toolbar",
718
- children: s
788
+ children: l
719
789
  });
720
790
  }
721
- ft.displayName = "DataTableToolbar";
722
- function pt({ className: e, children: a }) {
791
+ Nt.displayName = "DataTableToolbar";
792
+ function Et({ className: e, children: a }) {
723
793
  return /* @__PURE__ */ t("div", {
724
- className: h("flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-auto", e),
794
+ className: S("flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-auto", e),
725
795
  "data-slot": "data-table-toolbar-left",
726
796
  children: a
727
797
  });
728
798
  }
729
- pt.displayName = "DataTableToolbarLeft";
730
- function bt({ className: e, children: a }) {
799
+ Et.displayName = "DataTableToolbarLeft";
800
+ function It({ className: e, children: a }) {
731
801
  return /* @__PURE__ */ t("div", {
732
- className: h("flex w-full items-center justify-end gap-2 sm:ml-auto sm:w-auto", e),
802
+ className: S("flex w-full items-center justify-end gap-2 sm:ml-auto sm:w-auto", e),
733
803
  "data-slot": "data-table-toolbar-right",
734
804
  children: a
735
805
  });
736
806
  }
737
- bt.displayName = "DataTableToolbarRight";
807
+ It.displayName = "DataTableToolbarRight";
738
808
  export {
739
- Je as DataTable,
740
- dt as DataTableBulkActions,
741
- gt as DataTableBulkActionsActions,
742
- ut as DataTableBulkActionsSummary,
743
- tt as DataTableColumnHeader,
744
- st as DataTableExpandRowButton,
745
- it as DataTableExpandedSkeleton,
746
- ot as DataTablePagination,
747
- be as DataTablePaginationNav,
748
- K as DataTablePaginationRowCount,
749
- at as DataTableSearch,
750
- lt as DataTableSelectAllCheckbox,
751
- rt as DataTableSelectRowCheckbox,
752
- ft as DataTableToolbar,
753
- pt as DataTableToolbarLeft,
754
- bt as DataTableToolbarRight,
755
- et as VirtualizedDataTable,
756
- Mt as useDataTable,
757
- ct as useDataTableBulkActionsContext,
758
- nt as useDataTablePagination
809
+ ut as DataTable,
810
+ Dt as DataTableBulkActions,
811
+ Rt as DataTableBulkActionsActions,
812
+ Pt as DataTableBulkActionsSummary,
813
+ ht as DataTableColumnHeader,
814
+ yt as DataTableExpandRowButton,
815
+ Tt as DataTableExpandedSkeleton,
816
+ xt as DataTablePagination,
817
+ Ne as DataTablePaginationNav,
818
+ ne as DataTablePaginationRowCount,
819
+ vt as DataTableSearch,
820
+ wt as DataTableSelectAllCheckbox,
821
+ Ct as DataTableSelectRowCheckbox,
822
+ Nt as DataTableToolbar,
823
+ Et as DataTableToolbarLeft,
824
+ It as DataTableToolbarRight,
825
+ mt as VirtualizedDataTable,
826
+ Jt as useDataTable,
827
+ kt as useDataTableBulkActionsContext,
828
+ St as useDataTablePagination
759
829
  };