better-table 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1335 +1,2268 @@
1
- import I, { useContext as Ee, createContext as Ke, useCallback as m, useMemo as x, useEffect as Oe, useState as z } from "react";
2
- import { jsx as i, jsxs as y, Fragment as Fe } from "react/jsx-runtime";
1
+ import R, { useContext as yt, createContext as wt, useCallback as w, useMemo as I, useState as M, useRef as V, useEffect as B } from "react";
2
+ import { jsx as n, jsxs as g, Fragment as Ct } from "react/jsx-runtime";
3
+ import { createPortal as kt } from "react-dom";
3
4
  import "./styles.js";
4
- const Ve = {
5
- search: "Buscar",
6
- searchPlaceholder: "Buscar...",
7
- noData: "No hay datos",
8
- loading: "Cargando...",
9
- page: "Página",
10
- of: "de",
11
- items: "elementos",
12
- selected: "seleccionados",
13
- rowsPerPage: "Filas por página",
14
- actions: "Acciones",
15
- sortAsc: "Ordenar ascendente",
16
- sortDesc: "Ordenar descendente",
17
- filterBy: "Filtrar por",
18
- clearFilters: "Limpiar filtros",
19
- selectAll: "Seleccionar todo",
20
- deselectAll: "Deseleccionar todo"
21
- }, $e = Ke(null);
22
- function w() {
23
- const e = Ee($e);
5
+ const it = {
6
+ search: "Search",
7
+ searchPlaceholder: "Search...",
8
+ noData: "No data",
9
+ loading: "Loading...",
10
+ page: "Page",
11
+ of: "of",
12
+ items: "items",
13
+ selected: "selected",
14
+ rowsPerPage: "Rows per page",
15
+ actions: "Actions",
16
+ sortAsc: "Sort ascending",
17
+ sortDesc: "Sort descending",
18
+ filterBy: "Filter by",
19
+ clearFilters: "Clear filters",
20
+ dateFrom: "From",
21
+ dateTo: "To",
22
+ selectAll: "Select all",
23
+ deselectAll: "Deselect all",
24
+ moreActions: "More actions",
25
+ clearSearch: "Clear search",
26
+ closeModal: "Close",
27
+ previousPage: "Previous page",
28
+ nextPage: "Next page",
29
+ jumpToPage: "Go to page",
30
+ details: "Details",
31
+ columns: "Columns",
32
+ showAllColumns: "Show all",
33
+ hideColumn: "Hide column",
34
+ sortPriority: "Sort priority",
35
+ clearSort: "Clear sort"
36
+ }, Nt = {
37
+ en: it,
38
+ es: {
39
+ search: "Buscar",
40
+ searchPlaceholder: "Buscar...",
41
+ noData: "No hay datos",
42
+ loading: "Cargando...",
43
+ page: "Página",
44
+ of: "de",
45
+ items: "elementos",
46
+ selected: "seleccionados",
47
+ rowsPerPage: "Filas por página",
48
+ actions: "Acciones",
49
+ sortAsc: "Ordenar ascendente",
50
+ sortDesc: "Ordenar descendente",
51
+ filterBy: "Filtrar por",
52
+ clearFilters: "Limpiar filtros",
53
+ dateFrom: "Desde",
54
+ dateTo: "Hasta",
55
+ selectAll: "Seleccionar todo",
56
+ deselectAll: "Deseleccionar todo",
57
+ moreActions: "Más acciones",
58
+ clearSearch: "Limpiar búsqueda",
59
+ closeModal: "Cerrar",
60
+ previousPage: "Página anterior",
61
+ nextPage: "Página siguiente",
62
+ jumpToPage: "Ir a página",
63
+ details: "Detalles",
64
+ columns: "Columnas",
65
+ showAllColumns: "Mostrar todas",
66
+ hideColumn: "Ocultar columna",
67
+ sortPriority: "Prioridad de orden",
68
+ clearSort: "Quitar orden"
69
+ },
70
+ pt: {
71
+ search: "Pesquisar",
72
+ searchPlaceholder: "Pesquisar...",
73
+ noData: "Sem dados",
74
+ loading: "Carregando...",
75
+ page: "Página",
76
+ of: "de",
77
+ items: "itens",
78
+ selected: "selecionados",
79
+ rowsPerPage: "Linhas por página",
80
+ actions: "Ações",
81
+ sortAsc: "Ordenar ascendente",
82
+ sortDesc: "Ordenar descendente",
83
+ filterBy: "Filtrar por",
84
+ clearFilters: "Limpar filtros",
85
+ dateFrom: "De",
86
+ dateTo: "Até",
87
+ selectAll: "Selecionar tudo",
88
+ deselectAll: "Desselecionar tudo",
89
+ moreActions: "Mais ações",
90
+ clearSearch: "Limpar pesquisa",
91
+ closeModal: "Fechar",
92
+ previousPage: "Página anterior",
93
+ nextPage: "Próxima página",
94
+ jumpToPage: "Ir para página",
95
+ details: "Detalhes",
96
+ columns: "Colunas",
97
+ showAllColumns: "Mostrar todas",
98
+ hideColumn: "Ocultar coluna",
99
+ sortPriority: "Prioridade de ordem",
100
+ clearSort: "Remover ordem"
101
+ }
102
+ }, lt = wt(null);
103
+ function $() {
104
+ const e = yt(lt);
24
105
  if (!e)
25
106
  throw new Error("useTableContext must be used within a TableProvider");
26
107
  return e;
27
108
  }
28
- function He({
109
+ function St({
29
110
  value: e,
30
111
  children: t
31
112
  }) {
32
- return /* @__PURE__ */ i($e.Provider, { value: e, children: t });
113
+ return /* @__PURE__ */ n(lt.Provider, { value: e, children: t });
33
114
  }
34
- function xe(e) {
35
- var t, l, n = "";
36
- if (typeof e == "string" || typeof e == "number") n += e;
115
+ function rt(e) {
116
+ var t, l, i = "";
117
+ if (typeof e == "string" || typeof e == "number") i += e;
37
118
  else if (typeof e == "object") if (Array.isArray(e)) {
38
- var s = e.length;
39
- for (t = 0; t < s; t++) e[t] && (l = xe(e[t])) && (n && (n += " "), n += l);
40
- } else for (l in e) e[l] && (n && (n += " "), n += l);
41
- return n;
119
+ var a = e.length;
120
+ for (t = 0; t < a; t++) e[t] && (l = rt(e[t])) && (i && (i += " "), i += l);
121
+ } else for (l in e) e[l] && (i && (i += " "), i += l);
122
+ return i;
123
+ }
124
+ function x() {
125
+ for (var e, t, l = 0, i = "", a = arguments.length; l < a; l++) (e = arguments[l]) && (t = rt(e)) && (i && (i += " "), i += t);
126
+ return i;
127
+ }
128
+ function Pt() {
129
+ return /* @__PURE__ */ g("svg", { className: "bt-sort-icon", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
130
+ /* @__PURE__ */ n("path", { d: "M7 2.5L10 5.5H4L7 2.5Z", fill: "currentColor", opacity: "0.4" }),
131
+ /* @__PURE__ */ n("path", { d: "M7 11.5L4 8.5H10L7 11.5Z", fill: "currentColor", opacity: "0.4" })
132
+ ] });
42
133
  }
43
- function P() {
44
- for (var e, t, l = 0, n = "", s = arguments.length; l < s; l++) (e = arguments[l]) && (t = xe(e)) && (n && (n += " "), n += t);
45
- return n;
134
+ function xt() {
135
+ return /* @__PURE__ */ g("svg", { className: "bt-sort-icon", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
136
+ /* @__PURE__ */ n("path", { d: "M7 2.5L10 5.5H4L7 2.5Z", fill: "currentColor" }),
137
+ /* @__PURE__ */ n("path", { d: "M7 11.5L4 8.5H10L7 11.5Z", fill: "currentColor", opacity: "0.2" })
138
+ ] });
46
139
  }
47
- function qe({
140
+ function At() {
141
+ return /* @__PURE__ */ g("svg", { className: "bt-sort-icon", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
142
+ /* @__PURE__ */ n("path", { d: "M7 2.5L10 5.5H4L7 2.5Z", fill: "currentColor", opacity: "0.2" }),
143
+ /* @__PURE__ */ n("path", { d: "M7 11.5L4 8.5H10L7 11.5Z", fill: "currentColor" })
144
+ ] });
145
+ }
146
+ function Lt({
48
147
  column: e
49
148
  }) {
50
149
  const {
51
150
  sortState: t,
52
151
  handleSort: l,
53
- filters: n,
54
- setFilter: s,
55
- locale: a
56
- } = w(), r = t.columnId === e.id, b = r ? t.direction : null, o = m(() => {
152
+ locale: i,
153
+ multiSortState: a,
154
+ isMultiSort: o
155
+ } = $(), s = t.columnId === e.id, d = o ? a.findIndex((k) => k.columnId === e.id) : -1, c = d >= 0, r = c ? a[d].direction : null, h = o && a.length > 1 && c, b = o ? c : s, u = o ? r : s ? t.direction : null, m = w(() => {
57
156
  e.sortable !== !1 && l(e.id);
58
- }, [e.id, e.sortable, l]), h = m(
59
- (u) => {
60
- const v = u.target.value;
61
- e.type === "boolean" ? v === "" ? s(e.id, null) : s(e.id, v === "true") : s(e.id, v || null);
62
- },
63
- [e.id, e.type, s]
64
- ), f = m(
65
- (u) => {
66
- u.key === "Enter" && e.sortable !== !1 && l(e.id);
157
+ }, [e.id, e.sortable, l]), v = w(
158
+ (k) => {
159
+ k.key === "Enter" && e.sortable !== !1 && l(e.id);
67
160
  },
68
161
  [e.id, e.sortable, l]
69
- ), S = () => e.sortable === !1 || e.type === "custom" ? null : /* @__PURE__ */ i(
70
- "button",
71
- {
72
- className: P("bt-sort-btn", r && "bt-active"),
73
- onClick: o,
74
- "aria-label": b === "asc" ? a.sortDesc : a.sortAsc,
75
- type: "button",
76
- children: r ? b === "asc" ? "↑" : "↓" : "⇅"
77
- }
78
- ), p = () => {
79
- if (e.filterable === !1 || e.type === "custom")
162
+ ), N = () => {
163
+ if (e.sortable === !1 || e.type === "custom")
80
164
  return null;
81
- const u = n[e.id];
82
- return e.type === "boolean" ? /* @__PURE__ */ y(
83
- "select",
165
+ const k = b ? u === "asc" ? xt : At : Pt;
166
+ return /* @__PURE__ */ g(
167
+ "button",
84
168
  {
85
- className: "bt-filter-select",
86
- value: u == null ? "" : String(u),
87
- onChange: h,
88
- "aria-label": `${a.filterBy} ${e.header}`,
169
+ className: x("bt-sort-btn", b && "bt-active"),
170
+ onClick: m,
171
+ "aria-label": u === "asc" ? i.sortDesc : i.sortAsc,
172
+ type: "button",
89
173
  children: [
90
- /* @__PURE__ */ i("option", { value: "", children: "-" }),
91
- /* @__PURE__ */ i("option", { value: "true", children: "✅" }),
92
- /* @__PURE__ */ i("option", { value: "false", children: "❌" })
174
+ /* @__PURE__ */ n(k, {}),
175
+ h && /* @__PURE__ */ n("span", { className: "bt-sort-priority", "aria-label": `${i.sortPriority} ${d + 1}`, children: d + 1 })
93
176
  ]
94
177
  }
95
- ) : /* @__PURE__ */ i(
96
- "input",
97
- {
98
- type: e.type === "number" ? "number" : "text",
99
- className: "bt-filter-input",
100
- placeholder: `${a.filterBy}...`,
101
- value: u != null ? String(u) : "",
102
- onChange: h,
103
- "aria-label": `${a.filterBy} ${e.header}`
104
- }
105
178
  );
106
179
  };
107
- return e.headerCell ? /* @__PURE__ */ i(
180
+ return e.headerCell ? /* @__PURE__ */ n(
108
181
  "th",
109
182
  {
110
- className: P("bt-th", e.align && `bt-align-${e.align}`),
183
+ className: x("bt-th", e.align && `bt-align-${e.align}`),
111
184
  style: { width: e.width },
112
185
  children: e.headerCell(e)
113
186
  }
114
- ) : /* @__PURE__ */ i(
187
+ ) : /* @__PURE__ */ n(
115
188
  "th",
116
189
  {
117
- className: P("bt-th", e.align && `bt-align-${e.align}`),
190
+ className: x("bt-th", e.align && `bt-align-${e.align}`, b && "bt-sorted"),
118
191
  style: { width: e.width },
119
192
  role: "columnheader",
120
- "aria-sort": r ? b === "asc" ? "ascending" : "descending" : void 0,
193
+ "aria-sort": b ? u === "asc" ? "ascending" : "descending" : void 0,
121
194
  tabIndex: e.sortable !== !1 ? 0 : void 0,
122
- onKeyDown: e.sortable !== !1 ? f : void 0,
123
- children: /* @__PURE__ */ y("div", { className: "bt-th-content", children: [
124
- /* @__PURE__ */ y("div", { className: "bt-th-header", children: [
125
- /* @__PURE__ */ i("span", { className: "bt-th-title", children: e.header }),
126
- S()
127
- ] }),
128
- e.filterable !== !1 && p()
129
- ] })
195
+ onKeyDown: e.sortable !== !1 ? v : void 0,
196
+ children: /* @__PURE__ */ n("div", { className: "bt-th-content", children: /* @__PURE__ */ g("div", { className: "bt-th-header", children: [
197
+ /* @__PURE__ */ n("span", { className: "bt-th-title", children: e.header }),
198
+ N()
199
+ ] }) })
130
200
  }
131
201
  );
132
202
  }
133
- const _e = I.memo(
134
- qe
203
+ const Dt = R.memo(
204
+ Lt
205
+ ), Ye = () => /* @__PURE__ */ n(
206
+ "svg",
207
+ {
208
+ className: "bt-ff-icon",
209
+ width: "12",
210
+ height: "12",
211
+ viewBox: "0 0 16 16",
212
+ fill: "none",
213
+ stroke: "currentColor",
214
+ strokeWidth: "1.5",
215
+ strokeLinecap: "round",
216
+ strokeLinejoin: "round",
217
+ "aria-hidden": "true",
218
+ children: /* @__PURE__ */ n("path", { d: "M1.5 2h13L9.5 8.5V14l-3-1.5V8.5z" })
219
+ }
135
220
  );
136
- function Je() {
221
+ function Tt() {
137
222
  const {
138
- columns: e,
139
- selectable: t,
140
- selectionMode: l,
141
- rowActions: n,
142
- isAllSelected: s,
143
- isPartiallySelected: a,
144
- selectAll: r,
145
- deselectAll: b,
146
- locale: o,
147
- stickyHeader: h
148
- } = w(), f = e.filter((u) => !u.hidden), S = n && n.length > 0, p = () => {
149
- s ? b() : r();
150
- };
151
- return /* @__PURE__ */ i("thead", { className: P("bt-thead", h && "bt-sticky"), children: /* @__PURE__ */ y("tr", { className: "bt-tr", children: [
152
- t && /* @__PURE__ */ i("th", { className: "bt-th bt-checkbox-cell", children: l === "multiple" && /* @__PURE__ */ i(
223
+ visibleColumns: e,
224
+ filters: t,
225
+ setFilter: l,
226
+ selectable: i,
227
+ selectionMode: a,
228
+ rowActions: o,
229
+ locale: s,
230
+ stickyHeader: d
231
+ } = $(), c = o && o.length > 0;
232
+ return e.some(
233
+ (h) => h.filterable !== !1 && h.type !== "custom"
234
+ ) ? /* @__PURE__ */ g("tr", { className: x("bt-tr", "bt-floating-filter-row", d && "bt-sticky-filter"), children: [
235
+ i && a === "multiple" && /* @__PURE__ */ n("th", { className: "bt-th bt-floating-filter-cell bt-checkbox-cell" }),
236
+ i && a === "single" && /* @__PURE__ */ n("th", { className: "bt-th bt-floating-filter-cell bt-checkbox-cell" }),
237
+ e.map((h) => /* @__PURE__ */ n(
238
+ "th",
239
+ {
240
+ className: x(
241
+ "bt-th",
242
+ "bt-floating-filter-cell",
243
+ h.align && `bt-align-${h.align}`
244
+ ),
245
+ style: { width: h.width },
246
+ children: h.filterable !== !1 && h.type !== "custom" ? /* @__PURE__ */ n(
247
+ It,
248
+ {
249
+ column: h,
250
+ value: t[h.id],
251
+ setFilter: l,
252
+ locale: s
253
+ }
254
+ ) : null
255
+ },
256
+ h.id
257
+ )),
258
+ c && /* @__PURE__ */ n("th", { className: "bt-th bt-floating-filter-cell bt-actions-cell" })
259
+ ] }) : null;
260
+ }
261
+ function Mt({
262
+ column: e,
263
+ value: t,
264
+ setFilter: l,
265
+ locale: i
266
+ }) {
267
+ const a = w(
268
+ (c) => {
269
+ const r = c.target.value;
270
+ e.type === "boolean" ? r === "" ? l(e.id, null) : l(e.id, r === "true") : l(e.id, r || null);
271
+ },
272
+ [e.id, e.type, l]
273
+ ), o = w(
274
+ (c, r) => {
275
+ const b = { ...t ?? {}, [c]: r || void 0 };
276
+ l(e.id, b);
277
+ },
278
+ [e.id, t, l]
279
+ ), s = `bt-ff-${e.id}`, d = I(() => {
280
+ if (t == null) return !1;
281
+ if (typeof t == "object") {
282
+ const c = t;
283
+ return !!(c.from || c.to);
284
+ }
285
+ return t !== "";
286
+ }, [t]);
287
+ if (e.type === "boolean")
288
+ return /* @__PURE__ */ g("div", { className: x("bt-ff-wrapper", d && "bt-ff-active"), children: [
289
+ /* @__PURE__ */ n(Ye, {}),
290
+ /* @__PURE__ */ g(
291
+ "select",
292
+ {
293
+ id: s,
294
+ name: s,
295
+ className: "bt-floating-filter-select",
296
+ value: t == null ? "" : String(t),
297
+ onChange: a,
298
+ "aria-label": `${i.filterBy} ${e.header}`,
299
+ children: [
300
+ /* @__PURE__ */ n("option", { value: "", children: "—" }),
301
+ /* @__PURE__ */ n("option", { value: "true", children: "✅" }),
302
+ /* @__PURE__ */ n("option", { value: "false", children: "❌" })
303
+ ]
304
+ }
305
+ )
306
+ ] });
307
+ if (e.type === "date") {
308
+ const c = t ?? {};
309
+ return /* @__PURE__ */ g("div", { className: x("bt-floating-filter-dates", d && "bt-ff-active"), children: [
310
+ /* @__PURE__ */ n(
311
+ "input",
312
+ {
313
+ id: `${s}-from`,
314
+ name: `${s}-from`,
315
+ type: "date",
316
+ className: "bt-floating-filter-input",
317
+ value: c.from ?? "",
318
+ onChange: (r) => o("from", r.target.value),
319
+ "aria-label": `${i.dateFrom} ${e.header}`,
320
+ title: i.dateFrom
321
+ }
322
+ ),
323
+ /* @__PURE__ */ n("span", { className: "bt-ff-date-sep", children: "–" }),
324
+ /* @__PURE__ */ n(
325
+ "input",
326
+ {
327
+ id: `${s}-to`,
328
+ name: `${s}-to`,
329
+ type: "date",
330
+ className: "bt-floating-filter-input",
331
+ value: c.to ?? "",
332
+ onChange: (r) => o("to", r.target.value),
333
+ "aria-label": `${i.dateTo} ${e.header}`,
334
+ title: i.dateTo
335
+ }
336
+ )
337
+ ] });
338
+ }
339
+ return /* @__PURE__ */ g("div", { className: x("bt-ff-wrapper", d && "bt-ff-active"), children: [
340
+ /* @__PURE__ */ n(Ye, {}),
341
+ /* @__PURE__ */ n(
153
342
  "input",
154
343
  {
155
- type: "checkbox",
156
- className: "bt-checkbox",
157
- checked: s,
158
- ref: (u) => {
159
- u && (u.indeterminate = a);
160
- },
161
- onChange: p,
162
- "aria-label": s ? o.deselectAll : o.selectAll
344
+ id: s,
345
+ name: s,
346
+ type: e.type === "number" ? "number" : "text",
347
+ className: "bt-floating-filter-input",
348
+ placeholder: "...",
349
+ value: t != null ? String(t) : "",
350
+ onChange: a,
351
+ "aria-label": `${i.filterBy} ${e.header}`
163
352
  }
164
- ) }),
165
- f.map((u) => /* @__PURE__ */ i(_e, { column: u }, u.id)),
166
- S && /* @__PURE__ */ i("th", { className: "bt-th bt-actions-cell", children: o.actions })
167
- ] }) });
353
+ )
354
+ ] });
355
+ }
356
+ const It = R.memo(Mt), $t = R.memo(
357
+ Tt
358
+ );
359
+ function Ft() {
360
+ const {
361
+ visibleColumns: e,
362
+ selectable: t,
363
+ selectionMode: l,
364
+ rowActions: i,
365
+ isAllSelected: a,
366
+ isPartiallySelected: o,
367
+ selectAll: s,
368
+ deselectAll: d,
369
+ locale: c,
370
+ stickyHeader: r,
371
+ filterMode: h
372
+ } = $(), b = i && i.length > 0, u = h === "floating" || h === "both", m = () => {
373
+ a ? d() : s();
374
+ };
375
+ return /* @__PURE__ */ g("thead", { className: x("bt-thead", r && "bt-sticky"), children: [
376
+ /* @__PURE__ */ g("tr", { className: "bt-tr", children: [
377
+ t && /* @__PURE__ */ n("th", { className: "bt-th bt-checkbox-cell", children: l === "multiple" && /* @__PURE__ */ n(
378
+ "input",
379
+ {
380
+ id: "bt-select-all",
381
+ name: "bt-select-all",
382
+ type: "checkbox",
383
+ className: "bt-checkbox",
384
+ checked: a,
385
+ ref: (v) => {
386
+ v && (v.indeterminate = o);
387
+ },
388
+ onChange: m,
389
+ "aria-label": a ? c.deselectAll : c.selectAll
390
+ }
391
+ ) }),
392
+ e.map((v) => /* @__PURE__ */ n(Dt, { column: v }, v.id)),
393
+ b && /* @__PURE__ */ n("th", { className: "bt-th bt-actions-cell", children: c.actions })
394
+ ] }),
395
+ u && /* @__PURE__ */ n($t, {})
396
+ ] });
168
397
  }
169
- const Qe = Je;
170
- function M(e, t) {
398
+ const Rt = Ft;
399
+ function j(e, t) {
171
400
  if (!e || !t) return;
172
401
  const l = t.split(".");
173
- let n = e;
174
- for (const s of l) {
175
- if (n == null)
402
+ let i = e;
403
+ for (const a of l) {
404
+ if (i == null)
176
405
  return;
177
- if (typeof n == "object")
178
- n = n[s];
406
+ if (typeof i == "object")
407
+ i = i[a];
179
408
  else
180
409
  return;
181
410
  }
182
- return n;
411
+ return i;
183
412
  }
184
- function Ge(e, t, l) {
185
- return [...e].sort((n, s) => {
186
- const a = M(n, t), r = M(s, t);
187
- if (a == null)
188
- return l === "asc" ? 1 : -1;
189
- if (r == null)
190
- return l === "asc" ? -1 : 1;
191
- if (typeof a == "string" && typeof r == "string") {
192
- const f = a.localeCompare(r, void 0, {
193
- sensitivity: "base",
194
- numeric: !0
195
- });
196
- return l === "asc" ? f : -f;
197
- }
198
- if (typeof a == "number" && typeof r == "number")
199
- return l === "asc" ? a - r : r - a;
200
- if (typeof a == "boolean" && typeof r == "boolean") {
201
- const f = a === r ? 0 : a ? -1 : 1;
202
- return l === "asc" ? f : -f;
203
- }
204
- if (a instanceof Date && r instanceof Date) {
205
- const f = a.getTime() - r.getTime();
206
- return l === "asc" ? f : -f;
413
+ function at(e, t, l) {
414
+ if (e == null)
415
+ return l === "asc" ? 1 : -1;
416
+ if (t == null)
417
+ return l === "asc" ? -1 : 1;
418
+ if (typeof e == "string" && typeof t == "string") {
419
+ const s = e.localeCompare(t, void 0, {
420
+ sensitivity: "base",
421
+ numeric: !0
422
+ });
423
+ return l === "asc" ? s : -s;
424
+ }
425
+ if (typeof e == "number" && typeof t == "number")
426
+ return l === "asc" ? e - t : t - e;
427
+ if (typeof e == "boolean" && typeof t == "boolean") {
428
+ const s = e === t ? 0 : e ? -1 : 1;
429
+ return l === "asc" ? s : -s;
430
+ }
431
+ if (e instanceof Date && t instanceof Date) {
432
+ const s = e.getTime() - t.getTime();
433
+ return l === "asc" ? s : -s;
434
+ }
435
+ const i = String(e), a = String(t), o = i.localeCompare(a);
436
+ return l === "asc" ? o : -o;
437
+ }
438
+ function Et(e, t, l) {
439
+ return [...e].sort((i, a) => {
440
+ const o = j(i, t), s = j(a, t);
441
+ return at(o, s, l);
442
+ });
443
+ }
444
+ function jt(e, t) {
445
+ const l = t.filter((i) => i.columnId !== null);
446
+ return l.length === 0 ? e : [...e].sort((i, a) => {
447
+ for (const o of l) {
448
+ const s = j(
449
+ i,
450
+ o.columnId
451
+ ), d = j(
452
+ a,
453
+ o.columnId
454
+ ), c = at(s, d, o.direction);
455
+ if (c !== 0) return c;
207
456
  }
208
- const b = String(a), o = String(r), h = b.localeCompare(o);
209
- return l === "asc" ? h : -h;
457
+ return 0;
210
458
  });
211
459
  }
212
- function Ue(e, t, l) {
213
- const n = Object.entries(t).filter(
214
- ([, s]) => s != null && s !== ""
460
+ function _(e) {
461
+ if (e instanceof Date) return e;
462
+ if (typeof e == "string" || typeof e == "number") {
463
+ const t = new Date(e);
464
+ return isNaN(t.getTime()) ? null : t;
465
+ }
466
+ return null;
467
+ }
468
+ function Ot(e, t, l) {
469
+ const i = Object.entries(t).filter(
470
+ ([, a]) => a != null && a !== ""
215
471
  );
216
- return n.length === 0 ? e : e.filter((s) => n.every(([a, r]) => {
217
- const b = l.find((f) => f.id === a);
218
- if (!b) return !0;
219
- const o = M(
220
- s,
221
- String(b.accessor)
472
+ return i.length === 0 ? e : e.filter((a) => i.every(([o, s]) => {
473
+ const d = l.find((h) => h.id === o);
474
+ if (!d) return !0;
475
+ const c = j(
476
+ a,
477
+ String(d.accessor)
222
478
  );
223
- if (o == null)
479
+ if (c == null)
224
480
  return !1;
225
- switch (b.type ?? "string") {
481
+ switch (d.type ?? "string") {
226
482
  case "boolean":
227
- return o === r;
483
+ return c === s;
228
484
  case "number":
229
- return String(o) === String(r);
230
- case "date":
231
- if (o instanceof Date && r) {
232
- const f = new Date(String(r));
233
- return o.toDateString() === f.toDateString();
485
+ return String(c) === String(s);
486
+ case "date": {
487
+ const h = _(c);
488
+ if (!h) return !1;
489
+ if (s && typeof s == "object" && ("from" in s || "to" in s)) {
490
+ const u = s;
491
+ if (u.from) {
492
+ const m = _(u.from);
493
+ if (m && h < m) return !1;
494
+ }
495
+ if (u.to) {
496
+ const m = _(u.to);
497
+ if (m) {
498
+ const v = new Date(m);
499
+ if (v.setHours(23, 59, 59, 999), h > v) return !1;
500
+ }
501
+ }
502
+ return !0;
234
503
  }
235
- return String(o).includes(String(r));
504
+ const b = _(s);
505
+ return b ? h.toDateString() === b.toDateString() : String(c).includes(String(s));
506
+ }
236
507
  default:
237
- return String(o).toLowerCase().includes(String(r).toLowerCase());
508
+ return String(c).toLowerCase().includes(String(s).toLowerCase());
238
509
  }
239
510
  }));
240
511
  }
241
- function We(e, t, l, n) {
512
+ function Bt(e, t, l, i) {
242
513
  if (!t.trim())
243
514
  return e;
244
- const s = t.toLowerCase().trim(), a = n ? l.filter((r) => n.includes(r.id)) : l.filter((r) => r.type !== "custom");
515
+ const a = t.toLowerCase().trim(), o = i ? l.filter(
516
+ (s) => i.includes(s.id) || i.includes(String(s.accessor))
517
+ ) : l.filter((s) => s.type !== "custom");
245
518
  return e.filter(
246
- (r) => a.some((b) => {
247
- const o = M(
248
- r,
249
- String(b.accessor)
519
+ (s) => o.some((d) => {
520
+ const c = j(
521
+ s,
522
+ String(d.accessor)
250
523
  );
251
- return o == null ? !1 : String(o).toLowerCase().includes(s);
524
+ return c == null ? !1 : String(c).toLowerCase().includes(a);
252
525
  })
253
526
  );
254
527
  }
255
- function Xe({
528
+ function zt({
256
529
  row: e,
257
530
  column: t,
258
531
  rowIndex: l
259
532
  }) {
260
- const n = M(
533
+ const i = j(
261
534
  e,
262
535
  String(t.accessor)
263
- ), a = (() => {
536
+ ), o = (() => {
264
537
  if (t.cell)
265
- return t.cell(n, e, l);
266
- if (n == null)
267
- return /* @__PURE__ */ i("span", { className: "bt-cell-empty", children: "—" });
538
+ return t.cell(i, e, l);
539
+ if (i == null)
540
+ return /* @__PURE__ */ n("span", { className: "bt-cell-empty", children: "—" });
268
541
  switch (t.type) {
269
542
  case "boolean":
270
- return n ? "✅" : "❌";
543
+ return i ? "✅" : "❌";
271
544
  case "date":
272
- if (n instanceof Date)
273
- return n.toLocaleDateString();
274
- const r = new Date(String(n));
275
- return isNaN(r.getTime()) ? String(n) : r.toLocaleDateString();
545
+ if (i instanceof Date)
546
+ return i.toLocaleDateString();
547
+ const s = new Date(String(i));
548
+ return isNaN(s.getTime()) ? String(i) : s.toLocaleDateString();
276
549
  case "number":
277
- return typeof n == "number" ? n.toLocaleString() : n;
550
+ return typeof i == "number" ? i.toLocaleString() : i;
278
551
  default:
279
- return String(n);
552
+ return String(i);
280
553
  }
281
554
  })();
282
- return /* @__PURE__ */ i(
555
+ return /* @__PURE__ */ n(
283
556
  "td",
284
557
  {
285
- className: P("bt-td", t.align && `bt-align-${t.align}`),
558
+ className: x("bt-td", t.align && `bt-align-${t.align}`),
286
559
  style: { width: t.width },
287
- children: a
560
+ children: o
288
561
  }
289
562
  );
290
563
  }
291
- const Ye = I.memo(Xe);
292
- function Ze({
564
+ const Vt = R.memo(zt), Ht = "📦";
565
+ function Wt({
566
+ actions: e,
567
+ row: t,
568
+ rowIndex: l,
569
+ onActionClick: i,
570
+ direction: a = "down"
571
+ }) {
572
+ const { locale: o } = $(), [s, d] = M(!1), [c, r] = M({ top: 0, left: 0, openUp: !1 }), h = V(null), b = V(null), u = w((y) => {
573
+ y.stopPropagation(), d((f) => {
574
+ if (!f && h.current) {
575
+ const C = h.current.getBoundingClientRect(), A = window.innerHeight - C.bottom, D = a === "up" || A < 200;
576
+ r({
577
+ top: D ? C.top : C.bottom,
578
+ left: C.right,
579
+ openUp: D
580
+ });
581
+ }
582
+ return !f;
583
+ });
584
+ }, [a]);
585
+ B(() => {
586
+ if (!s) return;
587
+ const y = (f) => {
588
+ const C = f.target;
589
+ h.current && !h.current.contains(C) && b.current && !b.current.contains(C) && d(!1);
590
+ };
591
+ return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
592
+ }, [s]), B(() => {
593
+ if (!s) return;
594
+ const y = (f) => {
595
+ f.key === "Escape" && d(!1);
596
+ };
597
+ return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
598
+ }, [s]), B(() => {
599
+ if (!s) return;
600
+ const y = () => d(!1);
601
+ return window.addEventListener("scroll", y, !0), () => window.removeEventListener("scroll", y, !0);
602
+ }, [s]);
603
+ const m = e.filter((y) => y.variant !== "danger"), v = e.filter((y) => y.variant === "danger"), N = [...m, ...v], k = m.length > 0 && v.length > 0, L = m.length, S = c.openUp ? { position: "fixed", bottom: window.innerHeight - c.top, right: window.innerWidth - c.left } : { position: "fixed", top: c.top, right: window.innerWidth - c.left };
604
+ return /* @__PURE__ */ g("div", { className: "bt-overflow-container", children: [
605
+ /* @__PURE__ */ n(
606
+ "button",
607
+ {
608
+ ref: h,
609
+ className: "bt-action-btn bt-overflow-trigger",
610
+ onClick: u,
611
+ "aria-label": o.moreActions,
612
+ "aria-expanded": s,
613
+ "aria-haspopup": "menu",
614
+ title: o.moreActions,
615
+ type: "button",
616
+ children: /* @__PURE__ */ n("span", { className: "bt-overflow-icon", children: /* @__PURE__ */ g("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
617
+ /* @__PURE__ */ n("circle", { cx: "3", cy: "8", r: "1.5" }),
618
+ /* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "1.5" }),
619
+ /* @__PURE__ */ n("circle", { cx: "13", cy: "8", r: "1.5" })
620
+ ] }) })
621
+ }
622
+ ),
623
+ s && kt(
624
+ /* @__PURE__ */ n(
625
+ "div",
626
+ {
627
+ ref: b,
628
+ className: x(
629
+ "bt-overflow-menu",
630
+ c.openUp && "bt-overflow-menu-up"
631
+ ),
632
+ style: S,
633
+ role: "menu",
634
+ children: N.map((y, f) => {
635
+ if (y.visible && !y.visible(t))
636
+ return null;
637
+ const C = y.disabled ? y.disabled(t) : !1, A = y.icon ?? Ht, D = k && f === L;
638
+ return /* @__PURE__ */ g(R.Fragment, { children: [
639
+ D && /* @__PURE__ */ n("div", { className: "bt-overflow-separator", role: "separator" }),
640
+ y.mode === "link" && y.href ? /* @__PURE__ */ g(
641
+ "a",
642
+ {
643
+ href: typeof y.href == "function" ? y.href(t) : y.href,
644
+ target: "_blank",
645
+ rel: "noopener noreferrer",
646
+ className: x(
647
+ "bt-overflow-item",
648
+ y.variant === "danger" && "bt-overflow-item-danger"
649
+ ),
650
+ role: "menuitem",
651
+ onClick: (p) => {
652
+ p.stopPropagation(), d(!1);
653
+ },
654
+ children: [
655
+ /* @__PURE__ */ n("span", { className: "bt-overflow-item-icon", children: A }),
656
+ /* @__PURE__ */ n("span", { className: "bt-overflow-item-label", children: y.label })
657
+ ]
658
+ }
659
+ ) : /* @__PURE__ */ g(
660
+ "button",
661
+ {
662
+ className: x(
663
+ "bt-overflow-item",
664
+ y.variant === "danger" && "bt-overflow-item-danger"
665
+ ),
666
+ role: "menuitem",
667
+ disabled: C,
668
+ onClick: (p) => {
669
+ p.stopPropagation(), i(y), d(!1);
670
+ },
671
+ type: "button",
672
+ children: [
673
+ /* @__PURE__ */ n("span", { className: "bt-overflow-item-icon", children: A }),
674
+ /* @__PURE__ */ n("span", { className: "bt-overflow-item-label", children: y.label })
675
+ ]
676
+ }
677
+ )
678
+ ] }, y.id);
679
+ })
680
+ }
681
+ ),
682
+ document.body
683
+ )
684
+ ] });
685
+ }
686
+ const st = R.memo(
687
+ Wt
688
+ ), qt = "📦";
689
+ function Kt({
293
690
  row: e,
294
691
  rowIndex: t
295
692
  }) {
296
- const { rowActions: l, openModal: n } = w(), s = m(
297
- (a) => {
298
- if (a.mode === "callback" && a.onClick)
299
- a.onClick(e, t);
300
- else if (a.mode === "modal" && a.modalContent) {
301
- const r = a.modalContent;
302
- n(
303
- /* @__PURE__ */ i(
304
- r,
693
+ const { rowActions: l, openModal: i, closeModal: a, maxVisibleActions: o } = $(), s = w(
694
+ (r) => {
695
+ if (r.mode === "callback" && r.onClick)
696
+ r.onClick(e, t);
697
+ else if (r.mode === "modal" && r.modalContent) {
698
+ const h = r.modalContent;
699
+ i(
700
+ /* @__PURE__ */ n(
701
+ h,
305
702
  {
306
703
  data: e,
307
- onClose: () => {
308
- }
704
+ onClose: a
309
705
  }
310
706
  )
311
707
  );
312
- } else if (a.mode === "link" && a.href) {
313
- const r = typeof a.href == "function" ? a.href(e) : a.href;
314
- window.open(r, "_blank");
708
+ } else if (r.mode === "link" && r.href) {
709
+ const h = typeof r.href == "function" ? r.href(e) : r.href;
710
+ window.open(h, "_blank");
315
711
  }
316
712
  },
317
- [e, t, n]
318
- );
319
- return !l || l.length === 0 ? null : /* @__PURE__ */ i("td", { className: "bt-td bt-actions-cell", children: /* @__PURE__ */ i("div", { className: "bt-actions-wrapper", children: l.map((a) => {
320
- if (a.visible && !a.visible(e))
321
- return null;
322
- const r = a.disabled ? a.disabled(e) : !1;
323
- if (a.mode === "link" && a.href) {
324
- const b = typeof a.href == "function" ? a.href(e) : a.href;
325
- return /* @__PURE__ */ i(
326
- "a",
713
+ [e, t, i, a]
714
+ ), { inlineActions: d, overflowActions: c } = I(() => {
715
+ if (!l) return { inlineActions: [], overflowActions: [] };
716
+ const r = l.filter(
717
+ (b) => !b.visible || b.visible(e)
718
+ );
719
+ if (r.length <= o)
720
+ return { inlineActions: r, overflowActions: [] };
721
+ const h = o - 1;
722
+ return {
723
+ inlineActions: r.slice(0, h),
724
+ overflowActions: r.slice(h)
725
+ };
726
+ }, [l, o, e]);
727
+ return !l || l.length === 0 ? null : /* @__PURE__ */ n("td", { className: "bt-td bt-actions-cell", children: /* @__PURE__ */ g("div", { className: "bt-actions-wrapper", children: [
728
+ d.map((r) => {
729
+ const h = r.disabled ? r.disabled(e) : !1, b = r.icon ?? qt;
730
+ if (r.mode === "link" && r.href) {
731
+ const u = typeof r.href == "function" ? r.href(e) : r.href;
732
+ return /* @__PURE__ */ n(
733
+ "a",
734
+ {
735
+ href: u,
736
+ target: "_blank",
737
+ rel: "noopener noreferrer",
738
+ className: x(
739
+ "bt-action-btn bt-action-icon-only",
740
+ r.variant && `bt-variant-${r.variant}`
741
+ ),
742
+ "aria-label": r.label,
743
+ title: r.label,
744
+ children: /* @__PURE__ */ n("span", { className: "bt-action-icon", children: b })
745
+ },
746
+ r.id
747
+ );
748
+ }
749
+ return /* @__PURE__ */ n(
750
+ "button",
327
751
  {
328
- href: b,
329
- target: "_blank",
330
- rel: "noopener noreferrer",
331
- className: P(
332
- "bt-action-btn",
333
- a.variant && `bt-variant-${a.variant}`
752
+ className: x(
753
+ "bt-action-btn bt-action-icon-only",
754
+ r.variant && `bt-variant-${r.variant}`
334
755
  ),
335
- "aria-label": a.label,
336
- children: a.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: a.icon })
756
+ onClick: () => s(r),
757
+ disabled: h,
758
+ "aria-label": r.label,
759
+ title: r.label,
760
+ type: "button",
761
+ children: /* @__PURE__ */ n("span", { className: "bt-action-icon", children: b })
337
762
  },
338
- a.id
763
+ r.id
339
764
  );
340
- }
341
- return /* @__PURE__ */ i(
342
- "button",
765
+ }),
766
+ c.length > 0 && /* @__PURE__ */ n(
767
+ st,
343
768
  {
344
- className: P(
345
- "bt-action-btn",
346
- a.variant && `bt-variant-${a.variant}`
347
- ),
348
- onClick: () => s(a),
349
- disabled: r,
350
- "aria-label": a.label,
351
- title: a.label,
352
- type: "button",
353
- children: a.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: a.icon })
354
- },
355
- a.id
356
- );
357
- }) }) });
769
+ actions: c,
770
+ row: e,
771
+ rowIndex: t,
772
+ onActionClick: s,
773
+ direction: "down"
774
+ }
775
+ )
776
+ ] }) });
358
777
  }
359
- const et = I.memo(
360
- Ze
778
+ const _t = R.memo(
779
+ Kt
361
780
  );
362
- function tt({ row: e, rowIndex: t }) {
781
+ function Ut({ row: e, rowIndex: t }) {
363
782
  const {
364
- columns: l,
365
- selectable: n,
366
- rowActions: s,
367
- isSelected: a,
368
- toggleRow: r,
369
- striped: b,
370
- hoverable: o,
371
- onRowClick: h,
372
- onRowDoubleClick: f
373
- } = w(), S = l.filter((k) => !k.hidden), p = s && s.length > 0, u = n && a(e, t), v = !!h, N = m(() => {
783
+ visibleColumns: l,
784
+ selectable: i,
785
+ rowActions: a,
786
+ isSelected: o,
787
+ toggleRow: s,
788
+ striped: d,
789
+ hoverable: c,
790
+ onRowClick: r,
791
+ onRowDoubleClick: h
792
+ } = $(), b = a && a.length > 0, u = i && o(e, t), m = !!r, v = w(() => {
793
+ r?.(e, t);
794
+ }, [e, t, r]), N = w(() => {
374
795
  h?.(e, t);
375
- }, [e, t, h]), D = m(() => {
376
- f?.(e, t);
377
- }, [e, t, f]), $ = m(() => {
378
- r(e, t);
379
- }, [e, t, r]), T = m(
380
- (k) => {
381
- k.key === "Enter" && h && N();
796
+ }, [e, t, h]), k = w(() => {
797
+ s(e, t);
798
+ }, [e, t, s]), L = w(
799
+ (S) => {
800
+ S.key === "Enter" && r && v();
382
801
  },
383
- [N, h]
802
+ [v, r]
384
803
  );
385
- return /* @__PURE__ */ y(
804
+ return /* @__PURE__ */ g(
386
805
  "tr",
387
806
  {
388
- className: P(
807
+ className: x(
389
808
  "bt-tr",
390
- b && "bt-striped",
391
- o && "bt-hoverable",
809
+ d && "bt-striped",
810
+ c && "bt-hoverable",
392
811
  u && "bt-selected",
393
- v && "bt-clickable"
812
+ m && "bt-clickable"
394
813
  ),
395
- onClick: v ? N : void 0,
396
- onDoubleClick: f ? D : void 0,
397
- onKeyDown: v ? T : void 0,
398
- tabIndex: v ? 0 : void 0,
399
- role: v ? "button" : void 0,
400
- "aria-selected": n ? u : void 0,
814
+ onClick: m ? v : void 0,
815
+ onDoubleClick: h ? N : void 0,
816
+ onKeyDown: m ? L : void 0,
817
+ tabIndex: m ? 0 : void 0,
818
+ role: m ? "button" : void 0,
819
+ "aria-selected": i ? u : void 0,
401
820
  children: [
402
- n && /* @__PURE__ */ i("td", { className: "bt-td bt-checkbox-cell", children: /* @__PURE__ */ i(
821
+ i && /* @__PURE__ */ n("td", { className: "bt-td bt-checkbox-cell", children: /* @__PURE__ */ n(
403
822
  "input",
404
823
  {
824
+ id: `bt-row-select-${t}`,
825
+ name: `bt-row-select-${t}`,
405
826
  type: "checkbox",
406
827
  className: "bt-checkbox",
407
828
  checked: u,
408
- onChange: $,
409
- onClick: (k) => k.stopPropagation(),
829
+ onChange: k,
830
+ onClick: (S) => S.stopPropagation(),
410
831
  "aria-label": `Select row ${t + 1}`
411
832
  }
412
833
  ) }),
413
- S.map((k) => /* @__PURE__ */ i(
414
- Ye,
834
+ l.map((S) => /* @__PURE__ */ n(
835
+ Vt,
415
836
  {
416
837
  row: e,
417
- column: k,
838
+ column: S,
418
839
  rowIndex: t
419
840
  },
420
- k.id
841
+ S.id
421
842
  )),
422
- p && /* @__PURE__ */ i(et, { row: e, rowIndex: t })
843
+ b && /* @__PURE__ */ n(_t, { row: e, rowIndex: t })
423
844
  ]
424
845
  }
425
846
  );
426
847
  }
427
- const at = I.memo(tt);
428
- function nt() {
429
- const { processedData: e, rowKey: t } = w(), l = (n, s) => {
848
+ const Zt = R.memo(Ut);
849
+ function Qt() {
850
+ const { processedData: e, rowKey: t } = $(), l = (i, a) => {
430
851
  if (typeof t == "function")
431
- return t(n, s);
432
- const a = n[t];
433
- return String(a !== void 0 ? a : s);
852
+ return t(i, a);
853
+ const o = i[t];
854
+ return String(o !== void 0 ? o : a);
434
855
  };
435
- return /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: e.map((n, s) => /* @__PURE__ */ i(at, { row: n, rowIndex: s }, l(n, s))) });
856
+ return /* @__PURE__ */ n("tbody", { className: "bt-tbody", children: e.map((i, a) => /* @__PURE__ */ n(Zt, { row: i, rowIndex: a }, l(i, a))) });
436
857
  }
437
- const lt = nt;
438
- function st({ row: e, rowIndex: t }) {
858
+ const Gt = Qt, Jt = "📦";
859
+ function Xt({ row: e, rowIndex: t }) {
439
860
  const {
440
- columns: l,
441
- selectable: n,
442
- rowActions: s,
443
- isSelected: a,
444
- toggleRow: r,
445
- hoverable: b,
446
- onRowClick: o,
447
- openModal: h
448
- } = w(), f = l.filter((c) => !c.hidden), S = s && s.length > 0, p = n && a(e, t), u = f[0], v = f.slice(1), N = m(() => {
449
- r(e, t);
450
- }, [e, t, r]), D = m(() => {
451
- o?.(e, t);
452
- }, [e, t, o]), $ = m(
453
- (c) => {
454
- c.key === "Enter" && o && D();
861
+ visibleColumns: l,
862
+ selectable: i,
863
+ rowActions: a,
864
+ maxVisibleActions: o,
865
+ isSelected: s,
866
+ toggleRow: d,
867
+ hoverable: c,
868
+ onRowClick: r,
869
+ openModal: h,
870
+ closeModal: b
871
+ } = $(), u = a && a.length > 0, m = i && s(e, t), v = l[0], N = l.slice(1), { inlineActions: k, overflowActions: L } = I(() => {
872
+ if (!a) return { inlineActions: [], overflowActions: [] };
873
+ const p = a.filter(
874
+ (F) => !F.visible || F.visible(e)
875
+ );
876
+ if (p.length <= o)
877
+ return { inlineActions: p, overflowActions: [] };
878
+ const P = o - 1;
879
+ return {
880
+ inlineActions: p.slice(0, P),
881
+ overflowActions: p.slice(P)
882
+ };
883
+ }, [a, o, e]), S = w(() => {
884
+ d(e, t);
885
+ }, [e, t, d]), y = w(() => {
886
+ r?.(e, t);
887
+ }, [e, t, r]), f = w(
888
+ (p) => {
889
+ p.key === "Enter" && r && y();
455
890
  },
456
- [D, o]
457
- ), T = m(
458
- (c) => {
459
- if (c.mode === "callback" && c.onClick)
460
- c.onClick(e, t);
461
- else if (c.mode === "modal" && c.modalContent) {
462
- const g = c.modalContent;
463
- h(/* @__PURE__ */ i(g, { data: e, onClose: () => {
464
- } }));
465
- } else if (c.mode === "link" && c.href) {
466
- const g = typeof c.href == "function" ? c.href(e) : c.href;
467
- window.open(g, "_blank");
891
+ [y, r]
892
+ ), C = w(
893
+ (p) => {
894
+ if (p.mode === "callback" && p.onClick)
895
+ p.onClick(e, t);
896
+ else if (p.mode === "modal" && p.modalContent) {
897
+ const P = p.modalContent;
898
+ h(/* @__PURE__ */ n(P, { data: e, onClose: b }));
899
+ } else if (p.mode === "link" && p.href) {
900
+ const P = typeof p.href == "function" ? p.href(e) : p.href;
901
+ window.open(P, "_blank");
468
902
  }
469
903
  },
470
- [e, t, h]
471
- ), k = (c, g) => {
472
- if (c.cell)
473
- return c.cell(g, e, t);
474
- if (g == null)
475
- return /* @__PURE__ */ i("span", { className: "bt-card-value-empty", children: "—" });
476
- switch (c.type) {
904
+ [e, t, h, b]
905
+ ), A = (p, P) => {
906
+ if (p.cell)
907
+ return p.cell(P, e, t);
908
+ if (P == null)
909
+ return /* @__PURE__ */ n("span", { className: "bt-card-value-empty", children: "—" });
910
+ switch (p.type) {
477
911
  case "boolean":
478
- return g ? "✅" : "❌";
912
+ return P ? "✅" : "❌";
479
913
  case "date":
480
- if (g instanceof Date)
481
- return g.toLocaleDateString();
482
- const C = new Date(String(g));
483
- return isNaN(C.getTime()) ? String(g) : C.toLocaleDateString();
914
+ if (P instanceof Date)
915
+ return P.toLocaleDateString();
916
+ const F = new Date(String(P));
917
+ return isNaN(F.getTime()) ? String(P) : F.toLocaleDateString();
484
918
  case "number":
485
- return typeof g == "number" ? g.toLocaleString() : String(g);
919
+ return typeof P == "number" ? P.toLocaleString() : String(P);
486
920
  default:
487
- return String(g);
921
+ return String(P);
488
922
  }
489
- }, d = u ? M(e, String(u.accessor)) : "";
490
- return /* @__PURE__ */ y(
923
+ }, D = v ? j(e, String(v.accessor)) : "";
924
+ return /* @__PURE__ */ g(
491
925
  "div",
492
926
  {
493
- className: P(
927
+ className: x(
494
928
  "bt-card",
495
- b && "bt-hoverable",
496
- p && "bt-selected",
497
- o && "bt-clickable"
929
+ c && "bt-hoverable",
930
+ m && "bt-selected",
931
+ r && "bt-clickable"
498
932
  ),
499
- onClick: o ? D : void 0,
500
- onKeyDown: o ? $ : void 0,
501
- tabIndex: o ? 0 : void 0,
502
- role: o ? "button" : void 0,
503
- "aria-selected": n ? p : void 0,
933
+ onClick: r ? y : void 0,
934
+ onKeyDown: r ? f : void 0,
935
+ tabIndex: r ? 0 : void 0,
936
+ role: r ? "button" : void 0,
937
+ "aria-selected": i ? m : void 0,
504
938
  children: [
505
- /* @__PURE__ */ y("div", { className: "bt-card-header", children: [
506
- n && /* @__PURE__ */ i(
939
+ /* @__PURE__ */ g("div", { className: "bt-card-header", children: [
940
+ i && /* @__PURE__ */ n(
507
941
  "input",
508
942
  {
943
+ id: `bt-card-select-${t}`,
944
+ name: `bt-card-select-${t}`,
509
945
  type: "checkbox",
510
946
  className: "bt-checkbox",
511
- checked: p,
512
- onChange: N,
513
- onClick: (c) => c.stopPropagation(),
947
+ checked: m,
948
+ onChange: S,
949
+ onClick: (p) => p.stopPropagation(),
514
950
  "aria-label": `Select row ${t + 1}`
515
951
  }
516
952
  ),
517
- /* @__PURE__ */ i("span", { className: "bt-card-title", children: u ? k(u, d) : `Item ${t + 1}` })
953
+ /* @__PURE__ */ n("span", { className: "bt-card-title", children: v ? A(v, D) : `Item ${t + 1}` })
518
954
  ] }),
519
- v.map((c) => {
520
- const g = M(
955
+ N.map((p) => {
956
+ const P = j(
521
957
  e,
522
- String(c.accessor)
523
- ), C = k(c, g);
524
- return /* @__PURE__ */ y("div", { className: "bt-card-row", children: [
525
- /* @__PURE__ */ i("span", { className: "bt-card-label", children: c.header }),
526
- /* @__PURE__ */ i("span", { className: "bt-card-value", children: C })
527
- ] }, c.id);
958
+ String(p.accessor)
959
+ ), F = A(p, P);
960
+ return /* @__PURE__ */ g("div", { className: "bt-card-row", children: [
961
+ /* @__PURE__ */ n("span", { className: "bt-card-label", children: p.header }),
962
+ /* @__PURE__ */ n("span", { className: "bt-card-value", children: F })
963
+ ] }, p.id);
528
964
  }),
529
- S && /* @__PURE__ */ i("div", { className: "bt-card-actions", children: s.map((c) => {
530
- if (c.visible && !c.visible(e))
531
- return null;
532
- const g = c.disabled ? c.disabled(e) : !1;
533
- if (c.mode === "link" && c.href) {
534
- const C = typeof c.href == "function" ? c.href(e) : c.href;
535
- return /* @__PURE__ */ y(
536
- "a",
965
+ u && /* @__PURE__ */ g("div", { className: "bt-card-actions", children: [
966
+ k.map((p) => {
967
+ const P = p.disabled ? p.disabled(e) : !1, F = p.icon ?? Jt;
968
+ if (p.mode === "link" && p.href) {
969
+ const z = typeof p.href == "function" ? p.href(e) : p.href;
970
+ return /* @__PURE__ */ n(
971
+ "a",
972
+ {
973
+ href: z,
974
+ target: "_blank",
975
+ rel: "noopener noreferrer",
976
+ className: x(
977
+ "bt-action-btn bt-action-icon-only",
978
+ p.variant && `bt-variant-${p.variant}`
979
+ ),
980
+ "aria-label": p.label,
981
+ title: p.label,
982
+ onClick: (H) => H.stopPropagation(),
983
+ children: /* @__PURE__ */ n("span", { className: "bt-action-icon", children: F })
984
+ },
985
+ p.id
986
+ );
987
+ }
988
+ return /* @__PURE__ */ n(
989
+ "button",
537
990
  {
538
- href: C,
539
- target: "_blank",
540
- rel: "noopener noreferrer",
541
- className: P(
542
- "bt-action-btn",
543
- c.variant && `bt-variant-${c.variant}`
991
+ className: x(
992
+ "bt-action-btn bt-action-icon-only",
993
+ p.variant && `bt-variant-${p.variant}`
544
994
  ),
545
- onClick: (A) => A.stopPropagation(),
546
- children: [
547
- c.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: c.icon }),
548
- /* @__PURE__ */ i("span", { children: c.label })
549
- ]
995
+ onClick: (z) => {
996
+ z.stopPropagation(), C(p);
997
+ },
998
+ disabled: P,
999
+ "aria-label": p.label,
1000
+ title: p.label,
1001
+ type: "button",
1002
+ children: /* @__PURE__ */ n("span", { className: "bt-action-icon", children: F })
550
1003
  },
551
- c.id
1004
+ p.id
552
1005
  );
553
- }
554
- return /* @__PURE__ */ y(
555
- "button",
1006
+ }),
1007
+ L.length > 0 && /* @__PURE__ */ n(
1008
+ st,
556
1009
  {
557
- className: P(
558
- "bt-action-btn",
559
- c.variant && `bt-variant-${c.variant}`
560
- ),
561
- onClick: (C) => {
562
- C.stopPropagation(), T(c);
563
- },
564
- disabled: g,
565
- type: "button",
566
- children: [
567
- c.icon && /* @__PURE__ */ i("span", { className: "bt-action-icon", children: c.icon }),
568
- /* @__PURE__ */ i("span", { children: c.label })
569
- ]
570
- },
571
- c.id
572
- );
573
- }) })
1010
+ actions: L,
1011
+ row: e,
1012
+ rowIndex: t,
1013
+ onActionClick: C,
1014
+ direction: "up"
1015
+ }
1016
+ )
1017
+ ] })
574
1018
  ]
575
1019
  }
576
1020
  );
577
1021
  }
578
- const rt = I.memo(st);
579
- function it() {
580
- const { processedData: e, rowKey: t } = w(), l = (n, s) => {
1022
+ const Yt = R.memo(Xt);
1023
+ function en() {
1024
+ const { processedData: e, rowKey: t } = $(), l = (i, a) => {
581
1025
  if (typeof t == "function")
582
- return t(n, s);
583
- const a = n[t];
584
- return String(a !== void 0 ? a : s);
1026
+ return t(i, a);
1027
+ const o = i[t];
1028
+ return String(o !== void 0 ? o : a);
585
1029
  };
586
- return /* @__PURE__ */ i("div", { className: "bt-cards", children: e.map((n, s) => /* @__PURE__ */ i(rt, { row: n, rowIndex: s }, l(n, s))) });
1030
+ return /* @__PURE__ */ n("div", { className: "bt-cards", children: e.map((i, a) => /* @__PURE__ */ n(Yt, { row: i, rowIndex: a }, l(i, a))) });
1031
+ }
1032
+ const tn = en;
1033
+ function et() {
1034
+ return /* @__PURE__ */ n("svg", { className: "bt-fp-icon", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M1.5 2H10.5L7 5.87V9.5L5 8.5V5.87L1.5 2Z", stroke: "currentColor", strokeWidth: "1.2", strokeLinejoin: "round" }) });
587
1035
  }
588
- const ct = it;
589
- function ot() {
1036
+ function nn({
1037
+ open: e
1038
+ }) {
1039
+ const { columns: t, filters: l, setFilter: i, clearFilter: a, clearFilters: o, locale: s } = $(), d = t.filter(
1040
+ (r) => r.filterable !== !1 && r.type !== "custom" && !r.hidden
1041
+ );
1042
+ if (!e || d.length === 0)
1043
+ return null;
1044
+ const c = Object.keys(l).length;
1045
+ return /* @__PURE__ */ g("div", { className: "bt-filter-panel", role: "region", "aria-label": s.filterBy, children: [
1046
+ /* @__PURE__ */ n("div", { className: "bt-filter-panel-grid", children: d.map((r) => /* @__PURE__ */ n(
1047
+ rn,
1048
+ {
1049
+ column: r,
1050
+ value: l[r.id],
1051
+ setFilter: i,
1052
+ clearFilter: a,
1053
+ locale: s
1054
+ },
1055
+ r.id
1056
+ )) }),
1057
+ c > 0 && /* @__PURE__ */ n("div", { className: "bt-filter-panel-footer", children: /* @__PURE__ */ n(
1058
+ "button",
1059
+ {
1060
+ className: "bt-filter-panel-clear",
1061
+ onClick: o,
1062
+ type: "button",
1063
+ children: s.clearFilters
1064
+ }
1065
+ ) })
1066
+ ] });
1067
+ }
1068
+ function ln({
1069
+ column: e,
1070
+ value: t,
1071
+ setFilter: l,
1072
+ locale: i
1073
+ }) {
1074
+ const a = w(
1075
+ (h) => {
1076
+ const b = h.target.value;
1077
+ e.type === "boolean" ? b === "" ? l(e.id, null) : l(e.id, b === "true") : l(e.id, b || null);
1078
+ },
1079
+ [e.id, e.type, l]
1080
+ ), o = w(
1081
+ (h, b) => {
1082
+ const m = { ...t ?? {}, [h]: b || void 0 };
1083
+ l(e.id, m);
1084
+ },
1085
+ [e.id, t, l]
1086
+ ), s = t != null && t !== "", d = s && typeof t == "object" && ("from" in t || "to" in t) && !!(t.from || t.to), c = e.type === "date" ? d : s, r = () => {
1087
+ const h = `bt-filter-${e.id}`;
1088
+ if (e.type === "boolean")
1089
+ return /* @__PURE__ */ g("div", { className: x("bt-fp-wrapper", c && "bt-fp-active"), children: [
1090
+ /* @__PURE__ */ n(et, {}),
1091
+ /* @__PURE__ */ g(
1092
+ "select",
1093
+ {
1094
+ id: h,
1095
+ name: h,
1096
+ className: "bt-filter-select",
1097
+ value: t == null ? "" : String(t),
1098
+ onChange: a,
1099
+ "aria-label": `${i.filterBy} ${e.header}`,
1100
+ children: [
1101
+ /* @__PURE__ */ n("option", { value: "", children: "—" }),
1102
+ /* @__PURE__ */ n("option", { value: "true", children: "✅" }),
1103
+ /* @__PURE__ */ n("option", { value: "false", children: "❌" })
1104
+ ]
1105
+ }
1106
+ )
1107
+ ] });
1108
+ if (e.type === "date") {
1109
+ const b = t ?? {};
1110
+ return /* @__PURE__ */ g("div", { className: x("bt-fp-wrapper bt-filter-field-dates", c && "bt-fp-active"), children: [
1111
+ /* @__PURE__ */ n(
1112
+ "input",
1113
+ {
1114
+ id: `${h}-from`,
1115
+ name: `${h}-from`,
1116
+ type: "date",
1117
+ className: "bt-filter-input",
1118
+ value: b.from ?? "",
1119
+ onChange: (u) => o("from", u.target.value),
1120
+ "aria-label": `${i.dateFrom} ${e.header}`,
1121
+ placeholder: i.dateFrom
1122
+ }
1123
+ ),
1124
+ /* @__PURE__ */ n("span", { className: "bt-filter-field-separator", children: "–" }),
1125
+ /* @__PURE__ */ n(
1126
+ "input",
1127
+ {
1128
+ id: `${h}-to`,
1129
+ name: `${h}-to`,
1130
+ type: "date",
1131
+ className: "bt-filter-input",
1132
+ value: b.to ?? "",
1133
+ onChange: (u) => o("to", u.target.value),
1134
+ "aria-label": `${i.dateTo} ${e.header}`,
1135
+ placeholder: i.dateTo
1136
+ }
1137
+ )
1138
+ ] });
1139
+ }
1140
+ return /* @__PURE__ */ g("div", { className: x("bt-fp-wrapper", c && "bt-fp-active"), children: [
1141
+ /* @__PURE__ */ n(et, {}),
1142
+ /* @__PURE__ */ n(
1143
+ "input",
1144
+ {
1145
+ id: h,
1146
+ name: h,
1147
+ type: e.type === "number" ? "number" : "text",
1148
+ className: "bt-filter-input",
1149
+ placeholder: "...",
1150
+ value: t != null ? String(t) : "",
1151
+ onChange: a,
1152
+ "aria-label": `${i.filterBy} ${e.header}`
1153
+ }
1154
+ )
1155
+ ] });
1156
+ };
1157
+ return /* @__PURE__ */ g("div", { className: x("bt-filter-field", c && "bt-filter-field-active"), children: [
1158
+ /* @__PURE__ */ n("label", { className: "bt-filter-field-label", htmlFor: `bt-filter-${e.id}`, children: e.header }),
1159
+ r()
1160
+ ] });
1161
+ }
1162
+ const rn = R.memo(ln), an = R.memo(
1163
+ nn
1164
+ );
1165
+ function sn() {
1166
+ return /* @__PURE__ */ g("svg", { className: "bt-columns-svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
1167
+ /* @__PURE__ */ n("rect", { x: "1.5", y: "2", width: "4", height: "10", rx: "1", stroke: "currentColor", strokeWidth: "1.3" }),
1168
+ /* @__PURE__ */ n("rect", { x: "8.5", y: "2", width: "4", height: "10", rx: "1", stroke: "currentColor", strokeWidth: "1.3" })
1169
+ ] });
1170
+ }
1171
+ function on() {
1172
+ return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2.5 6L5 8.5L9.5 3.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1173
+ }
1174
+ function cn() {
1175
+ const {
1176
+ columns: e,
1177
+ hiddenColumnIds: t,
1178
+ toggleColumn: l,
1179
+ showAllColumns: i,
1180
+ isColumnVisible: a,
1181
+ locale: o,
1182
+ columnVisibilityEnabled: s
1183
+ } = $(), [d, c] = M(!1), r = V(null), h = V(null), b = t.size;
1184
+ B(() => {
1185
+ if (!d) return;
1186
+ const v = (k) => {
1187
+ r.current && !r.current.contains(k.target) && c(!1);
1188
+ }, N = (k) => {
1189
+ k.key === "Escape" && (c(!1), h.current?.focus());
1190
+ };
1191
+ return document.addEventListener("mousedown", v), document.addEventListener("keydown", N), () => {
1192
+ document.removeEventListener("mousedown", v), document.removeEventListener("keydown", N);
1193
+ };
1194
+ }, [d]);
1195
+ const u = w(() => {
1196
+ c((v) => !v);
1197
+ }, []);
1198
+ if (!s) return null;
1199
+ const m = e.filter((v) => v.type !== "custom");
1200
+ return /* @__PURE__ */ g("div", { className: "bt-column-visibility", ref: r, children: [
1201
+ /* @__PURE__ */ g(
1202
+ "button",
1203
+ {
1204
+ ref: h,
1205
+ className: x("bt-column-visibility-btn", d && "bt-column-visibility-btn-active"),
1206
+ onClick: u,
1207
+ "aria-expanded": d,
1208
+ "aria-haspopup": "true",
1209
+ "aria-label": o.columns,
1210
+ title: o.columns,
1211
+ type: "button",
1212
+ children: [
1213
+ /* @__PURE__ */ n(sn, {}),
1214
+ /* @__PURE__ */ n("span", { className: "bt-column-visibility-label", children: o.columns }),
1215
+ b > 0 && /* @__PURE__ */ n("span", { className: "bt-column-visibility-badge", children: b })
1216
+ ]
1217
+ }
1218
+ ),
1219
+ d && /* @__PURE__ */ g("div", { className: "bt-column-visibility-dropdown", role: "menu", children: [
1220
+ /* @__PURE__ */ g("div", { className: "bt-column-visibility-header", children: [
1221
+ /* @__PURE__ */ n("span", { className: "bt-column-visibility-title", children: o.columns }),
1222
+ b > 0 && /* @__PURE__ */ n(
1223
+ "button",
1224
+ {
1225
+ className: "bt-column-visibility-show-all",
1226
+ onClick: i,
1227
+ type: "button",
1228
+ children: o.showAllColumns
1229
+ }
1230
+ )
1231
+ ] }),
1232
+ /* @__PURE__ */ n("div", { className: "bt-column-visibility-list", children: m.map((v) => {
1233
+ const N = a(v.id);
1234
+ return /* @__PURE__ */ g(
1235
+ "button",
1236
+ {
1237
+ className: x(
1238
+ "bt-column-visibility-item",
1239
+ !N && "bt-column-visibility-item-hidden"
1240
+ ),
1241
+ onClick: () => l(v.id),
1242
+ role: "menuitemcheckbox",
1243
+ "aria-checked": N,
1244
+ type: "button",
1245
+ children: [
1246
+ /* @__PURE__ */ n("span", { className: x("bt-column-visibility-check", N && "bt-column-visibility-check-active"), children: N && /* @__PURE__ */ n(on, {}) }),
1247
+ /* @__PURE__ */ n("span", { className: "bt-column-visibility-item-label", children: v.header })
1248
+ ]
1249
+ },
1250
+ v.id
1251
+ );
1252
+ }) })
1253
+ ] })
1254
+ ] });
1255
+ }
1256
+ const dn = cn;
1257
+ function hn() {
1258
+ return /* @__PURE__ */ n("svg", { className: "bt-pagination-svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M9 3L5 7L9 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1259
+ }
1260
+ function bn() {
1261
+ return /* @__PURE__ */ n("svg", { className: "bt-pagination-svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M5 3L9 7L5 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1262
+ }
1263
+ function un() {
590
1264
  const {
591
1265
  page: e,
592
1266
  pageSize: t,
593
1267
  totalPages: l,
594
- totalItems: n,
595
- goToPage: s,
596
- nextPage: a,
597
- prevPage: r,
598
- changePageSize: b,
599
- hasNextPage: o,
600
- hasPrevPage: h,
601
- startIndex: f,
602
- endIndex: S,
603
- paginationEnabled: p,
604
- pageSizeOptions: u,
1268
+ totalItems: i,
1269
+ goToPage: a,
1270
+ nextPage: o,
1271
+ prevPage: s,
1272
+ changePageSize: d,
1273
+ hasNextPage: c,
1274
+ hasPrevPage: r,
1275
+ startIndex: h,
1276
+ endIndex: b,
1277
+ paginationEnabled: u,
1278
+ pageSizeOptions: m,
605
1279
  showSizeChanger: v,
606
1280
  locale: N,
607
- classNames: D
608
- } = w(), $ = m(
609
- (d) => {
610
- b(Number(d.target.value));
1281
+ classNames: k
1282
+ } = $(), L = w(
1283
+ (f) => {
1284
+ d(Number(f.target.value));
611
1285
  },
612
- [b]
613
- ), T = m(
614
- (d) => {
615
- if (d.key === "Enter") {
616
- const c = parseInt(d.target.value, 10);
617
- !isNaN(c) && c >= 1 && c <= l && s(c);
1286
+ [d]
1287
+ ), S = w(
1288
+ (f) => {
1289
+ if (f.key === "Enter") {
1290
+ const C = parseInt(f.target.value, 10);
1291
+ !isNaN(C) && C >= 1 && C <= l && a(C);
618
1292
  }
619
1293
  },
620
- [s, l]
621
- ), k = x(() => {
622
- const d = [];
1294
+ [a, l]
1295
+ ), y = I(() => {
1296
+ const f = [];
623
1297
  if (l <= 5)
624
- for (let g = 1; g <= l; g++)
625
- d.push(g);
1298
+ for (let A = 1; A <= l; A++)
1299
+ f.push(A);
626
1300
  else {
627
- d.push(1), e > 3 && d.push("ellipsis");
628
- const g = Math.max(2, e - 1), C = Math.min(l - 1, e + 1);
629
- for (let A = g; A <= C; A++)
630
- d.push(A);
631
- e < l - 2 && d.push("ellipsis"), l > 1 && d.push(l);
1301
+ f.push(1), e > 3 && f.push("ellipsis");
1302
+ const A = Math.max(2, e - 1), D = Math.min(l - 1, e + 1);
1303
+ for (let p = A; p <= D; p++)
1304
+ f.push(p);
1305
+ e < l - 2 && f.push("ellipsis"), l > 1 && f.push(l);
632
1306
  }
633
- return d;
1307
+ return f;
634
1308
  }, [e, l]);
635
- return p ? /* @__PURE__ */ y("div", { className: `bt-pagination ${D.pagination || ""}`, children: [
636
- /* @__PURE__ */ i("div", { className: "bt-pagination-info", children: n > 0 ? `${f}-${S} ${N.of} ${n} ${N.items}` : `0 ${N.items}` }),
637
- /* @__PURE__ */ y("div", { className: "bt-pagination-controls", children: [
638
- v && /* @__PURE__ */ y("div", { className: "bt-page-size", children: [
639
- /* @__PURE__ */ y("span", { className: "bt-page-size-label", children: [
1309
+ return u ? /* @__PURE__ */ g("div", { className: `bt-pagination ${k.pagination || ""}`, children: [
1310
+ /* @__PURE__ */ n("div", { className: "bt-pagination-info", children: i > 0 ? `${h}-${b} ${N.of} ${i} ${N.items}` : `0 ${N.items}` }),
1311
+ /* @__PURE__ */ g("div", { className: "bt-pagination-controls", children: [
1312
+ v && /* @__PURE__ */ g("div", { className: "bt-page-size", children: [
1313
+ /* @__PURE__ */ g("label", { className: "bt-page-size-label", htmlFor: "bt-page-size", children: [
640
1314
  N.rowsPerPage,
641
1315
  ":"
642
1316
  ] }),
643
- /* @__PURE__ */ i(
1317
+ /* @__PURE__ */ n(
644
1318
  "select",
645
1319
  {
1320
+ id: "bt-page-size",
1321
+ name: "bt-page-size",
646
1322
  className: "bt-page-size-select",
647
1323
  value: t,
648
- onChange: $,
1324
+ onChange: L,
649
1325
  "aria-label": N.rowsPerPage,
650
- children: u.map((d) => /* @__PURE__ */ i("option", { value: d, children: d }, d))
1326
+ children: m.map((f) => /* @__PURE__ */ n("option", { value: f, children: f }, f))
651
1327
  }
652
1328
  )
653
1329
  ] }),
654
- /* @__PURE__ */ i(
1330
+ /* @__PURE__ */ n(
655
1331
  "button",
656
1332
  {
657
1333
  className: "bt-pagination-btn",
658
- onClick: r,
659
- disabled: !h,
660
- "aria-label": "Previous page",
1334
+ onClick: s,
1335
+ disabled: !r,
1336
+ "aria-label": N.previousPage,
661
1337
  type: "button",
662
- children: "←"
1338
+ children: /* @__PURE__ */ n(hn, {})
663
1339
  }
664
1340
  ),
665
- /* @__PURE__ */ i("div", { className: "bt-pagination-pages", children: k.map((d, c) => d === "ellipsis" ? /* @__PURE__ */ i("span", { className: "bt-pagination-ellipsis", children: "..." }, `ellipsis-${c}`) : /* @__PURE__ */ i(
1341
+ /* @__PURE__ */ n("div", { className: "bt-pagination-pages", children: y.map((f, C) => f === "ellipsis" ? /* @__PURE__ */ n("span", { className: "bt-pagination-ellipsis", children: "..." }, `ellipsis-${C}`) : /* @__PURE__ */ n(
666
1342
  "button",
667
1343
  {
668
- className: `bt-pagination-btn ${e === d ? "bt-active" : ""}`,
669
- onClick: () => s(d),
670
- "aria-label": `${N.page} ${d}`,
671
- "aria-current": e === d ? "page" : void 0,
1344
+ className: `bt-pagination-btn ${e === f ? "bt-active" : ""}`,
1345
+ onClick: () => a(f),
1346
+ "aria-label": `${N.page} ${f}`,
1347
+ "aria-current": e === f ? "page" : void 0,
672
1348
  type: "button",
673
- children: d
1349
+ children: f
674
1350
  },
675
- d
1351
+ f
676
1352
  )) }),
677
- /* @__PURE__ */ i(
1353
+ /* @__PURE__ */ n(
678
1354
  "button",
679
1355
  {
680
1356
  className: "bt-pagination-btn",
681
- onClick: a,
682
- disabled: !o,
683
- "aria-label": "Next page",
1357
+ onClick: o,
1358
+ disabled: !c,
1359
+ "aria-label": N.nextPage,
684
1360
  type: "button",
685
- children: "→"
1361
+ children: /* @__PURE__ */ n(bn, {})
686
1362
  }
687
1363
  ),
688
- /* @__PURE__ */ y("div", { className: "bt-quick-jumper", children: [
689
- /* @__PURE__ */ y("span", { className: "bt-quick-jumper-label", children: [
1364
+ /* @__PURE__ */ g("div", { className: "bt-quick-jumper", children: [
1365
+ /* @__PURE__ */ g("label", { className: "bt-quick-jumper-label", htmlFor: "bt-quick-jumper", children: [
690
1366
  N.page,
691
1367
  ":"
692
1368
  ] }),
693
- /* @__PURE__ */ i(
694
- "input",
695
- {
696
- type: "number",
697
- className: "bt-quick-jumper-input",
698
- min: 1,
699
- max: l,
700
- defaultValue: e,
701
- onKeyDown: T,
702
- "aria-label": "Jump to page"
703
- }
704
- )
1369
+ /* @__PURE__ */ g("div", { className: "bt-qj-wrapper", children: [
1370
+ /* @__PURE__ */ n(
1371
+ "input",
1372
+ {
1373
+ id: "bt-quick-jumper",
1374
+ name: "bt-quick-jumper",
1375
+ type: "number",
1376
+ className: "bt-quick-jumper-input",
1377
+ min: 1,
1378
+ max: l,
1379
+ defaultValue: e,
1380
+ onKeyDown: S,
1381
+ "aria-label": N.jumpToPage
1382
+ },
1383
+ e
1384
+ ),
1385
+ /* @__PURE__ */ n("span", { className: "bt-qj-hint", "aria-hidden": "true", children: "↵" })
1386
+ ] })
705
1387
  ] })
706
1388
  ] })
707
1389
  ] }) : null;
708
1390
  }
709
- function dt() {
1391
+ function ot(e) {
1392
+ const [t, l] = M(() => typeof window > "u" ? !1 : window.matchMedia(e).matches);
1393
+ return B(() => {
1394
+ if (typeof window > "u") return;
1395
+ const i = window.matchMedia(e);
1396
+ l(i.matches);
1397
+ const a = (o) => l(o.matches);
1398
+ return i.addEventListener("change", a), () => i.removeEventListener("change", a);
1399
+ }, [e]), t;
1400
+ }
1401
+ function tt() {
1402
+ return /* @__PURE__ */ g("svg", { className: "bt-search-svg", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
1403
+ /* @__PURE__ */ n("circle", { cx: "6", cy: "6", r: "4.5", stroke: "currentColor", strokeWidth: "1.5" }),
1404
+ /* @__PURE__ */ n("path", { d: "M9.5 9.5L13 13", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
1405
+ ] });
1406
+ }
1407
+ function nt() {
1408
+ return /* @__PURE__ */ n("svg", { className: "bt-clear-svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M3 3L9 9M9 3L3 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) });
1409
+ }
1410
+ function fn() {
1411
+ return /* @__PURE__ */ n("svg", { className: "bt-check-svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M2.5 6L5 8.5L9.5 3.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1412
+ }
1413
+ function pn() {
1414
+ return /* @__PURE__ */ n("svg", { className: "bt-filter-toggle-svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M1 2.5H11L7.5 6.5V10L4.5 9V6.5L1 2.5Z", stroke: "currentColor", strokeWidth: "1.2", strokeLinejoin: "round" }) });
1415
+ }
1416
+ function mn() {
710
1417
  const {
711
1418
  searchable: e,
712
1419
  searchValue: t,
713
1420
  handleSearch: l,
714
- clearSearch: n,
715
- globalActions: s,
716
- selectedRows: a,
717
- selectedCount: r,
718
- deselectAll: b,
719
- data: o,
720
- locale: h,
721
- classNames: f,
722
- selectable: S
723
- } = w(), p = m(
724
- (v) => {
725
- l(v.target.value);
1421
+ clearSearch: i,
1422
+ globalActions: a,
1423
+ selectedRows: o,
1424
+ selectedCount: s,
1425
+ deselectAll: d,
1426
+ data: c,
1427
+ locale: r,
1428
+ classNames: h,
1429
+ selectable: b,
1430
+ filters: u,
1431
+ filterPanelOpen: m,
1432
+ toggleFilterPanel: v,
1433
+ hasFilterableColumns: N,
1434
+ filterMode: k,
1435
+ columnVisibilityEnabled: L
1436
+ } = $(), S = ot("(max-width: 640px)"), [y, f] = M(!1), C = V(null), A = Object.keys(u).length, D = w(
1437
+ (T) => {
1438
+ l(T.target.value);
726
1439
  },
727
1440
  [l]
728
- );
729
- return e || s && s.length > 0 || S && r > 0 ? /* @__PURE__ */ y("div", { className: `bt-toolbar ${f.toolbar || ""}`, children: [
730
- /* @__PURE__ */ y("div", { className: "bt-toolbar-left", children: [
731
- e && /* @__PURE__ */ y("div", { className: "bt-search", children: [
732
- /* @__PURE__ */ i("span", { className: "bt-search-icon", children: "🔍" }),
733
- /* @__PURE__ */ i(
1441
+ ), p = w(() => {
1442
+ f((T) => (T ? t && i() : setTimeout(() => C.current?.focus(), 50), !T));
1443
+ }, [t, i]);
1444
+ B(() => {
1445
+ t && !y && f(!0);
1446
+ }, [t, y]);
1447
+ const P = N && (k === "panel" || k === "both");
1448
+ if (!(e || P || L || a && a.length > 0 || b && s > 0))
1449
+ return null;
1450
+ const z = S && e && !y, H = e && (!S || y);
1451
+ return /* @__PURE__ */ g("div", { className: x("bt-toolbar", h.toolbar), children: [
1452
+ /* @__PURE__ */ g("div", { className: "bt-toolbar-left", children: [
1453
+ z && /* @__PURE__ */ n(
1454
+ "button",
1455
+ {
1456
+ className: "bt-search-toggle",
1457
+ onClick: p,
1458
+ "aria-label": r.search,
1459
+ title: r.search,
1460
+ type: "button",
1461
+ children: /* @__PURE__ */ n(tt, {})
1462
+ }
1463
+ ),
1464
+ H && /* @__PURE__ */ g("div", { className: x("bt-search", S && "bt-search-mobile"), children: [
1465
+ /* @__PURE__ */ n("span", { className: "bt-search-icon", children: /* @__PURE__ */ n(tt, {}) }),
1466
+ /* @__PURE__ */ n(
734
1467
  "input",
735
1468
  {
1469
+ id: "bt-search",
1470
+ name: "bt-search",
1471
+ ref: C,
736
1472
  type: "text",
737
1473
  className: "bt-search-input",
738
- placeholder: h.searchPlaceholder,
1474
+ placeholder: r.searchPlaceholder,
739
1475
  value: t,
740
- onChange: p,
741
- "aria-label": h.search
1476
+ onChange: D,
1477
+ "aria-label": r.search
742
1478
  }
743
1479
  ),
744
- t && /* @__PURE__ */ i(
1480
+ (t || S) && /* @__PURE__ */ n(
745
1481
  "button",
746
1482
  {
747
1483
  className: "bt-search-clear",
748
- onClick: n,
749
- "aria-label": "Clear search",
1484
+ onClick: S ? p : i,
1485
+ "aria-label": r.clearSearch,
750
1486
  type: "button",
751
- children: "✕"
1487
+ children: /* @__PURE__ */ n(nt, {})
752
1488
  }
753
1489
  )
754
1490
  ] }),
755
- S && r > 0 && /* @__PURE__ */ y("div", { className: "bt-selection-info", children: [
756
- /* @__PURE__ */ y("span", { children: [
757
- r,
1491
+ P && /* @__PURE__ */ g(
1492
+ "button",
1493
+ {
1494
+ className: x(
1495
+ "bt-filter-toggle",
1496
+ m && "bt-filter-toggle-active"
1497
+ ),
1498
+ onClick: v,
1499
+ "aria-expanded": m,
1500
+ "aria-label": r.filterBy,
1501
+ title: r.filterBy,
1502
+ type: "button",
1503
+ children: [
1504
+ /* @__PURE__ */ n("span", { className: "bt-filter-toggle-icon", children: /* @__PURE__ */ n(pn, {}) }),
1505
+ !S && /* @__PURE__ */ n("span", { children: r.filterBy }),
1506
+ A > 0 && /* @__PURE__ */ n("span", { className: "bt-filter-toggle-badge", children: A })
1507
+ ]
1508
+ }
1509
+ ),
1510
+ /* @__PURE__ */ n(dn, {}),
1511
+ b && s > 0 && /* @__PURE__ */ g("div", { className: "bt-selection-info", children: [
1512
+ /* @__PURE__ */ n(fn, {}),
1513
+ /* @__PURE__ */ g("span", { className: "bt-selection-count", children: [
1514
+ s,
758
1515
  " ",
759
- h.selected
1516
+ S ? "sel." : r.selected
760
1517
  ] }),
761
- /* @__PURE__ */ i(
1518
+ /* @__PURE__ */ n(
762
1519
  "button",
763
1520
  {
764
1521
  className: "bt-selection-clear",
765
- onClick: b,
1522
+ onClick: d,
766
1523
  type: "button",
767
- children: h.deselectAll
1524
+ children: S ? /* @__PURE__ */ n(nt, {}) : r.deselectAll
768
1525
  }
769
1526
  )
770
1527
  ] })
771
1528
  ] }),
772
- s && s.length > 0 && /* @__PURE__ */ i("div", { className: "bt-toolbar-right", children: /* @__PURE__ */ i("div", { className: "bt-global-actions", children: s.map((v) => {
773
- const N = v.requiresSelection && a.length === 0;
774
- return /* @__PURE__ */ y(
1529
+ a && a.length > 0 && /* @__PURE__ */ n("div", { className: "bt-toolbar-right", children: /* @__PURE__ */ n("div", { className: "bt-global-actions", children: a.map((T) => {
1530
+ const q = T.requiresSelection && o.length === 0;
1531
+ return /* @__PURE__ */ g(
775
1532
  "button",
776
1533
  {
777
- className: P(
1534
+ className: x(
778
1535
  "bt-global-btn",
779
- v.variant && `bt-variant-${v.variant}`
1536
+ T.variant && `bt-variant-${T.variant}`,
1537
+ S && "bt-global-btn-mobile"
780
1538
  ),
781
- onClick: () => v.onClick(a, o),
782
- disabled: N,
783
- title: v.label,
1539
+ onClick: () => T.onClick(o, c),
1540
+ disabled: q,
1541
+ title: T.label,
1542
+ "aria-label": T.label,
784
1543
  type: "button",
785
1544
  children: [
786
- v.icon && /* @__PURE__ */ i("span", { className: "bt-global-icon", children: v.icon }),
787
- /* @__PURE__ */ i("span", { children: v.label })
1545
+ T.icon && /* @__PURE__ */ n("span", { className: "bt-global-icon", children: T.icon }),
1546
+ !S && /* @__PURE__ */ n("span", { children: T.label })
788
1547
  ]
789
1548
  },
790
- v.id
1549
+ T.id
791
1550
  );
792
1551
  }) }) })
793
- ] }) : null;
1552
+ ] });
1553
+ }
1554
+ const gn = mn;
1555
+ function vn() {
1556
+ return /* @__PURE__ */ g("svg", { className: "bt-empty-svg", width: "64", height: "64", viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
1557
+ /* @__PURE__ */ n("rect", { x: "12", y: "18", width: "40", height: "32", rx: "3", stroke: "currentColor", strokeWidth: "2", opacity: "0.3" }),
1558
+ /* @__PURE__ */ n("path", { d: "M12 28H52", stroke: "currentColor", strokeWidth: "2", opacity: "0.2" }),
1559
+ /* @__PURE__ */ n("path", { d: "M24 38H40", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", opacity: "0.4" }),
1560
+ /* @__PURE__ */ n("path", { d: "M28 44H36", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", opacity: "0.25" }),
1561
+ /* @__PURE__ */ n("circle", { cx: "32", cy: "12", r: "4", stroke: "currentColor", strokeWidth: "2", opacity: "0.2" })
1562
+ ] });
794
1563
  }
795
- const bt = dt;
796
- function ht() {
797
- const { locale: e, emptyComponent: t, columns: l, selectable: n, rowActions: s } = w(), a = l.filter((o) => !o.hidden), r = s && s.length > 0, b = a.length + (n ? 1 : 0) + (r ? 1 : 0);
798
- return t ? /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: /* @__PURE__ */ i("tr", { className: "bt-tr", children: /* @__PURE__ */ i("td", { className: "bt-td", colSpan: b, children: t }) }) }) : /* @__PURE__ */ i("tbody", { className: "bt-tbody", children: /* @__PURE__ */ i("tr", { className: "bt-tr", children: /* @__PURE__ */ i("td", { className: "bt-td", colSpan: b, children: /* @__PURE__ */ y("div", { className: "bt-empty", children: [
799
- /* @__PURE__ */ i("div", { className: "bt-empty-icon", children: "📭" }),
800
- /* @__PURE__ */ i("div", { className: "bt-empty-text", children: e.noData })
1564
+ function yn() {
1565
+ const { locale: e, emptyComponent: t, visibleColumns: l, selectable: i, rowActions: a } = $(), o = a && a.length > 0, s = l.length + (i ? 1 : 0) + (o ? 1 : 0);
1566
+ return t ? /* @__PURE__ */ n("tbody", { className: "bt-tbody", children: /* @__PURE__ */ n("tr", { className: "bt-tr", children: /* @__PURE__ */ n("td", { className: "bt-td", colSpan: s, children: t }) }) }) : /* @__PURE__ */ n("tbody", { className: "bt-tbody", children: /* @__PURE__ */ n("tr", { className: "bt-tr", children: /* @__PURE__ */ n("td", { className: "bt-td", colSpan: s, children: /* @__PURE__ */ g("div", { className: "bt-empty", children: [
1567
+ /* @__PURE__ */ n("div", { className: "bt-empty-icon", children: /* @__PURE__ */ n(vn, {}) }),
1568
+ /* @__PURE__ */ n("div", { className: "bt-empty-text", children: e.noData })
801
1569
  ] }) }) }) });
802
1570
  }
803
- function ut({ show: e }) {
804
- const { loadingComponent: t, locale: l } = w();
805
- return e ? /* @__PURE__ */ i("div", { className: "bt-loading-overlay", role: "status", "aria-live": "polite", children: t || /* @__PURE__ */ y(Fe, { children: [
806
- /* @__PURE__ */ i("div", { className: "bt-loading-spinner", "aria-hidden": "true" }),
807
- /* @__PURE__ */ i("span", { className: "bt-loading-text", children: l.loading })
1571
+ function wn({ show: e }) {
1572
+ const { loadingComponent: t, locale: l } = $();
1573
+ return e ? /* @__PURE__ */ n("div", { className: "bt-loading-overlay", role: "status", "aria-live": "polite", children: t || /* @__PURE__ */ g(Ct, { children: [
1574
+ /* @__PURE__ */ n("div", { className: "bt-loading-spinner", "aria-hidden": "true" }),
1575
+ /* @__PURE__ */ n("span", { className: "bt-loading-text", children: l.loading })
808
1576
  ] }) }) : null;
809
1577
  }
810
- function ft() {
811
- const { isModalOpen: e, modalContent: t, closeModal: l } = w(), n = m(
812
- (a) => {
813
- a.target === a.currentTarget && l();
1578
+ function Cn() {
1579
+ return /* @__PURE__ */ n("svg", { className: "bt-modal-close-svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M4 4L12 12M12 4L4 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) });
1580
+ }
1581
+ function kn() {
1582
+ const { isModalOpen: e, modalContent: t, closeModal: l, locale: i } = $(), a = w(
1583
+ (s) => {
1584
+ s.target === s.currentTarget && l();
814
1585
  },
815
1586
  [l]
816
- ), s = m(
817
- (a) => {
818
- a.key === "Escape" && l();
1587
+ ), o = w(
1588
+ (s) => {
1589
+ s.key === "Escape" && l();
819
1590
  },
820
1591
  [l]
821
1592
  );
822
- return Oe(() => (e && (document.addEventListener("keydown", s), document.body.style.overflow = "hidden"), () => {
823
- document.removeEventListener("keydown", s), document.body.style.overflow = "";
824
- }), [e, s]), !e || !t ? null : /* @__PURE__ */ i(
1593
+ return B(() => (e && (document.addEventListener("keydown", o), document.body.style.overflow = "hidden"), () => {
1594
+ document.removeEventListener("keydown", o), document.body.style.overflow = "";
1595
+ }), [e, o]), !e || !t ? null : /* @__PURE__ */ n(
825
1596
  "div",
826
1597
  {
827
1598
  className: "bt-modal-backdrop",
828
- onClick: n,
1599
+ onClick: a,
829
1600
  role: "dialog",
830
1601
  "aria-modal": "true",
831
- children: /* @__PURE__ */ y("div", { className: "bt-modal bt-modal-md", children: [
832
- /* @__PURE__ */ y("div", { className: "bt-modal-header", children: [
833
- /* @__PURE__ */ i("h2", { className: "bt-modal-title", children: "Detalles" }),
834
- /* @__PURE__ */ i(
1602
+ children: /* @__PURE__ */ g("div", { className: "bt-modal bt-modal-md", children: [
1603
+ /* @__PURE__ */ g("div", { className: "bt-modal-header", children: [
1604
+ /* @__PURE__ */ n("h2", { className: "bt-modal-title", children: i.details }),
1605
+ /* @__PURE__ */ n(
835
1606
  "button",
836
1607
  {
837
1608
  className: "bt-modal-close",
838
1609
  onClick: l,
839
- "aria-label": "Close modal",
1610
+ "aria-label": i.closeModal,
840
1611
  type: "button",
841
- children: "✕"
1612
+ children: /* @__PURE__ */ n(Cn, {})
842
1613
  }
843
1614
  )
844
1615
  ] }),
845
- /* @__PURE__ */ i("div", { className: "bt-modal-body", children: t })
1616
+ /* @__PURE__ */ n("div", { className: "bt-modal-body", children: t })
846
1617
  ] })
847
1618
  }
848
1619
  );
849
1620
  }
850
- function pt({
1621
+ function Nn({
851
1622
  data: e,
852
1623
  initialSort: t,
853
1624
  controlledSort: l,
854
- onSortChange: n
1625
+ onSortChange: i,
1626
+ multiSort: a = !1,
1627
+ controlledMultiSort: o,
1628
+ onMultiSortChange: s
855
1629
  }) {
856
- const [s, a] = z(
1630
+ const [d, c] = M(
857
1631
  t ?? { columnId: null, direction: "asc" }
858
- ), r = l ?? s, b = m(
859
- (f) => {
860
- const S = {
861
- columnId: f,
862
- direction: r.columnId === f && r.direction === "asc" ? "desc" : "asc"
863
- };
864
- l || a(S), n?.(S);
1632
+ ), [r, h] = M(
1633
+ []
1634
+ ), b = l ?? d, u = o ?? r, m = w(
1635
+ (k) => {
1636
+ if (a) {
1637
+ const L = u.findIndex(
1638
+ (C) => C.columnId === k
1639
+ );
1640
+ let S;
1641
+ L >= 0 ? u[L].direction === "asc" ? (S = [...u], S[L] = {
1642
+ columnId: k,
1643
+ direction: "desc"
1644
+ }) : S = u.filter((A, D) => D !== L) : S = [...u, { columnId: k, direction: "asc" }], o || h(S), s?.(S);
1645
+ const y = S[0], f = y ? { columnId: y.columnId, direction: y.direction } : { columnId: null, direction: "asc" };
1646
+ l || c(f), i?.(f);
1647
+ } else {
1648
+ let L;
1649
+ b.columnId !== k ? L = { columnId: k, direction: "asc" } : b.direction === "asc" ? L = { columnId: k, direction: "desc" } : L = { columnId: null, direction: "asc" }, l || c(L), i?.(L);
1650
+ }
865
1651
  },
866
- [r, l, n]
867
- ), o = m(() => {
868
- const f = { columnId: null, direction: "asc" };
869
- l || a(f), n?.(f);
870
- }, [l, n]);
871
- return { sortedData: x(() => r.columnId ? Ge(e, r.columnId, r.direction) : e, [e, r]), sortState: r, handleSort: b, clearSort: o };
1652
+ [
1653
+ b,
1654
+ u,
1655
+ l,
1656
+ o,
1657
+ i,
1658
+ s,
1659
+ a
1660
+ ]
1661
+ ), v = w(() => {
1662
+ const k = { columnId: null, direction: "asc" };
1663
+ l || c(k), i?.(k), a && (o || h([]), s?.([]));
1664
+ }, [
1665
+ l,
1666
+ o,
1667
+ i,
1668
+ s,
1669
+ a
1670
+ ]);
1671
+ return {
1672
+ sortedData: I(() => a && u.length > 0 ? jt(e, u) : b.columnId ? Et(e, b.columnId, b.direction) : e, [e, b, u, a]),
1673
+ sortState: b,
1674
+ handleSort: m,
1675
+ clearSort: v,
1676
+ multiSortState: u,
1677
+ isMultiSort: a
1678
+ };
872
1679
  }
873
- function gt({
1680
+ function Sn({
874
1681
  data: e,
875
1682
  columns: t,
876
1683
  initialFilters: l,
877
- controlledFilters: n,
878
- onFilterChange: s
1684
+ controlledFilters: i,
1685
+ onFilterChange: a
879
1686
  }) {
880
- const [a, r] = z(
1687
+ const [o, s] = M(
881
1688
  l ?? {}
882
- ), b = n ?? a, o = m(
883
- (p, u) => {
884
- const v = { ...b };
885
- u == null || u === "" ? delete v[p] : v[p] = u, n || r(v), s?.(v);
1689
+ ), d = i ?? o, c = w(
1690
+ (u, m) => {
1691
+ const v = { ...d };
1692
+ if (m !== null && typeof m == "object" && "from" in m) {
1693
+ const N = m;
1694
+ !N.from && !N.to ? delete v[u] : v[u] = m;
1695
+ } else m == null || m === "" ? delete v[u] : v[u] = m;
1696
+ i || s(v), a?.(v);
886
1697
  },
887
- [b, n, s]
888
- ), h = m(
889
- (p) => {
890
- const u = { ...b };
891
- delete u[p], n || r(u), s?.(u);
1698
+ [d, i, a]
1699
+ ), r = w(
1700
+ (u) => {
1701
+ const m = { ...d };
1702
+ delete m[u], i || s(m), a?.(m);
892
1703
  },
893
- [b, n, s]
894
- ), f = m(() => {
895
- n || r({}), s?.({});
896
- }, [n, s]);
897
- return { filteredData: x(() => Ue(e, b, t), [e, b, t]), filters: b, setFilter: o, clearFilters: f, clearFilter: h };
1704
+ [d, i, a]
1705
+ ), h = w(() => {
1706
+ i || s({}), a?.({});
1707
+ }, [i, a]);
1708
+ return { filteredData: I(() => Ot(e, d, t), [e, d, t]), filters: d, setFilter: c, clearFilters: h, clearFilter: r };
898
1709
  }
899
- function mt({
1710
+ function Pn({
900
1711
  data: e,
901
1712
  config: t,
902
1713
  onPageChange: l
903
1714
  }) {
904
- const n = t !== !1, s = t && typeof t == "object" ? t.page ?? 1 : 1, a = t && typeof t == "object" ? t.pageSize ?? 10 : 10, r = t && typeof t == "object" ? t.totalItems : void 0, [b, o] = z(s), [h, f] = z(a), S = r ?? e.length, p = Math.max(1, Math.ceil(S / h)), u = m(
905
- (d) => {
906
- const c = Math.max(1, Math.min(d, p));
907
- o(c), l?.(c, h);
1715
+ const i = t !== !1, a = t && typeof t == "object" ? t.page ?? 1 : 1, o = t && typeof t == "object" ? t.pageSize ?? 10 : 10, s = t && typeof t == "object" ? t.totalItems : void 0, [d, c] = M(a), [r, h] = M(o), b = s ?? e.length, u = Math.max(1, Math.ceil(b / r)), m = w(
1716
+ (f) => {
1717
+ const C = Math.max(1, Math.min(f, u));
1718
+ c(C), l?.(C, r);
908
1719
  },
909
- [p, h, l]
910
- ), v = m(() => {
911
- b < p && u(b + 1);
912
- }, [b, p, u]), N = m(() => {
913
- b > 1 && u(b - 1);
914
- }, [b, u]), D = m(
915
- (d) => {
916
- f(d), o(1), l?.(1, d);
1720
+ [u, r, l]
1721
+ ), v = w(() => {
1722
+ d < u && m(d + 1);
1723
+ }, [d, u, m]), N = w(() => {
1724
+ d > 1 && m(d - 1);
1725
+ }, [d, m]), k = w(
1726
+ (f) => {
1727
+ h(f), c(1), l?.(1, f);
917
1728
  },
918
1729
  [l]
919
- ), $ = x(() => {
920
- if (!n || r !== void 0)
1730
+ ), L = I(() => {
1731
+ if (!i || s !== void 0)
921
1732
  return e;
922
- const d = (b - 1) * h;
923
- return e.slice(d, d + h);
924
- }, [e, b, h, n, r]), T = (b - 1) * h + 1, k = Math.min(b * h, S);
1733
+ const f = (d - 1) * r;
1734
+ return e.slice(f, f + r);
1735
+ }, [e, d, r, i, s]), S = (d - 1) * r + 1, y = Math.min(d * r, b);
925
1736
  return {
926
- paginatedData: $,
927
- page: b,
928
- pageSize: h,
929
- totalPages: p,
930
- totalItems: S,
931
- goToPage: u,
1737
+ paginatedData: L,
1738
+ page: d,
1739
+ pageSize: r,
1740
+ totalPages: u,
1741
+ totalItems: b,
1742
+ goToPage: m,
932
1743
  nextPage: v,
933
1744
  prevPage: N,
934
- changePageSize: D,
935
- hasNextPage: b < p,
936
- hasPrevPage: b > 1,
937
- startIndex: T,
938
- endIndex: k
1745
+ changePageSize: k,
1746
+ hasNextPage: d < u,
1747
+ hasPrevPage: d > 1,
1748
+ startIndex: S,
1749
+ endIndex: y
939
1750
  };
940
1751
  }
941
- function vt({
1752
+ function xn({
942
1753
  data: e,
943
1754
  rowKey: t,
944
1755
  mode: l = "multiple",
945
- initialSelection: n,
946
- controlledSelection: s,
947
- onSelectionChange: a
1756
+ initialSelection: i,
1757
+ controlledSelection: a,
1758
+ onSelectionChange: o
948
1759
  }) {
949
- const [r, b] = z(
950
- n ?? []
951
- ), o = s ?? r, h = m(
952
- (d, c) => typeof t == "function" ? t(d, c) : String(d[t]),
1760
+ const [s, d] = M(
1761
+ i ?? []
1762
+ ), c = a ?? s, r = w(
1763
+ (f, C) => typeof t == "function" ? t(f, C) : String(f[t]),
953
1764
  [t]
954
- ), f = x(() => new Set(o.map((d, c) => h(d, c))), [o, h]), S = m(
955
- (d, c) => {
956
- const g = h(d, c);
957
- return f.has(g);
1765
+ ), h = I(() => new Set(c.map((f, C) => r(f, C))), [c, r]), b = w(
1766
+ (f, C) => {
1767
+ const A = r(f, C);
1768
+ return h.has(A);
958
1769
  },
959
- [h, f]
960
- ), p = m(
961
- (d) => {
962
- s || b(d), a?.(d);
1770
+ [r, h]
1771
+ ), u = w(
1772
+ (f) => {
1773
+ a || d(f), o?.(f);
963
1774
  },
964
- [s, a]
965
- ), u = m(
966
- (d, c) => {
967
- const g = h(d, c);
968
- let C;
969
- l === "single" ? C = f.has(g) ? [] : [d] : f.has(g) ? C = o.filter((A, L) => h(A, L) !== g) : C = [...o, d], p(C);
1775
+ [a, o]
1776
+ ), m = w(
1777
+ (f, C) => {
1778
+ const A = r(f, C);
1779
+ let D;
1780
+ l === "single" ? D = h.has(A) ? [] : [f] : h.has(A) ? D = c.filter((p, P) => r(p, P) !== A) : D = [...c, f], u(D);
970
1781
  },
971
- [l, f, o, h, p]
972
- ), v = m(
973
- (d, c) => {
974
- if (!S(d, c)) {
975
- const g = l === "single" ? [d] : [...o, d];
976
- p(g);
1782
+ [l, h, c, r, u]
1783
+ ), v = w(
1784
+ (f, C) => {
1785
+ if (!b(f, C)) {
1786
+ const A = l === "single" ? [f] : [...c, f];
1787
+ u(A);
977
1788
  }
978
1789
  },
979
- [S, l, o, p]
980
- ), N = m(
981
- (d, c) => {
982
- const g = h(d, c), C = o.filter(
983
- (A, L) => h(A, L) !== g
1790
+ [b, l, c, u]
1791
+ ), N = w(
1792
+ (f, C) => {
1793
+ const A = r(f, C), D = c.filter(
1794
+ (p, P) => r(p, P) !== A
984
1795
  );
985
- p(C);
1796
+ u(D);
986
1797
  },
987
- [o, h, p]
988
- ), D = m(() => {
989
- l === "multiple" && p([...e]);
990
- }, [e, l, p]), $ = m(() => {
991
- p([]);
992
- }, [p]), T = e.length > 0 && o.length === e.length, k = o.length > 0 && o.length < e.length;
1798
+ [c, r, u]
1799
+ ), k = w(() => {
1800
+ l === "multiple" && u([...e]);
1801
+ }, [e, l, u]), L = w(() => {
1802
+ u([]);
1803
+ }, [u]), S = e.length > 0 && c.length === e.length, y = c.length > 0 && c.length < e.length;
993
1804
  return {
994
- selectedRows: o,
995
- isSelected: S,
996
- toggleRow: u,
1805
+ selectedRows: c,
1806
+ isSelected: b,
1807
+ toggleRow: m,
997
1808
  selectRow: v,
998
1809
  deselectRow: N,
999
- selectAll: D,
1000
- deselectAll: $,
1001
- isAllSelected: T,
1002
- isPartiallySelected: k,
1003
- selectedCount: o.length
1810
+ selectAll: k,
1811
+ deselectAll: L,
1812
+ isAllSelected: S,
1813
+ isPartiallySelected: y,
1814
+ selectedCount: c.length
1004
1815
  };
1005
1816
  }
1006
- function yt({
1817
+ function An({
1007
1818
  data: e,
1008
1819
  columns: t,
1009
1820
  searchColumns: l,
1010
- initialValue: n,
1011
- controlledValue: s,
1012
- onSearchChange: a
1821
+ initialValue: i,
1822
+ controlledValue: a,
1823
+ onSearchChange: o,
1824
+ debounceMs: s = 0
1013
1825
  }) {
1014
- const [r, b] = z(n ?? ""), o = s ?? r, h = m(
1015
- (p) => {
1016
- s === void 0 && b(p), a?.(p);
1826
+ const [d, c] = M(i ?? ""), [r, h] = M(i ?? ""), b = V(null), u = a ?? d;
1827
+ B(() => {
1828
+ if (s <= 0) {
1829
+ h(u);
1830
+ return;
1831
+ }
1832
+ return b.current = setTimeout(() => {
1833
+ h(u);
1834
+ }, s), () => {
1835
+ b.current && clearTimeout(b.current);
1836
+ };
1837
+ }, [u, s]);
1838
+ const m = w(
1839
+ (k) => {
1840
+ a === void 0 && c(k), o?.(k);
1017
1841
  },
1018
- [s, a]
1019
- ), f = m(() => {
1020
- s === void 0 && b(""), a?.("");
1021
- }, [s, a]);
1022
- return { searchedData: x(() => We(e, o, t, l), [e, o, t, l]), searchValue: o, handleSearch: h, clearSearch: f };
1842
+ [a, o]
1843
+ ), v = w(() => {
1844
+ a === void 0 && c(""), b.current && clearTimeout(b.current), h(""), o?.("");
1845
+ }, [a, o]);
1846
+ return { searchedData: I(() => Bt(e, r, t, l), [e, r, t, l]), searchValue: u, handleSearch: m, clearSearch: v };
1847
+ }
1848
+ function Ln({
1849
+ columns: e,
1850
+ controlledHiddenColumns: t,
1851
+ onColumnVisibilityChange: l
1852
+ }) {
1853
+ const [i, a] = M(
1854
+ () => e.filter((b) => b.hidden).map((b) => b.id)
1855
+ ), o = t ?? i, s = I(
1856
+ () => new Set(o),
1857
+ [o]
1858
+ ), d = w(
1859
+ (b) => {
1860
+ const u = s.has(b) ? o.filter((m) => m !== b) : [...o, b];
1861
+ t || a(u), l?.(u);
1862
+ },
1863
+ [
1864
+ o,
1865
+ s,
1866
+ t,
1867
+ l
1868
+ ]
1869
+ ), c = w(() => {
1870
+ t || a([]), l?.([]);
1871
+ }, [t, l]), r = w(
1872
+ (b) => !s.has(b),
1873
+ [s]
1874
+ );
1875
+ return {
1876
+ visibleColumns: I(
1877
+ () => e.filter((b) => !s.has(b.id)),
1878
+ [e, s]
1879
+ ),
1880
+ hiddenColumnIds: s,
1881
+ toggleColumn: d,
1882
+ showAllColumns: c,
1883
+ isColumnVisible: r,
1884
+ hiddenColumns: o
1885
+ };
1023
1886
  }
1024
- function St(e) {
1887
+ function Dn(e) {
1025
1888
  const {
1026
1889
  // Data
1027
1890
  data: t,
1028
1891
  columns: l,
1029
- rowKey: n = "id",
1892
+ rowKey: i = "id",
1030
1893
  // Actions
1031
- rowActions: s,
1032
- globalActions: a,
1894
+ rowActions: a,
1895
+ globalActions: o,
1896
+ maxVisibleActions: s = 3,
1033
1897
  // Pagination
1034
- pagination: r = { pageSize: 10 },
1035
- onPageChange: b,
1898
+ pagination: d = { pageSize: 10 },
1899
+ onPageChange: c,
1036
1900
  // Sort
1037
- sort: o,
1901
+ sort: r,
1038
1902
  onSortChange: h,
1903
+ multiSort: b = !1,
1904
+ multiSortState: u,
1905
+ onMultiSortChange: m,
1039
1906
  // Filter
1040
- filters: f,
1041
- onFilterChange: S,
1907
+ filters: v,
1908
+ onFilterChange: N,
1909
+ filterMode: k = "floating",
1042
1910
  // Search
1043
- searchable: p = !1,
1044
- searchValue: u,
1045
- onSearchChange: v,
1046
- searchColumns: N,
1911
+ searchable: L = !1,
1912
+ searchValue: S,
1913
+ onSearchChange: y,
1914
+ searchColumns: f,
1915
+ searchDebounceMs: C = 300,
1047
1916
  // Selection - now auto-inferred if not explicitly set
1048
- selectable: D,
1049
- selectedRows: $,
1050
- onSelectionChange: T,
1051
- selectionMode: k = "multiple",
1917
+ selectable: A,
1918
+ selectedRows: D,
1919
+ onSelectionChange: p,
1920
+ selectionMode: P = "multiple",
1921
+ // Column Visibility
1922
+ columnVisibility: F = !1,
1923
+ hiddenColumns: z,
1924
+ onColumnVisibilityChange: H,
1052
1925
  // States
1053
- loading: d = !1,
1054
- loadingComponent: c,
1055
- emptyComponent: g,
1926
+ loading: T = !1,
1927
+ loadingComponent: q,
1928
+ emptyComponent: ee,
1056
1929
  // Styling
1057
- classNames: C = {},
1058
- styles: A = {},
1059
- locale: L,
1060
- stickyHeader: V = !1,
1061
- maxHeight: Re,
1062
- bordered: B = !1,
1063
- striped: j = !1,
1064
- hoverable: E = !0,
1065
- size: K = "medium",
1930
+ classNames: K = {},
1931
+ styles: te = {},
1932
+ locale: W,
1933
+ stickyHeader: ne = !1,
1934
+ maxHeight: ct,
1935
+ bordered: U = !1,
1936
+ striped: Z = !1,
1937
+ hoverable: Q = !0,
1938
+ size: G = "medium",
1066
1939
  // Callbacks
1067
- onRowClick: H,
1068
- onRowDoubleClick: q,
1940
+ onRowClick: ie,
1941
+ onRowDoubleClick: le,
1069
1942
  // Accessibility
1070
- ariaLabel: ze,
1071
- ariaDescribedBy: Me
1072
- } = e, _ = x(() => D !== void 0 ? D : a?.some(
1073
- (je) => je.requiresSelection
1074
- ) || T !== void 0, [D, a, T]), J = x(
1075
- () => ({ ...Ve, ...L }),
1076
- [L]
1077
- ), [Q, G] = z(!1), [U, W] = z(null), X = m((we) => {
1078
- W(we), G(!0);
1079
- }, []), Y = m(() => {
1080
- G(!1), W(null);
1081
- }, []), R = x(() => r === !1 ? !1 : {
1943
+ ariaLabel: dt,
1944
+ ariaDescribedBy: ht
1945
+ } = e, re = I(() => A !== void 0 ? A : o?.some(
1946
+ (vt) => vt.requiresSelection
1947
+ ) || p !== void 0, [A, o, p]), ae = I(
1948
+ () => ({ ...typeof W == "string" ? Nt[W] : it, ...typeof W == "object" ? W : {} }),
1949
+ [W]
1950
+ ), [se, oe] = M(!1), [ce, de] = M(null), [J, bt] = M(!1), he = w(() => {
1951
+ bt((E) => !E);
1952
+ }, []), be = I(
1953
+ () => l.some((E) => E.filterable !== !1 && E.type !== "custom" && !E.hidden),
1954
+ [l]
1955
+ ), ue = w((E) => {
1956
+ de(E), oe(!0);
1957
+ }, []), fe = w(() => {
1958
+ oe(!1), de(null);
1959
+ }, []), O = I(() => d === !1 ? !1 : {
1082
1960
  pageSize: 10,
1083
1961
  pageSizeOptions: [10, 20, 50, 100],
1084
1962
  showSizeChanger: !1,
1085
- ...r
1086
- }, [r]), {
1087
- searchedData: Le,
1088
- searchValue: Z,
1089
- handleSearch: ee,
1090
- clearSearch: te
1091
- } = yt({
1963
+ ...d
1964
+ }, [d]), {
1965
+ searchedData: ut,
1966
+ searchValue: pe,
1967
+ handleSearch: me,
1968
+ clearSearch: ge
1969
+ } = An({
1092
1970
  data: t,
1093
1971
  columns: l,
1094
- searchColumns: N,
1095
- controlledValue: u,
1096
- onSearchChange: v
1972
+ searchColumns: f,
1973
+ controlledValue: S,
1974
+ onSearchChange: y,
1975
+ debounceMs: C
1976
+ }), {
1977
+ filteredData: ft,
1978
+ filters: ve,
1979
+ setFilter: ye,
1980
+ clearFilter: we,
1981
+ clearFilters: Ce
1982
+ } = Sn({
1983
+ data: ut,
1984
+ columns: l,
1985
+ controlledFilters: v,
1986
+ onFilterChange: N
1987
+ }), { sortedData: ke, sortState: Ne, handleSort: Se, clearSort: Pe, multiSortState: xe, isMultiSort: Ae } = Nn({
1988
+ data: ft,
1989
+ controlledSort: r,
1990
+ onSortChange: h,
1991
+ multiSort: b,
1992
+ controlledMultiSort: u,
1993
+ onMultiSortChange: m
1097
1994
  }), {
1098
- filteredData: Ie,
1099
- filters: ae,
1100
- setFilter: ne,
1101
- clearFilters: le
1102
- } = gt({
1103
- data: Le,
1995
+ visibleColumns: Le,
1996
+ hiddenColumnIds: De,
1997
+ toggleColumn: Te,
1998
+ showAllColumns: Me,
1999
+ isColumnVisible: Ie
2000
+ } = Ln({
1104
2001
  columns: l,
1105
- controlledFilters: f,
1106
- onFilterChange: S
1107
- }), { sortedData: se, sortState: re, handleSort: ie } = pt({
1108
- data: Ie,
1109
- controlledSort: o,
1110
- onSortChange: h
2002
+ controlledHiddenColumns: z,
2003
+ onColumnVisibilityChange: H
1111
2004
  }), {
1112
- selectedRows: ce,
1113
- isSelected: oe,
1114
- toggleRow: de,
1115
- selectAll: be,
1116
- deselectAll: he,
1117
- isAllSelected: ue,
1118
- isPartiallySelected: fe,
1119
- selectedCount: pe
1120
- } = vt({
1121
- data: se,
1122
- rowKey: n,
1123
- mode: k,
1124
- controlledSelection: $,
1125
- onSelectionChange: T
2005
+ selectedRows: $e,
2006
+ isSelected: Fe,
2007
+ toggleRow: Re,
2008
+ selectAll: Ee,
2009
+ deselectAll: je,
2010
+ isAllSelected: Oe,
2011
+ isPartiallySelected: Be,
2012
+ selectedCount: ze
2013
+ } = xn({
2014
+ data: ke,
2015
+ rowKey: i,
2016
+ mode: P,
2017
+ controlledSelection: D,
2018
+ onSelectionChange: p
1126
2019
  }), {
1127
- paginatedData: O,
1128
- page: ge,
1129
- pageSize: me,
1130
- totalPages: ve,
1131
- totalItems: ye,
1132
- goToPage: Se,
1133
- nextPage: Ce,
1134
- prevPage: Ne,
1135
- changePageSize: ke,
1136
- hasNextPage: De,
1137
- hasPrevPage: Pe,
1138
- startIndex: Te,
1139
- endIndex: Ae
1140
- } = mt({
1141
- data: se,
1142
- config: R,
1143
- onPageChange: b
1144
- }), Be = x(
2020
+ paginatedData: X,
2021
+ page: Ve,
2022
+ pageSize: He,
2023
+ totalPages: We,
2024
+ totalItems: qe,
2025
+ goToPage: Ke,
2026
+ nextPage: _e,
2027
+ prevPage: Ue,
2028
+ changePageSize: Ze,
2029
+ hasNextPage: Qe,
2030
+ hasPrevPage: Ge,
2031
+ startIndex: Je,
2032
+ endIndex: Xe
2033
+ } = Pn({
2034
+ data: ke,
2035
+ config: O,
2036
+ onPageChange: c
2037
+ }), pt = I(
1145
2038
  () => ({
1146
2039
  // Data
1147
2040
  data: t,
1148
- processedData: O,
2041
+ processedData: X,
1149
2042
  columns: l,
1150
- rowKey: n,
2043
+ visibleColumns: Le,
2044
+ rowKey: i,
1151
2045
  // Actions
1152
- rowActions: s,
1153
- globalActions: a,
2046
+ rowActions: a,
2047
+ globalActions: o,
2048
+ maxVisibleActions: s,
1154
2049
  // Sort
1155
- sortState: re,
1156
- handleSort: ie,
2050
+ sortState: Ne,
2051
+ handleSort: Se,
2052
+ multiSortState: xe,
2053
+ isMultiSort: Ae,
2054
+ clearSort: Pe,
2055
+ // Column Visibility
2056
+ columnVisibilityEnabled: F,
2057
+ hiddenColumnIds: De,
2058
+ toggleColumn: Te,
2059
+ showAllColumns: Me,
2060
+ isColumnVisible: Ie,
1157
2061
  // Filter
1158
- filters: ae,
1159
- setFilter: ne,
1160
- clearFilters: le,
2062
+ filters: ve,
2063
+ setFilter: ye,
2064
+ clearFilter: we,
2065
+ clearFilters: Ce,
1161
2066
  // Search
1162
- searchValue: Z,
1163
- handleSearch: ee,
1164
- clearSearch: te,
1165
- searchable: p,
2067
+ searchValue: pe,
2068
+ handleSearch: me,
2069
+ clearSearch: ge,
2070
+ searchable: L,
1166
2071
  // Selection
1167
- selectedRows: ce,
1168
- isSelected: oe,
1169
- toggleRow: de,
1170
- selectAll: be,
1171
- deselectAll: he,
1172
- isAllSelected: ue,
1173
- isPartiallySelected: fe,
1174
- selectable: _,
1175
- selectionMode: k,
1176
- selectedCount: pe,
2072
+ selectedRows: $e,
2073
+ isSelected: Fe,
2074
+ toggleRow: Re,
2075
+ selectAll: Ee,
2076
+ deselectAll: je,
2077
+ isAllSelected: Oe,
2078
+ isPartiallySelected: Be,
2079
+ selectable: re,
2080
+ selectionMode: P,
2081
+ selectedCount: ze,
1177
2082
  // Pagination
1178
- page: ge,
1179
- pageSize: me,
1180
- totalPages: ve,
1181
- totalItems: ye,
1182
- goToPage: Se,
1183
- nextPage: Ce,
1184
- prevPage: Ne,
1185
- changePageSize: ke,
1186
- hasNextPage: De,
1187
- hasPrevPage: Pe,
1188
- startIndex: Te,
1189
- endIndex: Ae,
1190
- paginationEnabled: r !== !1,
1191
- pageSizeOptions: R && typeof R == "object" ? R.pageSizeOptions ?? [10, 20, 50, 100] : [10, 20, 50, 100],
1192
- showSizeChanger: R && typeof R == "object" ? R.showSizeChanger ?? !1 : !1,
2083
+ page: Ve,
2084
+ pageSize: He,
2085
+ totalPages: We,
2086
+ totalItems: qe,
2087
+ goToPage: Ke,
2088
+ nextPage: _e,
2089
+ prevPage: Ue,
2090
+ changePageSize: Ze,
2091
+ hasNextPage: Qe,
2092
+ hasPrevPage: Ge,
2093
+ startIndex: Je,
2094
+ endIndex: Xe,
2095
+ paginationEnabled: d !== !1,
2096
+ pageSizeOptions: O && typeof O == "object" ? O.pageSizeOptions ?? [10, 20, 50, 100] : [10, 20, 50, 100],
2097
+ showSizeChanger: O && typeof O == "object" ? O.showSizeChanger ?? !1 : !1,
1193
2098
  // UI State
1194
- loading: d,
1195
- loadingComponent: c,
1196
- emptyComponent: g,
2099
+ loading: T,
2100
+ loadingComponent: q,
2101
+ emptyComponent: ee,
1197
2102
  // Styling
1198
- locale: J,
1199
- classNames: C,
1200
- size: K,
1201
- bordered: B,
1202
- striped: j,
1203
- hoverable: E,
1204
- stickyHeader: V,
2103
+ locale: ae,
2104
+ classNames: K,
2105
+ size: G,
2106
+ bordered: U,
2107
+ striped: Z,
2108
+ hoverable: Q,
2109
+ stickyHeader: ne,
1205
2110
  // Callbacks
1206
- onRowClick: H,
1207
- onRowDoubleClick: q,
2111
+ onRowClick: ie,
2112
+ onRowDoubleClick: le,
1208
2113
  // Modal
1209
- openModal: X,
1210
- closeModal: Y,
1211
- modalContent: U,
1212
- isModalOpen: Q
2114
+ openModal: ue,
2115
+ closeModal: fe,
2116
+ modalContent: ce,
2117
+ isModalOpen: se,
2118
+ // Filter panel
2119
+ filterPanelOpen: J,
2120
+ toggleFilterPanel: he,
2121
+ hasFilterableColumns: be,
2122
+ filterMode: k
1213
2123
  }),
1214
2124
  [
1215
2125
  t,
1216
- O,
2126
+ X,
1217
2127
  l,
1218
- n,
1219
- s,
2128
+ Le,
2129
+ i,
1220
2130
  a,
2131
+ o,
2132
+ s,
2133
+ Ne,
2134
+ Se,
2135
+ xe,
2136
+ Ae,
2137
+ Pe,
2138
+ F,
2139
+ De,
2140
+ Te,
2141
+ Me,
2142
+ Ie,
2143
+ ve,
2144
+ ye,
2145
+ we,
2146
+ Ce,
2147
+ pe,
2148
+ me,
2149
+ ge,
2150
+ L,
2151
+ $e,
2152
+ Fe,
2153
+ Re,
2154
+ Ee,
2155
+ je,
2156
+ Oe,
2157
+ Be,
1221
2158
  re,
1222
- ie,
2159
+ P,
2160
+ ze,
2161
+ Ve,
2162
+ He,
2163
+ We,
2164
+ qe,
2165
+ Ke,
2166
+ _e,
2167
+ Ue,
2168
+ Ze,
2169
+ Qe,
2170
+ Ge,
2171
+ Je,
2172
+ Xe,
2173
+ d,
2174
+ O,
2175
+ T,
2176
+ q,
2177
+ ee,
1223
2178
  ae,
2179
+ K,
2180
+ G,
2181
+ U,
2182
+ Z,
2183
+ Q,
1224
2184
  ne,
2185
+ ie,
1225
2186
  le,
1226
- Z,
1227
- ee,
1228
- te,
1229
- p,
1230
- ce,
1231
- oe,
1232
- de,
1233
- be,
1234
- he,
1235
2187
  ue,
1236
2188
  fe,
1237
- _,
1238
- k,
1239
- pe,
1240
- ge,
1241
- me,
1242
- ve,
1243
- ye,
1244
- Se,
1245
- Ce,
1246
- Ne,
1247
- ke,
1248
- De,
1249
- Pe,
1250
- Te,
1251
- Ae,
1252
- r,
1253
- R,
1254
- d,
1255
- c,
1256
- g,
2189
+ ce,
2190
+ se,
1257
2191
  J,
1258
- C,
1259
- K,
1260
- B,
1261
- j,
1262
- E,
1263
- V,
1264
- H,
1265
- q,
1266
- X,
1267
- Y,
1268
- U,
1269
- Q
2192
+ he,
2193
+ be,
2194
+ k
1270
2195
  ]
1271
- ), F = O.length > 0;
1272
- return /* @__PURE__ */ i(He, { value: Be, children: /* @__PURE__ */ y(
2196
+ ), Y = X.length > 0, mt = ot("(max-width: 640px)");
2197
+ return /* @__PURE__ */ n(St, { value: pt, children: /* @__PURE__ */ g(
1273
2198
  "div",
1274
2199
  {
1275
- className: P(
2200
+ className: x(
1276
2201
  "bt-container",
1277
- `bt-size-${K}`,
1278
- j && "bt-striped",
1279
- B && "bt-bordered",
1280
- E && "bt-hoverable",
1281
- d && "bt-container-loading",
1282
- C.container
2202
+ `bt-size-${G}`,
2203
+ Z && "bt-striped",
2204
+ U && "bt-bordered",
2205
+ Q && "bt-hoverable",
2206
+ T && "bt-container-loading",
2207
+ K.container
1283
2208
  ),
1284
- style: A.container,
2209
+ style: te.container,
1285
2210
  children: [
1286
- /* @__PURE__ */ i(bt, {}),
1287
- /* @__PURE__ */ y(
2211
+ /* @__PURE__ */ n(gn, {}),
2212
+ (k === "panel" || k === "both") && /* @__PURE__ */ n(an, { open: J }),
2213
+ /* @__PURE__ */ g(
1288
2214
  "div",
1289
2215
  {
1290
2216
  className: "bt-table-wrapper",
1291
- style: { maxHeight: Re },
2217
+ style: { maxHeight: ct },
1292
2218
  children: [
1293
- /* @__PURE__ */ y(
1294
- "table",
1295
- {
1296
- className: P("bt-table", C.table),
1297
- style: A.table,
1298
- role: "grid",
1299
- "aria-label": ze,
1300
- "aria-describedby": Me,
1301
- "aria-busy": d,
1302
- children: [
1303
- /* @__PURE__ */ i(Qe, {}),
1304
- F ? /* @__PURE__ */ i(lt, {}) : /* @__PURE__ */ i(ht, {})
1305
- ]
1306
- }
2219
+ mt ? (
2220
+ /* Cards (móvil) */
2221
+ Y && /* @__PURE__ */ n(tn, {})
2222
+ ) : (
2223
+ /* Tabla tradicional (desktop/tablet) */
2224
+ /* @__PURE__ */ g(
2225
+ "table",
2226
+ {
2227
+ className: x("bt-table", K.table),
2228
+ style: te.table,
2229
+ role: "grid",
2230
+ "aria-label": dt,
2231
+ "aria-describedby": ht,
2232
+ "aria-busy": T,
2233
+ children: [
2234
+ /* @__PURE__ */ n(Rt, {}),
2235
+ Y ? /* @__PURE__ */ n(Gt, {}) : /* @__PURE__ */ n(yn, {})
2236
+ ]
2237
+ }
2238
+ )
1307
2239
  ),
1308
- F && /* @__PURE__ */ i(ct, {}),
1309
- /* @__PURE__ */ i(ut, { show: d && F })
2240
+ /* @__PURE__ */ n(wn, { show: T && Y })
1310
2241
  ]
1311
2242
  }
1312
2243
  ),
1313
- r !== !1 && /* @__PURE__ */ i(ot, {}),
1314
- /* @__PURE__ */ i(ft, {})
2244
+ d !== !1 && /* @__PURE__ */ n(un, {}),
2245
+ /* @__PURE__ */ n(kn, {})
1315
2246
  ]
1316
2247
  }
1317
2248
  ) });
1318
2249
  }
1319
- const Pt = St;
2250
+ const Fn = Dn;
1320
2251
  export {
1321
- Pt as BetterTable,
1322
- He as TableProvider,
1323
- Ve as defaultLocale,
1324
- Ue as filterData,
1325
- M as getValueFromPath,
1326
- We as searchData,
1327
- Ge as sortData,
1328
- w as useTableContext,
1329
- gt as useTableFilter,
1330
- mt as useTablePagination,
1331
- yt as useTableSearch,
1332
- vt as useTableSelection,
1333
- pt as useTableSort
2252
+ Fn as BetterTable,
2253
+ St as TableProvider,
2254
+ it as defaultLocale,
2255
+ Ot as filterData,
2256
+ j as getValueFromPath,
2257
+ Nt as locales,
2258
+ Bt as searchData,
2259
+ Et as sortData,
2260
+ Ln as useColumnVisibility,
2261
+ $ as useTableContext,
2262
+ Sn as useTableFilter,
2263
+ Pn as useTablePagination,
2264
+ An as useTableSearch,
2265
+ xn as useTableSelection,
2266
+ Nn as useTableSort
1334
2267
  };
1335
2268
  //# sourceMappingURL=better-table.es.js.map