@tedi-design-system/react 19.0.0 → 19.0.1-rc.2

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