@brightlocal/ui-components 2.7.0 → 2.9.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/component-meta.json +6 -4
  2. package/dist/alert.cjs +1 -1
  3. package/dist/alert.js +1 -1
  4. package/dist/blocks/data-table.cjs +1 -1
  5. package/dist/blocks/data-table.d.ts +74 -26
  6. package/dist/blocks/data-table.d.ts.map +1 -1
  7. package/dist/blocks/data-table.js +318 -296
  8. package/dist/blocks/sidebar.cjs +1 -1
  9. package/dist/blocks/sidebar.d.ts +39 -21
  10. package/dist/blocks/sidebar.d.ts.map +1 -1
  11. package/dist/blocks/sidebar.js +379 -425
  12. package/dist/callout.cjs +1 -1
  13. package/dist/callout.js +1 -1
  14. package/dist/card.cjs +1 -1
  15. package/dist/card.js +11 -11
  16. package/dist/combobox.cjs +3 -3
  17. package/dist/combobox.d.ts +24 -3
  18. package/dist/combobox.d.ts.map +1 -1
  19. package/dist/combobox.js +327 -302
  20. package/dist/global-layout.cjs +1 -1
  21. package/dist/global-layout.d.ts +3 -3
  22. package/dist/global-layout.d.ts.map +1 -1
  23. package/dist/global-layout.js +90 -82
  24. package/dist/hooks/use-breakpoint.cjs +1 -0
  25. package/dist/hooks/use-breakpoint.d.ts +15 -0
  26. package/dist/hooks/use-breakpoint.d.ts.map +1 -0
  27. package/dist/hooks/use-breakpoint.js +30 -0
  28. package/dist/hooks/use-mobile.d.ts +13 -3
  29. package/dist/hooks/use-mobile.d.ts.map +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +220 -215
  34. package/dist/scroll-area.cjs +1 -1
  35. package/dist/scroll-area.d.ts +5 -0
  36. package/dist/scroll-area.d.ts.map +1 -1
  37. package/dist/scroll-area.js +34 -25
  38. package/dist/split-layout.cjs +1 -1
  39. package/dist/split-layout.d.ts +15 -0
  40. package/dist/split-layout.d.ts.map +1 -1
  41. package/dist/split-layout.js +40 -38
  42. package/package.json +3 -3
  43. package/src/blocks/data-table.tsx +139 -76
  44. package/src/blocks/sidebar.tsx +134 -148
  45. package/src/components/alert.tsx +1 -1
  46. package/src/components/callout.tsx +1 -1
  47. package/src/components/card.tsx +1 -1
  48. package/src/components/combobox.tsx +72 -11
  49. package/src/components/global-layout.tsx +49 -40
  50. package/src/components/scroll-area.tsx +15 -1
  51. package/src/components/split-layout.tsx +19 -2
  52. package/src/hooks/use-breakpoint.ts +58 -0
  53. package/src/hooks/use-mobile.ts +20 -40
  54. package/src/index.ts +1 -0
  55. package/dist/hooks/use-mobile.cjs +0 -1
  56. package/dist/hooks/use-mobile.js +0 -26
@@ -1,81 +1,80 @@
1
- import { jsx as e, jsxs as f, Fragment as k } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import { useReactTable as ne, getExpandedRowModel as oe, getFilteredRowModel as le, getSortedRowModel as ie, getPaginationRowModel as re, getCoreRowModel as se, flexRender as H } from "@tanstack/react-table";
1
+ import { jsx as a, jsxs as S, Fragment as T } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { useReactTable as ne, getExpandedRowModel as oe, getFilteredRowModel as le, getSortedRowModel as ie, getPaginationRowModel as re, getCoreRowModel as se, flexRender as A } from "@tanstack/react-table";
4
4
  import { useVirtualizer as ce } from "@tanstack/react-virtual";
5
- import { ArrowDown as de, ArrowUp as ue, ArrowUpDown as ge, Ellipsis as pe, Search as he, X as me } from "@brightlocal/icons";
6
- import { cn as b } from "@brightlocal/ui-components/lib/utils";
7
- import { Button as F } from "../button.js";
8
- import { Checkbox as E } from "../checkbox.js";
9
- import { DropdownMenu as fe, DropdownMenuTrigger as be, DropdownMenuContent as Se } from "../dropdown-menu.js";
10
- import { InputGroup as we, InputGroupAddon as A, InputGroupInput as Ce } from "../input-group.js";
11
- import { usePagination as xe, Pagination as Pe, PaginationContent as Re, PaginationItem as z, PaginationPrevious as ve, PaginationNext as ke, PaginationEllipsis as Te, PaginationLink as De } from "../pagination.js";
12
- import { Skeleton as ye } from "../skeleton.js";
13
- import { Table as V, TableBody as j, TableRow as C, TableCell as x, TableHeader as Ne, TableHead as ze } from "../table.js";
14
- function v(t, n, i) {
15
- const [a, l] = p.useState(n), o = t !== void 0 ? t : a, r = p.useRef(o);
16
- p.useEffect(() => {
5
+ import { ArrowDown as de, ArrowUp as ue, ArrowUpDown as ge, Search as me, X as pe } from "@brightlocal/icons";
6
+ import { cn as h } from "@brightlocal/ui-components/lib/utils";
7
+ import { Button as H } from "../button.js";
8
+ import { Checkbox as V } from "../checkbox.js";
9
+ import { InputGroup as he, InputGroupAddon as M, InputGroupInput as fe } from "../input-group.js";
10
+ import { usePagination as be, Pagination as Se, PaginationContent as we, PaginationItem as z, PaginationPrevious as Ce, PaginationNext as xe, PaginationEllipsis as Pe, PaginationLink as ve } from "../pagination.js";
11
+ import { Skeleton as Re } from "../skeleton.js";
12
+ import { Table as j, TableBody as E, TableRow as C, TableCell as x, TableHeader as Te, TableHead as ke } from "../table.js";
13
+ function R(e, n, l) {
14
+ const [t, i] = m.useState(n), o = e !== void 0 ? e : t, r = m.useRef(o);
15
+ m.useEffect(() => {
17
16
  r.current = o;
18
17
  });
19
- const c = t !== void 0, d = p.useCallback(
18
+ const c = e !== void 0, d = m.useCallback(
20
19
  (s) => {
21
20
  const u = typeof s == "function" ? s(r.current) : s;
22
- c || l(u), i?.(u);
21
+ c || i(u), l?.(u);
23
22
  },
24
- [c, i]
23
+ [c, l]
25
24
  );
26
25
  return [o, d];
27
26
  }
28
- function Ze(t) {
27
+ function Qe(e) {
29
28
  const {
30
29
  columns: n,
31
- data: i,
32
- enableSorting: a = !0,
33
- enableGlobalFiltering: l = !1,
30
+ data: l,
31
+ enableSorting: t = !0,
32
+ enableGlobalFiltering: i = !1,
34
33
  enableRowSelection: o = !1,
35
34
  enablePagination: r = !1,
36
35
  pageSize: c = 10,
37
36
  manualSorting: d = !1,
38
37
  manualFiltering: s = !1,
39
38
  manualPagination: u = !1,
40
- rowCount: h,
39
+ rowCount: p,
41
40
  pageCount: g,
42
- enableExpanding: m = !1,
41
+ enableExpanding: f = !1,
43
42
  getSubRows: w,
44
43
  getRowId: P,
45
- pagination: R,
46
- onPaginationChange: T,
47
- sorting: S,
48
- onSortingChange: $,
49
- globalFilter: D,
50
- onGlobalFilterChange: y,
51
- rowSelection: I,
52
- onRowSelectionChange: N,
53
- expanded: O,
54
- onExpandedChange: X
55
- } = t, [q, J] = v(
56
- R,
44
+ pagination: v,
45
+ onPaginationChange: k,
46
+ sorting: b,
47
+ onSortingChange: I,
48
+ globalFilter: y,
49
+ onGlobalFilterChange: N,
50
+ rowSelection: $,
51
+ onRowSelectionChange: D,
52
+ expanded: X,
53
+ onExpandedChange: q
54
+ } = e, [J, K] = R(
55
+ v,
57
56
  { pageIndex: 0, pageSize: c },
58
- T
59
- ), [K, Q] = v(
60
- S,
57
+ k
58
+ ), [O, Q] = R(
59
+ b,
61
60
  [],
62
- $
63
- ), [W, Y] = v(
64
- D,
61
+ I
62
+ ), [W, Y] = R(
63
+ y,
65
64
  "",
66
- y
67
- ), [Z, ee] = v(I, {}, N), [te, ae] = v(
68
- O,
65
+ N
66
+ ), [Z, ee] = R($, {}, D), [ae, te] = R(
67
+ X,
69
68
  {},
70
- X
69
+ q
71
70
  );
72
71
  return ne({
73
- data: i,
72
+ data: l,
74
73
  columns: n,
75
74
  getCoreRowModel: se(),
76
75
  ...P && { getRowId: P },
77
76
  ...(r || u) && {
78
- onPaginationChange: J
77
+ onPaginationChange: K
79
78
  },
80
79
  ...r && {
81
80
  ...!u && {
@@ -84,17 +83,17 @@ function Ze(t) {
84
83
  },
85
84
  ...u && {
86
85
  manualPagination: !0,
87
- ...h != null && { rowCount: h },
86
+ ...p != null && { rowCount: p },
88
87
  ...g != null && { pageCount: g }
89
88
  },
90
- ...a && {
89
+ ...t && {
91
90
  ...!d && {
92
91
  getSortedRowModel: ie()
93
92
  },
94
93
  onSortingChange: Q,
95
94
  ...d && { manualSorting: !0 }
96
95
  },
97
- ...l && {
96
+ ...i && {
98
97
  ...!s && {
99
98
  getFilteredRowModel: le()
100
99
  },
@@ -106,208 +105,208 @@ function Ze(t) {
106
105
  enableRowSelection: !0,
107
106
  onRowSelectionChange: ee
108
107
  },
109
- ...m && {
108
+ ...f && {
110
109
  getExpandedRowModel: oe(),
111
- onExpandedChange: ae,
110
+ onExpandedChange: te,
112
111
  getSubRows: w
113
112
  },
114
113
  state: {
115
- pagination: q,
116
- sorting: K,
114
+ pagination: J,
115
+ sorting: O,
117
116
  globalFilter: W,
118
117
  rowSelection: Z,
119
- expanded: te
118
+ expanded: ae
120
119
  }
121
120
  });
122
121
  }
123
- function $e({
124
- table: t,
122
+ function ye({
123
+ table: e,
125
124
  dataHook: n,
126
- trackingEl: i,
127
- trackingLabel: a,
128
- isLoading: l = !1,
125
+ trackingEl: l,
126
+ trackingLabel: t,
127
+ isLoading: i = !1,
129
128
  skeletonRowCount: o,
130
129
  noResultsMessage: r = "No results.",
131
130
  stickyHeader: c = !1,
132
131
  className: d,
133
132
  footer: s
134
133
  }) {
135
- const u = t.getVisibleLeafColumns().length, h = o ?? t.getState().pagination.pageSize ?? 10;
136
- return /* @__PURE__ */ e(
134
+ const u = e.getVisibleLeafColumns().length, p = o ?? e.getState().pagination.pageSize ?? 10;
135
+ return /* @__PURE__ */ a(
137
136
  "div",
138
137
  {
139
- "aria-busy": l || void 0,
140
- className: b("border-border overflow-auto rounded-md border", d),
138
+ "aria-busy": i || void 0,
139
+ className: h("border-border overflow-auto rounded-md border", d),
141
140
  "data-hook": n,
142
141
  "data-slot": "data-table-view",
143
- "data-tracking-el": i,
144
- "data-tracking-label": a,
145
- children: /* @__PURE__ */ f(V, { dataHook: `${n}-table`, children: [
146
- /* @__PURE__ */ e(G, { stickyHeader: c, table: t }),
147
- /* @__PURE__ */ e(j, { children: l ? /* @__PURE__ */ f(k, { children: [
148
- /* @__PURE__ */ e(
142
+ "data-tracking-el": l,
143
+ "data-tracking-label": t,
144
+ children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
145
+ /* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
146
+ /* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
147
+ /* @__PURE__ */ a(
149
148
  B,
150
149
  {
151
150
  colCount: u,
152
- rowCount: h
151
+ rowCount: p
153
152
  }
154
153
  ),
155
- /* @__PURE__ */ e(C, { className: "sr-only", children: /* @__PURE__ */ e(x, { colSpan: u, children: /* @__PURE__ */ e("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
156
- ] }) : /* @__PURE__ */ e(k, { children: t.getRowModel().rows.length > 0 ? t.getRowModel().rows.map((g) => /* @__PURE__ */ e(L, { row: g }, g.id)) : /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(x, { colSpan: u, children: /* @__PURE__ */ e("div", { "aria-live": "polite", role: "status", children: r }) }) }) }) }),
154
+ /* @__PURE__ */ a(C, { className: "sr-only", children: /* @__PURE__ */ a(x, { colSpan: u, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
155
+ ] }) : /* @__PURE__ */ a(T, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((g) => /* @__PURE__ */ a(L, { row: g }, g.id)) : /* @__PURE__ */ a(C, { children: /* @__PURE__ */ a(x, { colSpan: u, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }) }),
157
156
  s
158
157
  ] })
159
158
  }
160
159
  );
161
160
  }
162
- $e.displayName = "DataTable";
161
+ ye.displayName = "DataTable";
163
162
  function G({
164
- table: t,
163
+ table: e,
165
164
  stickyHeader: n
166
165
  }) {
167
- return /* @__PURE__ */ e(
168
- Ne,
166
+ return /* @__PURE__ */ a(
167
+ Te,
169
168
  {
170
- className: b(n && "bg-background sticky top-0 z-10"),
171
- children: t.getHeaderGroups().map((i) => /* @__PURE__ */ e(C, { children: i.headers.map((a) => {
172
- const l = a.column.getCanSort() ? a.column.getIsSorted() : !1, o = l === "asc" ? "ascending" : l === "desc" ? "descending" : a.column.getCanSort() ? "none" : void 0;
173
- return /* @__PURE__ */ e(
174
- ze,
169
+ className: h(n && "bg-background sticky top-0 z-10"),
170
+ children: e.getHeaderGroups().map((l) => /* @__PURE__ */ a(C, { children: l.headers.map((t) => {
171
+ const i = t.column.getCanSort() ? t.column.getIsSorted() : !1, o = i === "asc" ? "ascending" : i === "desc" ? "descending" : t.column.getCanSort() ? "none" : void 0;
172
+ return /* @__PURE__ */ a(
173
+ ke,
175
174
  {
176
175
  "aria-sort": o,
177
- colSpan: a.colSpan,
178
- children: a.isPlaceholder ? null : H(
179
- a.column.columnDef.header,
180
- a.getContext()
176
+ colSpan: t.colSpan,
177
+ children: t.isPlaceholder ? null : A(
178
+ t.column.columnDef.header,
179
+ t.getContext()
181
180
  )
182
181
  },
183
- a.id
182
+ t.id
184
183
  );
185
- }) }, i.id))
184
+ }) }, l.id))
186
185
  }
187
186
  );
188
187
  }
189
- function L({ row: t }) {
190
- return /* @__PURE__ */ e(C, { "data-state": t.getIsSelected() ? "selected" : void 0, children: t.getVisibleCells().map((n) => /* @__PURE__ */ e(x, { children: H(n.column.columnDef.cell, n.getContext()) }, n.id)) });
188
+ function L({ row: e }) {
189
+ return /* @__PURE__ */ a(C, { "data-state": e.getIsSelected() ? "selected" : void 0, children: e.getVisibleCells().map((n) => /* @__PURE__ */ a(x, { children: A(n.column.columnDef.cell, n.getContext()) }, n.id)) });
191
190
  }
192
191
  function B({
193
- rowCount: t,
192
+ rowCount: e,
194
193
  colCount: n
195
194
  }) {
196
- return /* @__PURE__ */ e(k, { children: Array.from({ length: t }).map((i, a) => /* @__PURE__ */ e(C, { children: Array.from({ length: n }).map((l, o) => /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(ye, { className: "h-4 w-full" }) }, `skeleton-${a}-${o}`)) }, `skeleton-${a}`)) });
195
+ return /* @__PURE__ */ a(T, { children: Array.from({ length: e }).map((l, t) => /* @__PURE__ */ a(C, { children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ a(x, { children: /* @__PURE__ */ a(Re, { className: "h-4 w-full" }) }, `skeleton-${t}-${o}`)) }, `skeleton-${t}`)) });
197
196
  }
198
- function Ie({
199
- table: t,
197
+ function Ne({
198
+ table: e,
200
199
  dataHook: n,
201
- trackingEl: i,
202
- trackingLabel: a,
203
- isLoading: l = !1,
200
+ trackingEl: l,
201
+ trackingLabel: t,
202
+ isLoading: i = !1,
204
203
  skeletonRowCount: o,
205
204
  noResultsMessage: r = "No results.",
206
205
  stickyHeader: c = !1,
207
206
  className: d,
208
207
  footer: s,
209
208
  height: u,
210
- estimateSize: h = 48,
209
+ estimateSize: p = 48,
211
210
  overscan: g = 5
212
211
  }) {
213
- const m = t.getVisibleLeafColumns().length, w = o ?? t.getState().pagination.pageSize ?? 10, P = p.useRef(null), R = t.getRowModel().rows, T = ce({
214
- count: R.length,
212
+ const f = e.getVisibleLeafColumns().length, w = o ?? e.getState().pagination.pageSize ?? 10, P = m.useRef(null), v = e.getRowModel().rows, k = ce({
213
+ count: v.length,
215
214
  getScrollElement: () => P.current,
216
- estimateSize: () => h,
215
+ estimateSize: () => p,
217
216
  overscan: g
218
- }), S = T.getVirtualItems(), $ = T.getTotalSize(), D = S.length > 0 ? S[0].start : 0, y = S.length > 0 ? $ - S[S.length - 1].end : 0;
219
- return /* @__PURE__ */ e(
217
+ }), b = k.getVirtualItems(), I = k.getTotalSize(), y = b.length > 0 ? b[0].start : 0, N = b.length > 0 ? I - b[b.length - 1].end : 0;
218
+ return /* @__PURE__ */ a(
220
219
  "div",
221
220
  {
222
221
  ref: P,
223
- "aria-busy": l || void 0,
224
- className: b("border-border overflow-auto rounded-md border", d),
222
+ "aria-busy": i || void 0,
223
+ className: h("border-border overflow-auto rounded-md border", d),
225
224
  "data-hook": n,
226
225
  "data-slot": "data-table-view",
227
- "data-tracking-el": i,
228
- "data-tracking-label": a,
226
+ "data-tracking-el": l,
227
+ "data-tracking-label": t,
229
228
  style: u != null ? { height: u } : void 0,
230
- children: /* @__PURE__ */ f(V, { dataHook: `${n}-table`, children: [
231
- /* @__PURE__ */ e(G, { stickyHeader: c, table: t }),
232
- /* @__PURE__ */ e(j, { children: l ? /* @__PURE__ */ f(k, { children: [
233
- /* @__PURE__ */ e(
229
+ children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
230
+ /* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
231
+ /* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
232
+ /* @__PURE__ */ a(
234
233
  B,
235
234
  {
236
- colCount: m,
235
+ colCount: f,
237
236
  rowCount: w
238
237
  }
239
238
  ),
240
- /* @__PURE__ */ e(C, { className: "sr-only", children: /* @__PURE__ */ e(x, { colSpan: m, children: /* @__PURE__ */ e("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
241
- ] }) : R.length > 0 ? /* @__PURE__ */ f(k, { children: [
242
- D > 0 && /* @__PURE__ */ e("tr", { "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m, style: { height: D } }) }),
243
- S.map((I) => {
244
- const N = R[I.index];
245
- return /* @__PURE__ */ e(L, { row: N }, N.id);
239
+ /* @__PURE__ */ a(C, { className: "sr-only", children: /* @__PURE__ */ a(x, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
240
+ ] }) : v.length > 0 ? /* @__PURE__ */ S(T, { children: [
241
+ y > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: y } }) }),
242
+ b.map(($) => {
243
+ const D = v[$.index];
244
+ return /* @__PURE__ */ a(L, { row: D }, D.id);
246
245
  }),
247
- y > 0 && /* @__PURE__ */ e("tr", { "aria-hidden": "true", children: /* @__PURE__ */ e("td", { colSpan: m, style: { height: y } }) })
248
- ] }) : /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(x, { colSpan: m, children: /* @__PURE__ */ e("div", { "aria-live": "polite", role: "status", children: r }) }) }) }),
246
+ N > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: N } }) })
247
+ ] }) : /* @__PURE__ */ a(C, { children: /* @__PURE__ */ a(x, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }),
249
248
  s
250
249
  ] })
251
250
  }
252
251
  );
253
252
  }
254
- Ie.displayName = "VirtualizedDataTable";
255
- function Me({
256
- column: t,
253
+ Ne.displayName = "VirtualizedDataTable";
254
+ function De({
255
+ column: e,
257
256
  title: n,
258
- className: i,
259
- dataHook: a,
260
- trackingEl: l,
257
+ className: l,
258
+ dataHook: t,
259
+ trackingEl: i,
261
260
  trackingLabel: o,
262
261
  align: r = "left"
263
262
  }) {
264
- if (!t.getCanSort())
265
- return /* @__PURE__ */ e(
263
+ if (!e.getCanSort())
264
+ return /* @__PURE__ */ a(
266
265
  "div",
267
266
  {
268
- className: b(
267
+ className: h(
269
268
  "text-muted-foreground text-left text-sm leading-normal font-medium",
270
269
  r === "right" && "text-right",
271
270
  r === "center" && "text-center",
272
- i
271
+ l
273
272
  ),
274
- "data-hook": a,
273
+ "data-hook": t,
275
274
  "data-slot": "data-table-column-header",
276
- "data-tracking-el": l,
275
+ "data-tracking-el": i,
277
276
  "data-tracking-label": o,
278
277
  children: n
279
278
  }
280
279
  );
281
- const c = t.getIsSorted(), d = c === "desc" ? `Sort by ${n}, currently descending` : c === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
282
- return /* @__PURE__ */ e(
280
+ const c = e.getIsSorted(), d = c === "desc" ? `Sort by ${n}, currently descending` : c === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
281
+ return /* @__PURE__ */ a(
283
282
  "div",
284
283
  {
285
- className: b(
284
+ className: h(
286
285
  "flex items-center",
287
286
  r === "right" && "justify-end",
288
287
  r === "center" && "justify-center",
289
- i
288
+ l
290
289
  ),
291
290
  "data-slot": "data-table-column-header",
292
- "data-tracking-el": l,
291
+ "data-tracking-el": i,
293
292
  "data-tracking-label": o,
294
- children: /* @__PURE__ */ f(
295
- F,
293
+ children: /* @__PURE__ */ S(
294
+ H,
296
295
  {
297
296
  "aria-label": d,
298
297
  className: "text-muted-foreground h-auto p-0 text-sm font-medium",
299
- dataHook: a || `column-header-${t.id}`,
298
+ dataHook: t || `column-header-${e.id}`,
300
299
  size: "sm",
301
300
  variant: "ghost",
302
- onClick: () => t.toggleSorting(c === "asc"),
301
+ onClick: () => e.toggleSorting(c === "asc"),
303
302
  children: [
304
- /* @__PURE__ */ e("span", { "aria-hidden": "true", children: n }),
305
- /* @__PURE__ */ e(
303
+ /* @__PURE__ */ a("span", { "aria-hidden": "true", children: n }),
304
+ /* @__PURE__ */ a(
306
305
  "span",
307
306
  {
308
307
  "aria-hidden": "true",
309
308
  className: "flex size-3 items-center justify-center",
310
- children: c === "desc" ? /* @__PURE__ */ e(de, { size: 12 }) : c === "asc" ? /* @__PURE__ */ e(ue, { size: 12 }) : /* @__PURE__ */ e(ge, { size: 12 })
309
+ children: c === "desc" ? /* @__PURE__ */ a(de, { size: 12 }) : c === "asc" ? /* @__PURE__ */ a(ue, { size: 12 }) : /* @__PURE__ */ a(ge, { size: 12 })
311
310
  }
312
311
  )
313
312
  ]
@@ -316,229 +315,197 @@ function Me({
316
315
  }
317
316
  );
318
317
  }
319
- Me.displayName = "DataTableColumnHeader";
320
- function Fe({
321
- row: t,
322
- dataHook: n,
323
- trackingEl: i,
324
- trackingLabel: a,
325
- ariaLabel: l = "Open row actions menu",
326
- children: o
327
- }) {
328
- return /* @__PURE__ */ f(fe, { children: [
329
- /* @__PURE__ */ e(be, { asChild: !0, "data-slot": "data-table-row-actions", children: /* @__PURE__ */ e(
330
- F,
331
- {
332
- "aria-label": l,
333
- dataHook: n || `row-actions-${t.id}`,
334
- size: "sm",
335
- trackingEl: i,
336
- trackingLabel: a,
337
- variant: "ghost",
338
- children: /* @__PURE__ */ e(pe, {})
339
- }
340
- ) }),
341
- /* @__PURE__ */ e(
342
- Se,
343
- {
344
- align: "end",
345
- dataHook: n ? `${n}-menu` : `row-actions-${t.id}-menu`,
346
- children: o
347
- }
348
- )
349
- ] });
350
- }
351
- Fe.displayName = "DataTableRowActions";
352
- function Ae({
353
- table: t,
318
+ De.displayName = "DataTableColumnHeader";
319
+ function ze({
320
+ table: e,
354
321
  ariaLabel: n = "Search table",
355
- placeholder: i = "Search...",
356
- ...a
322
+ placeholder: l = "Search...",
323
+ ...t
357
324
  }) {
358
- const l = t.getState().globalFilter ?? "", o = (r) => {
359
- t.setGlobalFilter(r);
325
+ const i = e.getState().globalFilter ?? "", o = (r) => {
326
+ e.setGlobalFilter(r);
360
327
  };
361
- return /* @__PURE__ */ f(we, { "data-slot": "data-table-search", ...a, children: [
362
- /* @__PURE__ */ e(A, { className: "pl-3", children: /* @__PURE__ */ e(he, {}) }),
363
- /* @__PURE__ */ e(
364
- Ce,
328
+ return /* @__PURE__ */ S(he, { "data-slot": "data-table-search", ...t, children: [
329
+ /* @__PURE__ */ a(M, { className: "pl-3", children: /* @__PURE__ */ a(me, {}) }),
330
+ /* @__PURE__ */ a(
331
+ fe,
365
332
  {
366
333
  "aria-label": n,
367
- placeholder: i,
334
+ placeholder: l,
368
335
  type: "text",
369
- value: l,
336
+ value: i,
370
337
  onChange: (r) => o(r.target.value)
371
338
  }
372
339
  ),
373
- l && /* @__PURE__ */ e(A, { className: "pr-1", children: /* @__PURE__ */ e(
374
- F,
340
+ i && /* @__PURE__ */ a(M, { className: "pr-1", children: /* @__PURE__ */ a(
341
+ H,
375
342
  {
376
343
  "aria-label": "Clear search",
377
344
  className: "h-auto p-1",
378
345
  "data-slot": "data-table-search-clear",
379
- dataHook: `${a.dataHook}-clear`,
346
+ dataHook: `${t.dataHook}-clear`,
380
347
  variant: "ghost",
381
348
  onClick: () => o(""),
382
- children: /* @__PURE__ */ e(me, { size: 14 })
349
+ children: /* @__PURE__ */ a(pe, { size: 14 })
383
350
  }
384
351
  ) })
385
352
  ] });
386
353
  }
387
- Ae.displayName = "DataTableSearch";
388
- function He(t) {
389
- const { pageIndex: n, pageSize: i } = t.getState().pagination, a = t.getRowCount(), l = t.getPageCount(), o = t.getCanPreviousPage(), r = t.getCanNextPage(), c = n + 1, d = a === 0 ? 0 : n * i + 1, s = Math.min(c * i, a), u = p.useCallback(
390
- (w) => t.setPageIndex(w - 1),
391
- [t]
392
- ), h = p.useCallback(() => t.nextPage(), [t]), g = p.useCallback(() => t.previousPage(), [t]), m = p.useCallback(
393
- (w) => t.setPageSize(w),
394
- [t]
354
+ ze.displayName = "DataTableSearch";
355
+ function Ie(e) {
356
+ const { pageIndex: n, pageSize: l } = e.getState().pagination, t = e.getRowCount(), i = e.getPageCount(), o = e.getCanPreviousPage(), r = e.getCanNextPage(), c = n + 1, d = t === 0 ? 0 : n * l + 1, s = Math.min(c * l, t), u = m.useCallback(
357
+ (w) => e.setPageIndex(w - 1),
358
+ [e]
359
+ ), p = m.useCallback(() => e.nextPage(), [e]), g = m.useCallback(() => e.previousPage(), [e]), f = m.useCallback(
360
+ (w) => e.setPageSize(w),
361
+ [e]
395
362
  );
396
- return p.useMemo(
363
+ return m.useMemo(
397
364
  () => ({
398
365
  pageIndex: n,
399
- pageSize: i,
400
- totalRows: a,
401
- totalPages: l,
366
+ pageSize: l,
367
+ totalRows: t,
368
+ totalPages: i,
402
369
  startRow: d,
403
370
  endRow: s,
404
371
  currentPage: c,
405
372
  canPrev: o,
406
373
  canNext: r,
407
374
  goToPage: u,
408
- nextPage: h,
375
+ nextPage: p,
409
376
  previousPage: g,
410
- setPageSize: m
377
+ setPageSize: f
411
378
  }),
412
379
  [
413
380
  n,
414
- i,
415
- a,
416
381
  l,
382
+ t,
383
+ i,
417
384
  d,
418
385
  s,
419
386
  c,
420
387
  o,
421
388
  r,
422
389
  u,
423
- h,
390
+ p,
424
391
  g,
425
- m
392
+ f
426
393
  ]
427
394
  );
428
395
  }
429
- const M = p.createContext(null);
396
+ const F = m.createContext(null);
430
397
  function U() {
431
- const t = p.useContext(M);
432
- if (!t)
398
+ const e = m.useContext(F);
399
+ if (!e)
433
400
  throw new Error(
434
401
  "DataTablePagination sub-components must be used within <DataTablePagination>"
435
402
  );
436
- return t;
403
+ return e;
437
404
  }
438
- function Ee({
439
- renderText: t,
405
+ function $e({
406
+ renderText: e,
440
407
  className: n
441
408
  }) {
442
- const { info: i } = U(), { startRow: a, endRow: l, totalRows: o, pageIndex: r, pageSize: c } = i, d = t ? t({ startRow: a, endRow: l, totalRows: o, pageIndex: r, pageSize: c }) : o === 0 ? null : `${a}-${l} of ${o}`;
443
- return d == null ? null : /* @__PURE__ */ e(
409
+ const { info: l } = U(), { startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c } = l, d = e ? e({ startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c }) : o === 0 ? null : `${t}-${i} of ${o}`;
410
+ return d == null ? null : /* @__PURE__ */ a(
444
411
  "span",
445
412
  {
446
- className: b("text-muted-foreground text-sm", n),
413
+ className: h("text-muted-foreground text-sm", n),
447
414
  "data-slot": "data-table-pagination-row-count",
448
415
  children: d
449
416
  }
450
417
  );
451
418
  }
452
- Ee.displayName = "DataTablePaginationRowCount";
419
+ $e.displayName = "DataTablePaginationRowCount";
453
420
  function _({
454
- ariaLabel: t = "Table pagination",
421
+ ariaLabel: e = "Table pagination",
455
422
  dataHook: n,
456
- className: i
423
+ className: l
457
424
  }) {
458
- const { info: a } = U(), l = xe({
459
- page: a.currentPage,
460
- totalPages: a.totalPages,
425
+ const { info: t } = U(), i = be({
426
+ page: t.currentPage,
427
+ totalPages: t.totalPages,
461
428
  siblingCount: 1,
462
429
  boundaryCount: 1
463
430
  });
464
- return /* @__PURE__ */ e(
465
- Pe,
431
+ return /* @__PURE__ */ a(
432
+ Se,
466
433
  {
467
- ariaLabel: t,
468
- className: b("mx-0 w-auto justify-end", i),
434
+ ariaLabel: e,
435
+ className: h("mx-0 w-auto justify-end", l),
469
436
  dataHook: n ?? "pagination-nav",
470
- children: /* @__PURE__ */ e(Re, { children: l.map((o, r) => o === "previous" ? /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(
471
- ve,
437
+ children: /* @__PURE__ */ a(we, { children: i.map((o, r) => o === "previous" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
438
+ Ce,
472
439
  {
473
- disabled: !a.canPrev,
474
- onClick: () => a.previousPage()
440
+ disabled: !t.canPrev,
441
+ onClick: () => t.previousPage()
475
442
  }
476
- ) }, "previous") : o === "next" ? /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(
477
- ke,
443
+ ) }, "previous") : o === "next" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
444
+ xe,
478
445
  {
479
- disabled: !a.canNext,
480
- onClick: () => a.nextPage()
446
+ disabled: !t.canNext,
447
+ onClick: () => t.nextPage()
481
448
  }
482
- ) }, "next") : o === "ellipsis" ? /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(Te, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(
483
- De,
449
+ ) }, "next") : o === "ellipsis" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(Pe, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
450
+ ve,
484
451
  {
485
- isActive: o === a.currentPage,
452
+ isActive: o === t.currentPage,
486
453
  page: o,
487
- onClick: () => a.goToPage(o)
454
+ onClick: () => t.goToPage(o)
488
455
  }
489
456
  ) }, o)) })
490
457
  }
491
458
  );
492
459
  }
493
460
  _.displayName = "DataTablePaginationNav";
494
- function Ve({
495
- table: t,
461
+ function Fe({
462
+ table: e,
496
463
  dataHook: n,
497
- showRowCount: i = !0,
498
- renderRowCount: a,
499
- trackingEl: l,
464
+ showRowCount: l = !0,
465
+ renderRowCount: t,
466
+ trackingEl: i,
500
467
  trackingLabel: o,
501
468
  className: r,
502
469
  ariaLabel: c = "Table pagination",
503
470
  children: d
504
471
  }) {
505
- const s = He(t), u = p.useMemo(
472
+ const s = Ie(e), u = m.useMemo(
506
473
  () => ({ info: s }),
507
474
  [s]
508
- ), h = {
475
+ ), p = {
509
476
  "data-hook": n,
510
477
  "data-slot": "data-table-pagination",
511
- "data-tracking-el": l,
478
+ "data-tracking-el": i,
512
479
  "data-tracking-label": o
513
480
  };
514
481
  if (d)
515
- return /* @__PURE__ */ e(M.Provider, { value: u, children: /* @__PURE__ */ e(
482
+ return /* @__PURE__ */ a(F.Provider, { value: u, children: /* @__PURE__ */ a(
516
483
  "div",
517
484
  {
518
- className: b("flex items-center gap-4", r),
519
- ...h,
485
+ className: h("flex w-full items-center gap-4", r),
486
+ ...p,
520
487
  children: d
521
488
  }
522
489
  ) });
523
- const g = !i || a === null ? null : a ? a({
490
+ const g = !l || t === null ? null : t ? t({
524
491
  startRow: s.startRow,
525
492
  endRow: s.endRow,
526
493
  totalRows: s.totalRows,
527
494
  pageIndex: s.pageIndex,
528
495
  pageSize: s.pageSize
529
496
  }) : s.totalRows === 0 ? null : `${s.startRow}-${s.endRow} of ${s.totalRows}`;
530
- return /* @__PURE__ */ e(M.Provider, { value: u, children: /* @__PURE__ */ f(
497
+ return /* @__PURE__ */ a(F.Provider, { value: u, children: /* @__PURE__ */ S(
531
498
  "div",
532
499
  {
533
- className: b(
534
- "flex items-center gap-4",
500
+ className: h(
501
+ "flex w-full items-center gap-4",
535
502
  g != null ? "justify-between" : "justify-end",
536
503
  r
537
504
  ),
538
- ...h,
505
+ ...p,
539
506
  children: [
540
- g != null && /* @__PURE__ */ e("span", { className: "text-muted-foreground text-sm", children: g }),
541
- /* @__PURE__ */ e(
507
+ g != null && /* @__PURE__ */ a("span", { className: "text-muted-foreground text-sm", children: g }),
508
+ /* @__PURE__ */ a(
542
509
  _,
543
510
  {
544
511
  ariaLabel: c,
@@ -549,56 +516,111 @@ function Ve({
549
516
  }
550
517
  ) });
551
518
  }
552
- Ve.displayName = "DataTablePagination";
553
- function je({
554
- table: t,
519
+ Fe.displayName = "DataTablePagination";
520
+ function Me({
521
+ table: e,
555
522
  dataHook: n,
556
- trackingEl: i,
557
- trackingLabel: a
523
+ trackingEl: l,
524
+ trackingLabel: t
558
525
  }) {
559
- return /* @__PURE__ */ e(
560
- E,
526
+ return /* @__PURE__ */ a(
527
+ V,
561
528
  {
562
529
  "aria-label": "Select all",
563
- checked: t.getIsAllPageRowsSelected() || t.getIsSomePageRowsSelected() && "indeterminate",
530
+ checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
564
531
  dataHook: n || "select-all-checkbox",
565
- trackingEl: i,
566
- trackingLabel: a,
567
- onCheckedChange: (l) => t.toggleAllPageRowsSelected(!!l)
532
+ trackingEl: l,
533
+ trackingLabel: t,
534
+ onCheckedChange: (i) => e.toggleAllPageRowsSelected(!!i)
568
535
  }
569
536
  );
570
537
  }
571
- je.displayName = "DataTableSelectAllCheckbox";
572
- function Ge({
573
- row: t,
538
+ Me.displayName = "DataTableSelectAllCheckbox";
539
+ function Ae({
540
+ row: e,
574
541
  dataHook: n,
575
- trackingEl: i,
576
- trackingLabel: a
542
+ trackingEl: l,
543
+ trackingLabel: t
577
544
  }) {
578
- return /* @__PURE__ */ e(
579
- E,
545
+ return /* @__PURE__ */ a(
546
+ V,
580
547
  {
581
548
  "aria-label": "Select row",
582
- checked: t.getIsSelected(),
583
- dataHook: n || `select-row-${t.id}`,
584
- disabled: !t.getCanSelect(),
585
- trackingEl: i,
586
- trackingLabel: a,
587
- onCheckedChange: (l) => t.toggleSelected(!!l)
549
+ checked: e.getIsSelected(),
550
+ dataHook: n || `select-row-${e.id}`,
551
+ disabled: !e.getCanSelect(),
552
+ trackingEl: l,
553
+ trackingLabel: t,
554
+ onCheckedChange: (i) => e.toggleSelected(!!i)
555
+ }
556
+ );
557
+ }
558
+ Ae.displayName = "DataTableSelectRowCheckbox";
559
+ function He({
560
+ dataHook: e,
561
+ className: n,
562
+ children: l
563
+ }) {
564
+ return /* @__PURE__ */ a(
565
+ "div",
566
+ {
567
+ className: h(
568
+ "flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
569
+ n
570
+ ),
571
+ "data-hook": e,
572
+ "data-slot": "data-table-toolbar",
573
+ children: l
574
+ }
575
+ );
576
+ }
577
+ He.displayName = "DataTableToolbar";
578
+ function Ve({
579
+ className: e,
580
+ children: n
581
+ }) {
582
+ return /* @__PURE__ */ a(
583
+ "div",
584
+ {
585
+ className: h(
586
+ "flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
587
+ e
588
+ ),
589
+ "data-slot": "data-table-toolbar-left",
590
+ children: n
591
+ }
592
+ );
593
+ }
594
+ Ve.displayName = "DataTableToolbarLeft";
595
+ function je({
596
+ className: e,
597
+ children: n
598
+ }) {
599
+ return /* @__PURE__ */ a(
600
+ "div",
601
+ {
602
+ className: h(
603
+ "flex w-full items-center justify-end gap-2 sm:w-auto",
604
+ e
605
+ ),
606
+ "data-slot": "data-table-toolbar-right",
607
+ children: n
588
608
  }
589
609
  );
590
610
  }
591
- Ge.displayName = "DataTableSelectRowCheckbox";
611
+ je.displayName = "DataTableToolbarRight";
592
612
  export {
593
- $e as DataTable,
594
- Me as DataTableColumnHeader,
595
- Ve as DataTablePagination,
613
+ ye as DataTable,
614
+ De as DataTableColumnHeader,
615
+ Fe as DataTablePagination,
596
616
  _ as DataTablePaginationNav,
597
- Ee as DataTablePaginationRowCount,
598
- Fe as DataTableRowActions,
599
- Ae as DataTableSearch,
600
- je as DataTableSelectAllCheckbox,
601
- Ge as DataTableSelectRowCheckbox,
602
- Ie as VirtualizedDataTable,
603
- Ze as useDataTable
617
+ $e as DataTablePaginationRowCount,
618
+ ze as DataTableSearch,
619
+ Me as DataTableSelectAllCheckbox,
620
+ Ae as DataTableSelectRowCheckbox,
621
+ He as DataTableToolbar,
622
+ Ve as DataTableToolbarLeft,
623
+ je as DataTableToolbarRight,
624
+ Ne as VirtualizedDataTable,
625
+ Qe as useDataTable
604
626
  };