@sito/dashboard 0.0.65 → 0.0.66

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 (100) hide show
  1. package/dist/Badge-CIeYthEy.js +9 -0
  2. package/dist/Badge-Z78MlGoQ.cjs +1 -0
  3. package/dist/Badge.cjs +1 -0
  4. package/dist/Badge.css +1 -0
  5. package/dist/Badge.d.ts +2 -0
  6. package/dist/Badge.js +4 -0
  7. package/dist/Button-BlYa3uPc.cjs +1 -0
  8. package/dist/Button-D73-swfo.js +24 -0
  9. package/dist/Button.cjs +1 -0
  10. package/dist/Button.css +1 -0
  11. package/dist/Button.d.ts +2 -0
  12. package/dist/Button.js +4 -0
  13. package/dist/Chip-JDQqzO9I.js +37 -0
  14. package/dist/Chip-a2z-338_.cjs +1 -0
  15. package/dist/Chip.cjs +1 -0
  16. package/dist/Chip.css +1 -0
  17. package/dist/Chip.d.ts +2 -0
  18. package/dist/Chip.js +4 -0
  19. package/dist/Close-O9P7wJGf.cjs +1 -0
  20. package/dist/Close-rKC9AcNX.js +17 -0
  21. package/dist/Dropdown-CAxauIXt.cjs +1 -0
  22. package/dist/Dropdown-CbaxuMbk.js +63 -0
  23. package/dist/Dropdown.cjs +1 -0
  24. package/dist/Dropdown.css +1 -0
  25. package/dist/Dropdown.d.ts +2 -0
  26. package/dist/Dropdown.js +4 -0
  27. package/dist/File-BuJndWMv.js +17 -0
  28. package/dist/File-_Hjw2d3F.cjs +1 -0
  29. package/dist/FileInput-5tMOO7mb.cjs +1 -0
  30. package/dist/FileInput-B--eBQVa.js +91 -0
  31. package/dist/FileInput.css +1 -0
  32. package/dist/Filters-BivtNVS3.js +64 -0
  33. package/dist/Filters-C5XEbF3V.cjs +1 -0
  34. package/dist/FiltersProvider-CY2fsw_F.js +57 -0
  35. package/dist/FiltersProvider-CYqLFEI9.cjs +1 -0
  36. package/dist/FiltersProvider.cjs +1 -0
  37. package/dist/FiltersProvider.d.ts +2 -0
  38. package/dist/FiltersProvider.js +8 -0
  39. package/dist/Form.cjs +1 -0
  40. package/dist/Form.d.ts +2 -0
  41. package/dist/Form.js +13 -0
  42. package/dist/IconButton-BpsTEj0z.js +29 -0
  43. package/dist/IconButton-CVnmT2E9.cjs +1 -0
  44. package/dist/IconButton.cjs +1 -0
  45. package/dist/IconButton.css +1 -0
  46. package/dist/IconButton.d.ts +2 -0
  47. package/dist/IconButton.js +4 -0
  48. package/dist/Loading-B_c_4XLr.js +26 -0
  49. package/dist/Loading-CNECRan-.cjs +1 -0
  50. package/dist/Loading.cjs +1 -0
  51. package/dist/Loading.css +1 -0
  52. package/dist/Loading.d.ts +2 -0
  53. package/dist/Loading.js +4 -0
  54. package/dist/SvgIcons.cjs +1 -0
  55. package/dist/SvgIcons.d.ts +2 -0
  56. package/dist/SvgIcons.js +12 -0
  57. package/dist/Table-CH9HYQ2I.js +946 -0
  58. package/dist/Table-CWss4TW5.cjs +1 -0
  59. package/dist/Table.cjs +1 -0
  60. package/dist/Table.css +1 -0
  61. package/dist/Table.d.ts +2 -0
  62. package/dist/Table.js +18 -0
  63. package/dist/TableOptions.cjs +1 -0
  64. package/dist/TableOptions.d.ts +2 -0
  65. package/dist/TableOptions.js +5 -0
  66. package/dist/TableOptionsProvider-BchUDA3B.cjs +1 -0
  67. package/dist/TableOptionsProvider-BfQS8l1N.js +50 -0
  68. package/dist/TextInput-BLfTozZ9.js +320 -0
  69. package/dist/TextInput-Bn8zsDnU.cjs +1 -0
  70. package/dist/TextInput.css +1 -0
  71. package/dist/Tooltip-B4E-FRwY.js +37 -0
  72. package/dist/Tooltip-BSKAgRkc.cjs +1 -0
  73. package/dist/Tooltip.cjs +1 -0
  74. package/dist/Tooltip.css +1 -0
  75. package/dist/Tooltip.d.ts +2 -0
  76. package/dist/Tooltip.js +4 -0
  77. package/dist/Translation.cjs +1 -0
  78. package/dist/Translation.d.ts +2 -0
  79. package/dist/Translation.js +5 -0
  80. package/dist/TranslationProvider-51Pc9Xrr.cjs +1 -0
  81. package/dist/TranslationProvider-COebIyxr.js +19 -0
  82. package/dist/components/Button/Button.stories.d.ts +1 -0
  83. package/dist/components/Dropdown/Dropdown.d.ts +1 -1
  84. package/dist/components/Dropdown/Dropdown.stories.d.ts +1 -0
  85. package/dist/components/Dropdown/types.d.ts +1 -0
  86. package/dist/components/Form/FileInput/FileInput.test.d.ts +1 -0
  87. package/dist/components/Form/TextInput/TextInput.test.d.ts +1 -0
  88. package/dist/components/IconButton/IconButton.stories.d.ts +1 -0
  89. package/dist/index.cjs +1 -0
  90. package/dist/index.css +1 -0
  91. package/dist/index.js +70 -0
  92. package/dist/lib.cjs +1 -0
  93. package/dist/lib.d.ts +2 -0
  94. package/dist/lib.js +6 -0
  95. package/dist/query-81BrXp3i.cjs +1 -0
  96. package/dist/query-CwuehjY1.js +4 -0
  97. package/package.json +80 -9
  98. package/dist/dashboard.cjs +0 -1
  99. package/dist/dashboard.js +0 -1661
  100. package/dist/main.css +0 -1
package/dist/dashboard.js DELETED
@@ -1,1661 +0,0 @@
1
- import "./main.css";
2
- import { jsx as t, jsxs as g, Fragment as ee } from "react/jsx-runtime";
3
- import { useRef as B, useCallback as C, useEffect as I, forwardRef as te, useState as T, useMemo as A, useLayoutEffect as ve, useReducer as we, createContext as re, useContext as ae, Fragment as xe, useId as ye, isValidElement as Se, cloneElement as $e } from "react";
4
- const Ee = (e) => {
5
- const { count: l, className: r = "" } = e;
6
- return /* @__PURE__ */ t("span", { className: `${r} badge-main`, children: l });
7
- }, Re = (e) => {
8
- const {
9
- children: l,
10
- type: r = "button",
11
- variant: n = "text",
12
- color: s = "default",
13
- className: a = "",
14
- ...u
15
- } = e;
16
- return /* @__PURE__ */ t(
17
- "button",
18
- {
19
- type: r,
20
- className: `button ${n} ${s} ${a}`,
21
- ...u,
22
- children: l
23
- }
24
- );
25
- };
26
- function G(e) {
27
- const {
28
- text: l,
29
- onDelete: r,
30
- children: n,
31
- icon: s,
32
- variant: a = "default",
33
- iconClassName: u = "",
34
- className: o = "",
35
- textClassName: c = ""
36
- } = e;
37
- return /* @__PURE__ */ g(
38
- "div",
39
- {
40
- className: `chip-main ${a} ${r ? "deletable" : ""} ${o}`,
41
- children: [
42
- /* @__PURE__ */ t("span", { className: c, children: l }),
43
- n,
44
- r ? /* @__PURE__ */ t(
45
- q,
46
- {
47
- icon: s ?? /* @__PURE__ */ t(ce, {}),
48
- className: `chip-delete-button ${u}`,
49
- onClick: r
50
- }
51
- ) : null
52
- ]
53
- }
54
- );
55
- }
56
- const pt = (e) => {
57
- const { children: l, open: r, onClose: n } = e, s = B(null), a = C(
58
- (o) => {
59
- const c = s.current;
60
- !r || !c || c.contains(o.target) || n();
61
- },
62
- [r, n]
63
- ), u = C(
64
- (o) => {
65
- r && o.key === "Escape" && n();
66
- },
67
- [r, n]
68
- );
69
- return I(() => {
70
- if (r)
71
- return setTimeout(() => s.current?.focus(), 0), document.addEventListener("mousedown", a), document.addEventListener("keydown", u), () => {
72
- document.removeEventListener("mousedown", a), document.removeEventListener("keydown", u);
73
- };
74
- }, [r, a, u]), /* @__PURE__ */ t(
75
- "div",
76
- {
77
- ref: s,
78
- role: "menu",
79
- "aria-hidden": !r,
80
- tabIndex: -1,
81
- className: `dropdown-main ${r ? "opened" : "closed"}`,
82
- onClick: (o) => o.stopPropagation(),
83
- children: l
84
- }
85
- );
86
- }, ke = te(function(e, l) {
87
- const {
88
- state: r,
89
- value: n,
90
- onChange: s,
91
- options: a = [],
92
- name: u = "",
93
- id: o = "",
94
- label: c = "",
95
- containerClassName: d = "",
96
- inputContainerClassName: p = "",
97
- helperText: h = "",
98
- placeholder: m = "",
99
- multiple: i = !1,
100
- ...v
101
- } = e, [S, $] = T("");
102
- I(() => {
103
- if (!i && n && !Array.isArray(n)) {
104
- $(String(n.value ?? n.name ?? ""));
105
- return;
106
- }
107
- $("");
108
- }, [i, n]);
109
- const [w, L] = T(!1), E = A(
110
- () => a.filter((b) => {
111
- const M = String(b.value ?? b.name).toLowerCase().includes(S?.toLowerCase());
112
- return Array.isArray(n) && n.length ? M && !n.some((W) => W.id === b.id) : n && !Array.isArray(n) ? M && n.id !== b.id : M;
113
- }),
114
- [a, n, S]
115
- ), N = B(null), y = B(null), [P, R] = T(!1), O = B(null);
116
- I(() => {
117
- const b = (W) => {
118
- N.current && !N.current.contains(W.target) && L(!1);
119
- }, M = (W) => {
120
- W.key === "Escape" && L(!1);
121
- };
122
- return document.addEventListener("mousedown", b), document.addEventListener("keydown", M), () => {
123
- document.removeEventListener("mousedown", b), document.removeEventListener("keydown", M);
124
- };
125
- }, []);
126
- const F = C((b) => {
127
- $(b.target.value);
128
- }, []), j = C(
129
- (b) => {
130
- b ? i ? ($(""), Array.isArray(n) && n.length ? s([...n, b]) : s([b])) : ($(String(b.name ?? b.value ?? "")), s(b)) : s(null), L(!1);
131
- },
132
- [i, s, n]
133
- ), z = C(
134
- (b) => {
135
- if (!Array.isArray(n)) {
136
- s(null);
137
- return;
138
- }
139
- const M = n.filter((W, f) => f !== b);
140
- M.length ? s(M) : s(null);
141
- },
142
- [s, n]
143
- ), J = C(() => {
144
- Array.isArray(n) && s([n[0]]);
145
- }, [s, n]);
146
- return ve(() => {
147
- const b = O.current?.offsetWidth ?? 0, M = N.current?.offsetWidth ?? 0;
148
- R(b > M * 0.4);
149
- }, [n]), /* @__PURE__ */ g(
150
- "div",
151
- {
152
- className: `autocomplete-input-container ${d}`,
153
- ref: N,
154
- children: [
155
- /* @__PURE__ */ g("div", { className: "autocomplete-value-input-container", children: [
156
- /* @__PURE__ */ t(
157
- ne,
158
- {
159
- state: r,
160
- name: u,
161
- id: o,
162
- value: S,
163
- onChange: F,
164
- placeholder: m,
165
- helperText: h,
166
- onFocus: () => L(!0),
167
- label: c,
168
- containerClassName: `autocomplete-text-input ${p}`,
169
- ref: l ?? y,
170
- ...v,
171
- children: !i && n && !Array.isArray(n) && (n.value || n.name) && /* @__PURE__ */ t(
172
- q,
173
- {
174
- icon: /* @__PURE__ */ t(ce, {}),
175
- className: "autocomplete-delete-button",
176
- onClick: (b) => {
177
- j(), b.stopPropagation();
178
- }
179
- }
180
- )
181
- }
182
- ),
183
- i && Array.isArray(n) && n.length ? /* @__PURE__ */ t("ul", { ref: O, className: "autocomplete-value-container", children: P ? /* @__PURE__ */ g(ee, { children: [
184
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
185
- G,
186
- {
187
- text: n[0]?.value ?? n[0]?.name,
188
- onDelete: (b) => {
189
- z(0), b.stopPropagation();
190
- }
191
- }
192
- ) }),
193
- n.length > 1 && /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
194
- G,
195
- {
196
- text: `+${n.length - 1}`,
197
- onDelete: (b) => {
198
- J(), b.stopPropagation();
199
- }
200
- }
201
- ) })
202
- ] }) : n.map((b, M) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
203
- G,
204
- {
205
- text: String(b.value ?? b.name),
206
- onDelete: (W) => {
207
- z(M), W.stopPropagation();
208
- }
209
- }
210
- ) }, b.id ?? b.value ?? b.name)) }) : null
211
- ] }),
212
- w && /* @__PURE__ */ t(
213
- "ul",
214
- {
215
- className: "autocomplete-suggestions-container",
216
- style: { width: N.current?.offsetWidth },
217
- children: E.map((b) => /* @__PURE__ */ t(
218
- "li",
219
- {
220
- className: "autocomplete-suggestion-item",
221
- onClick: (M) => {
222
- j(b), M.stopPropagation();
223
- },
224
- children: b.value ?? b.name
225
- },
226
- b.id ?? b.value ?? b.name
227
- ))
228
- }
229
- )
230
- ]
231
- }
232
- );
233
- }), Ae = te(function(e, l) {
234
- const {
235
- checked: r,
236
- onChange: n,
237
- name: s = "",
238
- id: a = "",
239
- label: u = "",
240
- containerClassName: o = "",
241
- inputClassName: c = "",
242
- labelClassName: d = "",
243
- ...p
244
- } = e;
245
- return /* @__PURE__ */ g("label", { className: `input-check-container ${o}`, children: [
246
- /* @__PURE__ */ t(
247
- "input",
248
- {
249
- id: a,
250
- ref: l,
251
- name: s,
252
- type: "checkbox",
253
- checked: r,
254
- onChange: n,
255
- className: `input-check ${c}`,
256
- ...p
257
- }
258
- ),
259
- /* @__PURE__ */ t("span", { className: `input-check-label ${d}`, children: u })
260
- ] });
261
- });
262
- function de(e, l = 25) {
263
- if (e.length <= l) return e;
264
- const r = e.lastIndexOf(".");
265
- if (r === -1)
266
- return e.slice(0, l - 3) + "...";
267
- const n = e.slice(0, r), s = e.slice(r), a = l - s.length - 3;
268
- return n.slice(0, a) + "..." + s;
269
- }
270
- const ht = te(function(e, l) {
271
- const {
272
- children: r,
273
- label: n,
274
- containerClassName: s = "",
275
- inputClassName: a = "",
276
- labelClassName: u = "",
277
- helperText: o = "",
278
- helperTextClassName: c = "",
279
- iconClassName: d = "",
280
- multiple: p = !1,
281
- onChange: h,
282
- onClear: m,
283
- ...i
284
- } = e, [v, S] = T([]), $ = C(
285
- (N) => {
286
- if (N.target.files) {
287
- const y = Array.from(N.target.files);
288
- S((P) => [...P, ...y]);
289
- }
290
- h?.(N);
291
- },
292
- [h]
293
- ), w = C(
294
- (N) => {
295
- S((y) => {
296
- const P = y.filter((R, O) => O !== N);
297
- return P.length === 0 && m?.(), P;
298
- });
299
- },
300
- [m]
301
- ), L = C(() => {
302
- S([]), m?.();
303
- }, [m]), E = C(
304
- (N) => {
305
- N.currentTarget.value = "";
306
- },
307
- []
308
- );
309
- return /* @__PURE__ */ g("div", { className: `file-input-container ${s}`, children: [
310
- v.length === 0 && /* @__PURE__ */ g("label", { htmlFor: i.name, className: `${u}`, children: [
311
- n,
312
- /* @__PURE__ */ t(
313
- "input",
314
- {
315
- type: "file",
316
- ref: l,
317
- multiple: p,
318
- onClick: E,
319
- onChange: $,
320
- className: `file-input ${a}`,
321
- ...i
322
- }
323
- ),
324
- i.required ? " *" : ""
325
- ] }),
326
- v.length > 1 && /* @__PURE__ */ t("ul", { className: "file-preview-list", children: v.map((N, y) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(le, { content: N.name, children: /* @__PURE__ */ t(
327
- G,
328
- {
329
- text: de(N.name, 25),
330
- onDelete: () => w(y)
331
- }
332
- ) }) }, `${N.name}-${N.lastModified}`)) }),
333
- v.length === 1 && /* @__PURE__ */ g("div", { className: "file-preview", children: [
334
- /* @__PURE__ */ t(Me, { className: `file-icon ${d}` }),
335
- /* @__PURE__ */ t(le, { content: v[0]?.name ?? "", children: /* @__PURE__ */ t("span", { className: "!cursor-default", children: de(v[0]?.name ?? "", 25) }) }),
336
- /* @__PURE__ */ t(q, { icon: /* @__PURE__ */ t(ce, {}), onClick: L, type: "button" })
337
- ] }),
338
- r,
339
- !!o && /* @__PURE__ */ t("p", { className: `file-input-helper-text ${c}`, children: o })
340
- ] });
341
- });
342
- var oe = /* @__PURE__ */ ((e) => (e.error = "error", e.good = "good", e.default = "default", e))(oe || {});
343
- const he = (e) => {
344
- switch (e) {
345
- case "error":
346
- return "input-error";
347
- case "good":
348
- return "input-good";
349
- default:
350
- return "input-normal";
351
- }
352
- }, me = (e) => {
353
- switch (e) {
354
- case "error":
355
- return "input-label-error";
356
- case "good":
357
- return "input-label-good";
358
- default:
359
- return "input-label-normal";
360
- }
361
- }, fe = (e) => {
362
- switch (e) {
363
- case "error":
364
- return "input-helper-text-error";
365
- case "good":
366
- return "input-helper-text-good";
367
- default:
368
- return "input-helper-text-normal";
369
- }
370
- }, ie = te(function(e, l) {
371
- const {
372
- value: r,
373
- onChange: n,
374
- options: s,
375
- containerClassName: a = "",
376
- inputClassName: u = "",
377
- labelClassName: o = "",
378
- helperText: c = "",
379
- helperTextClassName: d = "",
380
- label: p = "",
381
- name: h = "",
382
- id: m = "",
383
- state: i = oe.default,
384
- children: v,
385
- ...S
386
- } = e;
387
- return /* @__PURE__ */ g("div", { className: `select-input-container ${a}`, children: [
388
- /* @__PURE__ */ t(
389
- "select",
390
- {
391
- ...S,
392
- id: m,
393
- ref: l,
394
- name: h,
395
- value: r,
396
- onChange: n,
397
- className: `select-input ${he(i)} peer ${u}`,
398
- children: s?.map(($) => /* @__PURE__ */ t("option", { value: $.id, children: $.value ?? $.name ?? $.id }, $.id))
399
- }
400
- ),
401
- /* @__PURE__ */ t(
402
- "label",
403
- {
404
- htmlFor: m,
405
- className: `select-input-label ${me(i)} ${o}`,
406
- children: p
407
- }
408
- ),
409
- v,
410
- c && /* @__PURE__ */ t(
411
- "p",
412
- {
413
- className: `select-input-helper-text ${fe(i)} ${d}`,
414
- children: c
415
- }
416
- )
417
- ] });
418
- }), ne = te(function(e, l) {
419
- const {
420
- children: r,
421
- state: n = oe.default,
422
- label: s = "",
423
- containerClassName: a = "",
424
- inputClassName: u = "",
425
- labelClassName: o = "",
426
- helperText: c = "",
427
- helperTextClassName: d = "",
428
- value: p = "",
429
- ...h
430
- } = e;
431
- return /* @__PURE__ */ g("div", { className: `text-input-container ${a}`, children: [
432
- /* @__PURE__ */ t(
433
- "input",
434
- {
435
- ref: l,
436
- value: p,
437
- className: `text-input ${he(n)} peer ${u} ${p ? "has-value" : ""} ${h.placeholder ? "has-placeholder" : ""}`,
438
- ...h
439
- }
440
- ),
441
- !!s && /* @__PURE__ */ g(
442
- "label",
443
- {
444
- htmlFor: h.id,
445
- className: `text-input-label ${me(n)} ${o}`,
446
- children: [
447
- s,
448
- h.required ? " *" : ""
449
- ]
450
- }
451
- ),
452
- r,
453
- !!c && /* @__PURE__ */ t(
454
- "p",
455
- {
456
- className: `text-input-helper-text ${fe(n)} ${d}`,
457
- children: c
458
- }
459
- )
460
- ] });
461
- }), q = (e) => {
462
- const {
463
- children: l,
464
- icon: r,
465
- type: n = "button",
466
- className: s = "",
467
- variant: a = "text",
468
- color: u = "default",
469
- iconClassName: o = "",
470
- ...c
471
- } = e;
472
- return /* @__PURE__ */ g(
473
- "button",
474
- {
475
- type: n,
476
- className: `icon-button ${s} ${a} ${u}`,
477
- ...c,
478
- children: [
479
- /* @__PURE__ */ t("span", { className: o, children: r }),
480
- l
481
- ]
482
- }
483
- );
484
- };
485
- function Te(e) {
486
- const {
487
- color: l = "stroke-blue-800",
488
- className: r = "",
489
- loaderClass: n = "",
490
- strokeWidth: s = "4",
491
- ...a
492
- } = e;
493
- return /* @__PURE__ */ t("div", { ...a, className: `loading ${r}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${n}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
494
- "circle",
495
- {
496
- className: `path ${l}`,
497
- cx: "50",
498
- cy: "50",
499
- r: "20",
500
- fill: "none",
501
- strokeWidth: s,
502
- strokeMiterlimit: "10"
503
- }
504
- ) }) }) }) });
505
- }
506
- function Fe(e) {
507
- const { className: l = "" } = e;
508
- return /* @__PURE__ */ t(
509
- "svg",
510
- {
511
- className: l,
512
- xmlns: "http://www.w3.org/2000/svg",
513
- viewBox: "0 0 512 512",
514
- fill: "currentColor",
515
- children: /* @__PURE__ */ t("path", { d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z" })
516
- }
517
- );
518
- }
519
- function Le(e) {
520
- const { className: l = "" } = e;
521
- return /* @__PURE__ */ t(
522
- "svg",
523
- {
524
- className: l,
525
- xmlns: "http://www.w3.org/2000/svg",
526
- viewBox: "0 0 320 512",
527
- fill: "currentColor",
528
- children: /* @__PURE__ */ t("path", { d: "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z" })
529
- }
530
- );
531
- }
532
- function Pe(e) {
533
- const { className: l = "" } = e;
534
- return /* @__PURE__ */ t(
535
- "svg",
536
- {
537
- className: l,
538
- xmlns: "http://www.w3.org/2000/svg",
539
- viewBox: "0 0 320 512",
540
- fill: "currentColor",
541
- children: /* @__PURE__ */ t("path", { d: "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z" })
542
- }
543
- );
544
- }
545
- function Oe(e) {
546
- const { className: l = "" } = e;
547
- return /* @__PURE__ */ t(
548
- "svg",
549
- {
550
- className: l,
551
- xmlns: "http://www.w3.org/2000/svg",
552
- viewBox: "0 0 512 512",
553
- fill: "currentColor",
554
- children: /* @__PURE__ */ t("path", { d: "M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z" })
555
- }
556
- );
557
- }
558
- function ce(e) {
559
- const { className: l = "" } = e;
560
- return /* @__PURE__ */ t(
561
- "svg",
562
- {
563
- className: l,
564
- xmlns: "http://www.w3.org/2000/svg",
565
- viewBox: "0 0 384 512",
566
- fill: "currentColor",
567
- children: /* @__PURE__ */ t("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z" })
568
- }
569
- );
570
- }
571
- function Me(e) {
572
- const { className: l = "" } = e;
573
- return /* @__PURE__ */ t(
574
- "svg",
575
- {
576
- className: l,
577
- xmlns: "http://www.w3.org/2000/svg",
578
- viewBox: "0 0 640 640",
579
- fill: "currentColor",
580
- children: /* @__PURE__ */ t("path", { d: "M192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 234.5C512 217.5 505.3 201.2 493.3 189.2L386.7 82.7C374.7 70.7 358.5 64 341.5 64L192 64zM453.5 240L360 240C346.7 240 336 229.3 336 216L336 122.5L453.5 240z" })
581
- }
582
- );
583
- }
584
- const ze = (e) => {
585
- const { className: l = "" } = e;
586
- return /* @__PURE__ */ t("svg", { className: l, viewBox: "0 0 16 16", children: /* @__PURE__ */ t("path", { d: "M9 15H7a1 1 0 010-2h2a1 1 0 010 2zM11 11H5a1 1 0 010-2h6a1 1 0 010 2zM13 7H3a1 1 0 010-2h10a1 1 0 010 2zM15 3H1a1 1 0 010-2h14a1 1 0 010 2z" }) });
587
- };
588
- var X = /* @__PURE__ */ ((e) => (e[e.text = 0] = "text", e[e.number = 1] = "number", e[e.select = 2] = "select", e[e.autocomplete = 3] = "autocomplete", e[e.date = 4] = "date", e[e.check = 5] = "check", e))(X || {}), Q = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(Q || {}), _ = /* @__PURE__ */ ((e) => (e[e.update = 0] = "update", e[e.reset = 1] = "reset", e))(_ || {});
589
- const ue = (e) => {
590
- if (e) {
591
- const l = {};
592
- return Object.keys(e)?.forEach((n) => {
593
- l[n] = { value: e[n] };
594
- }), l;
595
- }
596
- return {};
597
- };
598
- function De(e, l) {
599
- const { type: r } = l;
600
- switch (r) {
601
- case _.reset:
602
- return {};
603
- case _.update: {
604
- const { toUpdate: n } = l;
605
- return { ...e, ...n };
606
- }
607
- default:
608
- return e;
609
- }
610
- }
611
- const be = re({}), Ie = (e) => {
612
- const { children: l } = e, { filters: r } = H(), [n, s] = we(
613
- De,
614
- ue(r)
615
- );
616
- I(() => {
617
- s({ type: _.reset });
618
- const u = ue(r);
619
- Object.keys(u).length && s({
620
- type: _.update,
621
- toUpdate: u
622
- });
623
- }, [r]);
624
- const a = {
625
- currentFilters: n,
626
- setCurrentFilters: s
627
- };
628
- return /* @__PURE__ */ t(be.Provider, { value: a, children: l });
629
- }, Y = () => {
630
- const e = ae(be);
631
- if (e === void 0)
632
- throw new Error("tableOptionsContext must be used within a Provider");
633
- return e;
634
- }, _e = [20, 50, 100], ge = re({}), mt = (e) => {
635
- const { children: l } = e, [r, n] = T(0), [s, a] = T(20), [u, o] = T(0), [c, d] = T("id"), [p, h] = T(Q.DESC), [m, i] = T({}), v = C(
636
- (E, N) => {
637
- let y = p;
638
- c === E && (p === Q.ASC ? y = Q.DESC : y = Q.ASC), d(E), h(y), N && N(E, y);
639
- },
640
- [c, p]
641
- ), S = C((E) => {
642
- const N = Object.entries(E).reduce(
643
- (y, [P, R]) => (R && typeof R.value < "u" && R.value !== null && (y[P] = R.value), y),
644
- {}
645
- );
646
- i(N);
647
- }, []), $ = C(
648
- (E) => {
649
- E ? (delete m[E.toLowerCase()], i({ ...m })) : i({});
650
- },
651
- [m]
652
- ), w = A(() => Object.keys(m).length, [m]), L = {
653
- onSort: v,
654
- total: r,
655
- setTotal: n,
656
- sortingBy: c,
657
- setSortingBy: d,
658
- sortingOrder: p,
659
- setSortingOrder: h,
660
- pageSize: s,
661
- pageSizes: _e,
662
- setPageSize: a,
663
- currentPage: u,
664
- setCurrentPage: o,
665
- filters: m,
666
- onFilterApply: S,
667
- clearFilters: $,
668
- countOfFilters: w
669
- };
670
- return /* @__PURE__ */ t(ge.Provider, { value: L, children: l });
671
- }, H = () => {
672
- const e = ae(ge);
673
- if (e === void 0)
674
- throw new Error("tableOptionsContext must be used within a Provider");
675
- return e;
676
- }, Ne = re(
677
- {}
678
- );
679
- function ft(e) {
680
- const { children: l, t: r, language: n } = e;
681
- return /* @__PURE__ */ t(Ne.Provider, { value: { t: r, language: n }, children: l });
682
- }
683
- const V = () => {
684
- const e = ae(Ne);
685
- if (e === void 0)
686
- throw new Error("translationContext must be used within a Provider");
687
- return e;
688
- };
689
- function Ce(e) {
690
- return [...e].sort((l, r) => (r.pos ?? 0) - (l.pos ?? 0)).filter((l) => l.display !== "none");
691
- }
692
- function Be(e) {
693
- const { t: l } = V(), {
694
- entity: r = "",
695
- columns: n = [],
696
- hasAction: s = !0,
697
- onSortCallback: a,
698
- selectionState: u,
699
- onToggleAllRows: o
700
- } = e, c = B(null);
701
- I(() => {
702
- c.current && (c.current.indeterminate = !!(u?.hasSomeSelected && !u?.allSelected));
703
- }, [u]);
704
- const { onSort: d, sortingOrder: p, sortingBy: h } = H(), m = A(() => Ce(n).map((i) => ({
705
- id: i.key,
706
- label: i.label,
707
- className: i.className ?? "",
708
- sortable: i.sortable ?? !0,
709
- sortOptions: i.sortOptions
710
- })), [n, r, l]);
711
- return /* @__PURE__ */ t("thead", { className: "table-headers-row", children: /* @__PURE__ */ g("tr", { children: [
712
- /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-column table-headers-checkbox", children: o ? /* @__PURE__ */ t(
713
- "input",
714
- {
715
- type: "checkbox",
716
- ref: c,
717
- checked: u?.allSelected ?? !1,
718
- onChange: o,
719
- "aria-label": l("_accessibility:components.table.selectAllRows")
720
- }
721
- ) : null }),
722
- m.map((i) => /* @__PURE__ */ t(
723
- "th",
724
- {
725
- scope: "col",
726
- className: `table-headers-column ${i.className}`,
727
- children: /* @__PURE__ */ g(
728
- Re,
729
- {
730
- disabled: !i.sortable,
731
- onClick: () => d(i.id, a),
732
- className: "table-headers-cell",
733
- children: [
734
- /* @__PURE__ */ t("span", { className: "table-headers-label", children: i.label }),
735
- i.sortable && h === i.id && /* @__PURE__ */ t("span", { children: p === Q.ASC ? i.sortOptions?.icons?.asc ?? /* @__PURE__ */ t(
736
- Oe,
737
- {
738
- className: i.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
739
- }
740
- ) : i.sortOptions?.icons?.desc ?? /* @__PURE__ */ t(
741
- Fe,
742
- {
743
- className: i.sortOptions?.icons?.className ?? "table-headers-sort-indicator"
744
- }
745
- ) })
746
- ]
747
- }
748
- )
749
- },
750
- i.id
751
- )),
752
- s && /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-action", children: /* @__PURE__ */ t("span", { className: "button text default disabled", children: l("_accessibility:labels.actions") }) })
753
- ] }) });
754
- }
755
- const Ve = (e) => {
756
- const { items: l, text: r, id: n, onClearFilter: s } = e;
757
- return /* @__PURE__ */ t(
758
- G,
759
- {
760
- text: `${r}: ${l.map((a) => a.value ?? a.name).join(", ")}`,
761
- onDelete: () => s(n)
762
- }
763
- );
764
- }, je = (e) => {
765
- const { end: l, start: r, text: n, id: s, onClearFilter: a } = e;
766
- return /* @__PURE__ */ t(
767
- G,
768
- {
769
- text: `${n}: ${r || "♾️"} - ${l || "♾️"}`,
770
- onDelete: () => a(s)
771
- }
772
- );
773
- }, We = (e) => {
774
- const { filtersDefinition: l } = e, r = A(() => {
775
- const o = {};
776
- return l.forEach((c) => {
777
- o[c.propertyName] = c.label ?? c.propertyName;
778
- }), o;
779
- }, [l]), { filters: n, clearFilters: s } = H(), a = A(() => Object.keys(n), [n]), u = C(
780
- (o) => n[o]?.end || n[o]?.start ? /* @__PURE__ */ t(
781
- je,
782
- {
783
- id: o,
784
- text: r[o],
785
- start: n[o].start,
786
- end: n[o].end,
787
- onClearFilter: s
788
- }
789
- ) : Array.isArray(n[o]) ? /* @__PURE__ */ t(
790
- Ve,
791
- {
792
- id: o,
793
- text: r[o],
794
- items: n[o],
795
- onClearFilter: s
796
- }
797
- ) : /* @__PURE__ */ t(
798
- G,
799
- {
800
- text: `${r[o]}: ${n[o]?.value ?? n[o]?.name ?? n[o]}`,
801
- onDelete: () => s(o)
802
- }
803
- ),
804
- [n, r]
805
- );
806
- return /* @__PURE__ */ t("ul", { className: "active-filters-main", children: a?.map((o) => /* @__PURE__ */ t("li", { children: u(o) }, o)) });
807
- };
808
- function Ue(e) {
809
- const { propertyName: l, label: r, placeholder: n, options: s, multiple: a = !0 } = e, { currentFilters: u, setCurrentFilters: o } = Y(), c = A(() => u[l] ?? s[0], [u]), d = C(
810
- (p) => {
811
- o({
812
- type: _.update,
813
- toUpdate: {
814
- [l]: {
815
- value: p
816
- }
817
- }
818
- });
819
- },
820
- [a]
821
- );
822
- return /* @__PURE__ */ t(
823
- ke,
824
- {
825
- value: c?.value,
826
- label: r,
827
- options: s,
828
- multiple: a,
829
- helperTextClassName: "hidden",
830
- containerClassName: "options-widget-container",
831
- onChange: d,
832
- placeholder: n
833
- }
834
- );
835
- }
836
- const He = (e) => {
837
- const { propertyName: l, label: r } = e, { currentFilters: n, setCurrentFilters: s } = Y(), a = A(() => n[l]?.value ?? "", [n]), u = C((o) => {
838
- s({
839
- type: _.update,
840
- toUpdate: { [l]: { value: o.target.checked } }
841
- });
842
- }, []);
843
- return /* @__PURE__ */ t(Ae, { label: r, checked: a ?? !1, onChange: u });
844
- };
845
- function qe(e) {
846
- const { propertyName: l, options: r, label: n, placeholder: s } = e, { currentFilters: a, setCurrentFilters: u } = Y(), o = A(() => a[l]?.value ?? r[0], [a]), c = C((d) => {
847
- u({
848
- type: _.update,
849
- toUpdate: { [l]: { value: d.target.value } }
850
- });
851
- }, []);
852
- return /* @__PURE__ */ t(
853
- ie,
854
- {
855
- value: o,
856
- label: n,
857
- options: r,
858
- helperTextClassName: "hidden",
859
- containerClassName: "options-widget-container",
860
- onChange: c,
861
- placeholder: s
862
- }
863
- );
864
- }
865
- const Je = (e) => {
866
- const { propertyName: l, label: r, placeholder: n } = e, { currentFilters: s, setCurrentFilters: a } = Y(), u = A(() => s[l]?.value ?? "", [s]), o = C((c) => {
867
- a({
868
- type: _.update,
869
- toUpdate: { [l]: { value: c.target.value } }
870
- });
871
- }, []);
872
- return /* @__PURE__ */ t(
873
- ne,
874
- {
875
- value: u ?? "",
876
- label: r,
877
- onChange: o,
878
- containerClassName: "input-widget-container",
879
- helperTextClassName: "",
880
- placeholder: n
881
- }
882
- );
883
- }, pe = (e) => {
884
- const { propertyName: l, label: r, inputType: n } = e, { t: s } = V(), { currentFilters: a, setCurrentFilters: u } = Y(), o = B(null), c = B(null), d = C((h) => {
885
- u({
886
- type: _.update,
887
- toUpdate: {
888
- [l]: {
889
- value: { end: c?.current?.value ?? null, start: h.target.value }
890
- }
891
- }
892
- });
893
- }, []), p = C((h) => {
894
- u({
895
- type: _.update,
896
- toUpdate: {
897
- [l]: {
898
- value: {
899
- start: o?.current?.value ?? null,
900
- end: h.target.value
901
- }
902
- }
903
- }
904
- });
905
- }, []);
906
- return /* @__PURE__ */ g("div", { className: "range-widget-container", children: [
907
- /* @__PURE__ */ t("p", { className: "text-input-label input-widget-label input-label-normal", children: r }),
908
- /* @__PURE__ */ g("div", { className: "range-widget-row", children: [
909
- /* @__PURE__ */ t(
910
- ne,
911
- {
912
- value: a[l]?.value?.start ?? "",
913
- placeholder: s("_accessibility:components.table.filters.range.start"),
914
- type: n,
915
- ref: o,
916
- onChange: d,
917
- containerClassName: "input-widget-container",
918
- helperTextClassName: ""
919
- }
920
- ),
921
- /* @__PURE__ */ t(
922
- ne,
923
- {
924
- value: a[l]?.value?.end ?? "",
925
- placeholder: s("_accessibility:components.table.filters.range.end"),
926
- type: n,
927
- ref: c,
928
- onChange: p,
929
- containerClassName: "input-widget-container",
930
- helperTextClassName: ""
931
- }
932
- )
933
- ] })
934
- ] });
935
- }, Ke = (e) => {
936
- switch (e.type) {
937
- case X.text:
938
- return /* @__PURE__ */ t(Je, { ...e });
939
- case X.number:
940
- return /* @__PURE__ */ t(
941
- pe,
942
- {
943
- ...e,
944
- inputType: "number"
945
- }
946
- );
947
- case X.date:
948
- return /* @__PURE__ */ t(
949
- pe,
950
- {
951
- ...e,
952
- inputType: "date"
953
- }
954
- );
955
- case X.select:
956
- return /* @__PURE__ */ t(qe, { ...e });
957
- case X.autocomplete:
958
- return /* @__PURE__ */ t(Ue, { ...e });
959
- case X.check:
960
- return /* @__PURE__ */ t(He, { ...e });
961
- }
962
- return /* @__PURE__ */ t(ee, {});
963
- }, Xe = (e) => {
964
- const { filters: l = [], show: r, handleShow: n } = e, { onFilterApply: s } = H(), { currentFilters: a, setCurrentFilters: u } = Y(), { t: o } = V(), c = B(null);
965
- return I(() => {
966
- const d = ({ target: h }) => {
967
- c.current && (h?.closest(".filter-dropdown-trigger") || !r || c.current.contains(h) || n(!1));
968
- }, p = ({ code: h }) => {
969
- !r || h !== "Escape" || n(!1);
970
- };
971
- return document.addEventListener("click", d), document.addEventListener("keydown", p), () => {
972
- document.removeEventListener("click", d), document.removeEventListener("keydown", p);
973
- };
974
- }, [n, r]), /* @__PURE__ */ t("div", { className: `filter-dropdown-backdrop ${r ? "opened" : "closed"}`, children: /* @__PURE__ */ g("div", { className: "filter-popup", ref: c, children: [
975
- /* @__PURE__ */ t("div", { className: "filter-title", children: o("_accessibility:buttons.filters") }),
976
- /* @__PURE__ */ t("ul", { className: "filter-container", children: l.map((d) => /* @__PURE__ */ t("li", { className: "filter-container-item", children: Ke(d) }, d.propertyName)) }),
977
- /* @__PURE__ */ t("div", { className: "filter-footer", children: /* @__PURE__ */ g("ul", { className: "filter-buttons-row", children: [
978
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
979
- "button",
980
- {
981
- onClick: () => u({
982
- type: _.reset,
983
- filters: l
984
- }),
985
- className: "filter-dropdown-button small filter-dropdown-cancel",
986
- children: o("_accessibility:buttons.clear")
987
- }
988
- ) }),
989
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
990
- "button",
991
- {
992
- className: "filter-dropdown-button small filter-dropdown-submit",
993
- onClick: () => {
994
- n(!1), s(a);
995
- },
996
- children: o("_accessibility:buttons.applyFilters")
997
- }
998
- ) })
999
- ] }) })
1000
- ] }) });
1001
- }, Ge = () => {
1002
- const { t: e } = V(), { total: l, pageSize: r, pageSizes: n, currentPage: s } = H(), a = (s + 1) * r > l ? l : (s + 1) * r;
1003
- return /* @__PURE__ */ g("div", { className: "table-navigation-sizes", children: [
1004
- n[0] < l && /* @__PURE__ */ t(ee, { children: /* @__PURE__ */ g("p", { children: [
1005
- s * r + 1,
1006
- " - ",
1007
- a,
1008
- " ",
1009
- e("_accessibility:components.table.of")
1010
- ] }) }),
1011
- /* @__PURE__ */ t("p", { children: l })
1012
- ] });
1013
- };
1014
- function Qe() {
1015
- const { t: e } = V(), { total: l, pageSize: r, currentPage: n, setCurrentPage: s } = H(), a = A(() => {
1016
- const u = Math.ceil(l / r);
1017
- return Array.from({ length: u }, (o, c) => ({
1018
- id: c,
1019
- value: c + 1
1020
- }));
1021
- }, [l, r]);
1022
- return /* @__PURE__ */ g("div", { className: "jump-to-page", children: [
1023
- /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.jumpToPage") }),
1024
- /* @__PURE__ */ t(
1025
- ie,
1026
- {
1027
- value: n,
1028
- options: a,
1029
- inputClassName: "jump-to-page-input",
1030
- containerClassName: "jump-to-page-input-container",
1031
- helperTextClassName: "hidden",
1032
- onChange: (u) => s(Number(u.target.value))
1033
- }
1034
- )
1035
- ] });
1036
- }
1037
- const Ye = () => {
1038
- const { t: e } = V(), { total: l, pageSize: r, currentPage: n, setCurrentPage: s } = H();
1039
- return /* @__PURE__ */ g("div", { className: "table-navigation-pages", children: [
1040
- /* @__PURE__ */ t(
1041
- q,
1042
- {
1043
- icon: /* @__PURE__ */ t(Le, { className: "w-2.5" }),
1044
- className: "table-navigation-buttons",
1045
- disabled: n === 0,
1046
- "aria-label": e("_accessibility:buttons.previous"),
1047
- name: e("_accessibility:buttons.previous"),
1048
- onClick: () => s(n - 1)
1049
- }
1050
- ),
1051
- /* @__PURE__ */ t(
1052
- q,
1053
- {
1054
- icon: /* @__PURE__ */ t(Pe, { className: "w-2.5" }),
1055
- disabled: Math.floor(l / ((n + 1) * r)) === 0,
1056
- className: "table-navigation-buttons",
1057
- name: e("_accessibility:buttons.next"),
1058
- "aria-label": e("_accessibility:buttons.next"),
1059
- onClick: () => s(n + 1)
1060
- }
1061
- )
1062
- ] });
1063
- };
1064
- function Ze() {
1065
- const { t: e } = V(), { pageSizes: l, pageSize: r, setPageSize: n } = H(), s = A(
1066
- () => l?.map((a) => ({ id: a, value: a })),
1067
- [l]
1068
- );
1069
- return /* @__PURE__ */ g("div", { className: "page-size", children: [
1070
- /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
1071
- /* @__PURE__ */ t(
1072
- ie,
1073
- {
1074
- value: r,
1075
- options: s,
1076
- inputClassName: "page-size-input",
1077
- containerClassName: "page-size-input-container",
1078
- helperTextClassName: "hidden",
1079
- onChange: (a) => n(Number(a.target.value))
1080
- }
1081
- )
1082
- ] });
1083
- }
1084
- function et() {
1085
- return /* @__PURE__ */ g("div", { className: "table-footer", children: [
1086
- /* @__PURE__ */ t(Qe, {}),
1087
- /* @__PURE__ */ t(Ze, {}),
1088
- /* @__PURE__ */ t(Ge, {}),
1089
- /* @__PURE__ */ t(Ye, {})
1090
- ] });
1091
- }
1092
- const tt = (e) => e, nt = (e) => {
1093
- const { t: l } = V(), {
1094
- columns: r,
1095
- softDeleteProperty: n = "deletedAt",
1096
- data: s,
1097
- actions: a,
1098
- selectedRows: u,
1099
- expandedRows: o = [],
1100
- onRowSelectionChange: c,
1101
- onRowExpand: d
1102
- } = e, p = A(
1103
- () => Ce(r),
1104
- [r]
1105
- ), h = A(
1106
- () => new Map(
1107
- o.map((m) => [m.rowId, m])
1108
- ),
1109
- [o]
1110
- );
1111
- return s?.map((m) => {
1112
- const i = u.has(m.id), v = h.get(m.id), S = !!v, $ = p.length + 1 + (a ? 1 : 0);
1113
- return /* @__PURE__ */ g(xe, { children: [
1114
- /* @__PURE__ */ g(
1115
- "tr",
1116
- {
1117
- className: `table-row ${d ? "expandable" : ""} ${m[n] ? "deleted-class" : ""} ${i ? "selected" : ""} ${S ? "expanded" : ""}`,
1118
- onClick: () => d?.(m),
1119
- children: [
1120
- /* @__PURE__ */ t("td", { className: "table-row-cell table-row-checkbox", children: /* @__PURE__ */ t(
1121
- "input",
1122
- {
1123
- type: "checkbox",
1124
- checked: i,
1125
- onClick: (w) => w.stopPropagation(),
1126
- onChange: () => c(m),
1127
- "aria-label": l("_accessibility:components.table.selectRow")
1128
- }
1129
- ) }),
1130
- p?.map((w, L) => /* @__PURE__ */ t(
1131
- "td",
1132
- {
1133
- className: `table-row-cell ${L === 0 ? "basic" : ""} ${w.className ?? ""}`,
1134
- children: w.renderBody ? w.renderBody(m[w.key], m) : tt(m[w.key])
1135
- },
1136
- w.key
1137
- )),
1138
- a ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "table-row-cell-action", children: a(m).filter((w) => !w.hidden)?.map((w) => /* @__PURE__ */ t(le, { content: w.tooltip, children: /* @__PURE__ */ t(
1139
- q,
1140
- {
1141
- icon: w.icon,
1142
- className: "row-table-action",
1143
- onClick: (L) => {
1144
- L.stopPropagation(), w.onClick(m);
1145
- }
1146
- }
1147
- ) }, w.id)) }) }) : null
1148
- ]
1149
- }
1150
- ),
1151
- S && v?.content !== null && typeof v?.content < "u" && /* @__PURE__ */ t("tr", { className: "table-row-expanded", children: /* @__PURE__ */ t("td", { className: "table-row-expanded-cell", colSpan: $, children: /* @__PURE__ */ t(
1152
- "div",
1153
- {
1154
- className: `table-row-expanded-content ${v.isVisible ? "open" : "closed"}`,
1155
- children: /* @__PURE__ */ t("div", { className: "table-row-expanded-inner", children: v.content })
1156
- }
1157
- ) }) })
1158
- ] }, m.id);
1159
- });
1160
- };
1161
- function lt() {
1162
- const { t: e } = V();
1163
- return /* @__PURE__ */ t("div", { className: "table-empty", children: /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.empty") }) });
1164
- }
1165
- const st = (e) => {
1166
- const { columns: l, title: r, isLoading: n, toolbar: s, filterOptions: a } = e, { countOfFilters: u } = H(), { t: o } = V(), c = A(() => l ? l.sort((i, v) => (v.pos ?? 0) - (i.pos ?? 0)).filter((i) => !!i.filterOptions).map((i) => ({
1167
- ...i.filterOptions,
1168
- label: i.filterOptions?.label ?? i.label,
1169
- propertyName: i.key
1170
- })) : [], [l]), [d, p] = T(!1), h = C(
1171
- (i) => {
1172
- a?.dropdown?.setOpened ? a.dropdown.setOpened(i ?? !1) : p(i ?? !1);
1173
- },
1174
- [a]
1175
- ), m = A(
1176
- () => a?.dropdown?.opened ?? d,
1177
- [a, d]
1178
- );
1179
- return /* @__PURE__ */ g("div", { className: `table-header ${m ? "showing-filters" : ""}`, children: [
1180
- /* @__PURE__ */ g("div", { children: [
1181
- r && /* @__PURE__ */ t("h1", { className: "table-header-title", children: r }),
1182
- n ? null : /* @__PURE__ */ g("div", { className: "table-header-content", children: [
1183
- s,
1184
- a?.button?.hide !== !0 && /* @__PURE__ */ g(
1185
- q,
1186
- {
1187
- icon: a?.button?.icon ?? /* @__PURE__ */ t(ze, { className: "filter-dropdown-trigger-icon" }),
1188
- className: "filter-dropdown-button normal filter-dropdown-trigger",
1189
- "aria-haspopup": "true",
1190
- onClick: () => h(!m),
1191
- "aria-expanded": m,
1192
- children: [
1193
- /* @__PURE__ */ t(
1194
- Ee,
1195
- {
1196
- count: u,
1197
- className: `${u > 0 ? "show" : "hide"} `
1198
- }
1199
- ),
1200
- /* @__PURE__ */ t("span", { className: "sr-only", children: o("_accessibility:buttons.filters") }),
1201
- /* @__PURE__ */ t("wbr", {})
1202
- ]
1203
- }
1204
- )
1205
- ] })
1206
- ] }),
1207
- !!c && !!c.length && /* @__PURE__ */ t(
1208
- Xe,
1209
- {
1210
- filters: c,
1211
- show: m,
1212
- handleShow: h,
1213
- options: a
1214
- }
1215
- ),
1216
- /* @__PURE__ */ t(We, { filtersDefinition: c })
1217
- ] });
1218
- };
1219
- function rt({
1220
- count: e,
1221
- multiActions: l,
1222
- onActionClick: r
1223
- }) {
1224
- const { t: n } = V();
1225
- return /* @__PURE__ */ g("div", { className: "table-selection-bar", children: [
1226
- /* @__PURE__ */ t("p", { className: "table-selection-bar-count", children: n("_accessibility:components.table.selectedCount", { count: e }) }),
1227
- l.length > 0 && /* @__PURE__ */ t("div", { className: "table-selection-bar-actions", children: l.map((s) => /* @__PURE__ */ t(le, { content: s.tooltip, children: /* @__PURE__ */ t(
1228
- q,
1229
- {
1230
- icon: s.icon,
1231
- className: "multi-table-action",
1232
- onClick: () => r(s),
1233
- disabled: s.disabled
1234
- }
1235
- ) }, s.id)) })
1236
- ] });
1237
- }
1238
- const se = 220;
1239
- function at({
1240
- data: e,
1241
- allowMultipleExpandedRows: l,
1242
- controlledExpandedRowId: r,
1243
- onExpandedRowChange: n,
1244
- onRowExpand: s,
1245
- findRowById: a
1246
- }) {
1247
- const [u, o] = T(null), [c, d] = T(null), [p, h] = T(null), [m, i] = T(null), [v, S] = T(!1), [$, w] = T(/* @__PURE__ */ new Set()), [L, E] = T([]), N = B(null), y = B(null), P = B(/* @__PURE__ */ new Map()), R = typeof r < "u", O = l && !R, F = R ? r ?? null : u, j = C(() => {
1248
- y.current && (clearTimeout(y.current), y.current = null);
1249
- }, []), z = C(
1250
- (f) => {
1251
- if (typeof f < "u") {
1252
- const x = P.current.get(f);
1253
- if (!x) return;
1254
- clearTimeout(x), P.current.delete(f);
1255
- return;
1256
- }
1257
- P.current.forEach(
1258
- (x) => clearTimeout(x)
1259
- ), P.current.clear();
1260
- },
1261
- []
1262
- ), J = C(
1263
- (f) => {
1264
- z(f), E((x) => x.some(
1265
- (D) => D.rowId === f
1266
- ) ? x.map(
1267
- (D) => D.rowId === f ? { ...D, isVisible: !1 } : D
1268
- ) : x), P.current.set(
1269
- f,
1270
- setTimeout(() => {
1271
- E(
1272
- (x) => x.filter((k) => k.rowId !== f)
1273
- ), P.current.delete(f);
1274
- }, se)
1275
- );
1276
- },
1277
- [z]
1278
- ), b = C(
1279
- (f, x) => {
1280
- z(f), E((k) => k.some(
1281
- (U) => U.rowId === f
1282
- ) ? k.map(
1283
- (U) => U.rowId === f ? { ...U, content: x, isVisible: !1 } : U
1284
- ) : [...k, { rowId: f, content: x, isVisible: !1 }]), requestAnimationFrame(() => {
1285
- E(
1286
- (k) => k.map(
1287
- (D) => D.rowId === f ? { ...D, isVisible: !0 } : D
1288
- )
1289
- );
1290
- });
1291
- },
1292
- [z]
1293
- );
1294
- I(() => {
1295
- if (!O) return;
1296
- const f = new Set(e.map((x) => x.id));
1297
- w((x) => {
1298
- const k = /* @__PURE__ */ new Set();
1299
- return x.forEach((D) => {
1300
- if (f.has(D)) {
1301
- k.add(D);
1302
- return;
1303
- }
1304
- z(D);
1305
- }), k;
1306
- }), E((x) => (x.forEach((k) => {
1307
- f.has(k.rowId) || z(k.rowId);
1308
- }), x.filter(
1309
- (k) => f.has(k.rowId)
1310
- )));
1311
- }, [e, O, z]), I(() => {
1312
- if (O) return;
1313
- if (F === null) {
1314
- d(null), R && (N.current = null);
1315
- return;
1316
- }
1317
- a(F) || (R || o(null), d(null), R && (N.current = null));
1318
- }, [
1319
- e,
1320
- F,
1321
- a,
1322
- R,
1323
- O
1324
- ]), I(() => {
1325
- if (!O) {
1326
- if (j(), F === null || c === null) {
1327
- if (p === null) {
1328
- S(!1), i(null);
1329
- return;
1330
- }
1331
- S(!1), y.current = setTimeout(() => {
1332
- h(null), i(null), y.current = null;
1333
- }, se);
1334
- return;
1335
- }
1336
- if (p === null) {
1337
- h(F), i(c), requestAnimationFrame(() => S(!0));
1338
- return;
1339
- }
1340
- if (p === F) {
1341
- i(c), requestAnimationFrame(() => S(!0));
1342
- return;
1343
- }
1344
- S(!1), y.current = setTimeout(() => {
1345
- h(F), i(c), requestAnimationFrame(() => S(!0)), y.current = null;
1346
- }, se);
1347
- }
1348
- }, [
1349
- j,
1350
- c,
1351
- F,
1352
- O,
1353
- p
1354
- ]), I(
1355
- () => () => {
1356
- j(), z();
1357
- },
1358
- [j, z]
1359
- ), I(() => {
1360
- if (!R) return;
1361
- if (F === null) {
1362
- d(null), N.current = null;
1363
- return;
1364
- }
1365
- const f = a(F);
1366
- if (!f) {
1367
- d(null), N.current = null;
1368
- return;
1369
- }
1370
- const x = N.current;
1371
- d(s?.(f, x) ?? null), N.current = f;
1372
- }, [F, a, R, s]);
1373
- const M = C(
1374
- (f) => {
1375
- if (O) {
1376
- if ($.has(f.id)) {
1377
- w((Z) => {
1378
- const K = new Set(Z);
1379
- return K.delete(f.id), K;
1380
- }), J(f.id), n?.(null, f);
1381
- return;
1382
- }
1383
- w((Z) => {
1384
- const K = new Set(Z);
1385
- return K.add(f.id), K;
1386
- });
1387
- const U = s?.(f, null) ?? null;
1388
- U !== null && typeof U < "u" ? b(f.id, U) : (z(f.id), E(
1389
- (Z) => Z.filter((K) => K.rowId !== f.id)
1390
- )), n?.(f, null);
1391
- return;
1392
- }
1393
- const x = F === f.id, k = x ? f : a(F);
1394
- if (R) {
1395
- n?.(x ? null : f, k);
1396
- return;
1397
- }
1398
- if (x) {
1399
- o(null), d(null), n?.(null, f);
1400
- return;
1401
- }
1402
- o(f.id), d(s?.(f, k) ?? null), n?.(f, k);
1403
- },
1404
- [
1405
- F,
1406
- J,
1407
- z,
1408
- b,
1409
- a,
1410
- $,
1411
- R,
1412
- O,
1413
- n,
1414
- s
1415
- ]
1416
- );
1417
- return { expandedRowsToRender: A(() => O ? L : p === null || m === null || typeof m > "u" ? [] : [
1418
- {
1419
- rowId: p,
1420
- content: m,
1421
- isVisible: v
1422
- }
1423
- ], [
1424
- v,
1425
- O,
1426
- m,
1427
- p,
1428
- L
1429
- ]), onRowExpandChange: M };
1430
- }
1431
- function ot({
1432
- actions: e,
1433
- selectedRowsData: l
1434
- }) {
1435
- const r = A(() => !e || !l.length ? [] : l.reduce(
1436
- (s, a, u) => {
1437
- const o = e(a).filter(
1438
- (d) => d.multiple && !d.hidden
1439
- );
1440
- if (u === 0) return o;
1441
- const c = new Map(
1442
- s.map((d) => [d.id, d])
1443
- );
1444
- return o.reduce((d, p) => {
1445
- const h = c.get(p.id);
1446
- return h && d.push({
1447
- ...h,
1448
- ...p,
1449
- disabled: p.disabled || h.disabled
1450
- }), d;
1451
- }, []);
1452
- },
1453
- []
1454
- ), [e, l]), n = C(
1455
- (s) => {
1456
- if (l.length) {
1457
- if (s.onMultipleClick) {
1458
- s.onMultipleClick(l);
1459
- return;
1460
- }
1461
- l.forEach((a) => s.onClick(a));
1462
- }
1463
- },
1464
- [l]
1465
- );
1466
- return { multiActions: r, handleMultipleActionClick: n };
1467
- }
1468
- function it({
1469
- data: e,
1470
- onRowSelect: l,
1471
- onSelectedRowsChange: r
1472
- }) {
1473
- const [n, s] = T(/* @__PURE__ */ new Set()), a = A(
1474
- () => e?.filter((d) => n.has(d.id)) ?? [],
1475
- [e, n]
1476
- );
1477
- I(() => {
1478
- if (!e?.length) {
1479
- s(/* @__PURE__ */ new Set());
1480
- return;
1481
- }
1482
- s((d) => {
1483
- const p = /* @__PURE__ */ new Set(), h = new Set(e.map((m) => m.id));
1484
- return d.forEach((m) => {
1485
- h.has(m) && p.add(m);
1486
- }), p;
1487
- });
1488
- }, [e]), I(() => {
1489
- r && r(a);
1490
- }, [a, r]);
1491
- const u = C(
1492
- (d) => {
1493
- s((p) => {
1494
- const h = new Set(p);
1495
- return h.has(d.id) ? (h.delete(d.id), l?.(d, !1)) : (h.add(d.id), l?.(d, !0)), h;
1496
- });
1497
- },
1498
- [l]
1499
- ), o = C(() => {
1500
- s((d) => {
1501
- const p = new Set(d), h = e ?? [], m = h.every(
1502
- (i) => p.has(i.id)
1503
- );
1504
- return h.forEach((i) => {
1505
- const v = p.has(i.id);
1506
- m ? v && (p.delete(i.id), l?.(i, !1)) : v || (p.add(i.id), l?.(i, !0));
1507
- }), p;
1508
- });
1509
- }, [e, l]), c = A(() => {
1510
- if (!e?.length)
1511
- return { allSelected: !1, hasSomeSelected: !1 };
1512
- const d = e.every((h) => n.has(h.id)), p = e.some((h) => n.has(h.id));
1513
- return { allSelected: d, hasSomeSelected: p };
1514
- }, [e, n]);
1515
- return {
1516
- selectedRows: n,
1517
- selectedRowsData: a,
1518
- selectionState: c,
1519
- onRowSelectionChange: u,
1520
- onToggleAllRows: o
1521
- };
1522
- }
1523
- function bt(e) {
1524
- const {
1525
- data: l,
1526
- onSort: r,
1527
- entity: n = "",
1528
- isLoading: s = !1,
1529
- actions: a,
1530
- columns: u = [],
1531
- contentClassName: o = "",
1532
- className: c = "",
1533
- softDeleteProperty: d = "deletedAt",
1534
- onRowSelect: p,
1535
- onSelectedRowsChange: h,
1536
- allowMultipleExpandedRows: m = !1,
1537
- expandedRowId: i,
1538
- onExpandedRowChange: v,
1539
- onRowExpand: S,
1540
- ...$
1541
- } = e, w = A(() => !l?.length, [l]), L = C(
1542
- (J) => J === null ? null : l.find((b) => b.id === J) ?? null,
1543
- [l]
1544
- ), {
1545
- selectedRows: E,
1546
- selectedRowsData: N,
1547
- selectionState: y,
1548
- onRowSelectionChange: P,
1549
- onToggleAllRows: R
1550
- } = it({ data: l, onRowSelect: p, onSelectedRowsChange: h }), { expandedRowsToRender: O, onRowExpandChange: F } = at({
1551
- data: l,
1552
- allowMultipleExpandedRows: m,
1553
- controlledExpandedRowId: i,
1554
- onExpandedRowChange: v,
1555
- onRowExpand: S,
1556
- findRowById: L
1557
- }), { multiActions: j, handleMultipleActionClick: z } = ot({
1558
- actions: a,
1559
- selectedRowsData: N
1560
- });
1561
- return /* @__PURE__ */ t(Ie, { children: /* @__PURE__ */ g("div", { className: `${c} table-main`, children: [
1562
- /* @__PURE__ */ t(st, { columns: u, isLoading: s, ...$ }),
1563
- s ? /* @__PURE__ */ t(Te, { className: "table-loading" }) : /* @__PURE__ */ t(ee, { children: w ? /* @__PURE__ */ t(lt, {}) : /* @__PURE__ */ g(ee, { children: [
1564
- !!N.length && /* @__PURE__ */ t(
1565
- rt,
1566
- {
1567
- count: N.length,
1568
- multiActions: j,
1569
- onActionClick: z
1570
- }
1571
- ),
1572
- /* @__PURE__ */ t("div", { className: `${o} table-body`, children: /* @__PURE__ */ g("table", { className: "table-content", children: [
1573
- /* @__PURE__ */ t(
1574
- Be,
1575
- {
1576
- entity: n,
1577
- columns: u,
1578
- onSortCallback: r,
1579
- hasAction: !!a,
1580
- selectionState: y,
1581
- onToggleAllRows: R
1582
- }
1583
- ),
1584
- /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t(
1585
- nt,
1586
- {
1587
- data: l,
1588
- actions: a,
1589
- columns: u,
1590
- softDeleteProperty: d,
1591
- selectedRows: E,
1592
- expandedRows: O,
1593
- onRowSelectionChange: P,
1594
- onRowExpand: S ? F : void 0
1595
- }
1596
- ) })
1597
- ] }) }),
1598
- /* @__PURE__ */ t(et, {})
1599
- ] }) })
1600
- ] }) });
1601
- }
1602
- function le(e) {
1603
- const { content: l, children: r, className: n = "" } = e, s = ye(), a = Se(r) ? $e(r, {
1604
- "aria-describedby": s
1605
- }) : r;
1606
- return /* @__PURE__ */ g("div", { className: `tooltip-container ${n}`, children: [
1607
- a,
1608
- /* @__PURE__ */ t("div", { id: s, role: "tooltip", className: "tooltip-text", children: l })
1609
- ] });
1610
- }
1611
- export {
1612
- We as ActiveFilters,
1613
- Ve as ArrayChip,
1614
- ke as AutocompleteInput,
1615
- Ee as Badge,
1616
- Re as Button,
1617
- Ae as CheckInput,
1618
- Fe as ChevronDown,
1619
- Le as ChevronLeft,
1620
- Pe as ChevronRight,
1621
- Oe as ChevronUp,
1622
- G as Chip,
1623
- ce as Close,
1624
- Be as Columns,
1625
- Ge as CountOfTotal,
1626
- pt as Dropdown,
1627
- Me as File,
1628
- ht as FileInput,
1629
- Xe as FilterDropdown,
1630
- X as FilterTypes,
1631
- ze as Filters,
1632
- _ as FiltersActions,
1633
- Ie as FiltersProvider,
1634
- et as Footer,
1635
- q as IconButton,
1636
- Te as Loading,
1637
- Ye as Navigation,
1638
- Ze as PageSize,
1639
- je as RangeChip,
1640
- nt as Rows,
1641
- ie as SelectInput,
1642
- Q as SortOrder,
1643
- oe as State,
1644
- bt as Table,
1645
- lt as TableEmpty,
1646
- st as TableHeader,
1647
- mt as TableOptionsProvider,
1648
- rt as TableSelectionBar,
1649
- ne as TextInput,
1650
- le as Tooltip,
1651
- ft as TranslationProvider,
1652
- De as filtersReducer,
1653
- fe as helperTextStateClassName,
1654
- ue as initializer,
1655
- he as inputStateClassName,
1656
- me as labelStateClassName,
1657
- Ke as renderFilterComponent,
1658
- Y as useFilters,
1659
- H as useTableOptions,
1660
- V as useTranslation
1661
- };