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