@sito/dashboard 0.0.66 → 0.0.68

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 (70) hide show
  1. package/README.md +3 -2
  2. package/dist/{Chip-JDQqzO9I.js → Chip-C5ogKbFn.js} +4 -4
  3. package/dist/{Chip-a2z-338_.cjs → Chip-D17UJHW6.cjs} +1 -1
  4. package/dist/Chip.cjs +1 -1
  5. package/dist/Chip.js +1 -1
  6. package/dist/{FileInput-B--eBQVa.js → FileInput-DNoJELoS.js} +19 -19
  7. package/dist/FileInput-YvKQ-wok.cjs +1 -0
  8. package/dist/{Filters-BivtNVS3.js → Filters-DL5jd8ps.js} +30 -16
  9. package/dist/{Filters-C5XEbF3V.cjs → Filters-Dyee8QYH.cjs} +1 -1
  10. package/dist/FiltersProvider-BlHv12dU.cjs +1 -0
  11. package/dist/{FiltersProvider-CY2fsw_F.js → FiltersProvider-gfC9gS8u.js} +5 -5
  12. package/dist/FiltersProvider.cjs +1 -1
  13. package/dist/FiltersProvider.js +1 -1
  14. package/dist/Form.cjs +1 -1
  15. package/dist/Form.js +2 -2
  16. package/dist/SvgIcons.cjs +1 -1
  17. package/dist/SvgIcons.js +7 -6
  18. package/dist/Table-B5vsXjAq.js +1080 -0
  19. package/dist/Table-DgFzKIJZ.cjs +1 -0
  20. package/dist/Table.cjs +1 -1
  21. package/dist/Table.css +1 -1
  22. package/dist/Table.js +1 -1
  23. package/dist/TableOptions.cjs +1 -1
  24. package/dist/TableOptions.js +1 -1
  25. package/dist/TableOptionsProvider-CDLZ4TXE.cjs +1 -0
  26. package/dist/TableOptionsProvider-HHCDcRbO.js +55 -0
  27. package/dist/TextInput-C27RFuya.cjs +1 -0
  28. package/dist/TextInput-DPYxzgm3.js +335 -0
  29. package/dist/TextInput.css +1 -1
  30. package/dist/Translation.cjs +1 -1
  31. package/dist/Translation.js +1 -1
  32. package/dist/{TranslationProvider-COebIyxr.js → TranslationProvider-BR4s--Vu.js} +2 -2
  33. package/dist/TranslationProvider-Czr0WIDH.cjs +1 -0
  34. package/dist/components/Actions/Action.d.ts +18 -0
  35. package/dist/components/Actions/Actions.d.ts +14 -0
  36. package/dist/components/Actions/Actions.stories.d.ts +20 -0
  37. package/dist/components/Actions/Actions.test.d.ts +1 -0
  38. package/dist/components/Actions/ActionsDropdown.d.ts +10 -0
  39. package/dist/components/Actions/ActionsDropdown.stories.d.ts +17 -0
  40. package/dist/components/Actions/ActionsDropdown.test.d.ts +1 -0
  41. package/dist/components/Actions/index.d.ts +4 -0
  42. package/dist/components/Actions/types.d.ts +17 -0
  43. package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +2 -0
  44. package/dist/components/Form/CheckInput/CheckInput.test.d.ts +1 -0
  45. package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +1 -0
  46. package/dist/components/Form/TextInput/TextInput.stories.d.ts +3 -0
  47. package/dist/components/SvgIcons/Ellipsis.d.ts +7 -0
  48. package/dist/components/SvgIcons/index.d.ts +1 -0
  49. package/dist/components/Table/Table.stories.d.ts +3 -0
  50. package/dist/components/Table/components/Footer/Navigation.test.d.ts +1 -0
  51. package/dist/components/Table/components/TableHeader/TableHeader.test.d.ts +1 -0
  52. package/dist/components/Table/types.d.ts +1 -0
  53. package/dist/components/index.d.ts +1 -0
  54. package/dist/index.cjs +1 -1
  55. package/dist/index.css +1 -1
  56. package/dist/index.js +69 -65
  57. package/dist/providers/FiltersProvider/FiltersProvider.test.d.ts +1 -0
  58. package/dist/providers/Translation/TranslationProvider.d.ts +5 -4
  59. package/dist/providers/Translation/TranslationProvider.test.d.ts +1 -0
  60. package/dist/setupTests.d.ts +0 -0
  61. package/package.json +5 -2
  62. package/dist/FileInput-5tMOO7mb.cjs +0 -1
  63. package/dist/FiltersProvider-CYqLFEI9.cjs +0 -1
  64. package/dist/Table-CH9HYQ2I.js +0 -946
  65. package/dist/Table-CWss4TW5.cjs +0 -1
  66. package/dist/TableOptionsProvider-BchUDA3B.cjs +0 -1
  67. package/dist/TableOptionsProvider-BfQS8l1N.js +0 -50
  68. package/dist/TextInput-BLfTozZ9.js +0 -320
  69. package/dist/TextInput-Bn8zsDnU.cjs +0 -1
  70. package/dist/TranslationProvider-51Pc9Xrr.cjs +0 -1
@@ -0,0 +1,1080 @@
1
+ import "./Table.css";
2
+ import { jsxs as g, jsx as e, Fragment as X } from "react/jsx-runtime";
3
+ import { useState as O, useRef as V, useEffect as I, useMemo as w, useCallback as x, Fragment as oe } from "react";
4
+ import { u as H, a as j, F as ce } from "./FiltersProvider-gfC9gS8u.js";
5
+ import { B as de } from "./Badge-CIeYthEy.js";
6
+ import { E as ue, c as se, C as ae, a as pe, b as me, F as he } from "./Filters-DL5jd8ps.js";
7
+ import { FilterTypes as W } from "./lib.js";
8
+ import { u as $ } from "./TranslationProvider-BR4s--Vu.js";
9
+ import { A as fe, C as be, S as ee, T as Y } from "./TextInput-DPYxzgm3.js";
10
+ import { u as z } from "./TableOptionsProvider-HHCDcRbO.js";
11
+ import { B as Z } from "./Button-D73-swfo.js";
12
+ import { C as te } from "./Chip-C5ogKbFn.js";
13
+ import { I as q } from "./IconButton-BpsTEj0z.js";
14
+ import { T as le } from "./Tooltip-B4E-FRwY.js";
15
+ import { S as ge } from "./query-CwuehjY1.js";
16
+ import { D as Ne } from "./Dropdown-CbaxuMbk.js";
17
+ import { L as Ce } from "./Loading-B_c_4XLr.js";
18
+ function we(s) {
19
+ const {
20
+ id: t,
21
+ icon: r,
22
+ tooltip: n,
23
+ onClick: l,
24
+ children: a,
25
+ hidden: d = !1,
26
+ disabled: i = !1,
27
+ showText: c = !1,
28
+ showTooltips: o = !0,
29
+ className: m = ""
30
+ } = s;
31
+ return d ? null : /* @__PURE__ */ g(
32
+ "button",
33
+ {
34
+ id: t,
35
+ className: `action ${c ? "text-action" : "icon-action"} ${m}`,
36
+ disabled: i,
37
+ onClick: () => l?.(),
38
+ "aria-disabled": i,
39
+ "data-tooltip-id": "tooltip",
40
+ "data-tooltip-content": o ? n : "",
41
+ children: [
42
+ r,
43
+ " ",
44
+ c && n,
45
+ a
46
+ ]
47
+ }
48
+ );
49
+ }
50
+ function xe(s) {
51
+ const {
52
+ actions: t = [],
53
+ className: r = "",
54
+ itemClassName: n = "",
55
+ actionClassName: l = "",
56
+ showTooltips: a = !0,
57
+ showActionTexts: d = !1
58
+ } = s;
59
+ return /* @__PURE__ */ e("ul", { className: `actions-container ${r}`, children: t.map((i) => /* @__PURE__ */ e(
60
+ "li",
61
+ {
62
+ className: `actions-container-item ${n}`,
63
+ children: /* @__PURE__ */ e(
64
+ we,
65
+ {
66
+ showTooltips: a,
67
+ showText: d,
68
+ className: l,
69
+ ...i
70
+ }
71
+ )
72
+ },
73
+ i.id
74
+ )) });
75
+ }
76
+ const ve = (s) => {
77
+ const { actions: t = [], className: r = "" } = s, { t: n } = $(), [l, a] = O(!1), [d, i] = O(null);
78
+ return /* @__PURE__ */ g("div", { className: `actions-dropdown ${r}`, children: [
79
+ /* @__PURE__ */ e(
80
+ q,
81
+ {
82
+ icon: /* @__PURE__ */ e(ue, {}),
83
+ onClick: (c) => {
84
+ c.stopPropagation(), i(c.currentTarget), a((o) => !o);
85
+ },
86
+ onMouseDown: (c) => c.stopPropagation(),
87
+ className: "actions-dropdown-trigger",
88
+ "aria-label": n("_accessibility:buttons.openActions"),
89
+ name: n("_accessibility:buttons.openActions"),
90
+ "data-tooltip-id": "tooltip",
91
+ "data-tooltip-content": n("_accessibility:buttons.openActions")
92
+ }
93
+ ),
94
+ /* @__PURE__ */ e(
95
+ Ne,
96
+ {
97
+ open: l,
98
+ onClose: () => a(!1),
99
+ anchorEl: d,
100
+ children: /* @__PURE__ */ e(
101
+ xe,
102
+ {
103
+ showActionTexts: !0,
104
+ actions: t,
105
+ itemClassName: "w-full",
106
+ actionClassName: "action-dropdown-item",
107
+ className: "actions-dropdown-list",
108
+ showTooltips: !1
109
+ }
110
+ )
111
+ }
112
+ )
113
+ ] });
114
+ };
115
+ function re(s) {
116
+ return [...s].sort((t, r) => (r.pos ?? 0) - (t.pos ?? 0)).filter((t) => t.display !== "none");
117
+ }
118
+ function ye(s) {
119
+ const { t } = $(), {
120
+ entity: r = "",
121
+ columns: n = [],
122
+ hasAction: l = !0,
123
+ onSortCallback: a,
124
+ selectionState: d,
125
+ onToggleAllRows: i
126
+ } = s, c = V(null);
127
+ I(() => {
128
+ c.current && (c.current.indeterminate = !!(d?.hasSomeSelected && !d?.allSelected));
129
+ }, [d]);
130
+ const { onSort: o, sortingOrder: m, sortingBy: h } = z(), f = w(() => re(n).map((u) => ({
131
+ id: u.key,
132
+ label: u.label,
133
+ className: u.className ?? "",
134
+ sortable: u.sortable ?? !0,
135
+ sortOptions: u.sortOptions
136
+ })), [n, r, t]);
137
+ return /* @__PURE__ */ e("thead", { className: "table-headers-row", children: /* @__PURE__ */ g("tr", { children: [
138
+ /* @__PURE__ */ e("th", { scope: "col", className: "table-headers-column table-headers-checkbox", children: i ? /* @__PURE__ */ e(
139
+ "input",
140
+ {
141
+ type: "checkbox",
142
+ ref: c,
143
+ checked: d?.allSelected ?? !1,
144
+ onChange: i,
145
+ "aria-label": t("_accessibility:components.table.selectAllRows")
146
+ }
147
+ ) : null }),
148
+ l && /* @__PURE__ */ e("th", { scope: "col", className: "table-headers-action", children: /* @__PURE__ */ e("span", { children: t("_accessibility:labels.actions") }) }),
149
+ f.map((u) => /* @__PURE__ */ e(
150
+ "th",
151
+ {
152
+ scope: "col",
153
+ className: `table-headers-column ${u.className}`,
154
+ children: /* @__PURE__ */ g(
155
+ Z,
156
+ {
157
+ disabled: !u.sortable,
158
+ onClick: () => o(u.id, a),
159
+ className: "table-headers-cell",
160
+ children: [
161
+ /* @__PURE__ */ e("span", { className: "table-headers-label", children: u.label }),
162
+ u.sortable && h === u.id && /* @__PURE__ */ e("span", { children: m === ge.ASC ? u.sortOptions?.icons?.asc ?? /* @__PURE__ */ e(
163
+ se,
164
+ {
165
+ className: u.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
166
+ }
167
+ ) : u.sortOptions?.icons?.desc ?? /* @__PURE__ */ e(
168
+ ae,
169
+ {
170
+ className: u.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
171
+ }
172
+ ) })
173
+ ]
174
+ }
175
+ )
176
+ },
177
+ u.id
178
+ ))
179
+ ] }) });
180
+ }
181
+ const Se = (s) => {
182
+ const { items: t, text: r, id: n, onClearFilter: l } = s;
183
+ return /* @__PURE__ */ e(
184
+ te,
185
+ {
186
+ text: `${r}: ${t.map((a) => a.value ?? a.name).join(", ")}`,
187
+ onDelete: () => l(n)
188
+ }
189
+ );
190
+ }, Re = (s) => {
191
+ const { end: t, start: r, text: n, id: l, onClearFilter: a } = s;
192
+ return /* @__PURE__ */ e(
193
+ te,
194
+ {
195
+ text: `${n}: ${r || "♾️"} - ${t || "♾️"}`,
196
+ onDelete: () => a(l)
197
+ }
198
+ );
199
+ }, Te = (s) => {
200
+ const { filtersDefinition: t } = s, r = w(() => {
201
+ const i = {};
202
+ return t.forEach((c) => {
203
+ i[c.propertyName] = c.label ?? c.propertyName;
204
+ }), i;
205
+ }, [t]), { filters: n, clearFilters: l } = z(), a = w(() => Object.keys(n), [n]), d = x(
206
+ (i) => n[i]?.end || n[i]?.start ? /* @__PURE__ */ e(
207
+ Re,
208
+ {
209
+ id: i,
210
+ text: r[i],
211
+ start: n[i].start,
212
+ end: n[i].end,
213
+ onClearFilter: l
214
+ }
215
+ ) : Array.isArray(n[i]) ? /* @__PURE__ */ e(
216
+ Se,
217
+ {
218
+ id: i,
219
+ text: r[i],
220
+ items: n[i],
221
+ onClearFilter: l
222
+ }
223
+ ) : /* @__PURE__ */ e(
224
+ te,
225
+ {
226
+ text: `${r[i]}: ${n[i]?.value ?? n[i]?.name ?? n[i]}`,
227
+ onDelete: () => l(i)
228
+ }
229
+ ),
230
+ [n, r]
231
+ );
232
+ return /* @__PURE__ */ e("ul", { className: "active-filters-main", children: a?.map((i) => /* @__PURE__ */ e("li", { children: d(i) }, i)) });
233
+ };
234
+ function Ae(s) {
235
+ const { propertyName: t, label: r, placeholder: n, options: l, multiple: a = !0 } = s, { currentFilters: d, setCurrentFilters: i } = H(), c = w(() => d[t] ?? l[0], [d]), o = x(
236
+ (m) => {
237
+ i({
238
+ type: j.update,
239
+ toUpdate: {
240
+ [t]: {
241
+ value: m
242
+ }
243
+ }
244
+ });
245
+ },
246
+ [a]
247
+ );
248
+ return /* @__PURE__ */ e(
249
+ fe,
250
+ {
251
+ value: c?.value,
252
+ label: r,
253
+ options: l,
254
+ multiple: a,
255
+ helperTextClassName: "hidden",
256
+ containerClassName: "options-widget-container",
257
+ onChange: o,
258
+ placeholder: n
259
+ }
260
+ );
261
+ }
262
+ const Ee = (s) => {
263
+ const { propertyName: t, label: r } = s, { currentFilters: n, setCurrentFilters: l } = H(), a = w(() => n[t]?.value ?? "", [n]), d = x((i) => {
264
+ l({
265
+ type: j.update,
266
+ toUpdate: { [t]: { value: i.target.checked } }
267
+ });
268
+ }, []);
269
+ return /* @__PURE__ */ e(be, { label: r, checked: a ?? !1, onChange: d });
270
+ };
271
+ function Fe(s) {
272
+ const { propertyName: t, options: r, label: n, placeholder: l } = s, { currentFilters: a, setCurrentFilters: d } = H(), i = w(() => a[t]?.value ?? r[0], [a]), c = x((o) => {
273
+ d({
274
+ type: j.update,
275
+ toUpdate: { [t]: { value: o.target.value } }
276
+ });
277
+ }, []);
278
+ return /* @__PURE__ */ e(
279
+ ee,
280
+ {
281
+ value: i,
282
+ label: n,
283
+ options: r,
284
+ helperTextClassName: "hidden",
285
+ containerClassName: "options-widget-container",
286
+ onChange: c,
287
+ placeholder: l
288
+ }
289
+ );
290
+ }
291
+ const ke = (s) => {
292
+ const { propertyName: t, label: r, placeholder: n } = s, { currentFilters: l, setCurrentFilters: a } = H(), d = w(() => l[t]?.value ?? "", [l]), i = x((c) => {
293
+ a({
294
+ type: j.update,
295
+ toUpdate: { [t]: { value: c.target.value } }
296
+ });
297
+ }, []);
298
+ return /* @__PURE__ */ e(
299
+ Y,
300
+ {
301
+ value: d ?? "",
302
+ label: r,
303
+ onChange: i,
304
+ containerClassName: "input-widget-container",
305
+ helperTextClassName: "",
306
+ placeholder: n
307
+ }
308
+ );
309
+ }, ne = (s) => {
310
+ const { propertyName: t, label: r, inputType: n } = s, { t: l } = $(), { currentFilters: a, setCurrentFilters: d } = H(), i = V(null), c = V(null), o = x((h) => {
311
+ d({
312
+ type: j.update,
313
+ toUpdate: {
314
+ [t]: {
315
+ value: { end: c?.current?.value ?? null, start: h.target.value }
316
+ }
317
+ }
318
+ });
319
+ }, []), m = x((h) => {
320
+ d({
321
+ type: j.update,
322
+ toUpdate: {
323
+ [t]: {
324
+ value: {
325
+ start: i?.current?.value ?? null,
326
+ end: h.target.value
327
+ }
328
+ }
329
+ }
330
+ });
331
+ }, []);
332
+ return /* @__PURE__ */ g("div", { className: "range-widget-container", children: [
333
+ /* @__PURE__ */ e("p", { className: "text-input-label input-widget-label input-label-normal", children: r }),
334
+ /* @__PURE__ */ g("div", { className: "range-widget-row", children: [
335
+ /* @__PURE__ */ e(
336
+ Y,
337
+ {
338
+ value: a[t]?.value?.start ?? "",
339
+ placeholder: l("_accessibility:components.table.filters.range.start"),
340
+ type: n,
341
+ ref: i,
342
+ onChange: o,
343
+ containerClassName: "input-widget-container",
344
+ helperTextClassName: ""
345
+ }
346
+ ),
347
+ /* @__PURE__ */ e(
348
+ Y,
349
+ {
350
+ value: a[t]?.value?.end ?? "",
351
+ placeholder: l("_accessibility:components.table.filters.range.end"),
352
+ type: n,
353
+ ref: c,
354
+ onChange: m,
355
+ containerClassName: "input-widget-container",
356
+ helperTextClassName: ""
357
+ }
358
+ )
359
+ ] })
360
+ ] });
361
+ }, $e = (s) => {
362
+ switch (s.type) {
363
+ case W.text:
364
+ return /* @__PURE__ */ e(ke, { ...s });
365
+ case W.number:
366
+ return /* @__PURE__ */ e(
367
+ ne,
368
+ {
369
+ ...s,
370
+ inputType: "number"
371
+ }
372
+ );
373
+ case W.date:
374
+ return /* @__PURE__ */ e(
375
+ ne,
376
+ {
377
+ ...s,
378
+ inputType: "date"
379
+ }
380
+ );
381
+ case W.select:
382
+ return /* @__PURE__ */ e(Fe, { ...s });
383
+ case W.autocomplete:
384
+ return /* @__PURE__ */ e(Ae, { ...s });
385
+ case W.check:
386
+ return /* @__PURE__ */ e(Ee, { ...s });
387
+ }
388
+ return /* @__PURE__ */ e(X, {});
389
+ }, _e = (s) => {
390
+ const { filters: t = [], show: r, handleShow: n } = s, { onFilterApply: l } = z(), { currentFilters: a, setCurrentFilters: d } = H(), { t: i } = $(), c = V(null);
391
+ return I(() => {
392
+ const o = ({ target: h }) => {
393
+ c.current && (h?.closest(".filter-dropdown-trigger") || !r || c.current.contains(h) || n(!1));
394
+ }, m = ({ code: h }) => {
395
+ !r || h !== "Escape" || n(!1);
396
+ };
397
+ return document.addEventListener("click", o), document.addEventListener("keydown", m), () => {
398
+ document.removeEventListener("click", o), document.removeEventListener("keydown", m);
399
+ };
400
+ }, [n, r]), /* @__PURE__ */ e("div", { className: `filter-dropdown-backdrop ${r ? "opened" : "closed"}`, children: /* @__PURE__ */ g("div", { className: "filter-popup", ref: c, children: [
401
+ /* @__PURE__ */ e("div", { className: "filter-title", children: i("_accessibility:buttons.filters") }),
402
+ /* @__PURE__ */ e("ul", { className: "filter-container", children: t.map((o) => /* @__PURE__ */ e("li", { className: "filter-container-item", children: $e(o) }, o.propertyName)) }),
403
+ /* @__PURE__ */ e("div", { className: "filter-footer", children: /* @__PURE__ */ g("ul", { className: "filter-buttons-row", children: [
404
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
405
+ Z,
406
+ {
407
+ type: "button",
408
+ variant: "submit",
409
+ onClick: () => d({
410
+ type: j.reset,
411
+ filters: t
412
+ }),
413
+ className: "filter-dropdown-button filter-dropdown-cancel",
414
+ children: i("_accessibility:buttons.clear")
415
+ }
416
+ ) }),
417
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
418
+ Z,
419
+ {
420
+ type: "button",
421
+ variant: "submit",
422
+ color: "primary",
423
+ className: "filter-dropdown-button filter-dropdown-submit",
424
+ onClick: () => {
425
+ n(!1), l(a);
426
+ },
427
+ children: i("_accessibility:buttons.applyFilters")
428
+ }
429
+ ) })
430
+ ] }) })
431
+ ] }) });
432
+ }, Oe = () => {
433
+ const { t: s } = $(), { total: t, pageSize: r, pageSizes: n, currentPage: l } = z(), a = (l + 1) * r > t ? t : (l + 1) * r;
434
+ return /* @__PURE__ */ g("div", { className: "table-navigation-sizes", children: [
435
+ n[0] < t && /* @__PURE__ */ e(X, { children: /* @__PURE__ */ g("p", { children: [
436
+ l * r + 1,
437
+ " - ",
438
+ a,
439
+ " ",
440
+ s("_accessibility:components.table.of")
441
+ ] }) }),
442
+ /* @__PURE__ */ e("p", { children: t })
443
+ ] });
444
+ };
445
+ function Pe() {
446
+ const { t: s } = $(), { total: t, pageSize: r, currentPage: n, setCurrentPage: l } = z(), a = w(() => {
447
+ const d = Math.ceil(t / r);
448
+ return Array.from({ length: d }, (i, c) => ({
449
+ id: c,
450
+ value: c + 1
451
+ }));
452
+ }, [t, r]);
453
+ return /* @__PURE__ */ g("div", { className: "jump-to-page", children: [
454
+ /* @__PURE__ */ e("p", { children: s("_accessibility:components.table.jumpToPage") }),
455
+ /* @__PURE__ */ e(
456
+ ee,
457
+ {
458
+ value: n,
459
+ options: a,
460
+ inputClassName: "jump-to-page-input",
461
+ containerClassName: "jump-to-page-input-container",
462
+ helperTextClassName: "hidden",
463
+ onChange: (d) => l(Number(d.target.value))
464
+ }
465
+ )
466
+ ] });
467
+ }
468
+ const Me = () => {
469
+ const { t: s } = $(), { total: t, pageSize: r, currentPage: n, setCurrentPage: l } = z(), a = Math.ceil(t / r), d = n < a - 1;
470
+ return /* @__PURE__ */ g("div", { className: "table-navigation-pages", children: [
471
+ /* @__PURE__ */ e(
472
+ q,
473
+ {
474
+ icon: /* @__PURE__ */ e(pe, { className: "table-navigation-icon" }),
475
+ className: "table-navigation-buttons",
476
+ disabled: n === 0,
477
+ "aria-label": s("_accessibility:buttons.previous"),
478
+ name: s("_accessibility:buttons.previous"),
479
+ onClick: () => l(n - 1)
480
+ }
481
+ ),
482
+ /* @__PURE__ */ e(
483
+ q,
484
+ {
485
+ icon: /* @__PURE__ */ e(me, { className: "table-navigation-icon" }),
486
+ disabled: !d,
487
+ className: "table-navigation-buttons",
488
+ name: s("_accessibility:buttons.next"),
489
+ "aria-label": s("_accessibility:buttons.next"),
490
+ onClick: () => {
491
+ d && l(n + 1);
492
+ }
493
+ }
494
+ )
495
+ ] });
496
+ };
497
+ function Ie() {
498
+ const { t: s } = $(), { pageSizes: t, pageSize: r, setPageSize: n } = z(), l = w(
499
+ () => t?.map((a) => ({ id: a, value: a })),
500
+ [t]
501
+ );
502
+ return /* @__PURE__ */ g("div", { className: "page-size", children: [
503
+ /* @__PURE__ */ e("p", { children: s("_accessibility:components.table.pageSizes") }),
504
+ /* @__PURE__ */ e(
505
+ ee,
506
+ {
507
+ value: r,
508
+ options: l,
509
+ inputClassName: "page-size-input",
510
+ containerClassName: "page-size-input-container",
511
+ helperTextClassName: "hidden",
512
+ onChange: (a) => n(Number(a.target.value))
513
+ }
514
+ )
515
+ ] });
516
+ }
517
+ function De() {
518
+ return /* @__PURE__ */ g("div", { className: "table-footer", children: [
519
+ /* @__PURE__ */ e(Pe, {}),
520
+ /* @__PURE__ */ e(Ie, {}),
521
+ /* @__PURE__ */ e(Oe, {}),
522
+ /* @__PURE__ */ e(Me, {})
523
+ ] });
524
+ }
525
+ const ze = (s) => s, Le = (s) => {
526
+ const { t } = $(), {
527
+ columns: r,
528
+ softDeleteProperty: n = "deletedAt",
529
+ data: l,
530
+ actions: a,
531
+ selectedRows: d,
532
+ expandedRows: i = [],
533
+ onRowSelectionChange: c,
534
+ onRowExpand: o
535
+ } = s, m = w(
536
+ () => re(r),
537
+ [r]
538
+ ), h = w(
539
+ () => new Map(
540
+ i.map((f) => [f.rowId, f])
541
+ ),
542
+ [i]
543
+ );
544
+ return l?.map((f) => {
545
+ const u = d.has(f.id), S = h.get(f.id), T = !!S, U = m.length + 1 + (a ? 1 : 0);
546
+ return /* @__PURE__ */ g(oe, { children: [
547
+ /* @__PURE__ */ g(
548
+ "tr",
549
+ {
550
+ className: `table-row ${o ? "expandable" : ""} ${f[n] ? "deleted-class" : ""} ${u ? "selected" : ""} ${T ? "expanded" : ""}`,
551
+ onClick: () => o?.(f),
552
+ children: [
553
+ /* @__PURE__ */ e("td", { className: "table-row-cell table-row-checkbox", children: /* @__PURE__ */ e(
554
+ "input",
555
+ {
556
+ type: "checkbox",
557
+ checked: u,
558
+ onClick: (v) => v.stopPropagation(),
559
+ onChange: () => c(f),
560
+ "aria-label": t("_accessibility:components.table.selectRow")
561
+ }
562
+ ) }),
563
+ a ? /* @__PURE__ */ e("td", { className: "w-px", children: /* @__PURE__ */ e("div", { className: "table-row-cell-action", children: (() => {
564
+ const v = a(f).filter(
565
+ (N) => !N.hidden
566
+ ), P = v.filter(
567
+ (N) => N.sticky
568
+ ), A = v.filter(
569
+ (N) => !N.sticky
570
+ );
571
+ return /* @__PURE__ */ g(X, { children: [
572
+ P.map((N) => /* @__PURE__ */ e(le, { content: N.tooltip, children: /* @__PURE__ */ e(
573
+ q,
574
+ {
575
+ icon: N.icon,
576
+ className: "row-table-action",
577
+ onClick: (_) => {
578
+ _.stopPropagation(), N.onClick(f);
579
+ }
580
+ }
581
+ ) }, N.id)),
582
+ A.length > 0 && /* @__PURE__ */ e(ve, { actions: A })
583
+ ] });
584
+ })() }) }) : null,
585
+ m?.map((v, P) => {
586
+ const A = f[v.key], N = v.renderBody ? v.renderBody(A, f) : ze(A);
587
+ return /* @__PURE__ */ e(
588
+ "td",
589
+ {
590
+ className: `table-row-cell ${P === 0 ? "basic" : ""} ${v.className ?? ""}`,
591
+ children: o && P === 0 ? /* @__PURE__ */ g("div", { className: "table-row-expand-content", children: [
592
+ /* @__PURE__ */ e(
593
+ "span",
594
+ {
595
+ className: "table-row-expand-indicator",
596
+ "aria-hidden": !0,
597
+ "data-state": T ? "expanded" : "collapsed",
598
+ children: T ? /* @__PURE__ */ e(se, { className: "table-row-expand-chevron" }) : /* @__PURE__ */ e(ae, { className: "table-row-expand-chevron" })
599
+ }
600
+ ),
601
+ /* @__PURE__ */ e("div", { className: "table-row-expand-value", children: N })
602
+ ] }) : N
603
+ },
604
+ v.key
605
+ );
606
+ })
607
+ ]
608
+ }
609
+ ),
610
+ T && S?.content !== null && typeof S?.content < "u" && /* @__PURE__ */ e("tr", { className: "table-row-expanded", children: /* @__PURE__ */ e("td", { className: "table-row-expanded-cell", colSpan: U, children: /* @__PURE__ */ e(
611
+ "div",
612
+ {
613
+ className: `table-row-expanded-content ${S.isVisible ? "open" : "closed"}`,
614
+ children: /* @__PURE__ */ e("div", { className: "table-row-expanded-inner", children: S.content })
615
+ }
616
+ ) }) })
617
+ ] }, f.id);
618
+ });
619
+ };
620
+ function Ve() {
621
+ const { t: s } = $();
622
+ return /* @__PURE__ */ e("div", { className: "table-empty", children: /* @__PURE__ */ e("p", { children: s("_accessibility:components.table.empty") }) });
623
+ }
624
+ const je = (s) => {
625
+ const { columns: t, title: r, isLoading: n, toolbar: l, filterOptions: a } = s, { countOfFilters: d } = z(), { t: i } = $(), c = w(() => t ? [...t].sort((u, S) => (S.pos ?? 0) - (u.pos ?? 0)).filter((u) => !!u.filterOptions).map((u) => ({
626
+ ...u.filterOptions,
627
+ label: u.filterOptions?.label ?? u.label,
628
+ propertyName: u.key
629
+ })) : [], [t]), [o, m] = O(!1), h = x(
630
+ (u) => {
631
+ a?.dropdown?.setOpened ? a.dropdown.setOpened(u ?? !1) : m(u ?? !1);
632
+ },
633
+ [a]
634
+ ), f = w(
635
+ () => a?.dropdown?.opened ?? o,
636
+ [a, o]
637
+ );
638
+ return /* @__PURE__ */ g("div", { className: `table-header ${f ? "showing-filters" : ""}`, children: [
639
+ /* @__PURE__ */ g("div", { children: [
640
+ r && /* @__PURE__ */ e("h1", { className: "table-header-title", children: r }),
641
+ n ? null : /* @__PURE__ */ g("div", { className: "table-header-content", children: [
642
+ l,
643
+ a?.button?.hide !== !0 && /* @__PURE__ */ g(
644
+ q,
645
+ {
646
+ icon: a?.button?.icon ?? /* @__PURE__ */ e(he, { className: "filter-dropdown-trigger-icon" }),
647
+ className: "filter-dropdown-button normal filter-dropdown-trigger",
648
+ "aria-haspopup": "true",
649
+ onClick: () => h(!f),
650
+ "aria-expanded": f,
651
+ children: [
652
+ /* @__PURE__ */ e(
653
+ de,
654
+ {
655
+ count: d,
656
+ className: `${d > 0 ? "show" : "hide"} `
657
+ }
658
+ ),
659
+ /* @__PURE__ */ e("span", { className: "table-header-sr", children: i("_accessibility:buttons.filters") }),
660
+ /* @__PURE__ */ e("wbr", {})
661
+ ]
662
+ }
663
+ )
664
+ ] })
665
+ ] }),
666
+ !!c && !!c.length && /* @__PURE__ */ e(
667
+ _e,
668
+ {
669
+ filters: c,
670
+ show: f,
671
+ handleShow: h,
672
+ options: a
673
+ }
674
+ ),
675
+ /* @__PURE__ */ e(Te, { filtersDefinition: c })
676
+ ] });
677
+ };
678
+ function Ue({
679
+ count: s,
680
+ multiActions: t,
681
+ onActionClick: r
682
+ }) {
683
+ const { t: n } = $();
684
+ return /* @__PURE__ */ g("div", { className: "table-selection-bar", children: [
685
+ /* @__PURE__ */ e("p", { className: "table-selection-bar-count", children: n("_accessibility:components.table.selectedCount", { count: s }) }),
686
+ t.length > 0 && /* @__PURE__ */ e("div", { className: "table-selection-bar-actions", children: t.map((l) => /* @__PURE__ */ e(le, { content: l.tooltip, children: /* @__PURE__ */ e(
687
+ q,
688
+ {
689
+ icon: l.icon,
690
+ className: "multi-table-action",
691
+ onClick: () => r(l),
692
+ disabled: l.disabled
693
+ }
694
+ ) }, l.id)) })
695
+ ] });
696
+ }
697
+ const Q = 220;
698
+ function Be({
699
+ data: s,
700
+ allowMultipleExpandedRows: t,
701
+ controlledExpandedRowId: r,
702
+ onExpandedRowChange: n,
703
+ onRowExpand: l,
704
+ findRowById: a
705
+ }) {
706
+ const [d, i] = O(null), [c, o] = O(null), [m, h] = O(null), [f, u] = O(null), [S, T] = O(!1), [U, v] = O(/* @__PURE__ */ new Set()), [P, A] = O([]), N = V(null), _ = V(null), D = V(/* @__PURE__ */ new Map()), F = typeof r < "u", k = t && !F, y = F ? r ?? null : d, B = x(() => {
707
+ _.current && (clearTimeout(_.current), _.current = null);
708
+ }, []), E = x(
709
+ (p) => {
710
+ if (typeof p < "u") {
711
+ const b = D.current.get(p);
712
+ if (!b) return;
713
+ clearTimeout(b), D.current.delete(p);
714
+ return;
715
+ }
716
+ D.current.forEach(
717
+ (b) => clearTimeout(b)
718
+ ), D.current.clear();
719
+ },
720
+ []
721
+ ), G = x(
722
+ (p) => {
723
+ E(p), A((b) => b.some(
724
+ (R) => R.rowId === p
725
+ ) ? b.map(
726
+ (R) => R.rowId === p ? { ...R, isVisible: !1 } : R
727
+ ) : b), D.current.set(
728
+ p,
729
+ setTimeout(() => {
730
+ A(
731
+ (b) => b.filter((C) => C.rowId !== p)
732
+ ), D.current.delete(p);
733
+ }, Q)
734
+ );
735
+ },
736
+ [E]
737
+ ), K = x(
738
+ (p, b) => {
739
+ E(p), A((C) => C.some(
740
+ (M) => M.rowId === p
741
+ ) ? C.map(
742
+ (M) => M.rowId === p ? { ...M, content: b, isVisible: !1 } : M
743
+ ) : [...C, { rowId: p, content: b, isVisible: !1 }]), requestAnimationFrame(() => {
744
+ A(
745
+ (C) => C.map(
746
+ (R) => R.rowId === p ? { ...R, isVisible: !0 } : R
747
+ )
748
+ );
749
+ });
750
+ },
751
+ [E]
752
+ );
753
+ I(() => {
754
+ if (!k) return;
755
+ const p = new Set(s.map((b) => b.id));
756
+ v((b) => {
757
+ const C = /* @__PURE__ */ new Set();
758
+ return b.forEach((R) => {
759
+ if (p.has(R)) {
760
+ C.add(R);
761
+ return;
762
+ }
763
+ E(R);
764
+ }), C;
765
+ }), A((b) => (b.forEach((C) => {
766
+ p.has(C.rowId) || E(C.rowId);
767
+ }), b.filter(
768
+ (C) => p.has(C.rowId)
769
+ )));
770
+ }, [s, k, E]), I(() => {
771
+ if (k) return;
772
+ if (y === null) {
773
+ o(null), F && (N.current = null);
774
+ return;
775
+ }
776
+ a(y) || (F || i(null), o(null), F && (N.current = null));
777
+ }, [
778
+ s,
779
+ y,
780
+ a,
781
+ F,
782
+ k
783
+ ]), I(() => {
784
+ if (!k) {
785
+ if (B(), y === null || c === null) {
786
+ if (m === null) {
787
+ T(!1), u(null);
788
+ return;
789
+ }
790
+ T(!1), _.current = setTimeout(() => {
791
+ h(null), u(null), _.current = null;
792
+ }, Q);
793
+ return;
794
+ }
795
+ if (m === null) {
796
+ h(y), u(c), requestAnimationFrame(() => T(!0));
797
+ return;
798
+ }
799
+ if (m === y) {
800
+ u(c), requestAnimationFrame(() => T(!0));
801
+ return;
802
+ }
803
+ T(!1), _.current = setTimeout(() => {
804
+ h(y), u(c), requestAnimationFrame(() => T(!0)), _.current = null;
805
+ }, Q);
806
+ }
807
+ }, [
808
+ B,
809
+ c,
810
+ y,
811
+ k,
812
+ m
813
+ ]), I(
814
+ () => () => {
815
+ B(), E();
816
+ },
817
+ [B, E]
818
+ ), I(() => {
819
+ if (!F) return;
820
+ if (y === null) {
821
+ o(null), N.current = null;
822
+ return;
823
+ }
824
+ const p = a(y);
825
+ if (!p) {
826
+ o(null), N.current = null;
827
+ return;
828
+ }
829
+ const b = N.current;
830
+ o(l?.(p, b) ?? null), N.current = p;
831
+ }, [y, a, F, l]);
832
+ const ie = x(
833
+ (p) => {
834
+ if (k) {
835
+ if (U.has(p.id)) {
836
+ v((J) => {
837
+ const L = new Set(J);
838
+ return L.delete(p.id), L;
839
+ }), G(p.id), n?.(null, p);
840
+ return;
841
+ }
842
+ v((J) => {
843
+ const L = new Set(J);
844
+ return L.add(p.id), L;
845
+ });
846
+ const M = l?.(p, null) ?? null;
847
+ M !== null && typeof M < "u" ? K(p.id, M) : (E(p.id), A(
848
+ (J) => J.filter((L) => L.rowId !== p.id)
849
+ )), n?.(p, null);
850
+ return;
851
+ }
852
+ const b = y === p.id, C = b ? p : a(y);
853
+ if (F) {
854
+ n?.(b ? null : p, C);
855
+ return;
856
+ }
857
+ if (b) {
858
+ i(null), o(null), n?.(null, p);
859
+ return;
860
+ }
861
+ i(p.id), o(l?.(p, C) ?? null), n?.(p, C);
862
+ },
863
+ [
864
+ y,
865
+ G,
866
+ E,
867
+ K,
868
+ a,
869
+ U,
870
+ F,
871
+ k,
872
+ n,
873
+ l
874
+ ]
875
+ );
876
+ return { expandedRowsToRender: w(() => k ? P : m === null || f === null || typeof f > "u" ? [] : [
877
+ {
878
+ rowId: m,
879
+ content: f,
880
+ isVisible: S
881
+ }
882
+ ], [
883
+ S,
884
+ k,
885
+ f,
886
+ m,
887
+ P
888
+ ]), onRowExpandChange: ie };
889
+ }
890
+ function We({
891
+ actions: s,
892
+ selectedRowsData: t
893
+ }) {
894
+ const r = w(() => !s || !t.length ? [] : t.reduce(
895
+ (l, a, d) => {
896
+ const i = s(a).filter(
897
+ (o) => o.multiple && !o.hidden
898
+ );
899
+ if (d === 0) return i;
900
+ const c = new Map(
901
+ l.map((o) => [o.id, o])
902
+ );
903
+ return i.reduce((o, m) => {
904
+ const h = c.get(m.id);
905
+ return h && o.push({
906
+ ...h,
907
+ ...m,
908
+ disabled: m.disabled || h.disabled
909
+ }), o;
910
+ }, []);
911
+ },
912
+ []
913
+ ), [s, t]), n = x(
914
+ (l) => {
915
+ if (t.length) {
916
+ if (l.onMultipleClick) {
917
+ l.onMultipleClick(t);
918
+ return;
919
+ }
920
+ t.forEach((a) => l.onClick(a));
921
+ }
922
+ },
923
+ [t]
924
+ );
925
+ return { multiActions: r, handleMultipleActionClick: n };
926
+ }
927
+ function qe({
928
+ data: s,
929
+ onRowSelect: t,
930
+ onSelectedRowsChange: r
931
+ }) {
932
+ const [n, l] = O(/* @__PURE__ */ new Set()), a = w(
933
+ () => s?.filter((o) => n.has(o.id)) ?? [],
934
+ [s, n]
935
+ );
936
+ I(() => {
937
+ if (!s?.length) {
938
+ l(/* @__PURE__ */ new Set());
939
+ return;
940
+ }
941
+ l((o) => {
942
+ const m = /* @__PURE__ */ new Set(), h = new Set(s.map((f) => f.id));
943
+ return o.forEach((f) => {
944
+ h.has(f) && m.add(f);
945
+ }), m;
946
+ });
947
+ }, [s]), I(() => {
948
+ r && r(a);
949
+ }, [a, r]);
950
+ const d = x(
951
+ (o) => {
952
+ l((m) => {
953
+ const h = new Set(m);
954
+ return h.has(o.id) ? (h.delete(o.id), t?.(o, !1)) : (h.add(o.id), t?.(o, !0)), h;
955
+ });
956
+ },
957
+ [t]
958
+ ), i = x(() => {
959
+ l((o) => {
960
+ const m = new Set(o), h = s ?? [], f = h.every(
961
+ (u) => m.has(u.id)
962
+ );
963
+ return h.forEach((u) => {
964
+ const S = m.has(u.id);
965
+ f ? S && (m.delete(u.id), t?.(u, !1)) : S || (m.add(u.id), t?.(u, !0));
966
+ }), m;
967
+ });
968
+ }, [s, t]), c = w(() => {
969
+ if (!s?.length)
970
+ return { allSelected: !1, hasSomeSelected: !1 };
971
+ const o = s.every((h) => n.has(h.id)), m = s.some((h) => n.has(h.id));
972
+ return { allSelected: o, hasSomeSelected: m };
973
+ }, [s, n]);
974
+ return {
975
+ selectedRows: n,
976
+ selectedRowsData: a,
977
+ selectionState: c,
978
+ onRowSelectionChange: d,
979
+ onToggleAllRows: i
980
+ };
981
+ }
982
+ function dt(s) {
983
+ const {
984
+ data: t,
985
+ onSort: r,
986
+ entity: n = "",
987
+ isLoading: l = !1,
988
+ actions: a,
989
+ columns: d = [],
990
+ contentClassName: i = "",
991
+ className: c = "",
992
+ softDeleteProperty: o = "deletedAt",
993
+ onRowSelect: m,
994
+ onSelectedRowsChange: h,
995
+ allowMultipleExpandedRows: f = !1,
996
+ expandedRowId: u,
997
+ onExpandedRowChange: S,
998
+ onRowExpand: T,
999
+ ...U
1000
+ } = s, v = w(() => !t?.length, [t]), P = x(
1001
+ (G) => G === null ? null : t.find((K) => K.id === G) ?? null,
1002
+ [t]
1003
+ ), {
1004
+ selectedRows: A,
1005
+ selectedRowsData: N,
1006
+ selectionState: _,
1007
+ onRowSelectionChange: D,
1008
+ onToggleAllRows: F
1009
+ } = qe({ data: t, onRowSelect: m, onSelectedRowsChange: h }), { expandedRowsToRender: k, onRowExpandChange: y } = Be({
1010
+ data: t,
1011
+ allowMultipleExpandedRows: f,
1012
+ controlledExpandedRowId: u,
1013
+ onExpandedRowChange: S,
1014
+ onRowExpand: T,
1015
+ findRowById: P
1016
+ }), { multiActions: B, handleMultipleActionClick: E } = We({
1017
+ actions: a,
1018
+ selectedRowsData: N
1019
+ });
1020
+ return /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ g("div", { className: `${c} table-main`, children: [
1021
+ /* @__PURE__ */ e(je, { columns: d, isLoading: l, ...U }),
1022
+ l ? /* @__PURE__ */ e(Ce, { className: "table-loading" }) : /* @__PURE__ */ e(X, { children: v ? /* @__PURE__ */ e(Ve, {}) : /* @__PURE__ */ g(X, { children: [
1023
+ !!N.length && /* @__PURE__ */ e(
1024
+ Ue,
1025
+ {
1026
+ count: N.length,
1027
+ multiActions: B,
1028
+ onActionClick: E
1029
+ }
1030
+ ),
1031
+ /* @__PURE__ */ e("div", { className: `${i} table-body`, children: /* @__PURE__ */ g("table", { className: "table-content", children: [
1032
+ /* @__PURE__ */ e(
1033
+ ye,
1034
+ {
1035
+ entity: n,
1036
+ columns: d,
1037
+ onSortCallback: r,
1038
+ hasAction: !!a,
1039
+ selectionState: _,
1040
+ onToggleAllRows: F
1041
+ }
1042
+ ),
1043
+ /* @__PURE__ */ e("tbody", { children: /* @__PURE__ */ e(
1044
+ Le,
1045
+ {
1046
+ data: t,
1047
+ actions: a,
1048
+ columns: d,
1049
+ softDeleteProperty: o,
1050
+ selectedRows: A,
1051
+ expandedRows: k,
1052
+ onRowSelectionChange: D,
1053
+ onRowExpand: T ? y : void 0
1054
+ }
1055
+ ) })
1056
+ ] }) }),
1057
+ /* @__PURE__ */ e(De, {})
1058
+ ] }) })
1059
+ ] }) });
1060
+ }
1061
+ export {
1062
+ Te as A,
1063
+ ye as C,
1064
+ _e as F,
1065
+ Me as N,
1066
+ Ie as P,
1067
+ Re as R,
1068
+ Ve as T,
1069
+ Se as a,
1070
+ Oe as b,
1071
+ De as c,
1072
+ Le as d,
1073
+ je as e,
1074
+ Ue as f,
1075
+ dt as g,
1076
+ we as h,
1077
+ xe as i,
1078
+ ve as j,
1079
+ $e as r
1080
+ };