@tedi-design-system/react 19.0.0-rc.4 → 19.0.0-rc.5

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,37 +1,37 @@
1
- import { jsx as i, jsxs as se } from "react/jsx-runtime";
2
- import { useReactTable as bn, flexRender as Se } from "../../../../../external/@tanstack/react-table/build/lib/index.es.js";
1
+ import { jsx as r, jsxs as re } from "react/jsx-runtime";
2
+ import { useReactTable as Cn, flexRender as De } from "../../../../../external/@tanstack/react-table/build/lib/index.es.js";
3
3
  import k from "../../../../../external/classnames/index.es.js";
4
- import { useRef as A, useId as hn, useMemo as w, useCallback as N, useState as K, useEffect as ht, Fragment as wn } from "react";
4
+ import { useRef as z, useId as _n, useMemo as w, useCallback as N, useState as B, useEffect as Me, Fragment as xn } from "react";
5
5
  import { Icon as _t } from "../../base/icon/icon.es.js";
6
- import { CollapseButton as _n } from "../../buttons/collapse-button/collapse-button.es.js";
7
- import { Checkbox as wt } from "../../form/checkbox/checkbox.es.js";
8
- import { Radio as vn } from "../../form/radio/radio.es.js";
9
- import { TextField as Cn } from "../../form/textfield/textfield.es.js";
6
+ import { CollapseButton as Sn } from "../../buttons/collapse-button/collapse-button.es.js";
7
+ import { Checkbox as Ct } from "../../form/checkbox/checkbox.es.js";
8
+ import { Radio as Dn } from "../../form/radio/radio.es.js";
9
+ import { TextField as Rn } from "../../form/textfield/textfield.es.js";
10
10
  import l from "./table.module.scss.es.js";
11
- import { TableColumnsMenu as xn } from "./table-columns-menu/table-columns-menu.es.js";
12
- import { TableContext as Sn } from "./table-context.es.js";
13
- import { TableHeaderButton as Dn } from "./table-header-button/table-header-button.es.js";
14
- import { TableToolbar as Rn } from "./table-toolbar/table-toolbar.es.js";
15
- import { useTablePersistence as yn } from "./use-table-persistence.es.js";
16
- import { useLabels as In } from "../../../providers/label-provider/use-labels.es.js";
17
- import { getCoreRowModel as kn, getFilteredRowModel as Tn, getSortedRowModel as En, getExpandedRowModel as Nn, getPaginationRowModel as On } from "../../../../../external/@tanstack/table-core/build/lib/index.es.js";
18
- import { Pagination as $n } from "../../navigation/pagination/pagination.es.js";
19
- const no = (R, T) => (V) => {
11
+ import { TableColumnsMenu as yn } from "./table-columns-menu/table-columns-menu.es.js";
12
+ import { TableContext as In } from "./table-context.es.js";
13
+ import { TableHeaderButton as kn } from "./table-header-button/table-header-button.es.js";
14
+ import { TableToolbar as En } from "./table-toolbar/table-toolbar.es.js";
15
+ import { useTablePersistence as Tn } from "./use-table-persistence.es.js";
16
+ import { useLabels as Nn } from "../../../providers/label-provider/use-labels.es.js";
17
+ import { getCoreRowModel as On, getFilteredRowModel as Ln, getSortedRowModel as $n, getExpandedRowModel as Pn, getPaginationRowModel as An } from "../../../../../external/@tanstack/table-core/build/lib/index.es.js";
18
+ import { Pagination as Fn } from "../../navigation/pagination/pagination.es.js";
19
+ const io = (R, E) => (V) => {
20
20
  const x = V.index;
21
21
  if (x < 0 || x >= R.length) return 1;
22
- const O = T(R[x]);
23
- if (x > 0 && T(R[x - 1]) === O) return 0;
24
- let E = 1;
25
- for (let F = x + 1; F < R.length && T(R[F]) === O; F++)
26
- E++;
27
- return E;
28
- }, vt = "data-tedi-drag-handle", Ln = ({
22
+ const L = E(R[x]);
23
+ if (x > 0 && E(R[x - 1]) === L) return 0;
24
+ let T = 1;
25
+ for (let U = x + 1; U < R.length && E(R[U]) === L; U++)
26
+ T++;
27
+ return T;
28
+ }, xt = "data-tedi-drag-handle", zn = ({
29
29
  label: R,
30
- onHandlePointerDown: T,
30
+ onHandlePointerDown: E,
31
31
  id: V,
32
32
  pickedUp: x,
33
- onKeyDown: O
34
- }) => /* @__PURE__ */ i(
33
+ onKeyDown: L
34
+ }) => /* @__PURE__ */ r(
35
35
  "button",
36
36
  {
37
37
  type: "button",
@@ -41,157 +41,158 @@ const no = (R, T) => (V) => {
41
41
  }),
42
42
  "aria-label": R,
43
43
  "aria-pressed": x,
44
- onClick: (E) => E.stopPropagation(),
45
- onMouseDown: T,
46
- onTouchStart: T,
47
- onKeyDown: O,
48
- [vt]: "",
49
- children: /* @__PURE__ */ i(_t, { name: "drag_indicator", size: 18, color: "inherit" })
44
+ onClick: (T) => T.stopPropagation(),
45
+ onMouseDown: E,
46
+ onTouchStart: E,
47
+ onKeyDown: L,
48
+ [xt]: "",
49
+ children: /* @__PURE__ */ r(_t, { name: "drag_indicator", size: 18, color: "inherit" })
50
50
  }
51
- ), Pn = (R) => {
51
+ ), Bn = (R) => {
52
52
  const {
53
- row: T,
53
+ row: E,
54
54
  rowClassName: V,
55
55
  rowStyle: x,
56
- isActiveRow: O,
57
- clickable: E,
58
- onClick: F,
59
- onKeyDownHandler: Re,
60
- ariaRowIndex: ye,
61
- columnProps: oe,
62
- draggable: ce,
63
- dragHandleLabel: ue,
56
+ isActiveRow: L,
57
+ clickable: T,
58
+ onClick: U,
59
+ onKeyDownHandler: ye,
60
+ ariaRowIndex: Ie,
61
+ columnProps: ne,
62
+ draggable: de,
63
+ dragHandleLabel: ce,
64
64
  dragHandlers: u,
65
- dragHandleId: Ie,
66
- dragHandlePickedUp: ke,
67
- dragOverColumnId: ge
65
+ dragHandleId: ke,
66
+ dragHandlePickedUp: Ee,
67
+ dragOverColumnId: ue
68
68
  } = R;
69
- return /* @__PURE__ */ i(
69
+ return /* @__PURE__ */ r(
70
70
  "tr",
71
71
  {
72
72
  className: V,
73
73
  style: x,
74
- draggable: ce || void 0,
74
+ draggable: de || void 0,
75
75
  onDragStart: u == null ? void 0 : u.onDragStart,
76
76
  onDragOver: u == null ? void 0 : u.onDragOver,
77
77
  onDragLeave: u == null ? void 0 : u.onDragLeave,
78
78
  onDragEnd: u == null ? void 0 : u.onDragEnd,
79
79
  onDrop: u == null ? void 0 : u.onDrop,
80
- onClick: E && F ? () => F(T) : void 0,
81
- onKeyDown: E ? Re : void 0,
82
- tabIndex: E ? 0 : void 0,
83
- role: E ? "button" : void 0,
84
- "aria-rowindex": ye,
85
- "aria-current": O ? "true" : void 0,
86
- children: T.getVisibleCells().map(($) => {
87
- var pe;
88
- const g = $.column.columnDef.meta, z = oe == null ? void 0 : oe($.column.id), le = ce && $.column.id === De, B = !!ge && $.column.id === ge, G = (pe = g == null ? void 0 : g.rowSpan) == null ? void 0 : pe.call(g, $.row);
89
- return G === 0 ? null : /* @__PURE__ */ i(
80
+ onClick: T && U ? () => U(E) : void 0,
81
+ onKeyDown: T ? ye : void 0,
82
+ tabIndex: T ? 0 : void 0,
83
+ role: T ? "button" : void 0,
84
+ "aria-rowindex": Ie,
85
+ "aria-current": L ? "true" : void 0,
86
+ children: E.getVisibleCells().map(($) => {
87
+ var oe;
88
+ const g = $.column.columnDef.meta, P = ne == null ? void 0 : ne($.column.id), ge = de && $.column.id === Re, me = !!ue && $.column.id === ue, O = (oe = g == null ? void 0 : g.rowSpan) == null ? void 0 : oe.call(g, $.row);
89
+ return O === 0 ? null : /* @__PURE__ */ r(
90
90
  "td",
91
91
  {
92
- rowSpan: G && G > 1 ? G : void 0,
92
+ rowSpan: O && O > 1 ? O : void 0,
93
93
  className: k(
94
94
  l["tedi-table__cell"],
95
95
  {
96
96
  [l[`tedi-table__cell--align-${g == null ? void 0 : g.align}`]]: g == null ? void 0 : g.align,
97
97
  [l[`tedi-table__cell--valign-${g == null ? void 0 : g.vAlign}`]]: g == null ? void 0 : g.vAlign,
98
- [l["tedi-table__cell--drag-handle"]]: le,
99
- [l["tedi-table__cell--drag-over"]]: B
98
+ [l["tedi-table__cell--drag-handle"]]: ge,
99
+ [l["tedi-table__cell--drag-over"]]: me
100
100
  },
101
- z == null ? void 0 : z.className
101
+ P == null ? void 0 : P.className
102
102
  ),
103
- style: z == null ? void 0 : z.style,
104
- children: le ? /* @__PURE__ */ i(
105
- Ln,
103
+ style: P == null ? void 0 : P.style,
104
+ children: ge ? /* @__PURE__ */ r(
105
+ zn,
106
106
  {
107
- label: ue,
107
+ label: ce,
108
108
  onHandlePointerDown: (u == null ? void 0 : u.onHandlePointerDown) ?? (() => {
109
109
  }),
110
110
  onKeyDown: u == null ? void 0 : u.onKeyDown,
111
- id: Ie,
112
- pickedUp: ke
111
+ id: ke,
112
+ pickedUp: Ee
113
113
  }
114
- ) : Se($.column.columnDef.cell, $.getContext())
114
+ ) : De($.column.columnDef.cell, $.getContext())
115
115
  },
116
116
  $.id
117
117
  );
118
118
  })
119
119
  }
120
120
  );
121
- }, Me = "__select__", je = "__expand__", De = "__drag__", de = () => !0, An = {
122
- text: de,
123
- select: de,
124
- "multi-select": de,
125
- "date-range": de,
126
- "date-range-period": de
121
+ }, We = "__select__", je = "__expand__", Re = "__drag__", se = () => !0, Un = {
122
+ text: se,
123
+ select: se,
124
+ "multi-select": se,
125
+ "date-range": se,
126
+ "date-range-period": se
127
127
  };
128
- function Fn(R) {
128
+ function Hn(R) {
129
129
  return Array.isArray(R.columns);
130
130
  }
131
- function Ct(R) {
131
+ function St(R) {
132
132
  const {
133
- id: T,
133
+ id: E,
134
134
  data: V,
135
135
  columns: x,
136
- size: O = "medium",
137
- caption: E,
138
- state: F,
139
- defaultState: Re,
140
- onStateChange: ye,
141
- persist: oe,
142
- emptyState: ce,
143
- emptyStateRole: ue,
136
+ size: L = "medium",
137
+ caption: T,
138
+ state: U,
139
+ defaultState: ye,
140
+ onStateChange: Ie,
141
+ persist: ne,
142
+ emptyState: de,
143
+ emptyStateRole: ce,
144
144
  className: u,
145
- children: Ie,
146
- striped: ke = !1,
147
- verticalBorders: ge = !1,
145
+ children: ke,
146
+ striped: Ee = !1,
147
+ verticalBorders: ue = !1,
148
148
  borderless: $ = !1,
149
149
  stickyFirstColumn: g = !1,
150
- stickyHeader: z = !1,
151
- maxHeight: le,
152
- onRowClick: B,
153
- activeRowId: G,
154
- rowHover: pe,
155
- enableRowSelection: We,
150
+ stickyLastColumn: P = !1,
151
+ stickyHeader: ge = !1,
152
+ maxHeight: me,
153
+ onRowClick: O,
154
+ activeRowId: oe,
155
+ rowHover: Dt,
156
+ enableRowSelection: Xe,
156
157
  selectionMode: Te = "multiple",
157
- highlightSelectedRows: xt = !0,
158
- enableColumnFilters: Ee = !1,
159
- renderSubComponent: X,
160
- getRowCanExpand: Xe,
161
- getSubRows: Ye,
162
- getRowId: St,
163
- expandTrigger: Ne = "button",
164
- paginateExpandedRows: Dt = !1,
165
- pagination: M,
166
- autoResetPageIndex: Rt,
167
- manualPagination: j = !1,
168
- manualSorting: Oe = !1,
158
+ highlightSelectedRows: Rt = !0,
159
+ enableColumnFilters: Ne = !1,
160
+ renderSubComponent: j,
161
+ getRowCanExpand: Ye,
162
+ getSubRows: qe,
163
+ getRowId: yt,
164
+ expandTrigger: Oe = "button",
165
+ paginateExpandedRows: It = !1,
166
+ pagination: G,
167
+ autoResetPageIndex: kt,
168
+ manualPagination: M = !1,
169
+ manualSorting: Le = !1,
169
170
  manualFiltering: $e = !1,
170
- pageCount: qe,
171
- rowCount: me,
172
- checkboxProps: Le,
173
- radioProps: Je,
174
- collapseProps: Qe,
175
- rowProps: Pe,
171
+ pageCount: Je,
172
+ rowCount: pe,
173
+ checkboxProps: Pe,
174
+ radioProps: Qe,
175
+ collapseProps: Ze,
176
+ rowProps: Ae,
176
177
  columnProps: W,
177
178
  reorderableRows: S = !1,
178
- onRowDrop: L,
179
- reorderableColumns: Y = !1
180
- } = R, { getLabel: b } = In(), Ze = ce ?? b("table.no-data"), q = A(b);
181
- q.current = b;
182
- const yt = hn(), p = T ?? yt, h = w(() => M ? M === !0 ? { pageSize: 10, pageSizeOptions: [10, 25, 50], paginationProps: void 0 } : {
183
- pageSize: M.pageSize ?? 10,
184
- pageSizeOptions: M.pageSizeOptions === void 0 ? [10, 25, 50] : M.pageSizeOptions,
185
- paginationProps: M.paginationProps
186
- } : null, [M]), y = h !== null, It = w(() => {
179
+ onRowDrop: A,
180
+ reorderableColumns: X = !1
181
+ } = R, { getLabel: b } = Nn(), et = de ?? b("table.no-data"), Y = z(b);
182
+ Y.current = b;
183
+ const Et = _n(), m = E ?? Et, h = w(() => G ? G === !0 ? { pageSize: 10, pageSizeOptions: [10, 25, 50], paginationProps: void 0 } : {
184
+ pageSize: G.pageSize ?? 10,
185
+ pageSizeOptions: G.pageSizeOptions === void 0 ? [10, 25, 50] : G.pageSizeOptions,
186
+ paginationProps: G.paginationProps
187
+ } : null, [G]), y = h !== null, Tt = w(() => {
187
188
  const e = h == null ? void 0 : h.pageSizeOptions;
188
189
  return Array.isArray(e) && e.length > 0 ? e : void 0;
189
- }, [h]), [P, D] = yn({
190
- persist: oe,
191
- controlled: F,
192
- defaultState: Re,
193
- onStateChange: ye
194
- }), kt = N(
190
+ }, [h]), [F, D] = Tn({
191
+ persist: ne,
192
+ controlled: U,
193
+ defaultState: ye,
194
+ onStateChange: Ie
195
+ }), Nt = N(
195
196
  (e) => {
196
197
  D((n) => {
197
198
  const t = n.columnVisibility ?? {};
@@ -199,7 +200,7 @@ function Ct(R) {
199
200
  });
200
201
  },
201
202
  [D]
202
- ), Tt = N(
203
+ ), Ot = N(
203
204
  (e) => {
204
205
  D((n) => {
205
206
  const t = n.rowSelection ?? {};
@@ -207,7 +208,7 @@ function Ct(R) {
207
208
  });
208
209
  },
209
210
  [D]
210
- ), Et = N(
211
+ ), Lt = N(
211
212
  (e) => {
212
213
  D((n) => {
213
214
  const t = n.expanded ?? {};
@@ -215,7 +216,7 @@ function Ct(R) {
215
216
  });
216
217
  },
217
218
  [D]
218
- ), Nt = N(
219
+ ), $t = N(
219
220
  (e) => {
220
221
  D((n) => {
221
222
  const t = n.columnFilters ?? [];
@@ -223,7 +224,7 @@ function Ct(R) {
223
224
  });
224
225
  },
225
226
  [D]
226
- ), Ot = N(
227
+ ), Pt = N(
227
228
  (e) => {
228
229
  D((n) => {
229
230
  const t = n.columnOrder ?? [];
@@ -231,7 +232,7 @@ function Ct(R) {
231
232
  });
232
233
  },
233
234
  [D]
234
- ), $t = N(
235
+ ), At = N(
235
236
  (e) => {
236
237
  D((n) => {
237
238
  const t = n.sorting ?? [];
@@ -239,7 +240,7 @@ function Ct(R) {
239
240
  });
240
241
  },
241
242
  [D]
242
- ), Lt = N(
243
+ ), Ft = N(
243
244
  (e) => {
244
245
  D((n) => {
245
246
  const t = n.pagination ?? {
@@ -250,74 +251,74 @@ function Ct(R) {
250
251
  });
251
252
  },
252
253
  [D, h]
253
- ), ae = !!(X || Ye), et = !!We, Pt = w(() => kn(), []), At = w(() => $e ? void 0 : Tn(), [$e]), Ft = w(() => Oe ? void 0 : En(), [Oe]), zt = w(() => ae ? Nn() : void 0, [ae]), Bt = w(
254
- () => y && !j ? On() : void 0,
255
- [y, j]
256
- ), Ut = w(() => {
254
+ ), le = !!(j || qe), tt = !!Xe, zt = w(() => On(), []), Bt = w(() => $e ? void 0 : Ln(), [$e]), Ut = w(() => Le ? void 0 : $n(), [Le]), Ht = w(() => le ? Pn() : void 0, [le]), Kt = w(
255
+ () => y && !M ? An() : void 0,
256
+ [y, M]
257
+ ), Vt = w(() => {
257
258
  const e = [];
258
259
  if (S && e.push({
259
- id: De,
260
+ id: Re,
260
261
  enableSorting: !1,
261
262
  enableHiding: !1,
262
263
  enableColumnFilter: !1,
263
264
  size: 40,
264
265
  header: "",
265
266
  cell: () => null
266
- }), et) {
267
- const n = Te === "single", t = `${p}-select`;
267
+ }), tt) {
268
+ const n = Te === "single", t = `${m}-select`;
268
269
  e.push({
269
- id: Me,
270
+ id: We,
270
271
  enableSorting: !1,
271
272
  enableHiding: !1,
272
273
  enableColumnFilter: !1,
273
274
  size: 40,
274
- header: n ? "" : ({ table: o }) => /* @__PURE__ */ i(
275
- wt,
275
+ header: n ? "" : ({ table: o }) => /* @__PURE__ */ r(
276
+ Ct,
276
277
  {
277
- ...Le,
278
- id: `${p}-select-all`,
279
- name: `${p}-select-all`,
280
- label: q.current("table.select-all", o.getIsAllPageRowsSelected()),
278
+ ...Pe,
279
+ id: `${m}-select-all`,
280
+ name: `${m}-select-all`,
281
+ label: Y.current("table.select-all", o.getIsAllPageRowsSelected()),
281
282
  hideLabel: !0,
282
283
  value: "all",
283
284
  checked: o.getIsAllPageRowsSelected(),
284
285
  indeterminate: o.getIsSomePageRowsSelected() && !o.getIsAllPageRowsSelected(),
285
- onChange: (a, r) => o.toggleAllPageRowsSelected(r)
286
+ onChange: (a, i) => o.toggleAllPageRowsSelected(i)
286
287
  }
287
288
  ),
288
- cell: ({ row: o }) => n ? /* @__PURE__ */ i(
289
- vn,
289
+ cell: ({ row: o }) => n ? /* @__PURE__ */ r(
290
+ Dn,
290
291
  {
291
- ...Je,
292
- id: `${p}-select-${o.id}`,
292
+ ...Qe,
293
+ id: `${m}-select-${o.id}`,
293
294
  name: t,
294
- label: q.current("table.select-row", o.getIsSelected()),
295
+ label: Y.current("table.select-row", o.getIsSelected()),
295
296
  hideLabel: !0,
296
297
  value: o.id,
297
298
  checked: o.getIsSelected(),
298
299
  disabled: !o.getCanSelect(),
299
- onChange: (a, r) => {
300
- r && o.toggleSelected(!0);
300
+ onChange: (a, i) => {
301
+ i && o.toggleSelected(!0);
301
302
  }
302
303
  }
303
- ) : /* @__PURE__ */ i(
304
- wt,
304
+ ) : /* @__PURE__ */ r(
305
+ Ct,
305
306
  {
306
- ...Le,
307
- id: `${p}-select-${o.id}`,
308
- name: `${p}-select-${o.id}`,
309
- label: q.current("table.select-row", o.getIsSelected()),
307
+ ...Pe,
308
+ id: `${m}-select-${o.id}`,
309
+ name: `${m}-select-${o.id}`,
310
+ label: Y.current("table.select-row", o.getIsSelected()),
310
311
  hideLabel: !0,
311
312
  value: o.id,
312
313
  checked: o.getIsSelected(),
313
314
  disabled: !o.getCanSelect(),
314
315
  indeterminate: o.getIsSomeSelected(),
315
- onChange: (a, r) => o.toggleSelected(r)
316
+ onChange: (a, i) => o.toggleSelected(i)
316
317
  }
317
318
  )
318
319
  });
319
320
  }
320
- return ae && e.push({
321
+ return le && e.push({
321
322
  id: je,
322
323
  enableSorting: !1,
323
324
  enableHiding: !1,
@@ -326,24 +327,24 @@ function Ct(R) {
326
327
  header: "",
327
328
  cell: ({ row: n }) => {
328
329
  if (!n.getCanExpand()) return null;
329
- const t = `${p}-sub-${n.id}`;
330
- return /* @__PURE__ */ i(
330
+ const t = `${m}-sub-${n.id}`;
331
+ return /* @__PURE__ */ r(
331
332
  "span",
332
333
  {
333
334
  onClick: (o) => o.stopPropagation(),
334
335
  onKeyDown: (o) => {
335
336
  (o.key === "Enter" || o.key === " ") && o.stopPropagation();
336
337
  },
337
- children: /* @__PURE__ */ i(
338
- _n,
338
+ children: /* @__PURE__ */ r(
339
+ Sn,
339
340
  {
340
- arrowType: Ne === "row" ? "default" : "secondary",
341
- ...Qe,
341
+ arrowType: Oe === "row" ? "default" : "secondary",
342
+ ...Ze,
342
343
  hideText: !0,
343
- id: `${p}-expand-${n.id}`,
344
- "aria-controls": X ? t : void 0,
345
- openText: q.current("table.expand-row"),
346
- closeText: q.current("table.collapse-row"),
344
+ id: `${m}-expand-${n.id}`,
345
+ "aria-controls": j ? t : void 0,
346
+ openText: Y.current("table.expand-row"),
347
+ closeText: Y.current("table.collapse-row"),
347
348
  open: n.getIsExpanded(),
348
349
  onOpenChange: () => n.toggleExpanded()
349
350
  }
@@ -354,347 +355,364 @@ function Ct(R) {
354
355
  }), [...e, ...x];
355
356
  }, [
356
357
  x,
357
- et,
358
+ tt,
358
359
  Te,
359
- ae,
360
- X,
361
- Ne,
360
+ le,
361
+ j,
362
+ Oe,
362
363
  S,
363
- p,
364
- Le,
365
- Je,
366
- Qe
367
- ]), Ht = w(() => ({}), []), Kt = w(() => ({}), []), Vt = w(() => [], []), Gt = w(() => [], []), Mt = w(() => [], []), jt = w(
364
+ m,
365
+ Pe,
366
+ Qe,
367
+ Ze
368
+ ]), Gt = w(() => ({}), []), Mt = w(() => ({}), []), Wt = w(() => [], []), jt = w(() => [], []), Xt = w(() => [], []), Yt = w(
368
369
  () => ({ pageIndex: 0, pageSize: (h == null ? void 0 : h.pageSize) ?? 10 }),
369
370
  [h]
370
- ), d = bn({
371
+ ), d = Cn({
371
372
  data: V,
372
- columns: Ut,
373
+ columns: Vt,
373
374
  state: {
374
- columnVisibility: P.columnVisibility,
375
- columnOrder: P.columnOrder ?? Gt,
376
- rowSelection: P.rowSelection ?? Ht,
377
- expanded: P.expanded ?? Kt,
378
- columnFilters: P.columnFilters ?? Vt,
379
- sorting: P.sorting ?? Mt,
380
- pagination: y ? P.pagination ?? jt : void 0
375
+ columnVisibility: F.columnVisibility,
376
+ columnOrder: F.columnOrder ?? jt,
377
+ rowSelection: F.rowSelection ?? Gt,
378
+ expanded: F.expanded ?? Mt,
379
+ columnFilters: F.columnFilters ?? Wt,
380
+ sorting: F.sorting ?? Xt,
381
+ pagination: y ? F.pagination ?? Yt : void 0
381
382
  },
382
- enableRowSelection: We,
383
+ enableRowSelection: Xe,
383
384
  enableMultiRowSelection: Te !== "single",
384
- enableColumnFilters: Ee,
385
- autoResetPageIndex: Rt ?? !j,
386
- paginateExpandedRows: y && !j ? Dt : !0,
387
- manualPagination: j,
388
- manualSorting: Oe,
385
+ enableColumnFilters: Ne,
386
+ autoResetPageIndex: kt ?? !M,
387
+ paginateExpandedRows: y && !M ? It : !0,
388
+ manualPagination: M,
389
+ manualSorting: Le,
389
390
  manualFiltering: $e,
390
391
  // `pageCount` only matters in manual mode; TanStack ignores it otherwise.
391
- pageCount: j && qe !== void 0 ? qe : void 0,
392
- rowCount: j && me !== void 0 ? me : void 0,
393
- getRowCanExpand: X ? Xe ?? (() => !0) : Xe,
394
- getSubRows: Ye,
395
- getRowId: St,
396
- onColumnVisibilityChange: kt,
397
- onColumnOrderChange: Ot,
398
- onRowSelectionChange: Tt,
399
- onExpandedChange: Et,
400
- onColumnFiltersChange: Nt,
401
- onSortingChange: $t,
402
- onPaginationChange: y ? Lt : void 0,
403
- filterFns: An,
404
- getCoreRowModel: Pt,
405
- getFilteredRowModel: At,
406
- getExpandedRowModel: zt,
407
- getSortedRowModel: Ft,
408
- getPaginationRowModel: Bt
409
- }), Wt = w(
410
- () => ({ table: d, size: O, id: p, state: P }),
411
- [d, O, p, P]
412
- ), Ae = A(null), fe = N(() => {
413
- Ae.current && (Ae.current.scrollTop = 0);
414
- }, []), Xt = N(
392
+ pageCount: M && Je !== void 0 ? Je : void 0,
393
+ rowCount: M && pe !== void 0 ? pe : void 0,
394
+ getRowCanExpand: j ? Ye ?? (() => !0) : Ye,
395
+ getSubRows: qe,
396
+ getRowId: yt,
397
+ onColumnVisibilityChange: Nt,
398
+ onColumnOrderChange: Pt,
399
+ onRowSelectionChange: Ot,
400
+ onExpandedChange: Lt,
401
+ onColumnFiltersChange: $t,
402
+ onSortingChange: At,
403
+ onPaginationChange: y ? Ft : void 0,
404
+ filterFns: Un,
405
+ getCoreRowModel: zt,
406
+ getFilteredRowModel: Bt,
407
+ getExpandedRowModel: Ht,
408
+ getSortedRowModel: Ut,
409
+ getPaginationRowModel: Kt
410
+ }), qt = w(
411
+ () => ({ table: d, size: L, id: m, state: F }),
412
+ [d, L, m, F]
413
+ ), fe = z(null), [nt, Jt] = B({ left: !1, right: !1 }), ot = g || P;
414
+ Me(() => {
415
+ const e = fe.current;
416
+ if (!e || !ot) return;
417
+ const n = () => {
418
+ const o = e.scrollLeft > 0, a = Math.ceil(e.scrollLeft + e.clientWidth) < e.scrollWidth;
419
+ Jt((i) => i.left === o && i.right === a ? i : { left: o, right: a });
420
+ };
421
+ n(), e.addEventListener("scroll", n, { passive: !0 });
422
+ const t = new ResizeObserver(n);
423
+ return t.observe(e), e.firstElementChild && t.observe(e.firstElementChild), () => {
424
+ e.removeEventListener("scroll", n), t.disconnect();
425
+ };
426
+ }, [ot]);
427
+ const be = N(() => {
428
+ fe.current && (fe.current.scrollTop = 0);
429
+ }, []), Qt = N(
415
430
  (e) => {
416
- d.setPageIndex(e - 1), fe();
431
+ d.setPageIndex(e - 1), be();
417
432
  },
418
- [d, fe]
419
- ), Yt = N(
433
+ [d, be]
434
+ ), Zt = N(
420
435
  (e) => {
421
- d.setPageSize(e), fe();
436
+ d.setPageSize(e), be();
422
437
  },
423
- [d, fe]
424
- ), qt = d.getHeaderGroups().length > 1, be = Ne === "row" && ae, Jt = pe ?? (!!B || be), Qt = k(
438
+ [d, be]
439
+ ), en = d.getHeaderGroups().length > 1, he = Oe === "row" && le, tn = Dt ?? (!!O || he), nn = k(
425
440
  l["tedi-table"],
426
- l[`tedi-table--${O}`],
441
+ l[`tedi-table--${L}`],
427
442
  {
428
- [l["tedi-table--striped"]]: ke,
429
- [l["tedi-table--vertical-borders"]]: ge,
443
+ [l["tedi-table--striped"]]: Ee,
444
+ [l["tedi-table--vertical-borders"]]: ue,
430
445
  [l["tedi-table--borderless"]]: $,
431
446
  [l["tedi-table--sticky-first-column"]]: g,
432
- [l["tedi-table--sticky-header"]]: z,
433
- [l["tedi-table--clickable-rows"]]: !!B || be,
434
- [l["tedi-table--row-hover"]]: Jt,
447
+ [l["tedi-table--sticky-last-column"]]: P,
448
+ [l["tedi-table--overflow-left"]]: g && nt.left,
449
+ [l["tedi-table--overflow-right"]]: P && nt.right,
450
+ [l["tedi-table--sticky-header"]]: ge,
451
+ [l["tedi-table--clickable-rows"]]: !!O || he,
452
+ [l["tedi-table--row-hover"]]: tn,
435
453
  [l["tedi-table--has-pagination"]]: y,
436
- [l["tedi-table--grouped-headers"]]: qt
454
+ [l["tedi-table--grouped-headers"]]: en
437
455
  },
438
456
  u
439
- ), _ = d.getRowModel().rows, he = d.getHeaderGroups(), tt = d.getFooterGroups(), nt = d.getVisibleLeafColumns(), we = nt.length, Zt = tt.some(
457
+ ), v = d.getRowModel().rows, we = d.getHeaderGroups(), lt = d.getFooterGroups(), at = d.getVisibleLeafColumns(), ve = at.length, on = lt.some(
440
458
  (e) => e.headers.some((n) => n.column.columnDef.footer !== void 0)
441
- ), ot = (e) => !!B || be && e.getCanExpand(), lt = (e) => {
442
- be && e.getCanExpand() && e.toggleExpanded(), B == null || B(e);
443
- }, en = (e) => (n) => {
444
- ot(e) && n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), lt(e));
445
- }, at = he.length + (Ee ? 1 : 0), it = d.getState().pagination, tn = y ? it.pageIndex * it.pageSize : 0, nn = y ? me ?? d.getFilteredRowModel().rows.length : _.length, on = y ? at + nn : void 0, [rt, Fe] = K(null), [ln, _e] = K(null), J = A(null), Q = A(null), [st, ze] = K(null), [dt, ve] = K(null), Z = A(null), ee = A(null), [ct, Be] = K(null), Ce = A([]), [ut, Ue] = K(null), ie = A(-1), [an, U] = K(""), xe = A(null), [rn, gt] = K(0), He = w(
446
- () => S ? new Map(_.map((e) => [e.id, e.index])) : /* @__PURE__ */ new Map(),
447
- [S, _]
459
+ ), it = (e) => !!O || he && e.getCanExpand(), rt = (e) => {
460
+ he && e.getCanExpand() && e.toggleExpanded(), O == null || O(e);
461
+ }, ln = (e) => (n) => {
462
+ it(e) && n.target === n.currentTarget && (n.key === "Enter" || n.key === " ") && (n.preventDefault(), rt(e));
463
+ }, st = we.length + (Ne ? 1 : 0), dt = d.getState().pagination, an = y ? dt.pageIndex * dt.pageSize : 0, rn = y ? pe ?? d.getFilteredRowModel().rows.length : v.length, sn = y ? st + rn : void 0, [ct, Fe] = B(null), [dn, Ce] = B(null), q = z(null), J = z(null), [ut, ze] = B(null), [gt, _e] = B(null), Q = z(null), Z = z(null), [mt, Be] = B(null), xe = z([]), [pt, Ue] = B(null), ae = z(-1), [cn, H] = B(""), Se = z(null), [un, ft] = B(0), He = w(
464
+ () => S ? new Map(v.map((e) => [e.id, e.index])) : /* @__PURE__ */ new Map(),
465
+ [S, v]
448
466
  );
449
- ht(() => {
450
- if (!S && !Y) return;
467
+ Me(() => {
468
+ if (!S && !X) return;
451
469
  const e = () => {
452
- Q.current = null, ee.current = null;
470
+ J.current = null, Z.current = null;
453
471
  };
454
472
  return window.addEventListener("mouseup", e), window.addEventListener("touchend", e), () => {
455
473
  window.removeEventListener("mouseup", e), window.removeEventListener("touchend", e);
456
474
  };
457
- }, [S, Y]);
458
- const sn = N(
475
+ }, [S, X]);
476
+ const gn = N(
459
477
  (e) => ({
460
478
  onHandlePointerDown: () => {
461
- Q.current = e;
479
+ J.current = e;
462
480
  },
463
481
  onDragStart: (n) => {
464
- if (Q.current !== e) {
482
+ if (J.current !== e) {
465
483
  n.preventDefault();
466
484
  return;
467
485
  }
468
- Q.current = null, n.dataTransfer.effectAllowed = "move";
486
+ J.current = null, n.dataTransfer.effectAllowed = "move";
469
487
  try {
470
488
  n.dataTransfer.setData("text/plain", e);
471
489
  } catch {
472
490
  }
473
491
  const t = n.currentTarget, o = t.closest("table");
474
492
  if (o) {
475
- const a = t.getBoundingClientRect(), r = Array.from(t.children), c = document.createElement("div");
493
+ const a = t.getBoundingClientRect(), i = Array.from(t.children), c = document.createElement("div");
476
494
  c.style.cssText = `position:fixed;top:-10000px;left:0;width:${a.width}px;pointer-events:none;`;
477
495
  const f = document.createElement("table");
478
496
  f.className = o.className, f.style.cssText = `width:${a.width}px;table-layout:fixed;border-collapse:collapse;`;
479
- const v = document.createElement("tbody"), C = t.cloneNode(!0);
480
- C.classList.add(l["tedi-table__row--drag-preview"]);
481
- const s = Array.from(C.children);
482
- r.forEach((te, I) => {
483
- const H = s[I];
484
- if (!H) return;
485
- const re = te.getBoundingClientRect();
486
- H.style.width = `${re.width}px`, H.style.minWidth = `${re.width}px`, H.style.maxWidth = `${re.width}px`;
487
- }), v.appendChild(C), f.appendChild(v), c.appendChild(f), document.body.appendChild(c), n.dataTransfer.setDragImage(c, 24, a.height / 2), window.setTimeout(() => c.remove(), 0);
497
+ const C = document.createElement("tbody"), _ = t.cloneNode(!0);
498
+ _.classList.add(l["tedi-table__row--drag-preview"]);
499
+ const s = Array.from(_.children);
500
+ i.forEach((ee, I) => {
501
+ const K = s[I];
502
+ if (!K) return;
503
+ const ie = ee.getBoundingClientRect();
504
+ K.style.width = `${ie.width}px`, K.style.minWidth = `${ie.width}px`, K.style.maxWidth = `${ie.width}px`;
505
+ }), C.appendChild(_), f.appendChild(C), c.appendChild(f), document.body.appendChild(c), n.dataTransfer.setDragImage(c, 24, a.height / 2), window.setTimeout(() => c.remove(), 0);
488
506
  }
489
- J.current = e, Fe(e);
507
+ q.current = e, Fe(e);
490
508
  },
491
509
  onDragOver: (n) => {
492
- !J.current || J.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", _e(e));
510
+ !q.current || q.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", Ce(e));
493
511
  },
494
512
  onDragLeave: () => {
495
- _e((n) => n === e ? null : n);
513
+ Ce((n) => n === e ? null : n);
496
514
  },
497
515
  onDragEnd: () => {
498
- J.current = null, Q.current = null, Fe(null), _e(null);
516
+ q.current = null, J.current = null, Fe(null), Ce(null);
499
517
  },
500
518
  onDrop: (n) => {
501
519
  n.preventDefault();
502
- const t = J.current, o = e;
503
- if (J.current = null, Q.current = null, Fe(null), _e(null), !t || t === o) return;
504
- const a = He.get(t), r = He.get(o);
505
- a === void 0 || r === void 0 || L == null || L({ fromId: t, toId: o, fromIndex: a, toIndex: r });
520
+ const t = q.current, o = e;
521
+ if (q.current = null, J.current = null, Fe(null), Ce(null), !t || t === o) return;
522
+ const a = He.get(t), i = He.get(o);
523
+ a === void 0 || i === void 0 || A == null || A({ fromId: t, toId: o, fromIndex: a, toIndex: i });
506
524
  }
507
525
  }),
508
- [He, L]
509
- ), pt = (e, n, t) => {
526
+ [He, A]
527
+ ), bt = (e, n, t) => {
510
528
  const o = e.slice(), [a] = o.splice(n, 1);
511
529
  return o.splice(t, 0, a), o;
512
- }, dn = N(
530
+ }, mn = N(
513
531
  (e) => ({
514
532
  onHandlePointerDown: () => {
515
- ee.current = e;
533
+ Z.current = e;
516
534
  },
517
535
  onDragStart: (n) => {
518
- if (ee.current !== e) {
536
+ if (Z.current !== e) {
519
537
  n.preventDefault();
520
538
  return;
521
539
  }
522
- ee.current = null, n.dataTransfer.effectAllowed = "move";
540
+ Z.current = null, n.dataTransfer.effectAllowed = "move";
523
541
  try {
524
542
  n.dataTransfer.setData("text/plain", e);
525
543
  } catch {
526
544
  }
527
545
  const t = n.currentTarget, o = t.getBoundingClientRect(), a = document.createElement("div");
528
546
  a.style.cssText = `position:fixed;top:-10000px;left:0;width:${o.width}px;pointer-events:none;`;
529
- const r = document.createElement("table"), c = t.closest("table");
530
- r.className = (c == null ? void 0 : c.className) ?? "", r.style.cssText = `width:${o.width}px;table-layout:fixed;border-collapse:collapse;`;
531
- const f = document.createElement("thead"), v = document.createElement("tr");
532
- v.className = l["tedi-table__row"];
533
- const C = t.cloneNode(!0);
534
- C.classList.add(l["tedi-table__header-cell--drag-preview"]), C.style.width = `${o.width}px`, v.appendChild(C), f.appendChild(v), r.appendChild(f), a.appendChild(r), document.body.appendChild(a), n.dataTransfer.setDragImage(a, o.width / 2, o.height / 2), window.setTimeout(() => a.remove(), 0), Z.current = e, ze(e);
547
+ const i = document.createElement("table"), c = t.closest("table");
548
+ i.className = (c == null ? void 0 : c.className) ?? "", i.style.cssText = `width:${o.width}px;table-layout:fixed;border-collapse:collapse;`;
549
+ const f = document.createElement("thead"), C = document.createElement("tr");
550
+ C.className = l["tedi-table__row"];
551
+ const _ = t.cloneNode(!0);
552
+ _.classList.add(l["tedi-table__header-cell--drag-preview"]), _.style.width = `${o.width}px`, C.appendChild(_), f.appendChild(C), i.appendChild(f), a.appendChild(i), document.body.appendChild(a), n.dataTransfer.setDragImage(a, o.width / 2, o.height / 2), window.setTimeout(() => a.remove(), 0), Q.current = e, ze(e);
535
553
  },
536
554
  onDragOver: (n) => {
537
- !Z.current || Z.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", ve(e));
555
+ !Q.current || Q.current === e || (n.preventDefault(), n.dataTransfer.dropEffect = "move", _e(e));
538
556
  },
539
557
  onDragLeave: () => {
540
- ve((n) => n === e ? null : n);
558
+ _e((n) => n === e ? null : n);
541
559
  },
542
560
  onDragEnd: () => {
543
- Z.current = null, ee.current = null, ze(null), ve(null);
561
+ Q.current = null, Z.current = null, ze(null), _e(null);
544
562
  },
545
563
  onDrop: (n) => {
546
564
  n.preventDefault();
547
- const t = Z.current, o = e;
548
- if (Z.current = null, ee.current = null, ze(null), ve(null), !t || t === o) return;
549
- const a = d.getState().columnOrder, r = a.length > 0 ? a : d.getAllLeafColumns().map((v) => v.id), c = r.indexOf(t), f = r.indexOf(o);
550
- c < 0 || f < 0 || d.setColumnOrder(pt(r, c, f));
565
+ const t = Q.current, o = e;
566
+ if (Q.current = null, Z.current = null, ze(null), _e(null), !t || t === o) return;
567
+ const a = d.getState().columnOrder, i = a.length > 0 ? a : d.getAllLeafColumns().map((C) => C.id), c = i.indexOf(t), f = i.indexOf(o);
568
+ c < 0 || f < 0 || d.setColumnOrder(bt(i, c, f));
551
569
  }
552
570
  }),
553
571
  [d]
554
- ), cn = (e) => `${p}-col-reorder-${e}`, un = (e) => `${p}-row-reorder-${e}`, mt = () => d.getVisibleLeafColumns().filter((e) => !e.parent && e.id !== De && e.id !== Me && e.id !== je).map((e) => e.id), Ke = (e) => {
572
+ ), pn = (e) => `${m}-col-reorder-${e}`, fn = (e) => `${m}-row-reorder-${e}`, ht = () => d.getVisibleLeafColumns().filter((e) => !e.parent && e.id !== Re && e.id !== We && e.id !== je).map((e) => e.id), Ke = (e) => {
555
573
  const n = d.getColumn(e), t = n == null ? void 0 : n.columnDef.meta;
556
574
  return (t == null ? void 0 : t.label) ?? (typeof (n == null ? void 0 : n.columnDef.header) == "string" ? n.columnDef.header : e);
557
- }, ft = (e, n) => {
558
- const t = mt(), o = t.indexOf(n);
575
+ }, wt = (e, n) => {
576
+ const t = ht(), o = t.indexOf(n);
559
577
  if (o < 0) return;
560
578
  const a = o + e;
561
579
  if (a < 0 || a >= t.length) return;
562
- const r = pt(t, o, a), c = d.getState().columnOrder.length > 0 ? [...d.getState().columnOrder] : d.getAllLeafColumns().map((s) => s.id), f = new Set(t);
563
- let v = 0;
564
- const C = c.map((s) => f.has(s) ? r[v++] : s);
565
- for (const s of r) C.includes(s) || C.push(s);
566
- d.setColumnOrder(C), U(b("table.reorder.move", Ke(n), a + 1)), xe.current = { kind: "column", id: n }, gt((s) => s + 1);
567
- }, gn = (e, n) => {
568
- if (!Y) return;
569
- const t = ct;
580
+ const i = bt(t, o, a), c = d.getState().columnOrder.length > 0 ? [...d.getState().columnOrder] : d.getAllLeafColumns().map((s) => s.id), f = new Set(t);
581
+ let C = 0;
582
+ const _ = c.map((s) => f.has(s) ? i[C++] : s);
583
+ for (const s of i) _.includes(s) || _.push(s);
584
+ d.setColumnOrder(_), H(b("table.reorder.move", Ke(n), a + 1)), Se.current = { kind: "column", id: n }, ft((s) => s + 1);
585
+ }, bn = (e, n) => {
586
+ if (!X) return;
587
+ const t = mt;
570
588
  switch (e.key) {
571
589
  case " ":
572
590
  case "Enter":
573
591
  if (e.preventDefault(), t === null)
574
- Ce.current = [...d.getState().columnOrder ?? []], Be(n), U(b("table.reorder.pickup", Ke(n)));
592
+ xe.current = [...d.getState().columnOrder ?? []], Be(n), H(b("table.reorder.pickup", Ke(n)));
575
593
  else {
576
- const o = mt().indexOf(t) + 1;
577
- Be(null), Ce.current = [], U(b("table.reorder.drop", Ke(t), o));
594
+ const o = ht().indexOf(t) + 1;
595
+ Be(null), xe.current = [], H(b("table.reorder.drop", Ke(t), o));
578
596
  }
579
597
  break;
580
598
  case "Escape":
581
- t !== null && (e.preventDefault(), d.setColumnOrder(Ce.current), Be(null), Ce.current = [], U(b("table.reorder.cancel")));
599
+ t !== null && (e.preventDefault(), d.setColumnOrder(xe.current), Be(null), xe.current = [], H(b("table.reorder.cancel")));
582
600
  break;
583
601
  case "ArrowLeft":
584
- t !== null && (e.preventDefault(), ft(-1, t));
602
+ t !== null && (e.preventDefault(), wt(-1, t));
585
603
  break;
586
604
  case "ArrowRight":
587
- t !== null && (e.preventDefault(), ft(1, t));
605
+ t !== null && (e.preventDefault(), wt(1, t));
588
606
  break;
589
607
  }
590
- }, bt = (e, n) => {
591
- const t = _.findIndex((c) => c.original === n);
608
+ }, vt = (e, n) => {
609
+ const t = v.findIndex((c) => c.original === n);
592
610
  if (t < 0) return;
593
611
  const o = t + e;
594
- if (o < 0 || o >= _.length) return;
595
- const a = _[t], r = _[o];
596
- L == null || L({
612
+ if (o < 0 || o >= v.length) return;
613
+ const a = v[t], i = v[o];
614
+ A == null || A({
597
615
  fromId: a.id,
598
- toId: r.id,
616
+ toId: i.id,
599
617
  fromIndex: a.index,
600
- toIndex: r.index
601
- }), U(b("table.row-reorder.move", o + 1)), xe.current = { kind: "row", original: n }, gt((c) => c + 1);
602
- }, pn = (e, n) => {
618
+ toIndex: i.index
619
+ }), H(b("table.row-reorder.move", o + 1)), Se.current = { kind: "row", original: n }, ft((c) => c + 1);
620
+ }, hn = (e, n) => {
603
621
  if (!S) return;
604
- const t = ut;
622
+ const t = pt;
605
623
  switch (e.key) {
606
624
  case " ":
607
625
  case "Enter":
608
626
  if (e.preventDefault(), t === null)
609
- Ue(n.original), ie.current = n.index, U(b("table.row-reorder.pickup", _.indexOf(n) + 1));
627
+ Ue(n.original), ae.current = n.index, H(b("table.row-reorder.pickup", v.indexOf(n) + 1));
610
628
  else {
611
- const o = _.findIndex((a) => a.original === t) + 1;
612
- Ue(null), ie.current = -1, U(b("table.row-reorder.drop", o));
629
+ const o = v.findIndex((a) => a.original === t) + 1;
630
+ Ue(null), ae.current = -1, H(b("table.row-reorder.drop", o));
613
631
  }
614
632
  break;
615
633
  case "Escape":
616
634
  if (t !== null) {
617
635
  e.preventDefault();
618
- const o = _.findIndex((a) => a.original === t);
619
- if (o >= 0 && ie.current >= 0) {
620
- const a = _[o];
621
- L == null || L({
636
+ const o = v.findIndex((a) => a.original === t);
637
+ if (o >= 0 && ae.current >= 0) {
638
+ const a = v[o];
639
+ A == null || A({
622
640
  fromId: a.id,
623
641
  toId: a.id,
624
642
  fromIndex: a.index,
625
- toIndex: ie.current
643
+ toIndex: ae.current
626
644
  });
627
645
  }
628
- Ue(null), ie.current = -1, U(b("table.row-reorder.cancel"));
646
+ Ue(null), ae.current = -1, H(b("table.row-reorder.cancel"));
629
647
  }
630
648
  break;
631
649
  case "ArrowUp":
632
- t !== null && (e.preventDefault(), bt(-1, t));
650
+ t !== null && (e.preventDefault(), vt(-1, t));
633
651
  break;
634
652
  case "ArrowDown":
635
- t !== null && (e.preventDefault(), bt(1, t));
653
+ t !== null && (e.preventDefault(), vt(1, t));
636
654
  break;
637
655
  }
638
656
  };
639
- return ht(() => {
657
+ return Me(() => {
640
658
  var t;
641
- const e = xe.current;
659
+ const e = Se.current;
642
660
  if (!e) return;
643
- xe.current = null;
661
+ Se.current = null;
644
662
  let n;
645
663
  if (e.kind === "column")
646
- n = `${p}-col-reorder-${e.id}`;
664
+ n = `${m}-col-reorder-${e.id}`;
647
665
  else {
648
- const o = _.find((a) => a.original === e.original);
649
- n = o ? `${p}-row-reorder-${o.id}` : null;
666
+ const o = v.find((a) => a.original === e.original);
667
+ n = o ? `${m}-row-reorder-${o.id}` : null;
650
668
  }
651
669
  n && ((t = document.getElementById(n)) == null || t.focus());
652
- }, [rn, _, p]), /* @__PURE__ */ i(Sn.Provider, { value: Wt, children: /* @__PURE__ */ se("div", { className: Qt, "data-name": "tedi-table", children: [
653
- Ie,
654
- (S || Y) && /* @__PURE__ */ i("div", { className: l["tedi-table__sr-only"], "aria-live": "polite", "aria-atomic": "true", children: an }),
655
- /* @__PURE__ */ i(
670
+ }, [un, v, m]), /* @__PURE__ */ r(In.Provider, { value: qt, children: /* @__PURE__ */ re("div", { className: nn, "data-name": "tedi-table", children: [
671
+ ke,
672
+ (S || X) && /* @__PURE__ */ r("div", { className: l["tedi-table__sr-only"], "aria-live": "polite", "aria-atomic": "true", children: cn }),
673
+ /* @__PURE__ */ r(
656
674
  "div",
657
675
  {
658
- ref: Ae,
676
+ ref: fe,
659
677
  className: l["tedi-table__scroll"],
660
- style: le !== void 0 ? { maxHeight: le, overflowY: "auto" } : void 0,
661
- children: /* @__PURE__ */ se(
678
+ style: me !== void 0 ? { maxHeight: me, overflowY: "auto" } : void 0,
679
+ children: /* @__PURE__ */ re(
662
680
  "table",
663
681
  {
664
- id: T,
682
+ id: E,
665
683
  className: l["tedi-table__table"],
666
- "aria-rowcount": on,
667
- "aria-colcount": we > 0 ? we : void 0,
684
+ "aria-rowcount": sn,
685
+ "aria-colcount": ve > 0 ? ve : void 0,
668
686
  children: [
669
- E && /* @__PURE__ */ i("caption", { className: l["tedi-table__caption"], children: E }),
670
- /* @__PURE__ */ se("thead", { className: l["tedi-table__head"], children: [
671
- he.map((e, n) => /* @__PURE__ */ i(
687
+ T && /* @__PURE__ */ r("caption", { className: l["tedi-table__caption"], children: T }),
688
+ /* @__PURE__ */ re("thead", { className: l["tedi-table__head"], children: [
689
+ we.map((e, n) => /* @__PURE__ */ r(
672
690
  "tr",
673
691
  {
674
692
  className: l["tedi-table__row"],
675
693
  "aria-rowindex": y ? n + 1 : void 0,
676
694
  children: e.headers.map((t) => {
677
- const o = t.subHeaders.length > 0, a = !!t.column.parent, r = Fn(t.column.columnDef), c = !r && !a;
695
+ const o = t.subHeaders.length > 0, a = !!t.column.parent, i = Hn(t.column.columnDef), c = !i && !a;
678
696
  if (t.isPlaceholder && !c || !t.isPlaceholder && c && n > 0)
679
697
  return null;
680
- const f = c ? he.length - n : 1, v = t.column.getIsSorted(), C = t.column.getCanSort() ? v === "asc" ? "ascending" : v === "desc" ? "descending" : "none" : void 0, s = t.column.columnDef.meta, te = (s == null ? void 0 : s.label) ?? (typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : void 0), I = W == null ? void 0 : W(t.column.id), H = t.column.getSize(), re = t.column.id === De || t.column.id === Me || t.column.id === je, ne = Y && c && !re, m = ne ? dn(t.column.id) : void 0, mn = ne && st === t.column.id, fn = ne && dt === t.column.id && st !== t.column.id, Ve = ne && ct === t.column.id;
681
- return /* @__PURE__ */ i(
698
+ const f = c ? we.length - n : 1, C = t.column.getIsSorted(), _ = t.column.getCanSort() ? C === "asc" ? "ascending" : C === "desc" ? "descending" : "none" : void 0, s = t.column.columnDef.meta, ee = (s == null ? void 0 : s.label) ?? (typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : void 0), I = W == null ? void 0 : W(t.column.id), K = t.column.getSize(), ie = t.column.id === Re || t.column.id === We || t.column.id === je, te = X && c && !ie, p = te ? mn(t.column.id) : void 0, wn = te && ut === t.column.id, vn = te && gt === t.column.id && ut !== t.column.id, Ve = te && mt === t.column.id;
699
+ return /* @__PURE__ */ r(
682
700
  "th",
683
701
  {
684
702
  colSpan: t.colSpan,
685
703
  rowSpan: f > 1 ? f : void 0,
686
- draggable: ne || void 0,
687
- onDragStart: m == null ? void 0 : m.onDragStart,
688
- onDragOver: m == null ? void 0 : m.onDragOver,
689
- onDragLeave: m == null ? void 0 : m.onDragLeave,
690
- onDragEnd: m == null ? void 0 : m.onDragEnd,
691
- onDrop: m == null ? void 0 : m.onDrop,
704
+ draggable: te || void 0,
705
+ onDragStart: p == null ? void 0 : p.onDragStart,
706
+ onDragOver: p == null ? void 0 : p.onDragOver,
707
+ onDragLeave: p == null ? void 0 : p.onDragLeave,
708
+ onDragEnd: p == null ? void 0 : p.onDragEnd,
709
+ onDrop: p == null ? void 0 : p.onDrop,
692
710
  className: k(
693
711
  l["tedi-table__header-cell"],
694
712
  {
695
713
  [l["tedi-table__header-cell--group"]]: o,
696
- [l["tedi-table__header-cell--dragging"]]: mn,
697
- [l["tedi-table__header-cell--drag-over"]]: fn,
714
+ [l["tedi-table__header-cell--dragging"]]: wn,
715
+ [l["tedi-table__header-cell--drag-over"]]: vn,
698
716
  [l["tedi-table__header-cell--picked-up"]]: Ve,
699
717
  [l[`tedi-table__cell--align-${s == null ? void 0 : s.align}`]]: s == null ? void 0 : s.align,
700
718
  [l[`tedi-table__cell--valign-${s == null ? void 0 : s.vAlign}`]]: s == null ? void 0 : s.vAlign
@@ -702,30 +720,30 @@ function Ct(R) {
702
720
  I == null ? void 0 : I.className
703
721
  ),
704
722
  scope: "col",
705
- "aria-sort": C,
706
- "aria-label": te ?? (r ? void 0 : t.column.id),
707
- style: H || I != null && I.style ? { ...H ? { width: H } : null, ...I == null ? void 0 : I.style } : void 0,
708
- children: ne && m ? /* @__PURE__ */ se("span", { className: l["tedi-table__header-cell-inner"], children: [
709
- /* @__PURE__ */ i(
723
+ "aria-sort": _,
724
+ "aria-label": ee ?? (i ? void 0 : t.column.id),
725
+ style: K || I != null && I.style ? { ...K ? { width: K } : null, ...I == null ? void 0 : I.style } : void 0,
726
+ children: te && p ? /* @__PURE__ */ re("span", { className: l["tedi-table__header-cell-inner"], children: [
727
+ /* @__PURE__ */ r(
710
728
  "button",
711
729
  {
712
730
  type: "button",
713
- id: cn(t.column.id),
731
+ id: pn(t.column.id),
714
732
  className: k(l["tedi-table__drag-handle"], {
715
733
  [l["tedi-table__drag-handle--picked-up"]]: Ve
716
734
  }),
717
- "aria-label": b("table.drag-column", te ?? t.column.id),
735
+ "aria-label": b("table.drag-column", ee ?? t.column.id),
718
736
  "aria-pressed": Ve,
719
737
  onClick: (Ge) => Ge.stopPropagation(),
720
- onMouseDown: m.onHandlePointerDown,
721
- onTouchStart: m.onHandlePointerDown,
722
- onKeyDown: (Ge) => gn(Ge, t.column.id),
723
- [vt]: "",
724
- children: /* @__PURE__ */ i(_t, { name: "drag_indicator", size: 18, color: "inherit" })
738
+ onMouseDown: p.onHandlePointerDown,
739
+ onTouchStart: p.onHandlePointerDown,
740
+ onKeyDown: (Ge) => bn(Ge, t.column.id),
741
+ [xt]: "",
742
+ children: /* @__PURE__ */ r(_t, { name: "drag_indicator", size: 18, color: "inherit" })
725
743
  }
726
744
  ),
727
- Se(t.column.columnDef.header, t.getContext())
728
- ] }) : Se(t.column.columnDef.header, t.getContext())
745
+ De(t.column.columnDef.header, t.getContext())
746
+ ] }) : De(t.column.columnDef.header, t.getContext())
729
747
  },
730
748
  t.id
731
749
  );
@@ -733,21 +751,21 @@ function Ct(R) {
733
751
  },
734
752
  e.id
735
753
  )),
736
- Ee && /* @__PURE__ */ i(
754
+ Ne && /* @__PURE__ */ r(
737
755
  "tr",
738
756
  {
739
757
  className: k(l["tedi-table__row"], l["tedi-table__row--filter"]),
740
- "aria-rowindex": y ? he.length + 1 : void 0,
741
- children: nt.map((e) => {
742
- const n = e.columnDef.meta, t = (n == null ? void 0 : n.label) ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id), o = `${p}-filter-${e.id}`, a = W == null ? void 0 : W(e.id);
743
- return /* @__PURE__ */ i(
758
+ "aria-rowindex": y ? we.length + 1 : void 0,
759
+ children: at.map((e) => {
760
+ const n = e.columnDef.meta, t = (n == null ? void 0 : n.label) ?? (typeof e.columnDef.header == "string" ? e.columnDef.header : e.id), o = `${m}-filter-${e.id}`, a = W == null ? void 0 : W(e.id);
761
+ return /* @__PURE__ */ r(
744
762
  "th",
745
763
  {
746
764
  className: k(l["tedi-table__header-cell"], a == null ? void 0 : a.className),
747
765
  style: a == null ? void 0 : a.style,
748
766
  scope: "col",
749
- children: e.getCanFilter() && /* @__PURE__ */ i(
750
- Cn,
767
+ children: e.getCanFilter() && /* @__PURE__ */ r(
768
+ Rn,
751
769
  {
752
770
  size: "small",
753
771
  placeholder: b("table.filter-placeholder"),
@@ -757,7 +775,7 @@ function Ct(R) {
757
775
  label: b("table.filter-input", t),
758
776
  hideLabel: !0,
759
777
  value: e.getFilterValue() ?? "",
760
- onChange: (r) => e.setFilterValue(r || void 0)
778
+ onChange: (i) => e.setFilterValue(i || void 0)
761
779
  }
762
780
  )
763
781
  },
@@ -767,62 +785,62 @@ function Ct(R) {
767
785
  }
768
786
  )
769
787
  ] }),
770
- /* @__PURE__ */ i("tbody", { className: l["tedi-table__body"], children: _.length === 0 ? /* @__PURE__ */ i("tr", { className: l["tedi-table__row"], children: /* @__PURE__ */ i(
788
+ /* @__PURE__ */ r("tbody", { className: l["tedi-table__body"], children: v.length === 0 ? /* @__PURE__ */ r("tr", { className: l["tedi-table__row"], children: /* @__PURE__ */ r(
771
789
  "td",
772
790
  {
773
- colSpan: Math.max(1, we),
791
+ colSpan: Math.max(1, ve),
774
792
  className: k(l["tedi-table__cell"], l["tedi-table__cell--placeholder"]),
775
- children: ue ? /* @__PURE__ */ i("div", { role: ue, children: Ze }) : Ze
793
+ children: ce ? /* @__PURE__ */ r("div", { role: ce, children: et }) : et
776
794
  }
777
- ) }) : _.map((e, n) => {
778
- const t = ot(e), o = G !== void 0 && e.id === G, a = Pe == null ? void 0 : Pe(e), r = k(
795
+ ) }) : v.map((e, n) => {
796
+ const t = it(e), o = oe !== void 0 && e.id === oe, a = Ae == null ? void 0 : Ae(e), i = k(
779
797
  l["tedi-table__row"],
780
798
  {
781
- [l["tedi-table__row--selected"]]: xt && e.getIsSelected(),
799
+ [l["tedi-table__row--selected"]]: Rt && e.getIsSelected(),
782
800
  [l["tedi-table__row--active"]]: o,
783
801
  [l["tedi-table__row--clickable"]]: t,
784
802
  [l["tedi-table__row--sub-row"]]: e.depth > 0
785
803
  },
786
804
  a == null ? void 0 : a.className
787
- ), c = y ? at + tn + n + 1 : void 0, f = `${p}-sub-${e.id}`, v = S && rt === e.id, C = S && ln === e.id && rt !== e.id, s = S && ut === e.original, te = {
805
+ ), c = y ? st + an + n + 1 : void 0, f = `${m}-sub-${e.id}`, C = S && ct === e.id, _ = S && dn === e.id && ct !== e.id, s = S && pt === e.original, ee = {
788
806
  row: e,
789
- rowClassName: k(r, {
790
- [l["tedi-table__row--dragging"]]: v,
791
- [l["tedi-table__row--drag-over"]]: C,
807
+ rowClassName: k(i, {
808
+ [l["tedi-table__row--dragging"]]: C,
809
+ [l["tedi-table__row--drag-over"]]: _,
792
810
  [l["tedi-table__row--picked-up"]]: s
793
811
  }),
794
812
  rowStyle: a == null ? void 0 : a.style,
795
813
  isActiveRow: o,
796
814
  clickable: t,
797
- onClick: lt,
798
- onKeyDownHandler: en(e),
815
+ onClick: rt,
816
+ onKeyDownHandler: ln(e),
799
817
  ariaRowIndex: c,
800
818
  columnProps: W,
801
819
  draggable: S,
802
820
  dragHandleLabel: b("table.drag-row"),
803
- dragHandlers: S ? { ...sn(e.id), onKeyDown: (I) => pn(I, e) } : void 0,
804
- dragHandleId: S ? un(e.id) : void 0,
821
+ dragHandlers: S ? { ...gn(e.id), onKeyDown: (I) => hn(I, e) } : void 0,
822
+ dragHandleId: S ? fn(e.id) : void 0,
805
823
  dragHandlePickedUp: s,
806
- dragOverColumnId: Y ? dt : null
824
+ dragOverColumnId: X ? gt : null
807
825
  };
808
- return /* @__PURE__ */ se(wn, { children: [
809
- /* @__PURE__ */ i(Pn, { ...te }),
810
- X && e.getIsExpanded() && /* @__PURE__ */ i("tr", { className: k(l["tedi-table__row"], l["tedi-table__row--sub-component"]), children: /* @__PURE__ */ i(
826
+ return /* @__PURE__ */ re(xn, { children: [
827
+ /* @__PURE__ */ r(Bn, { ...ee }),
828
+ j && e.getIsExpanded() && /* @__PURE__ */ r("tr", { className: k(l["tedi-table__row"], l["tedi-table__row--sub-component"]), children: /* @__PURE__ */ r(
811
829
  "td",
812
830
  {
813
831
  id: f,
814
832
  role: "region",
815
833
  "aria-label": b("table.row-details"),
816
- colSpan: Math.max(1, we),
834
+ colSpan: Math.max(1, ve),
817
835
  className: k(l["tedi-table__cell"], l["tedi-table__cell--sub-component"]),
818
- children: X(e)
836
+ children: j(e)
819
837
  }
820
838
  ) })
821
839
  ] }, e.id);
822
840
  }) }),
823
- Zt && /* @__PURE__ */ i("tfoot", { className: l["tedi-table__foot"], children: tt.map((e) => /* @__PURE__ */ i("tr", { className: l["tedi-table__row"], children: e.headers.map((n) => {
841
+ on && /* @__PURE__ */ r("tfoot", { className: l["tedi-table__foot"], children: lt.map((e) => /* @__PURE__ */ r("tr", { className: l["tedi-table__row"], children: e.headers.map((n) => {
824
842
  const t = n.column.columnDef.meta;
825
- return /* @__PURE__ */ i(
843
+ return /* @__PURE__ */ r(
826
844
  "td",
827
845
  {
828
846
  colSpan: n.colSpan,
@@ -830,7 +848,7 @@ function Ct(R) {
830
848
  [l[`tedi-table__cell--align-${t == null ? void 0 : t.align}`]]: t == null ? void 0 : t.align,
831
849
  [l[`tedi-table__cell--valign-${t == null ? void 0 : t.vAlign}`]]: t == null ? void 0 : t.vAlign
832
850
  }),
833
- children: n.isPlaceholder ? null : Se(n.column.columnDef.footer, n.getContext())
851
+ children: n.isPlaceholder ? null : De(n.column.columnDef.footer, n.getContext())
834
852
  },
835
853
  n.id
836
854
  );
@@ -840,28 +858,28 @@ function Ct(R) {
840
858
  )
841
859
  }
842
860
  ),
843
- y && /* @__PURE__ */ i("div", { className: l["tedi-table__pagination"], children: /* @__PURE__ */ i(
844
- $n,
861
+ y && /* @__PURE__ */ r("div", { className: l["tedi-table__pagination"], children: /* @__PURE__ */ r(
862
+ Fn,
845
863
  {
846
864
  ...h == null ? void 0 : h.paginationProps,
847
865
  pageCount: Math.max(1, d.getPageCount()),
848
866
  page: d.getState().pagination.pageIndex + 1,
849
- onPageChange: Xt,
850
- totalItems: me ?? d.getFilteredRowModel().rows.length,
867
+ onPageChange: Qt,
868
+ totalItems: pe ?? d.getFilteredRowModel().rows.length,
851
869
  pageSize: d.getState().pagination.pageSize,
852
- pageSizeOptions: It,
853
- onPageSizeChange: Yt
870
+ pageSizeOptions: Tt,
871
+ onPageSizeChange: Zt
854
872
  }
855
873
  ) })
856
874
  ] }) });
857
875
  }
858
- Ct.displayName = "Table";
859
- const oo = Object.assign(Ct, {
860
- Toolbar: Rn,
861
- ColumnsMenu: xn,
862
- HeaderButton: Dn
876
+ St.displayName = "Table";
877
+ const ro = Object.assign(St, {
878
+ Toolbar: En,
879
+ ColumnsMenu: yn,
880
+ HeaderButton: kn
863
881
  });
864
882
  export {
865
- oo as Table,
866
- no as groupRowSpan
883
+ ro as Table,
884
+ io as groupRowSpan
867
885
  };