@tetrascience-npm/tetrascience-react-ui 0.5.0-beta.41.1 → 0.5.0-beta.43.1

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.
@@ -1,293 +1,398 @@
1
- import { jsx as t, jsxs as b } from "react/jsx-runtime";
2
- import { useSensors as xe, useSensor as A, PointerSensor as ye, KeyboardSensor as Ce, DndContext as we, closestCenter as De, DragOverlay as Te } from "@dnd-kit/core";
3
- import { restrictToHorizontalAxis as _e } from "@dnd-kit/modifiers";
4
- import { sortableKeyboardCoordinates as Ne, arrayMove as Ie, SortableContext as Re, horizontalListSortingStrategy as He, useSortable as Me } from "@dnd-kit/sortable";
5
- import { CSS as Oe } from "@dnd-kit/utilities";
6
- import { useReactTable as ke, getPaginationRowModel as ze, getSortedRowModel as Ve, getCoreRowModel as Ee, flexRender as B } from "@tanstack/react-table";
7
- import { GripVerticalIcon as Ae, ArrowUpIcon as Le, ArrowDownIcon as Ke, ArrowUpDownIcon as Pe } from "lucide-react";
8
- import * as s from "react";
9
- import { DataTablePagination as je } from "./data-table-pagination.js";
10
- import { Table as L, TableHeader as K, TableRow as D, TableBody as P, TableHead as G, TableCell as j } from "../table.js";
11
- import { cn as S } from "../../../lib/utils.js";
12
- const X = s.createContext(null);
13
- function tt() {
14
- const o = s.useContext(X);
15
- if (!o)
1
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
2
+ import { useSensors as ke, useSensor as q, PointerSensor as Ve, KeyboardSensor as Ee, DndContext as Le, closestCenter as Ke, DragOverlay as Ae } from "@dnd-kit/core";
3
+ import { restrictToHorizontalAxis as Fe } from "@dnd-kit/modifiers";
4
+ import { sortableKeyboardCoordinates as je, arrayMove as Ge, SortableContext as Pe, horizontalListSortingStrategy as qe, useSortable as Ue } from "@dnd-kit/sortable";
5
+ import { CSS as We } from "@dnd-kit/utilities";
6
+ import { useReactTable as Be, getPaginationRowModel as Xe, getSortedRowModel as Ye, getCoreRowModel as Je, flexRender as Q } from "@tanstack/react-table";
7
+ import { GripVerticalIcon as Qe, ArrowUpIcon as Ze, ArrowDownIcon as $e, ArrowUpDownIcon as et } from "lucide-react";
8
+ import * as i from "react";
9
+ import { DataTablePagination as tt } from "./data-table-pagination.js";
10
+ import { Table as U, TableHeader as W, TableRow as H, TableBody as B, TableHead as Z, TableCell as X } from "../table.js";
11
+ import { cn as h } from "../../../lib/utils.js";
12
+ function ot(n, l, c) {
13
+ const s = n.toLowerCase().trim(), a = c.toLowerCase().trim();
14
+ switch (l) {
15
+ case "contains":
16
+ return s.includes(a);
17
+ case "equals":
18
+ return s === a;
19
+ case "not_equals":
20
+ return s !== a;
21
+ case "starts_with":
22
+ return s.startsWith(a);
23
+ case "ends_with":
24
+ return s.endsWith(a);
25
+ case "is_empty":
26
+ return s === "";
27
+ case "is_not_empty":
28
+ return s !== "";
29
+ default:
30
+ return !0;
31
+ }
32
+ }
33
+ const $ = i.createContext(null);
34
+ function ht() {
35
+ const n = i.useContext($);
36
+ if (!n)
16
37
  throw new Error("useDataTable must be used within a <DataTable>");
17
- return o;
38
+ return n;
18
39
  }
19
- function Fe({
20
- header: o,
21
- children: a,
22
- position: l,
23
- numeric: i
40
+ function nt({
41
+ header: n,
42
+ children: l,
43
+ position: c,
44
+ numeric: s,
45
+ truncate: a
24
46
  }) {
25
47
  const {
26
- attributes: n,
27
- listeners: g,
28
- setNodeRef: v,
29
- transform: m,
30
- transition: T,
31
- isDragging: f
32
- } = Me({ id: o.column.id }), _ = {
33
- transform: Oe.Transform.toString(
34
- m ? { ...m, scaleX: 1, scaleY: 1 } : null
48
+ attributes: r,
49
+ listeners: f,
50
+ setNodeRef: y,
51
+ transform: g,
52
+ transition: C,
53
+ isDragging: v
54
+ } = Ue({ id: n.column.id }), D = {
55
+ transform: We.Transform.toString(
56
+ g ? { ...g, scaleX: 1, scaleY: 1 } : null
35
57
  ),
36
- transition: T,
58
+ transition: C,
37
59
  position: "relative"
38
60
  };
39
- return /* @__PURE__ */ t(
40
- G,
61
+ return /* @__PURE__ */ o(
62
+ Z,
41
63
  {
42
- ref: v,
43
- style: _,
44
- variant: i ? "numeric" : void 0,
45
- className: S(
64
+ ref: y,
65
+ style: D,
66
+ variant: s ? "numeric" : void 0,
67
+ truncate: a,
68
+ className: h(
46
69
  "group/header transition-shadow duration-150",
47
- !f && l === "first" && "hover:shadow-[inset_-1px_0_0_0_var(--color-border)]",
48
- !f && l === "last" && "hover:shadow-[inset_1px_0_0_0_var(--color-border)]",
49
- !f && l === "middle" && "hover:shadow-[inset_1px_0_0_0_var(--color-border),inset_-1px_0_0_0_var(--color-border)]",
50
- f && "opacity-40"
70
+ !v && c === "first" && "hover:shadow-[inset_-1px_0_0_0_var(--color-border)]",
71
+ !v && c === "last" && "hover:shadow-[inset_1px_0_0_0_var(--color-border)]",
72
+ !v && c === "middle" && "hover:shadow-[inset_1px_0_0_0_var(--color-border),inset_-1px_0_0_0_var(--color-border)]",
73
+ v && "opacity-40"
51
74
  ),
52
- children: /* @__PURE__ */ b("div", { className: S("flex items-center gap-1", i && "flex-row-reverse"), children: [
53
- /* @__PURE__ */ t("div", { className: "flex-1", children: a }),
54
- /* @__PURE__ */ t(
75
+ children: /* @__PURE__ */ x("div", { className: h("flex items-center gap-1 min-w-0", s && "flex-row-reverse"), children: [
76
+ /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: l }),
77
+ /* @__PURE__ */ o(
55
78
  "button",
56
79
  {
57
80
  type: "button",
58
81
  "data-drag-handle": "",
59
82
  className: "cursor-grab touch-none text-muted-foreground hover:text-foreground active:cursor-grabbing opacity-0 group-hover/header:opacity-100 transition-opacity",
60
- ...n,
61
- ...g,
62
- children: /* @__PURE__ */ t(Ae, { className: "size-3.5" })
83
+ ...r,
84
+ ...f,
85
+ children: /* @__PURE__ */ o(Qe, { className: "size-3.5" })
63
86
  }
64
87
  )
65
88
  ] })
66
89
  }
67
90
  );
68
91
  }
69
- function F({
70
- header: o,
71
- enableSorting: a,
72
- numericColumns: l,
73
- columnLabels: i
92
+ function Y({
93
+ header: n,
94
+ enableSorting: l,
95
+ numericColumns: c,
96
+ columnLabels: s,
97
+ truncate: a
74
98
  }) {
75
- if (o.isPlaceholder) return null;
76
- const n = a && o.column.getCanSort(), g = o.column.getIsSorted(), v = l.has(o.column.id);
77
- return /* @__PURE__ */ b(
99
+ if (n.isPlaceholder) return null;
100
+ const r = l && n.column.getCanSort(), f = n.column.getIsSorted(), y = c.has(n.column.id);
101
+ return /* @__PURE__ */ x(
78
102
  "div",
79
103
  {
80
- className: S(
81
- "flex items-center gap-1",
82
- n && "group/sort cursor-pointer select-none",
83
- v && "flex-row-reverse"
104
+ className: h(
105
+ "flex items-center gap-1 min-w-0",
106
+ r && "group/sort cursor-pointer select-none",
107
+ y && "flex-row-reverse"
84
108
  ),
85
- onClick: n ? o.column.getToggleSortingHandler() : void 0,
86
- onKeyDown: (m) => {
87
- (m.key === "Enter" || m.key === " ") && n && o.column.getToggleSortingHandler();
109
+ onClick: r ? n.column.getToggleSortingHandler() : void 0,
110
+ onKeyDown: (g) => {
111
+ (g.key === "Enter" || g.key === " ") && r && n.column.getToggleSortingHandler();
88
112
  },
89
113
  children: [
90
- i[o.column.id] ?? B(o.column.columnDef.header, o.getContext()),
91
- n && /* @__PURE__ */ t(
114
+ /* @__PURE__ */ o("span", { className: h("min-w-0", a && "truncate"), children: s[n.column.id] ?? Q(n.column.columnDef.header, n.getContext()) }),
115
+ r && /* @__PURE__ */ o(
92
116
  "span",
93
117
  {
94
- className: S(
95
- !g && "opacity-0 group-hover/sort:opacity-100 transition-opacity"
118
+ className: h(
119
+ !f && "opacity-0 group-hover/sort:opacity-100 transition-opacity"
96
120
  ),
97
- children: g === "asc" ? /* @__PURE__ */ t(Le, { className: "size-3.5 text-foreground" }) : g === "desc" ? /* @__PURE__ */ t(Ke, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ t(Pe, { className: "size-3.5 text-muted-foreground" })
121
+ children: f === "asc" ? /* @__PURE__ */ o(Ze, { className: "size-3.5 text-foreground" }) : f === "desc" ? /* @__PURE__ */ o($e, { className: "size-3.5 text-foreground" }) : /* @__PURE__ */ o(et, { className: "size-3.5 text-muted-foreground" })
98
122
  }
99
123
  )
100
124
  ]
101
125
  }
102
126
  );
103
127
  }
104
- function U({
105
- table: o,
106
- columns: a,
107
- numericColumns: l
128
+ function J({
129
+ table: n,
130
+ columns: l,
131
+ numericColumns: c,
132
+ truncate: s
108
133
  }) {
109
- return o.getRowModel().rows.length === 0 ? /* @__PURE__ */ t(D, { children: /* @__PURE__ */ t(j, { colSpan: a.length, className: "h-24 text-center text-muted-foreground", children: "No results." }) }) : o.getRowModel().rows.map((i) => /* @__PURE__ */ t(D, { "data-state": i.getIsSelected() ? "selected" : void 0, children: i.getVisibleCells().map((n) => /* @__PURE__ */ t(j, { variant: l.has(n.column.id) ? "numeric" : void 0, children: B(n.column.columnDef.cell, n.getContext()) }, n.id)) }, i.id));
134
+ return n.getRowModel().rows.length === 0 ? /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(X, { colSpan: l.length, className: "h-24 text-center text-muted-foreground", children: "No results." }) }) : n.getRowModel().rows.map((a) => /* @__PURE__ */ o(H, { "data-state": a.getIsSelected() ? "selected" : void 0, children: a.getVisibleCells().map((r) => /* @__PURE__ */ o(
135
+ X,
136
+ {
137
+ variant: c.has(r.column.id) ? "numeric" : void 0,
138
+ truncate: s && (r.column.columnDef.meta?.truncate ?? !0),
139
+ children: Q(r.column.columnDef.cell, r.getContext())
140
+ },
141
+ r.id
142
+ )) }, a.id));
110
143
  }
111
- function Ue(o) {
112
- const a = [], l = [], i = [];
113
- return s.Children.forEach(o, (n) => {
114
- s.isValidElement(n) && n.type === Be ? a.push(n) : s.isValidElement(n) && n.type === je ? l.push(n) : i.push(n);
115
- }), { toolbarSlots: a, paginationSlots: l, restSlots: i };
144
+ function rt(n) {
145
+ const l = [], c = [], s = [], a = [];
146
+ return i.Children.forEach(n, (r) => {
147
+ i.isValidElement(r) && r.type === st ? l.push(r) : i.isValidElement(r) && r.type.displayName === "DataTableFilter" ? c.push(r) : i.isValidElement(r) && r.type === tt ? s.push(r) : a.push(r);
148
+ }), { toolbarSlots: l, filterSlots: c, paginationSlots: s, restSlots: a };
116
149
  }
117
- function ot({
118
- columns: o,
119
- data: a,
120
- toolbar: l,
121
- enableSorting: i = !1,
122
- enableColumnVisibility: n = !1,
123
- children: g,
124
- columnOrder: v,
125
- onColumnOrderChange: m,
126
- columnVisibility: T,
127
- onColumnVisibilityChange: f,
128
- columnLabels: _,
129
- onColumnLabelChange: H,
130
- enablePagination: y = !1,
131
- defaultPageSize: Y = 10,
132
- pagination: N,
133
- onPaginationChange: I,
134
- enableColumnReorder: q = !1,
135
- density: M = "default",
136
- className: J,
137
- variant: O = "card",
138
- containerClassName: k
150
+ function yt({
151
+ columns: n,
152
+ data: l,
153
+ toolbar: c,
154
+ enableSorting: s = !1,
155
+ enableColumnVisibility: a = !1,
156
+ children: r,
157
+ columnOrder: f,
158
+ onColumnOrderChange: y,
159
+ columnVisibility: g,
160
+ onColumnVisibilityChange: C,
161
+ columnLabels: v,
162
+ onColumnLabelChange: D,
163
+ enablePagination: _ = !1,
164
+ defaultPageSize: ee = 10,
165
+ pagination: M,
166
+ onPaginationChange: R,
167
+ enableColumnReorder: te = !1,
168
+ enableFiltering: z = !1,
169
+ filters: oe,
170
+ onFiltersChange: E,
171
+ filterConfig: O,
172
+ manualFiltering: L = !1,
173
+ density: K = "default",
174
+ className: ne,
175
+ variant: A = "card",
176
+ containerClassName: F,
177
+ truncate: S = !0
139
178
  }) {
140
- const [Q, W] = s.useState([]), [Z, $] = s.useState({}), [ee, te] = s.useState([]), [oe, ne] = s.useState({}), [re, se] = s.useState({
179
+ const [re, se] = i.useState([]), [ie, le] = i.useState({}), [ae, ce] = i.useState([]), [ue, de] = i.useState({}), [me, fe] = i.useState({
141
180
  pageIndex: 0,
142
- pageSize: Y
143
- }), ie = N ?? re, R = T ?? Z, p = v ?? ee, C = _ ?? oe, ae = s.useMemo(() => {
144
- if (y)
145
- return I ? (e) => {
146
- const r = typeof e == "function" ? e(N) : e;
147
- I(r);
148
- } : se;
149
- }, [y, I, N]), le = s.useMemo(() => {
150
- if (n)
181
+ pageSize: ee
182
+ }), [ge, pe] = i.useState([]), he = M ?? me, k = oe ?? ge, V = g ?? ie, p = f ?? ae, T = v ?? ue, ye = i.useMemo(() => {
183
+ if (_)
184
+ return R ? (e) => {
185
+ const t = typeof e == "function" ? e(M) : e;
186
+ R(t);
187
+ } : fe;
188
+ }, [_, R, M]), ve = i.useMemo(() => {
189
+ if (a)
151
190
  return (e) => {
152
- const r = typeof e == "function" ? e(R) : e;
153
- (f ?? $)(r);
191
+ const t = typeof e == "function" ? e(V) : e;
192
+ (C ?? le)(t);
154
193
  };
155
- }, [n, R, f]), ce = s.useCallback(
194
+ }, [a, V, C]), Se = i.useCallback(
156
195
  (e) => {
157
- const r = typeof e == "function" ? e(p) : e;
158
- (m ?? te)(r);
196
+ (E ?? pe)(e);
159
197
  },
160
- [p, m]
161
- ), d = ke({
162
- data: a,
163
- columns: o,
198
+ [E]
199
+ ), be = i.useMemo(() => O || n.filter((e) => "accessorKey" in e).map((e) => ({ columnId: String(e.accessorKey) })), [O, n]), xe = i.useMemo(() => {
200
+ if (!z || L) return l;
201
+ const e = k.filter(
202
+ (t) => t.columnId && t.operator && (t.value.trim() !== "" || t.operator === "is_empty" || t.operator === "is_not_empty")
203
+ );
204
+ return e.length === 0 ? l : l.filter(
205
+ (t) => e.every((u) => {
206
+ const m = String(
207
+ t[u.columnId] ?? ""
208
+ );
209
+ return ot(m, u.operator, u.value);
210
+ })
211
+ );
212
+ }, [l, k, z, L]), we = i.useCallback(
213
+ (e) => {
214
+ const t = typeof e == "function" ? e(p) : e;
215
+ (y ?? ce)(t);
216
+ },
217
+ [p, y]
218
+ ), d = Be({
219
+ data: xe,
220
+ columns: n,
164
221
  state: {
165
- sorting: i ? Q : void 0,
166
- columnVisibility: n ? R : void 0,
222
+ sorting: s ? re : void 0,
223
+ columnVisibility: a ? V : void 0,
167
224
  columnOrder: p.length > 0 ? p : void 0,
168
- ...y ? { pagination: ie } : {}
225
+ ..._ ? { pagination: he } : {}
169
226
  },
170
- onSortingChange: i ? W : void 0,
171
- onPaginationChange: ae,
172
- onColumnVisibilityChange: le,
173
- onColumnOrderChange: ce,
174
- getCoreRowModel: Ee(),
175
- getSortedRowModel: i ? Ve() : void 0,
176
- getPaginationRowModel: y ? ze() : void 0
177
- }), de = s.useCallback(
178
- (e, r) => {
179
- (H ?? ((c, u) => ne((w) => ({ ...w, [c]: u }))))(e, r);
227
+ onSortingChange: s ? se : void 0,
228
+ onPaginationChange: ye,
229
+ onColumnVisibilityChange: ve,
230
+ onColumnOrderChange: we,
231
+ getCoreRowModel: Je(),
232
+ getSortedRowModel: s ? Ye() : void 0,
233
+ getPaginationRowModel: _ ? Xe() : void 0
234
+ }), Ce = i.useCallback(
235
+ (e, t) => {
236
+ (D ?? ((u, m) => de((N) => ({ ...N, [u]: m }))))(e, t);
180
237
  },
181
- [H]
182
- ), ue = xe(
183
- A(ye, { activationConstraint: { distance: 5 } }),
184
- A(Ce, { coordinateGetter: Ne })
185
- ), [z, V] = s.useState(null), me = s.useCallback(
238
+ [D]
239
+ ), De = ke(
240
+ q(Ve, { activationConstraint: { distance: 5 } }),
241
+ q(Ee, { coordinateGetter: je })
242
+ ), [j, G] = i.useState(null), _e = i.useCallback(
186
243
  (e) => {
187
- V(String(e.active.id));
244
+ G(String(e.active.id));
188
245
  },
189
246
  []
190
- ), ge = s.useCallback(
247
+ ), Te = i.useCallback(
191
248
  (e) => {
192
- V(null);
193
- const { active: r, over: c } = e;
194
- if (!c || r.id === c.id) return;
195
- const u = p.length > 0 ? p : d.getAllLeafColumns().map((ve) => ve.id), w = u.indexOf(String(r.id)), E = u.indexOf(String(c.id));
196
- if (w === -1 || E === -1) return;
197
- const Se = Ie(u, w, E);
198
- d.setColumnOrder(Se);
249
+ G(null);
250
+ const { active: t, over: u } = e;
251
+ if (!u || t.id === u.id) return;
252
+ const m = p.length > 0 ? p : d.getAllLeafColumns().map((Oe) => Oe.id), N = m.indexOf(String(t.id)), P = m.indexOf(String(u.id));
253
+ if (N === -1 || P === -1) return;
254
+ const ze = Ge(m, N, P);
255
+ d.setColumnOrder(ze);
199
256
  },
200
257
  [p, d]
201
- ), x = z ? d.getFlatHeaders().find((e) => e.column.id === z) : null, h = s.useMemo(() => {
202
- if (a.length === 0) return /* @__PURE__ */ new Set();
203
- const e = a[0], r = /* @__PURE__ */ new Set();
204
- for (const c of o) {
205
- const u = "accessorKey" in c ? String(c.accessorKey) : "";
206
- u && typeof e[u] == "number" && r.add(u);
258
+ ), w = j ? d.getFlatHeaders().find((e) => e.column.id === j) : null, b = i.useMemo(() => {
259
+ if (l.length === 0) return /* @__PURE__ */ new Set();
260
+ const e = l[0], t = /* @__PURE__ */ new Set();
261
+ for (const u of n) {
262
+ const m = "accessorKey" in u ? String(u.accessorKey) : "";
263
+ m && typeof e[m] == "number" && t.add(m);
207
264
  }
208
- return r;
209
- }, [a, o]), fe = {
265
+ return t;
266
+ }, [l, n]), I = n.some((e) => e.size != null), Ie = {
210
267
  table: d,
211
- columnLabels: C,
212
- setColumnLabel: de
213
- }, { toolbarSlots: pe, paginationSlots: he, restSlots: be } = Ue(g);
214
- return /* @__PURE__ */ t(X.Provider, { value: fe, children: /* @__PURE__ */ b("div", { "data-slot": "data-table", className: S("w-full space-y-2", J), children: [
215
- l,
216
- pe,
217
- q ? /* @__PURE__ */ b(
218
- we,
268
+ columnLabels: T,
269
+ setColumnLabel: Ce,
270
+ filters: k,
271
+ setFilters: Se,
272
+ filterConfig: be,
273
+ enableFiltering: z
274
+ }, { toolbarSlots: Ne, filterSlots: He, paginationSlots: Me, restSlots: Re } = rt(r);
275
+ return /* @__PURE__ */ o($.Provider, { value: Ie, children: /* @__PURE__ */ x("div", { "data-slot": "data-table", className: h("w-full space-y-2", ne), children: [
276
+ c,
277
+ Ne,
278
+ He,
279
+ te ? /* @__PURE__ */ x(
280
+ Le,
219
281
  {
220
- sensors: ue,
221
- collisionDetection: De,
222
- modifiers: [_e],
223
- onDragStart: me,
224
- onDragEnd: ge,
282
+ sensors: De,
283
+ collisionDetection: Ke,
284
+ modifiers: [Fe],
285
+ onDragStart: _e,
286
+ onDragEnd: Te,
225
287
  children: [
226
- /* @__PURE__ */ t(
227
- Re,
288
+ /* @__PURE__ */ o(
289
+ Pe,
228
290
  {
229
291
  items: d.getFlatHeaders().map((e) => e.column.id),
230
- strategy: He,
231
- children: /* @__PURE__ */ b(L, { "data-density": M, variant: O, containerClassName: k, children: [
232
- /* @__PURE__ */ t(K, { children: d.getHeaderGroups().map((e) => /* @__PURE__ */ t(D, { children: e.headers.map((r, c) => /* @__PURE__ */ t(
233
- Fe,
234
- {
235
- header: r,
236
- position: c === 0 ? "first" : c === e.headers.length - 1 ? "last" : "middle",
237
- numeric: h.has(r.column.id),
238
- children: /* @__PURE__ */ t(
239
- F,
292
+ strategy: qe,
293
+ children: /* @__PURE__ */ x(
294
+ U,
295
+ {
296
+ "data-density": K,
297
+ variant: A,
298
+ containerClassName: F,
299
+ layout: I ? "fixed" : void 0,
300
+ children: [
301
+ I && /* @__PURE__ */ o("colgroup", { children: d.getHeaderGroups()[0]?.headers.map((e) => /* @__PURE__ */ o(
302
+ "col",
303
+ {
304
+ style: { width: e.column.getSize() }
305
+ },
306
+ e.id
307
+ )) }),
308
+ /* @__PURE__ */ o(W, { children: d.getHeaderGroups().map((e) => /* @__PURE__ */ o(H, { children: e.headers.map((t, u) => /* @__PURE__ */ o(
309
+ nt,
240
310
  {
241
- header: r,
242
- enableSorting: i,
243
- numericColumns: h,
244
- columnLabels: C
245
- }
246
- )
247
- },
248
- r.id
249
- )) }, e.id)) }),
250
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(U, { table: d, columns: o, numericColumns: h }) })
251
- ] })
311
+ header: t,
312
+ position: u === 0 ? "first" : u === e.headers.length - 1 ? "last" : "middle",
313
+ numeric: b.has(t.column.id),
314
+ truncate: S && (t.column.columnDef.meta?.truncate ?? !0),
315
+ children: /* @__PURE__ */ o(
316
+ Y,
317
+ {
318
+ header: t,
319
+ enableSorting: s,
320
+ numericColumns: b,
321
+ columnLabels: T,
322
+ truncate: S && (t.column.columnDef.meta?.truncate ?? !0)
323
+ }
324
+ )
325
+ },
326
+ t.id
327
+ )) }, e.id)) }),
328
+ /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(J, { table: d, columns: n, numericColumns: b, truncate: S }) })
329
+ ]
330
+ }
331
+ )
252
332
  }
253
333
  ),
254
- /* @__PURE__ */ t(Te, { dropAnimation: null, children: x && /* @__PURE__ */ t("div", { className: "rounded-md border bg-background px-4 py-3 text-sm font-medium shadow-lg", children: C[x.column.id] ?? (typeof x.column.columnDef.header == "string" ? x.column.columnDef.header : x.column.id) }) })
334
+ /* @__PURE__ */ o(Ae, { dropAnimation: null, children: w && /* @__PURE__ */ o("div", { className: "rounded-md border bg-background px-4 py-3 text-sm font-medium shadow-lg", children: T[w.column.id] ?? (typeof w.column.columnDef.header == "string" ? w.column.columnDef.header : w.column.id) }) })
255
335
  ]
256
336
  }
257
- ) : /* @__PURE__ */ b(L, { "data-density": M, variant: O, containerClassName: k, children: [
258
- /* @__PURE__ */ t(K, { children: d.getHeaderGroups().map((e) => /* @__PURE__ */ t(D, { children: e.headers.map((r) => /* @__PURE__ */ t(G, { variant: h.has(r.column.id) ? "numeric" : void 0, children: /* @__PURE__ */ t(
259
- F,
260
- {
261
- header: r,
262
- enableSorting: i,
263
- numericColumns: h,
264
- columnLabels: C
265
- }
266
- ) }, r.id)) }, e.id)) }),
267
- /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(U, { table: d, columns: o, numericColumns: h }) })
268
- ] }),
269
- he,
270
- be
337
+ ) : /* @__PURE__ */ x(
338
+ U,
339
+ {
340
+ "data-density": K,
341
+ variant: A,
342
+ containerClassName: F,
343
+ layout: I ? "fixed" : void 0,
344
+ children: [
345
+ I && /* @__PURE__ */ o("colgroup", { children: d.getHeaderGroups()[0]?.headers.map((e) => /* @__PURE__ */ o(
346
+ "col",
347
+ {
348
+ style: e.column.columnDef.size == null ? void 0 : { width: e.column.columnDef.size }
349
+ },
350
+ e.id
351
+ )) }),
352
+ /* @__PURE__ */ o(W, { children: d.getHeaderGroups().map((e) => /* @__PURE__ */ o(H, { children: e.headers.map((t) => /* @__PURE__ */ o(
353
+ Z,
354
+ {
355
+ variant: b.has(t.column.id) ? "numeric" : void 0,
356
+ truncate: S && (t.column.columnDef.meta?.truncate ?? !0),
357
+ children: /* @__PURE__ */ o(
358
+ Y,
359
+ {
360
+ header: t,
361
+ enableSorting: s,
362
+ numericColumns: b,
363
+ columnLabels: T,
364
+ truncate: S && (t.column.columnDef.meta?.truncate ?? !0)
365
+ }
366
+ )
367
+ },
368
+ t.id
369
+ )) }, e.id)) }),
370
+ /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(J, { table: d, columns: n, numericColumns: b, truncate: S }) })
371
+ ]
372
+ }
373
+ ),
374
+ Me,
375
+ Re
271
376
  ] }) });
272
377
  }
273
- function Be({
274
- className: o,
275
- children: a,
276
- ...l
378
+ function st({
379
+ className: n,
380
+ children: l,
381
+ ...c
277
382
  }) {
278
- return /* @__PURE__ */ t(
383
+ return /* @__PURE__ */ o(
279
384
  "div",
280
385
  {
281
386
  "data-slot": "table-toolbar",
282
- className: S("flex items-center gap-2", o),
283
- ...l,
284
- children: a
387
+ className: h("flex items-center justify-end gap-2", n),
388
+ ...c,
389
+ children: l
285
390
  }
286
391
  );
287
392
  }
288
393
  export {
289
- ot as DataTable,
290
- Be as TableToolbar,
291
- tt as useDataTable
394
+ yt as DataTable,
395
+ st as TableToolbar,
396
+ ht as useDataTable
292
397
  };
293
398
  //# sourceMappingURL=data-table.js.map