better-table 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import B, { useContext as Ee, createContext as Oe, useCallback as m, useMemo as x, useEffect as Ke, useState as I } from "react";
2
- import { jsx as r, jsxs as y, Fragment as He } from "react/jsx-runtime";
1
+ import B, { useContext as Ee, createContext as Oe, useCallback as g, useMemo as A, useEffect as Fe, useState as I } from "react";
2
+ import { jsx as r, jsxs as y, Fragment as Ke } from "react/jsx-runtime";
3
3
  import "./styles.js";
4
- const Ve = {
4
+ const He = {
5
5
  search: "Buscar",
6
6
  searchPlaceholder: "Buscar...",
7
7
  noData: "No hay datos",
@@ -18,72 +18,72 @@ const Ve = {
18
18
  clearFilters: "Limpiar filtros",
19
19
  selectAll: "Seleccionar todo",
20
20
  deselectAll: "Deseleccionar todo"
21
- }, Ce = Oe(null);
22
- function C() {
23
- const e = Ee(Ce);
21
+ }, xe = Oe(null);
22
+ function x() {
23
+ const e = Ee(xe);
24
24
  if (!e)
25
25
  throw new Error("useTableContext must be used within a TableProvider");
26
26
  return e;
27
27
  }
28
- function qe({
28
+ function Ve({
29
29
  value: e,
30
- children: s
30
+ children: a
31
31
  }) {
32
- return /* @__PURE__ */ r(Ce.Provider, { value: e, children: s });
32
+ return /* @__PURE__ */ r(xe.Provider, { value: e, children: a });
33
33
  }
34
34
  function $e(e) {
35
- var s, a, l = "";
35
+ var a, n, l = "";
36
36
  if (typeof e == "string" || typeof e == "number") l += e;
37
37
  else if (typeof e == "object") if (Array.isArray(e)) {
38
- var n = e.length;
39
- for (s = 0; s < n; s++) e[s] && (a = $e(e[s])) && (l && (l += " "), l += a);
40
- } else for (a in e) e[a] && (l && (l += " "), l += a);
38
+ var i = e.length;
39
+ for (a = 0; a < i; a++) e[a] && (n = $e(e[a])) && (l && (l += " "), l += n);
40
+ } else for (n in e) e[n] && (l && (l += " "), l += n);
41
41
  return l;
42
42
  }
43
- function T() {
44
- for (var e, s, a = 0, l = "", n = arguments.length; a < n; a++) (e = arguments[a]) && (s = $e(e)) && (l && (l += " "), l += s);
43
+ function P() {
44
+ for (var e, a, n = 0, l = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (a = $e(e)) && (l && (l += " "), l += a);
45
45
  return l;
46
46
  }
47
- function Je({
47
+ function qe({
48
48
  column: e
49
49
  }) {
50
50
  const {
51
- sortState: s,
52
- handleSort: a,
51
+ sortState: a,
52
+ handleSort: n,
53
53
  filters: l,
54
- setFilter: n,
54
+ setFilter: i,
55
55
  locale: t
56
- } = C(), i = s.columnId === e.id, o = i ? s.direction : null, d = m(() => {
57
- e.sortable !== !1 && a(e.id);
58
- }, [e.id, e.sortable, a]), b = m(
59
- (f) => {
60
- const p = f.target.value;
61
- e.type === "boolean" ? p === "" ? n(e.id, null) : n(e.id, p === "true") : n(e.id, p || null);
56
+ } = x(), s = a.columnId === e.id, c = s ? a.direction : null, d = g(() => {
57
+ e.sortable !== !1 && n(e.id);
58
+ }, [e.id, e.sortable, n]), b = g(
59
+ (u) => {
60
+ const p = u.target.value;
61
+ e.type === "boolean" ? p === "" ? i(e.id, null) : i(e.id, p === "true") : i(e.id, p || null);
62
62
  },
63
- [e.id, e.type, n]
64
- ), u = m(
65
- (f) => {
66
- f.key === "Enter" && e.sortable !== !1 && a(e.id);
63
+ [e.id, e.type, i]
64
+ ), h = g(
65
+ (u) => {
66
+ u.key === "Enter" && e.sortable !== !1 && n(e.id);
67
67
  },
68
- [e.id, e.sortable, a]
69
- ), g = () => e.sortable === !1 || e.type === "custom" ? null : /* @__PURE__ */ r(
68
+ [e.id, e.sortable, n]
69
+ ), m = () => e.sortable === !1 || e.type === "custom" ? null : /* @__PURE__ */ r(
70
70
  "button",
71
71
  {
72
- className: T("bt-sort-btn", i && "bt-active"),
72
+ className: P("bt-sort-btn", s && "bt-active"),
73
73
  onClick: d,
74
- "aria-label": o === "asc" ? t.sortDesc : t.sortAsc,
74
+ "aria-label": c === "asc" ? t.sortDesc : t.sortAsc,
75
75
  type: "button",
76
- children: i ? o === "asc" ? "↑" : "↓" : "⇅"
76
+ children: s ? c === "asc" ? "↑" : "↓" : "⇅"
77
77
  }
78
- ), h = () => {
78
+ ), f = () => {
79
79
  if (e.filterable === !1 || e.type === "custom")
80
80
  return null;
81
- const f = l[e.id];
81
+ const u = l[e.id];
82
82
  return e.type === "boolean" ? /* @__PURE__ */ y(
83
83
  "select",
84
84
  {
85
85
  className: "bt-filter-select",
86
- value: f == null ? "" : String(f),
86
+ value: u == null ? "" : String(u),
87
87
  onChange: b,
88
88
  "aria-label": `${t.filterBy} ${e.header}`,
89
89
  children: [
@@ -98,7 +98,7 @@ function Je({
98
98
  type: e.type === "number" ? "number" : "text",
99
99
  className: "bt-filter-input",
100
100
  placeholder: `${t.filterBy}...`,
101
- value: f != null ? String(f) : "",
101
+ value: u != null ? String(u) : "",
102
102
  onChange: b,
103
103
  "aria-label": `${t.filterBy} ${e.header}`
104
104
  }
@@ -107,176 +107,174 @@ function Je({
107
107
  return e.headerCell ? /* @__PURE__ */ r(
108
108
  "th",
109
109
  {
110
- className: T("bt-th", e.align && `bt-align-${e.align}`),
110
+ className: P("bt-th", e.align && `bt-align-${e.align}`),
111
111
  style: { width: e.width },
112
112
  children: e.headerCell(e)
113
113
  }
114
114
  ) : /* @__PURE__ */ r(
115
115
  "th",
116
116
  {
117
- className: T("bt-th", e.align && `bt-align-${e.align}`),
117
+ className: P("bt-th", e.align && `bt-align-${e.align}`),
118
118
  style: { width: e.width },
119
119
  role: "columnheader",
120
- "aria-sort": i ? o === "asc" ? "ascending" : "descending" : void 0,
120
+ "aria-sort": s ? c === "asc" ? "ascending" : "descending" : void 0,
121
121
  tabIndex: e.sortable !== !1 ? 0 : void 0,
122
- onKeyDown: e.sortable !== !1 ? u : void 0,
122
+ onKeyDown: e.sortable !== !1 ? h : void 0,
123
123
  children: /* @__PURE__ */ y("div", { className: "bt-th-content", children: [
124
124
  /* @__PURE__ */ y("div", { className: "bt-th-header", children: [
125
125
  /* @__PURE__ */ r("span", { className: "bt-th-title", children: e.header }),
126
- g()
126
+ m()
127
127
  ] }),
128
- e.filterable !== !1 && h()
128
+ e.filterable !== !1 && f()
129
129
  ] })
130
130
  }
131
131
  );
132
132
  }
133
- const _e = B.memo(
134
- Je
133
+ const Je = B.memo(
134
+ qe
135
135
  );
136
- function Qe() {
136
+ function _e() {
137
137
  const {
138
138
  columns: e,
139
- selectable: s,
140
- selectionMode: a,
139
+ selectable: a,
140
+ selectionMode: n,
141
141
  rowActions: l,
142
- isAllSelected: n,
142
+ isAllSelected: i,
143
143
  isPartiallySelected: t,
144
- selectAll: i,
145
- deselectAll: o,
144
+ selectAll: s,
145
+ deselectAll: c,
146
146
  locale: d,
147
147
  stickyHeader: b
148
- } = C(), u = e.filter((f) => !f.hidden), g = l && l.length > 0, h = () => {
149
- n ? o() : i();
148
+ } = x(), h = e.filter((u) => !u.hidden), m = l && l.length > 0, f = () => {
149
+ i ? c() : s();
150
150
  };
151
- return /* @__PURE__ */ r("thead", { className: T("bt-thead", b && "bt-sticky"), children: /* @__PURE__ */ y("tr", { className: "bt-tr", children: [
152
- s && /* @__PURE__ */ r("th", { className: "bt-th bt-checkbox-cell", children: a === "multiple" && /* @__PURE__ */ r(
151
+ return /* @__PURE__ */ r("thead", { className: P("bt-thead", b && "bt-sticky"), children: /* @__PURE__ */ y("tr", { className: "bt-tr", children: [
152
+ a && /* @__PURE__ */ r("th", { className: "bt-th bt-checkbox-cell", children: n === "multiple" && /* @__PURE__ */ r(
153
153
  "input",
154
154
  {
155
155
  type: "checkbox",
156
156
  className: "bt-checkbox",
157
- checked: n,
158
- ref: (f) => {
159
- f && (f.indeterminate = t);
157
+ checked: i,
158
+ ref: (u) => {
159
+ u && (u.indeterminate = t);
160
160
  },
161
- onChange: h,
162
- "aria-label": n ? d.deselectAll : d.selectAll
161
+ onChange: f,
162
+ "aria-label": i ? d.deselectAll : d.selectAll
163
163
  }
164
164
  ) }),
165
- u.map((f) => /* @__PURE__ */ r(_e, { column: f }, f.id)),
166
- g && /* @__PURE__ */ r("th", { className: "bt-th bt-actions-cell", children: d.actions })
165
+ h.map((u) => /* @__PURE__ */ r(Je, { column: u }, u.id)),
166
+ m && /* @__PURE__ */ r("th", { className: "bt-th bt-actions-cell", children: d.actions })
167
167
  ] }) });
168
168
  }
169
- const Ge = Qe;
170
- function R(e, s) {
171
- if (!e || !s) return;
172
- const a = s.split(".");
169
+ const Qe = _e;
170
+ function M(e, a) {
171
+ if (!e || !a) return;
172
+ const n = a.split(".");
173
173
  let l = e;
174
- for (const n of a) {
174
+ for (const i of n) {
175
175
  if (l == null)
176
176
  return;
177
177
  if (typeof l == "object")
178
- l = l[n];
178
+ l = l[i];
179
179
  else
180
180
  return;
181
181
  }
182
182
  return l;
183
183
  }
184
- function Ue(e, s, a) {
185
- return [...e].sort((l, n) => {
186
- const t = R(l, s), i = R(n, s);
184
+ function Ge(e, a, n) {
185
+ return [...e].sort((l, i) => {
186
+ const t = M(l, a), s = M(i, a);
187
187
  if (t == null)
188
- return a === "asc" ? 1 : -1;
189
- if (i == null)
190
- return a === "asc" ? -1 : 1;
191
- if (typeof t == "string" && typeof i == "string") {
192
- const u = t.localeCompare(i, void 0, {
188
+ return n === "asc" ? 1 : -1;
189
+ if (s == null)
190
+ return n === "asc" ? -1 : 1;
191
+ if (typeof t == "string" && typeof s == "string") {
192
+ const h = t.localeCompare(s, void 0, {
193
193
  sensitivity: "base",
194
194
  numeric: !0
195
195
  });
196
- return a === "asc" ? u : -u;
196
+ return n === "asc" ? h : -h;
197
197
  }
198
- if (typeof t == "number" && typeof i == "number")
199
- return a === "asc" ? t - i : i - t;
200
- if (typeof t == "boolean" && typeof i == "boolean") {
201
- const u = t === i ? 0 : t ? -1 : 1;
202
- return a === "asc" ? u : -u;
198
+ if (typeof t == "number" && typeof s == "number")
199
+ return n === "asc" ? t - s : s - t;
200
+ if (typeof t == "boolean" && typeof s == "boolean") {
201
+ const h = t === s ? 0 : t ? -1 : 1;
202
+ return n === "asc" ? h : -h;
203
203
  }
204
- if (t instanceof Date && i instanceof Date) {
205
- const u = t.getTime() - i.getTime();
206
- return a === "asc" ? u : -u;
204
+ if (t instanceof Date && s instanceof Date) {
205
+ const h = t.getTime() - s.getTime();
206
+ return n === "asc" ? h : -h;
207
207
  }
208
- const o = String(t), d = String(i), b = o.localeCompare(d);
209
- return a === "asc" ? b : -b;
208
+ const c = String(t), d = String(s), b = c.localeCompare(d);
209
+ return n === "asc" ? b : -b;
210
210
  });
211
211
  }
212
- function We(e, s, a) {
213
- const l = Object.entries(s).filter(
214
- ([, n]) => n != null && n !== ""
212
+ function Ue(e, a, n) {
213
+ const l = Object.entries(a).filter(
214
+ ([, i]) => i != null && i !== ""
215
215
  );
216
- return l.length === 0 ? e : e.filter((n) => l.every(([t, i]) => {
217
- const o = a.find((u) => u.id === t);
218
- if (!o) return !0;
219
- const d = R(
220
- n,
221
- String(o.accessor)
216
+ return l.length === 0 ? e : e.filter((i) => l.every(([t, s]) => {
217
+ const c = n.find((h) => h.id === t);
218
+ if (!c) return !0;
219
+ const d = M(
220
+ i,
221
+ String(c.accessor)
222
222
  );
223
223
  if (d == null)
224
224
  return !1;
225
- switch (o.type ?? "string") {
225
+ switch (c.type ?? "string") {
226
226
  case "boolean":
227
- return d === i;
227
+ return d === s;
228
228
  case "number":
229
- return String(d) === String(i);
229
+ return String(d) === String(s);
230
230
  case "date":
231
- if (d instanceof Date && i) {
232
- const u = new Date(String(i));
233
- return d.toDateString() === u.toDateString();
231
+ if (d instanceof Date && s) {
232
+ const h = new Date(String(s));
233
+ return d.toDateString() === h.toDateString();
234
234
  }
235
- return String(d).includes(String(i));
236
- case "string":
235
+ return String(d).includes(String(s));
237
236
  default:
238
- return String(d).toLowerCase().includes(String(i).toLowerCase());
237
+ return String(d).toLowerCase().includes(String(s).toLowerCase());
239
238
  }
240
239
  }));
241
240
  }
242
- function Xe(e, s, a, l) {
243
- if (!s.trim())
241
+ function We(e, a, n, l) {
242
+ if (!a.trim())
244
243
  return e;
245
- const n = s.toLowerCase().trim(), t = l ? a.filter((i) => l.includes(i.id)) : a.filter((i) => i.type !== "custom");
244
+ const i = a.toLowerCase().trim(), t = l ? n.filter((s) => l.includes(s.id)) : n.filter((s) => s.type !== "custom");
246
245
  return e.filter(
247
- (i) => t.some((o) => {
248
- const d = R(
249
- i,
250
- String(o.accessor)
246
+ (s) => t.some((c) => {
247
+ const d = M(
248
+ s,
249
+ String(c.accessor)
251
250
  );
252
- return d == null ? !1 : String(d).toLowerCase().includes(n);
251
+ return d == null ? !1 : String(d).toLowerCase().includes(i);
253
252
  })
254
253
  );
255
254
  }
256
- function Ye({
255
+ function Xe({
257
256
  row: e,
258
- column: s,
259
- rowIndex: a
257
+ column: a,
258
+ rowIndex: n
260
259
  }) {
261
- const l = R(
260
+ const l = M(
262
261
  e,
263
- String(s.accessor)
262
+ String(a.accessor)
264
263
  ), t = (() => {
265
- if (s.cell)
266
- return s.cell(l, e, a);
264
+ if (a.cell)
265
+ return a.cell(l, e, n);
267
266
  if (l == null)
268
267
  return /* @__PURE__ */ r("span", { className: "bt-cell-empty", children: "—" });
269
- switch (s.type) {
268
+ switch (a.type) {
270
269
  case "boolean":
271
270
  return l ? "✅" : "❌";
272
271
  case "date":
273
272
  if (l instanceof Date)
274
273
  return l.toLocaleDateString();
275
- const i = new Date(String(l));
276
- return isNaN(i.getTime()) ? String(l) : i.toLocaleDateString();
274
+ const s = new Date(String(l));
275
+ return isNaN(s.getTime()) ? String(l) : s.toLocaleDateString();
277
276
  case "number":
278
277
  return typeof l == "number" ? l.toLocaleString() : l;
279
- case "string":
280
278
  default:
281
279
  return String(l);
282
280
  }
@@ -284,26 +282,26 @@ function Ye({
284
282
  return /* @__PURE__ */ r(
285
283
  "td",
286
284
  {
287
- className: T("bt-td", s.align && `bt-align-${s.align}`),
288
- style: { width: s.width },
285
+ className: P("bt-td", a.align && `bt-align-${a.align}`),
286
+ style: { width: a.width },
289
287
  children: t
290
288
  }
291
289
  );
292
290
  }
293
- const Ze = B.memo(Ye);
294
- function Fe({
291
+ const Ye = B.memo(Xe);
292
+ function Ze({
295
293
  row: e,
296
- rowIndex: s
294
+ rowIndex: a
297
295
  }) {
298
- const { rowActions: a, openModal: l } = C(), n = m(
296
+ const { rowActions: n, openModal: l } = x(), i = g(
299
297
  (t) => {
300
298
  if (t.mode === "callback" && t.onClick)
301
- t.onClick(e, s);
299
+ t.onClick(e, a);
302
300
  else if (t.mode === "modal" && t.modalContent) {
303
- const i = t.modalContent;
301
+ const s = t.modalContent;
304
302
  l(
305
303
  /* @__PURE__ */ r(
306
- i,
304
+ s,
307
305
  {
308
306
  data: e,
309
307
  onClose: () => {
@@ -312,25 +310,25 @@ function Fe({
312
310
  )
313
311
  );
314
312
  } else if (t.mode === "link" && t.href) {
315
- const i = typeof t.href == "function" ? t.href(e) : t.href;
316
- window.open(i, "_blank");
313
+ const s = typeof t.href == "function" ? t.href(e) : t.href;
314
+ window.open(s, "_blank");
317
315
  }
318
316
  },
319
- [e, s, l]
317
+ [e, a, l]
320
318
  );
321
- return !a || a.length === 0 ? null : /* @__PURE__ */ r("td", { className: "bt-td bt-actions-cell", children: /* @__PURE__ */ r("div", { className: "bt-actions-wrapper", children: a.map((t) => {
319
+ return !n || n.length === 0 ? null : /* @__PURE__ */ r("td", { className: "bt-td bt-actions-cell", children: /* @__PURE__ */ r("div", { className: "bt-actions-wrapper", children: n.map((t) => {
322
320
  if (t.visible && !t.visible(e))
323
321
  return null;
324
- const i = t.disabled ? t.disabled(e) : !1;
322
+ const s = t.disabled ? t.disabled(e) : !1;
325
323
  if (t.mode === "link" && t.href) {
326
- const o = typeof t.href == "function" ? t.href(e) : t.href;
324
+ const c = typeof t.href == "function" ? t.href(e) : t.href;
327
325
  return /* @__PURE__ */ r(
328
326
  "a",
329
327
  {
330
- href: o,
328
+ href: c,
331
329
  target: "_blank",
332
330
  rel: "noopener noreferrer",
333
- className: T(
331
+ className: P(
334
332
  "bt-action-btn",
335
333
  t.variant && `bt-variant-${t.variant}`
336
334
  ),
@@ -343,12 +341,12 @@ function Fe({
343
341
  return /* @__PURE__ */ r(
344
342
  "button",
345
343
  {
346
- className: T(
344
+ className: P(
347
345
  "bt-action-btn",
348
346
  t.variant && `bt-variant-${t.variant}`
349
347
  ),
350
- onClick: () => n(t),
351
- disabled: i,
348
+ onClick: () => i(t),
349
+ disabled: s,
352
350
  "aria-label": t.label,
353
351
  title: t.label,
354
352
  type: "button",
@@ -359,146 +357,146 @@ function Fe({
359
357
  }) }) });
360
358
  }
361
359
  const et = B.memo(
362
- Fe
360
+ Ze
363
361
  );
364
- function tt({ row: e, rowIndex: s }) {
362
+ function tt({ row: e, rowIndex: a }) {
365
363
  const {
366
- columns: a,
364
+ columns: n,
367
365
  selectable: l,
368
- rowActions: n,
366
+ rowActions: i,
369
367
  isSelected: t,
370
- toggleRow: i,
371
- striped: o,
368
+ toggleRow: s,
369
+ striped: c,
372
370
  hoverable: d,
373
371
  onRowClick: b,
374
- onRowDoubleClick: u
375
- } = C(), g = a.filter((S) => !S.hidden), h = n && n.length > 0, f = l && t(e, s), p = !!b, N = m(() => {
376
- b == null || b(e, s);
377
- }, [e, s, b]), P = m(() => {
378
- u == null || u(e, s);
379
- }, [e, s, u]), $ = m(() => {
380
- i(e, s);
381
- }, [e, s, i]), w = m(
382
- (S) => {
383
- S.key === "Enter" && b && N();
372
+ onRowDoubleClick: h
373
+ } = x(), m = n.filter((N) => !N.hidden), f = i && i.length > 0, u = l && t(e, a), p = !!b, S = g(() => {
374
+ b?.(e, a);
375
+ }, [e, a, b]), D = g(() => {
376
+ h?.(e, a);
377
+ }, [e, a, h]), $ = g(() => {
378
+ s(e, a);
379
+ }, [e, a, s]), T = g(
380
+ (N) => {
381
+ N.key === "Enter" && b && S();
384
382
  },
385
- [N, b]
383
+ [S, b]
386
384
  );
387
385
  return /* @__PURE__ */ y(
388
386
  "tr",
389
387
  {
390
- className: T(
388
+ className: P(
391
389
  "bt-tr",
392
- o && "bt-striped",
390
+ c && "bt-striped",
393
391
  d && "bt-hoverable",
394
- f && "bt-selected",
392
+ u && "bt-selected",
395
393
  p && "bt-clickable"
396
394
  ),
397
- onClick: p ? N : void 0,
398
- onDoubleClick: u ? P : void 0,
399
- onKeyDown: p ? w : void 0,
395
+ onClick: p ? S : void 0,
396
+ onDoubleClick: h ? D : void 0,
397
+ onKeyDown: p ? T : void 0,
400
398
  tabIndex: p ? 0 : void 0,
401
399
  role: p ? "button" : void 0,
402
- "aria-selected": l ? f : void 0,
400
+ "aria-selected": l ? u : void 0,
403
401
  children: [
404
402
  l && /* @__PURE__ */ r("td", { className: "bt-td bt-checkbox-cell", children: /* @__PURE__ */ r(
405
403
  "input",
406
404
  {
407
405
  type: "checkbox",
408
406
  className: "bt-checkbox",
409
- checked: f,
407
+ checked: u,
410
408
  onChange: $,
411
- onClick: (S) => S.stopPropagation(),
412
- "aria-label": `Select row ${s + 1}`
409
+ onClick: (N) => N.stopPropagation(),
410
+ "aria-label": `Select row ${a + 1}`
413
411
  }
414
412
  ) }),
415
- g.map((S) => /* @__PURE__ */ r(
416
- Ze,
413
+ m.map((N) => /* @__PURE__ */ r(
414
+ Ye,
417
415
  {
418
416
  row: e,
419
- column: S,
420
- rowIndex: s
417
+ column: N,
418
+ rowIndex: a
421
419
  },
422
- S.id
420
+ N.id
423
421
  )),
424
- h && /* @__PURE__ */ r(et, { row: e, rowIndex: s })
422
+ f && /* @__PURE__ */ r(et, { row: e, rowIndex: a })
425
423
  ]
426
424
  }
427
425
  );
428
426
  }
429
427
  const at = B.memo(tt);
430
- function lt() {
431
- const { processedData: e, rowKey: s } = C(), a = (l, n) => {
432
- if (typeof s == "function")
433
- return s(l, n);
434
- const t = l[s];
435
- return String(t !== void 0 ? t : n);
428
+ function nt() {
429
+ const { processedData: e, rowKey: a } = x(), n = (l, i) => {
430
+ if (typeof a == "function")
431
+ return a(l, i);
432
+ const t = l[a];
433
+ return String(t !== void 0 ? t : i);
436
434
  };
437
- return /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: e.map((l, n) => /* @__PURE__ */ r(at, { row: l, rowIndex: n }, a(l, n))) });
435
+ return /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: e.map((l, i) => /* @__PURE__ */ r(at, { row: l, rowIndex: i }, n(l, i))) });
438
436
  }
439
- const st = lt;
440
- function nt() {
437
+ const lt = nt;
438
+ function st() {
441
439
  const {
442
440
  page: e,
443
- pageSize: s,
444
- totalPages: a,
441
+ pageSize: a,
442
+ totalPages: n,
445
443
  totalItems: l,
446
- goToPage: n,
444
+ goToPage: i,
447
445
  nextPage: t,
448
- prevPage: i,
449
- changePageSize: o,
446
+ prevPage: s,
447
+ changePageSize: c,
450
448
  hasNextPage: d,
451
449
  hasPrevPage: b,
452
- startIndex: u,
453
- endIndex: g,
454
- paginationEnabled: h,
455
- pageSizeOptions: f,
450
+ startIndex: h,
451
+ endIndex: m,
452
+ paginationEnabled: f,
453
+ pageSizeOptions: u,
456
454
  showSizeChanger: p,
457
- locale: N,
458
- classNames: P
459
- } = C(), $ = m(
460
- (c) => {
461
- o(Number(c.target.value));
455
+ locale: S,
456
+ classNames: D
457
+ } = x(), $ = g(
458
+ (o) => {
459
+ c(Number(o.target.value));
462
460
  },
463
- [o]
464
- ), w = m(
465
- (c) => {
466
- if (c.key === "Enter") {
467
- const v = parseInt(c.target.value, 10);
468
- !isNaN(v) && v >= 1 && v <= a && n(v);
461
+ [c]
462
+ ), T = g(
463
+ (o) => {
464
+ if (o.key === "Enter") {
465
+ const v = parseInt(o.target.value, 10);
466
+ !isNaN(v) && v >= 1 && v <= n && i(v);
469
467
  }
470
468
  },
471
- [n, a]
472
- ), S = x(() => {
473
- const c = [];
474
- if (a <= 5)
475
- for (let k = 1; k <= a; k++)
476
- c.push(k);
469
+ [i, n]
470
+ ), N = A(() => {
471
+ const o = [];
472
+ if (n <= 5)
473
+ for (let C = 1; C <= n; C++)
474
+ o.push(C);
477
475
  else {
478
- c.push(1), e > 3 && c.push("ellipsis");
479
- const k = Math.max(2, e - 1), D = Math.min(a - 1, e + 1);
480
- for (let A = k; A <= D; A++)
481
- c.push(A);
482
- e < a - 2 && c.push("ellipsis"), a > 1 && c.push(a);
476
+ o.push(1), e > 3 && o.push("ellipsis");
477
+ const C = Math.max(2, e - 1), k = Math.min(n - 1, e + 1);
478
+ for (let w = C; w <= k; w++)
479
+ o.push(w);
480
+ e < n - 2 && o.push("ellipsis"), n > 1 && o.push(n);
483
481
  }
484
- return c;
485
- }, [e, a]);
486
- return h ? /* @__PURE__ */ y("div", { className: `bt-pagination ${P.pagination || ""}`, children: [
487
- /* @__PURE__ */ r("div", { className: "bt-pagination-info", children: l > 0 ? `${u}-${g} ${N.of} ${l} ${N.items}` : `0 ${N.items}` }),
482
+ return o;
483
+ }, [e, n]);
484
+ return f ? /* @__PURE__ */ y("div", { className: `bt-pagination ${D.pagination || ""}`, children: [
485
+ /* @__PURE__ */ r("div", { className: "bt-pagination-info", children: l > 0 ? `${h}-${m} ${S.of} ${l} ${S.items}` : `0 ${S.items}` }),
488
486
  /* @__PURE__ */ y("div", { className: "bt-pagination-controls", children: [
489
487
  p && /* @__PURE__ */ y("div", { className: "bt-page-size", children: [
490
488
  /* @__PURE__ */ y("span", { className: "bt-page-size-label", children: [
491
- N.rowsPerPage,
489
+ S.rowsPerPage,
492
490
  ":"
493
491
  ] }),
494
492
  /* @__PURE__ */ r(
495
493
  "select",
496
494
  {
497
495
  className: "bt-page-size-select",
498
- value: s,
496
+ value: a,
499
497
  onChange: $,
500
- "aria-label": N.rowsPerPage,
501
- children: f.map((c) => /* @__PURE__ */ r("option", { value: c, children: c }, c))
498
+ "aria-label": S.rowsPerPage,
499
+ children: u.map((o) => /* @__PURE__ */ r("option", { value: o, children: o }, o))
502
500
  }
503
501
  )
504
502
  ] }),
@@ -506,24 +504,24 @@ function nt() {
506
504
  "button",
507
505
  {
508
506
  className: "bt-pagination-btn",
509
- onClick: i,
507
+ onClick: s,
510
508
  disabled: !b,
511
509
  "aria-label": "Previous page",
512
510
  type: "button",
513
511
  children: "←"
514
512
  }
515
513
  ),
516
- /* @__PURE__ */ r("div", { className: "bt-pagination-pages", children: S.map((c, v) => c === "ellipsis" ? /* @__PURE__ */ r("span", { className: "bt-pagination-ellipsis", children: "..." }, `ellipsis-${v}`) : /* @__PURE__ */ r(
514
+ /* @__PURE__ */ r("div", { className: "bt-pagination-pages", children: N.map((o, v) => o === "ellipsis" ? /* @__PURE__ */ r("span", { className: "bt-pagination-ellipsis", children: "..." }, `ellipsis-${v}`) : /* @__PURE__ */ r(
517
515
  "button",
518
516
  {
519
- className: `bt-pagination-btn ${e === c ? "bt-active" : ""}`,
520
- onClick: () => n(c),
521
- "aria-label": `${N.page} ${c}`,
522
- "aria-current": e === c ? "page" : void 0,
517
+ className: `bt-pagination-btn ${e === o ? "bt-active" : ""}`,
518
+ onClick: () => i(o),
519
+ "aria-label": `${S.page} ${o}`,
520
+ "aria-current": e === o ? "page" : void 0,
523
521
  type: "button",
524
- children: c
522
+ children: o
525
523
  },
526
- c
524
+ o
527
525
  )) }),
528
526
  /* @__PURE__ */ r(
529
527
  "button",
@@ -538,7 +536,7 @@ function nt() {
538
536
  ),
539
537
  /* @__PURE__ */ y("div", { className: "bt-quick-jumper", children: [
540
538
  /* @__PURE__ */ y("span", { className: "bt-quick-jumper-label", children: [
541
- N.page,
539
+ S.page,
542
540
  ":"
543
541
  ] }),
544
542
  /* @__PURE__ */ r(
@@ -547,9 +545,9 @@ function nt() {
547
545
  type: "number",
548
546
  className: "bt-quick-jumper-input",
549
547
  min: 1,
550
- max: a,
548
+ max: n,
551
549
  defaultValue: e,
552
- onKeyDown: w,
550
+ onKeyDown: T,
553
551
  "aria-label": "Jump to page"
554
552
  }
555
553
  )
@@ -560,24 +558,24 @@ function nt() {
560
558
  function it() {
561
559
  const {
562
560
  searchable: e,
563
- searchValue: s,
564
- handleSearch: a,
561
+ searchValue: a,
562
+ handleSearch: n,
565
563
  clearSearch: l,
566
- globalActions: n,
564
+ globalActions: i,
567
565
  selectedRows: t,
568
- selectedCount: i,
569
- deselectAll: o,
566
+ selectedCount: s,
567
+ deselectAll: c,
570
568
  data: d,
571
569
  locale: b,
572
- classNames: u,
573
- selectable: g
574
- } = C(), h = m(
570
+ classNames: h,
571
+ selectable: m
572
+ } = x(), f = g(
575
573
  (p) => {
576
- a(p.target.value);
574
+ n(p.target.value);
577
575
  },
578
- [a]
576
+ [n]
579
577
  );
580
- return e || n && n.length > 0 || g && i > 0 ? /* @__PURE__ */ y("div", { className: `bt-toolbar ${u.toolbar || ""}`, children: [
578
+ return e || i && i.length > 0 || m && s > 0 ? /* @__PURE__ */ y("div", { className: `bt-toolbar ${h.toolbar || ""}`, children: [
581
579
  /* @__PURE__ */ y("div", { className: "bt-toolbar-left", children: [
582
580
  e && /* @__PURE__ */ y("div", { className: "bt-search", children: [
583
581
  /* @__PURE__ */ r("span", { className: "bt-search-icon", children: "🔍" }),
@@ -587,12 +585,12 @@ function it() {
587
585
  type: "text",
588
586
  className: "bt-search-input",
589
587
  placeholder: b.searchPlaceholder,
590
- value: s,
591
- onChange: h,
588
+ value: a,
589
+ onChange: f,
592
590
  "aria-label": b.search
593
591
  }
594
592
  ),
595
- s && /* @__PURE__ */ r(
593
+ a && /* @__PURE__ */ r(
596
594
  "button",
597
595
  {
598
596
  className: "bt-search-clear",
@@ -603,9 +601,9 @@ function it() {
603
601
  }
604
602
  )
605
603
  ] }),
606
- g && i > 0 && /* @__PURE__ */ y("div", { className: "bt-selection-info", children: [
604
+ m && s > 0 && /* @__PURE__ */ y("div", { className: "bt-selection-info", children: [
607
605
  /* @__PURE__ */ y("span", { children: [
608
- i,
606
+ s,
609
607
  " ",
610
608
  b.selected
611
609
  ] }),
@@ -613,24 +611,24 @@ function it() {
613
611
  "button",
614
612
  {
615
613
  className: "bt-selection-clear",
616
- onClick: o,
614
+ onClick: c,
617
615
  type: "button",
618
616
  children: b.deselectAll
619
617
  }
620
618
  )
621
619
  ] })
622
620
  ] }),
623
- n && n.length > 0 && /* @__PURE__ */ r("div", { className: "bt-toolbar-right", children: /* @__PURE__ */ r("div", { className: "bt-global-actions", children: n.map((p) => {
624
- const N = p.requiresSelection && t.length === 0;
621
+ i && i.length > 0 && /* @__PURE__ */ r("div", { className: "bt-toolbar-right", children: /* @__PURE__ */ r("div", { className: "bt-global-actions", children: i.map((p) => {
622
+ const S = p.requiresSelection && t.length === 0;
625
623
  return /* @__PURE__ */ y(
626
624
  "button",
627
625
  {
628
- className: T(
626
+ className: P(
629
627
  "bt-global-btn",
630
628
  p.variant && `bt-variant-${p.variant}`
631
629
  ),
632
630
  onClick: () => p.onClick(t, d),
633
- disabled: N,
631
+ disabled: S,
634
632
  title: p.label,
635
633
  type: "button",
636
634
  children: [
@@ -644,35 +642,35 @@ function it() {
644
642
  ] }) : null;
645
643
  }
646
644
  const rt = it;
647
- function ct() {
648
- const { locale: e, emptyComponent: s, columns: a, selectable: l, rowActions: n } = C(), t = a.filter((d) => !d.hidden), i = n && n.length > 0, o = t.length + (l ? 1 : 0) + (i ? 1 : 0);
649
- return s ? /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: /* @__PURE__ */ r("tr", { className: "bt-tr", children: /* @__PURE__ */ r("td", { className: "bt-td", colSpan: o, children: s }) }) }) : /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: /* @__PURE__ */ r("tr", { className: "bt-tr", children: /* @__PURE__ */ r("td", { className: "bt-td", colSpan: o, children: /* @__PURE__ */ y("div", { className: "bt-empty", children: [
645
+ function ot() {
646
+ const { locale: e, emptyComponent: a, columns: n, selectable: l, rowActions: i } = x(), t = n.filter((d) => !d.hidden), s = i && i.length > 0, c = t.length + (l ? 1 : 0) + (s ? 1 : 0);
647
+ return a ? /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: /* @__PURE__ */ r("tr", { className: "bt-tr", children: /* @__PURE__ */ r("td", { className: "bt-td", colSpan: c, children: a }) }) }) : /* @__PURE__ */ r("tbody", { className: "bt-tbody", children: /* @__PURE__ */ r("tr", { className: "bt-tr", children: /* @__PURE__ */ r("td", { className: "bt-td", colSpan: c, children: /* @__PURE__ */ y("div", { className: "bt-empty", children: [
650
648
  /* @__PURE__ */ r("div", { className: "bt-empty-icon", children: "📭" }),
651
649
  /* @__PURE__ */ r("div", { className: "bt-empty-text", children: e.noData })
652
650
  ] }) }) }) });
653
651
  }
654
- function ot({ show: e }) {
655
- const { loadingComponent: s, locale: a } = C();
656
- return e ? /* @__PURE__ */ r("div", { className: "bt-loading-overlay", role: "status", "aria-live": "polite", children: s || /* @__PURE__ */ y(He, { children: [
652
+ function ct({ show: e }) {
653
+ const { loadingComponent: a, locale: n } = x();
654
+ return e ? /* @__PURE__ */ r("div", { className: "bt-loading-overlay", role: "status", "aria-live": "polite", children: a || /* @__PURE__ */ y(Ke, { children: [
657
655
  /* @__PURE__ */ r("div", { className: "bt-loading-spinner", "aria-hidden": "true" }),
658
- /* @__PURE__ */ r("span", { className: "bt-loading-text", children: a.loading })
656
+ /* @__PURE__ */ r("span", { className: "bt-loading-text", children: n.loading })
659
657
  ] }) }) : null;
660
658
  }
661
659
  function dt() {
662
- const { isModalOpen: e, modalContent: s, closeModal: a } = C(), l = m(
660
+ const { isModalOpen: e, modalContent: a, closeModal: n } = x(), l = g(
663
661
  (t) => {
664
- t.target === t.currentTarget && a();
662
+ t.target === t.currentTarget && n();
665
663
  },
666
- [a]
667
- ), n = m(
664
+ [n]
665
+ ), i = g(
668
666
  (t) => {
669
- t.key === "Escape" && a();
667
+ t.key === "Escape" && n();
670
668
  },
671
- [a]
669
+ [n]
672
670
  );
673
- return Ke(() => (e && (document.addEventListener("keydown", n), document.body.style.overflow = "hidden"), () => {
674
- document.removeEventListener("keydown", n), document.body.style.overflow = "";
675
- }), [e, n]), !e || !s ? null : /* @__PURE__ */ r(
671
+ return Fe(() => (e && (document.addEventListener("keydown", i), document.body.style.overflow = "hidden"), () => {
672
+ document.removeEventListener("keydown", i), document.body.style.overflow = "";
673
+ }), [e, i]), !e || !a ? null : /* @__PURE__ */ r(
676
674
  "div",
677
675
  {
678
676
  className: "bt-modal-backdrop",
@@ -686,497 +684,497 @@ function dt() {
686
684
  "button",
687
685
  {
688
686
  className: "bt-modal-close",
689
- onClick: a,
687
+ onClick: n,
690
688
  "aria-label": "Close modal",
691
689
  type: "button",
692
690
  children: "✕"
693
691
  }
694
692
  )
695
693
  ] }),
696
- /* @__PURE__ */ r("div", { className: "bt-modal-body", children: s })
694
+ /* @__PURE__ */ r("div", { className: "bt-modal-body", children: a })
697
695
  ] })
698
696
  }
699
697
  );
700
698
  }
701
699
  function bt({
702
700
  data: e,
703
- initialSort: s,
704
- controlledSort: a,
701
+ initialSort: a,
702
+ controlledSort: n,
705
703
  onSortChange: l
706
704
  }) {
707
- const [n, t] = I(
708
- s ?? { columnId: null, direction: "asc" }
709
- ), i = a ?? n, o = m(
710
- (u) => {
711
- const g = {
712
- columnId: u,
713
- direction: i.columnId === u && i.direction === "asc" ? "desc" : "asc"
705
+ const [i, t] = I(
706
+ a ?? { columnId: null, direction: "asc" }
707
+ ), s = n ?? i, c = g(
708
+ (h) => {
709
+ const m = {
710
+ columnId: h,
711
+ direction: s.columnId === h && s.direction === "asc" ? "desc" : "asc"
714
712
  };
715
- a || t(g), l == null || l(g);
713
+ n || t(m), l?.(m);
716
714
  },
717
- [i, a, l]
718
- ), d = m(() => {
719
- const u = { columnId: null, direction: "asc" };
720
- a || t(u), l == null || l(u);
721
- }, [a, l]);
722
- return { sortedData: x(() => i.columnId ? Ue(e, i.columnId, i.direction) : e, [e, i]), sortState: i, handleSort: o, clearSort: d };
715
+ [s, n, l]
716
+ ), d = g(() => {
717
+ const h = { columnId: null, direction: "asc" };
718
+ n || t(h), l?.(h);
719
+ }, [n, l]);
720
+ return { sortedData: A(() => s.columnId ? Ge(e, s.columnId, s.direction) : e, [e, s]), sortState: s, handleSort: c, clearSort: d };
723
721
  }
724
- function ut({
722
+ function ht({
725
723
  data: e,
726
- columns: s,
727
- initialFilters: a,
724
+ columns: a,
725
+ initialFilters: n,
728
726
  controlledFilters: l,
729
- onFilterChange: n
727
+ onFilterChange: i
730
728
  }) {
731
- const [t, i] = I(
732
- a ?? {}
733
- ), o = l ?? t, d = m(
734
- (h, f) => {
735
- const p = { ...o };
736
- f == null || f === "" ? delete p[h] : p[h] = f, l || i(p), n == null || n(p);
729
+ const [t, s] = I(
730
+ n ?? {}
731
+ ), c = l ?? t, d = g(
732
+ (f, u) => {
733
+ const p = { ...c };
734
+ u == null || u === "" ? delete p[f] : p[f] = u, l || s(p), i?.(p);
737
735
  },
738
- [o, l, n]
739
- ), b = m(
740
- (h) => {
741
- const f = { ...o };
742
- delete f[h], l || i(f), n == null || n(f);
736
+ [c, l, i]
737
+ ), b = g(
738
+ (f) => {
739
+ const u = { ...c };
740
+ delete u[f], l || s(u), i?.(u);
743
741
  },
744
- [o, l, n]
745
- ), u = m(() => {
746
- l || i({}), n == null || n({});
747
- }, [l, n]);
748
- return { filteredData: x(() => We(e, o, s), [e, o, s]), filters: o, setFilter: d, clearFilters: u, clearFilter: b };
742
+ [c, l, i]
743
+ ), h = g(() => {
744
+ l || s({}), i?.({});
745
+ }, [l, i]);
746
+ return { filteredData: A(() => Ue(e, c, a), [e, c, a]), filters: c, setFilter: d, clearFilters: h, clearFilter: b };
749
747
  }
750
- function ft({
748
+ function ut({
751
749
  data: e,
752
- config: s,
753
- onPageChange: a
750
+ config: a,
751
+ onPageChange: n
754
752
  }) {
755
- const l = s !== !1, n = s && typeof s == "object" ? s.page ?? 1 : 1, t = s && typeof s == "object" ? s.pageSize ?? 10 : 10, i = s && typeof s == "object" ? s.totalItems : void 0, [o, d] = I(n), [b, u] = I(t), g = i ?? e.length, h = Math.max(1, Math.ceil(g / b)), f = m(
756
- (c) => {
757
- const v = Math.max(1, Math.min(c, h));
758
- d(v), a == null || a(v, b);
753
+ const l = a !== !1, i = a && typeof a == "object" ? a.page ?? 1 : 1, t = a && typeof a == "object" ? a.pageSize ?? 10 : 10, s = a && typeof a == "object" ? a.totalItems : void 0, [c, d] = I(i), [b, h] = I(t), m = s ?? e.length, f = Math.max(1, Math.ceil(m / b)), u = g(
754
+ (o) => {
755
+ const v = Math.max(1, Math.min(o, f));
756
+ d(v), n?.(v, b);
759
757
  },
760
- [h, b, a]
761
- ), p = m(() => {
762
- o < h && f(o + 1);
763
- }, [o, h, f]), N = m(() => {
764
- o > 1 && f(o - 1);
765
- }, [o, f]), P = m(
766
- (c) => {
767
- u(c), d(1), a == null || a(1, c);
758
+ [f, b, n]
759
+ ), p = g(() => {
760
+ c < f && u(c + 1);
761
+ }, [c, f, u]), S = g(() => {
762
+ c > 1 && u(c - 1);
763
+ }, [c, u]), D = g(
764
+ (o) => {
765
+ h(o), d(1), n?.(1, o);
768
766
  },
769
- [a]
770
- ), $ = x(() => {
771
- if (!l || i !== void 0)
767
+ [n]
768
+ ), $ = A(() => {
769
+ if (!l || s !== void 0)
772
770
  return e;
773
- const c = (o - 1) * b;
774
- return e.slice(c, c + b);
775
- }, [e, o, b, l, i]), w = (o - 1) * b + 1, S = Math.min(o * b, g);
771
+ const o = (c - 1) * b;
772
+ return e.slice(o, o + b);
773
+ }, [e, c, b, l, s]), T = (c - 1) * b + 1, N = Math.min(c * b, m);
776
774
  return {
777
775
  paginatedData: $,
778
- page: o,
776
+ page: c,
779
777
  pageSize: b,
780
- totalPages: h,
781
- totalItems: g,
782
- goToPage: f,
778
+ totalPages: f,
779
+ totalItems: m,
780
+ goToPage: u,
783
781
  nextPage: p,
784
- prevPage: N,
785
- changePageSize: P,
786
- hasNextPage: o < h,
787
- hasPrevPage: o > 1,
788
- startIndex: w,
789
- endIndex: S
782
+ prevPage: S,
783
+ changePageSize: D,
784
+ hasNextPage: c < f,
785
+ hasPrevPage: c > 1,
786
+ startIndex: T,
787
+ endIndex: N
790
788
  };
791
789
  }
792
- function ht({
790
+ function ft({
793
791
  data: e,
794
- rowKey: s,
795
- mode: a = "multiple",
792
+ rowKey: a,
793
+ mode: n = "multiple",
796
794
  initialSelection: l,
797
- controlledSelection: n,
795
+ controlledSelection: i,
798
796
  onSelectionChange: t
799
797
  }) {
800
- const [i, o] = I(
798
+ const [s, c] = I(
801
799
  l ?? []
802
- ), d = n ?? i, b = m(
803
- (c, v) => typeof s == "function" ? s(c, v) : String(c[s]),
804
- [s]
805
- ), u = x(() => new Set(d.map((c, v) => b(c, v))), [d, b]), g = m(
806
- (c, v) => {
807
- const k = b(c, v);
808
- return u.has(k);
800
+ ), d = i ?? s, b = g(
801
+ (o, v) => typeof a == "function" ? a(o, v) : String(o[a]),
802
+ [a]
803
+ ), h = A(() => new Set(d.map((o, v) => b(o, v))), [d, b]), m = g(
804
+ (o, v) => {
805
+ const C = b(o, v);
806
+ return h.has(C);
809
807
  },
810
- [b, u]
811
- ), h = m(
812
- (c) => {
813
- n || o(c), t == null || t(c);
808
+ [b, h]
809
+ ), f = g(
810
+ (o) => {
811
+ i || c(o), t?.(o);
814
812
  },
815
- [n, t]
816
- ), f = m(
817
- (c, v) => {
818
- const k = b(c, v);
819
- let D;
820
- a === "single" ? D = u.has(k) ? [] : [c] : u.has(k) ? D = d.filter((A, M) => b(A, M) !== k) : D = [...d, c], h(D);
813
+ [i, t]
814
+ ), u = g(
815
+ (o, v) => {
816
+ const C = b(o, v);
817
+ let k;
818
+ n === "single" ? k = h.has(C) ? [] : [o] : h.has(C) ? k = d.filter((w, R) => b(w, R) !== C) : k = [...d, o], f(k);
821
819
  },
822
- [a, u, d, b, h]
823
- ), p = m(
824
- (c, v) => {
825
- if (!g(c, v)) {
826
- const k = a === "single" ? [c] : [...d, c];
827
- h(k);
820
+ [n, h, d, b, f]
821
+ ), p = g(
822
+ (o, v) => {
823
+ if (!m(o, v)) {
824
+ const C = n === "single" ? [o] : [...d, o];
825
+ f(C);
828
826
  }
829
827
  },
830
- [g, a, d, h]
831
- ), N = m(
832
- (c, v) => {
833
- const k = b(c, v), D = d.filter(
834
- (A, M) => b(A, M) !== k
828
+ [m, n, d, f]
829
+ ), S = g(
830
+ (o, v) => {
831
+ const C = b(o, v), k = d.filter(
832
+ (w, R) => b(w, R) !== C
835
833
  );
836
- h(D);
834
+ f(k);
837
835
  },
838
- [d, b, h]
839
- ), P = m(() => {
840
- a === "multiple" && h([...e]);
841
- }, [e, a, h]), $ = m(() => {
842
- h([]);
843
- }, [h]), w = e.length > 0 && d.length === e.length, S = d.length > 0 && d.length < e.length;
836
+ [d, b, f]
837
+ ), D = g(() => {
838
+ n === "multiple" && f([...e]);
839
+ }, [e, n, f]), $ = g(() => {
840
+ f([]);
841
+ }, [f]), T = e.length > 0 && d.length === e.length, N = d.length > 0 && d.length < e.length;
844
842
  return {
845
843
  selectedRows: d,
846
- isSelected: g,
847
- toggleRow: f,
844
+ isSelected: m,
845
+ toggleRow: u,
848
846
  selectRow: p,
849
- deselectRow: N,
850
- selectAll: P,
847
+ deselectRow: S,
848
+ selectAll: D,
851
849
  deselectAll: $,
852
- isAllSelected: w,
853
- isPartiallySelected: S,
850
+ isAllSelected: T,
851
+ isPartiallySelected: N,
854
852
  selectedCount: d.length
855
853
  };
856
854
  }
857
855
  function pt({
858
856
  data: e,
859
- columns: s,
860
- searchColumns: a,
857
+ columns: a,
858
+ searchColumns: n,
861
859
  initialValue: l,
862
- controlledValue: n,
860
+ controlledValue: i,
863
861
  onSearchChange: t
864
862
  }) {
865
- const [i, o] = I(l ?? ""), d = n ?? i, b = m(
866
- (h) => {
867
- n === void 0 && o(h), t == null || t(h);
863
+ const [s, c] = I(l ?? ""), d = i ?? s, b = g(
864
+ (f) => {
865
+ i === void 0 && c(f), t?.(f);
868
866
  },
869
- [n, t]
870
- ), u = m(() => {
871
- n === void 0 && o(""), t == null || t("");
872
- }, [n, t]);
873
- return { searchedData: x(() => Xe(e, d, s, a), [e, d, s, a]), searchValue: d, handleSearch: b, clearSearch: u };
867
+ [i, t]
868
+ ), h = g(() => {
869
+ i === void 0 && c(""), t?.("");
870
+ }, [i, t]);
871
+ return { searchedData: A(() => We(e, d, a, n), [e, d, a, n]), searchValue: d, handleSearch: b, clearSearch: h };
874
872
  }
875
- function mt(e) {
873
+ function gt(e) {
876
874
  const {
877
875
  // Data
878
- data: s,
879
- columns: a,
876
+ data: a,
877
+ columns: n,
880
878
  rowKey: l = "id",
881
879
  // Actions
882
- rowActions: n,
880
+ rowActions: i,
883
881
  globalActions: t,
884
882
  // Pagination
885
- pagination: i = { pageSize: 10 },
886
- onPageChange: o,
883
+ pagination: s = { pageSize: 10 },
884
+ onPageChange: c,
887
885
  // Sort
888
886
  sort: d,
889
887
  onSortChange: b,
890
888
  // Filter
891
- filters: u,
892
- onFilterChange: g,
889
+ filters: h,
890
+ onFilterChange: m,
893
891
  // Search
894
- searchable: h = !1,
895
- searchValue: f,
892
+ searchable: f = !1,
893
+ searchValue: u,
896
894
  onSearchChange: p,
897
- searchColumns: N,
895
+ searchColumns: S,
898
896
  // Selection - now auto-inferred if not explicitly set
899
- selectable: P,
897
+ selectable: D,
900
898
  selectedRows: $,
901
- onSelectionChange: w,
902
- selectionMode: S = "multiple",
899
+ onSelectionChange: T,
900
+ selectionMode: N = "multiple",
903
901
  // States
904
- loading: c = !1,
902
+ loading: o = !1,
905
903
  loadingComponent: v,
906
- emptyComponent: k,
904
+ emptyComponent: C,
907
905
  // Styling
908
- classNames: D = {},
909
- styles: A = {},
910
- locale: M,
906
+ classNames: k = {},
907
+ styles: w = {},
908
+ locale: R,
911
909
  stickyHeader: O = !1,
912
910
  maxHeight: ze,
913
911
  bordered: L = !1,
914
- striped: K = !1,
915
- hoverable: H = !0,
912
+ striped: F = !1,
913
+ hoverable: K = !0,
916
914
  size: j = "medium",
917
915
  // Callbacks
918
- onRowClick: V,
919
- onRowDoubleClick: q,
916
+ onRowClick: H,
917
+ onRowDoubleClick: V,
920
918
  // Accessibility
921
919
  ariaLabel: Ie,
922
- ariaDescribedBy: Me
923
- } = e, J = x(() => P !== void 0 ? P : (t == null ? void 0 : t.some(
920
+ ariaDescribedBy: Re
921
+ } = e, q = A(() => D !== void 0 ? D : t?.some(
924
922
  (je) => je.requiresSelection
925
- )) || w !== void 0, [P, t, w]), _ = x(
926
- () => ({ ...Ve, ...M }),
927
- [M]
928
- ), [Q, G] = I(!1), [U, W] = I(null), X = m((xe) => {
929
- W(xe), G(!0);
930
- }, []), Y = m(() => {
931
- G(!1), W(null);
932
- }, []), z = x(() => i === !1 ? !1 : {
923
+ ) || T !== void 0, [D, t, T]), J = A(
924
+ () => ({ ...He, ...R }),
925
+ [R]
926
+ ), [_, Q] = I(!1), [G, U] = I(null), W = g((Ae) => {
927
+ U(Ae), Q(!0);
928
+ }, []), X = g(() => {
929
+ Q(!1), U(null);
930
+ }, []), z = A(() => s === !1 ? !1 : {
933
931
  pageSize: 10,
934
932
  pageSizeOptions: [10, 20, 50, 100],
935
933
  showSizeChanger: !1,
936
- ...i
937
- }, [i]), {
938
- searchedData: Re,
939
- searchValue: Z,
940
- handleSearch: F,
934
+ ...s
935
+ }, [s]), {
936
+ searchedData: Me,
937
+ searchValue: Y,
938
+ handleSearch: Z,
941
939
  clearSearch: ee
942
940
  } = pt({
943
- data: s,
944
- columns: a,
945
- searchColumns: N,
946
- controlledValue: f,
941
+ data: a,
942
+ columns: n,
943
+ searchColumns: S,
944
+ controlledValue: u,
947
945
  onSearchChange: p
948
946
  }), {
949
947
  filteredData: Be,
950
948
  filters: te,
951
949
  setFilter: ae,
952
- clearFilters: le
953
- } = ut({
954
- data: Re,
955
- columns: a,
956
- controlledFilters: u,
957
- onFilterChange: g
958
- }), { sortedData: se, sortState: ne, handleSort: ie } = bt({
950
+ clearFilters: ne
951
+ } = ht({
952
+ data: Me,
953
+ columns: n,
954
+ controlledFilters: h,
955
+ onFilterChange: m
956
+ }), { sortedData: le, sortState: se, handleSort: ie } = bt({
959
957
  data: Be,
960
958
  controlledSort: d,
961
959
  onSortChange: b
962
960
  }), {
963
961
  selectedRows: re,
964
- isSelected: ce,
965
- toggleRow: oe,
962
+ isSelected: oe,
963
+ toggleRow: ce,
966
964
  selectAll: de,
967
965
  deselectAll: be,
968
- isAllSelected: ue,
969
- isPartiallySelected: fe,
970
- selectedCount: he
971
- } = ht({
972
- data: se,
966
+ isAllSelected: he,
967
+ isPartiallySelected: ue,
968
+ selectedCount: fe
969
+ } = ft({
970
+ data: le,
973
971
  rowKey: l,
974
- mode: S,
972
+ mode: N,
975
973
  controlledSelection: $,
976
- onSelectionChange: w
974
+ onSelectionChange: T
977
975
  }), {
978
976
  paginatedData: E,
979
977
  page: pe,
980
- pageSize: me,
981
- totalPages: ge,
978
+ pageSize: ge,
979
+ totalPages: me,
982
980
  totalItems: ve,
983
981
  goToPage: ye,
984
- nextPage: Ne,
985
- prevPage: Se,
986
- changePageSize: ke,
987
- hasNextPage: De,
988
- hasPrevPage: Te,
989
- startIndex: Pe,
990
- endIndex: we
991
- } = ft({
992
- data: se,
982
+ nextPage: Se,
983
+ prevPage: Ne,
984
+ changePageSize: Ce,
985
+ hasNextPage: ke,
986
+ hasPrevPage: Pe,
987
+ startIndex: De,
988
+ endIndex: Te
989
+ } = ut({
990
+ data: le,
993
991
  config: z,
994
- onPageChange: o
995
- }), Le = x(
992
+ onPageChange: c
993
+ }), Le = A(
996
994
  () => ({
997
995
  // Data
998
- data: s,
996
+ data: a,
999
997
  processedData: E,
1000
- columns: a,
998
+ columns: n,
1001
999
  rowKey: l,
1002
1000
  // Actions
1003
- rowActions: n,
1001
+ rowActions: i,
1004
1002
  globalActions: t,
1005
1003
  // Sort
1006
- sortState: ne,
1004
+ sortState: se,
1007
1005
  handleSort: ie,
1008
1006
  // Filter
1009
1007
  filters: te,
1010
1008
  setFilter: ae,
1011
- clearFilters: le,
1009
+ clearFilters: ne,
1012
1010
  // Search
1013
- searchValue: Z,
1014
- handleSearch: F,
1011
+ searchValue: Y,
1012
+ handleSearch: Z,
1015
1013
  clearSearch: ee,
1016
- searchable: h,
1014
+ searchable: f,
1017
1015
  // Selection
1018
1016
  selectedRows: re,
1019
- isSelected: ce,
1020
- toggleRow: oe,
1017
+ isSelected: oe,
1018
+ toggleRow: ce,
1021
1019
  selectAll: de,
1022
1020
  deselectAll: be,
1023
- isAllSelected: ue,
1024
- isPartiallySelected: fe,
1025
- selectable: J,
1026
- selectionMode: S,
1027
- selectedCount: he,
1021
+ isAllSelected: he,
1022
+ isPartiallySelected: ue,
1023
+ selectable: q,
1024
+ selectionMode: N,
1025
+ selectedCount: fe,
1028
1026
  // Pagination
1029
1027
  page: pe,
1030
- pageSize: me,
1031
- totalPages: ge,
1028
+ pageSize: ge,
1029
+ totalPages: me,
1032
1030
  totalItems: ve,
1033
1031
  goToPage: ye,
1034
- nextPage: Ne,
1035
- prevPage: Se,
1036
- changePageSize: ke,
1037
- hasNextPage: De,
1038
- hasPrevPage: Te,
1039
- startIndex: Pe,
1040
- endIndex: we,
1041
- paginationEnabled: i !== !1,
1032
+ nextPage: Se,
1033
+ prevPage: Ne,
1034
+ changePageSize: Ce,
1035
+ hasNextPage: ke,
1036
+ hasPrevPage: Pe,
1037
+ startIndex: De,
1038
+ endIndex: Te,
1039
+ paginationEnabled: s !== !1,
1042
1040
  pageSizeOptions: z && typeof z == "object" ? z.pageSizeOptions ?? [10, 20, 50, 100] : [10, 20, 50, 100],
1043
1041
  showSizeChanger: z && typeof z == "object" ? z.showSizeChanger ?? !1 : !1,
1044
1042
  // UI State
1045
- loading: c,
1043
+ loading: o,
1046
1044
  loadingComponent: v,
1047
- emptyComponent: k,
1045
+ emptyComponent: C,
1048
1046
  // Styling
1049
- locale: _,
1050
- classNames: D,
1047
+ locale: J,
1048
+ classNames: k,
1051
1049
  size: j,
1052
1050
  bordered: L,
1053
- striped: K,
1054
- hoverable: H,
1051
+ striped: F,
1052
+ hoverable: K,
1055
1053
  stickyHeader: O,
1056
1054
  // Callbacks
1057
- onRowClick: V,
1058
- onRowDoubleClick: q,
1055
+ onRowClick: H,
1056
+ onRowDoubleClick: V,
1059
1057
  // Modal
1060
- openModal: X,
1061
- closeModal: Y,
1062
- modalContent: U,
1063
- isModalOpen: Q
1058
+ openModal: W,
1059
+ closeModal: X,
1060
+ modalContent: G,
1061
+ isModalOpen: _
1064
1062
  }),
1065
1063
  [
1066
- s,
1067
- E,
1068
1064
  a,
1069
- l,
1065
+ E,
1070
1066
  n,
1067
+ l,
1068
+ i,
1071
1069
  t,
1072
- ne,
1070
+ se,
1073
1071
  ie,
1074
1072
  te,
1075
1073
  ae,
1076
- le,
1074
+ ne,
1075
+ Y,
1077
1076
  Z,
1078
- F,
1079
1077
  ee,
1080
- h,
1078
+ f,
1081
1079
  re,
1082
- ce,
1083
1080
  oe,
1081
+ ce,
1084
1082
  de,
1085
1083
  be,
1084
+ he,
1086
1085
  ue,
1086
+ q,
1087
+ N,
1087
1088
  fe,
1088
- J,
1089
- S,
1090
- he,
1091
1089
  pe,
1092
- me,
1093
1090
  ge,
1091
+ me,
1094
1092
  ve,
1095
1093
  ye,
1096
- Ne,
1097
1094
  Se,
1095
+ Ne,
1096
+ Ce,
1098
1097
  ke,
1098
+ Pe,
1099
1099
  De,
1100
1100
  Te,
1101
- Pe,
1102
- we,
1103
- i,
1101
+ s,
1104
1102
  z,
1105
- c,
1103
+ o,
1106
1104
  v,
1105
+ C,
1106
+ J,
1107
1107
  k,
1108
- _,
1109
- D,
1110
1108
  j,
1111
1109
  L,
1110
+ F,
1112
1111
  K,
1113
- H,
1114
1112
  O,
1113
+ H,
1115
1114
  V,
1116
- q,
1115
+ W,
1117
1116
  X,
1118
- Y,
1119
- U,
1120
- Q
1117
+ G,
1118
+ _
1121
1119
  ]
1122
- ), Ae = E.length > 0;
1123
- return /* @__PURE__ */ r(qe, { value: Le, children: /* @__PURE__ */ y(
1120
+ ), we = E.length > 0;
1121
+ return /* @__PURE__ */ r(Ve, { value: Le, children: /* @__PURE__ */ y(
1124
1122
  "div",
1125
1123
  {
1126
- className: T(
1124
+ className: P(
1127
1125
  "bt-container",
1128
1126
  `bt-size-${j}`,
1129
- c && "bt-container-loading",
1130
- D.container
1127
+ o && "bt-container-loading",
1128
+ k.container
1131
1129
  ),
1132
- style: A.container,
1130
+ style: w.container,
1133
1131
  children: [
1134
1132
  /* @__PURE__ */ r(rt, {}),
1135
1133
  /* @__PURE__ */ y(
1136
1134
  "div",
1137
1135
  {
1138
- className: T("bt-table-wrapper", L && "bt-bordered"),
1136
+ className: P("bt-table-wrapper", L && "bt-bordered"),
1139
1137
  style: { maxHeight: ze },
1140
1138
  children: [
1141
1139
  /* @__PURE__ */ y(
1142
1140
  "table",
1143
1141
  {
1144
- className: T("bt-table", D.table),
1145
- style: A.table,
1142
+ className: P("bt-table", k.table),
1143
+ style: w.table,
1146
1144
  role: "grid",
1147
1145
  "aria-label": Ie,
1148
- "aria-describedby": Me,
1149
- "aria-busy": c,
1146
+ "aria-describedby": Re,
1147
+ "aria-busy": o,
1150
1148
  children: [
1151
- /* @__PURE__ */ r(Ge, {}),
1152
- Ae ? /* @__PURE__ */ r(st, {}) : /* @__PURE__ */ r(ct, {})
1149
+ /* @__PURE__ */ r(Qe, {}),
1150
+ we ? /* @__PURE__ */ r(lt, {}) : /* @__PURE__ */ r(ot, {})
1153
1151
  ]
1154
1152
  }
1155
1153
  ),
1156
- /* @__PURE__ */ r(ot, { show: c && Ae })
1154
+ /* @__PURE__ */ r(ct, { show: o && we })
1157
1155
  ]
1158
1156
  }
1159
1157
  ),
1160
- i !== !1 && /* @__PURE__ */ r(nt, {}),
1158
+ s !== !1 && /* @__PURE__ */ r(st, {}),
1161
1159
  /* @__PURE__ */ r(dt, {})
1162
1160
  ]
1163
1161
  }
1164
1162
  ) });
1165
1163
  }
1166
- const St = mt;
1164
+ const Nt = gt;
1167
1165
  export {
1168
- St as BetterTable,
1169
- qe as TableProvider,
1170
- Ve as defaultLocale,
1171
- We as filterData,
1172
- R as getValueFromPath,
1173
- Xe as searchData,
1174
- Ue as sortData,
1175
- C as useTableContext,
1176
- ut as useTableFilter,
1177
- ft as useTablePagination,
1166
+ Nt as BetterTable,
1167
+ Ve as TableProvider,
1168
+ He as defaultLocale,
1169
+ Ue as filterData,
1170
+ M as getValueFromPath,
1171
+ We as searchData,
1172
+ Ge as sortData,
1173
+ x as useTableContext,
1174
+ ht as useTableFilter,
1175
+ ut as useTablePagination,
1178
1176
  pt as useTableSearch,
1179
- ht as useTableSelection,
1177
+ ft as useTableSelection,
1180
1178
  bt as useTableSort
1181
1179
  };
1182
1180
  //# sourceMappingURL=better-table.es.js.map