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