@sito/dashboard 0.0.28 → 0.0.29

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 (78) hide show
  1. package/README.md +8 -5
  2. package/dist/components/Chip/Chip.d.ts +7 -0
  3. package/dist/components/Chip/index.d.ts +2 -0
  4. package/dist/components/Chip/types.d.ts +12 -0
  5. package/dist/components/Form/AutocompleteInput/AutocompleteInput.d.ts +7 -0
  6. package/dist/components/Form/AutocompleteInput/index.d.ts +2 -0
  7. package/dist/components/Form/AutocompleteInput/types.d.ts +6 -0
  8. package/dist/components/Form/CheckInput/CheckInput.d.ts +7 -0
  9. package/dist/components/Form/CheckInput/index.d.ts +2 -0
  10. package/dist/components/Form/CheckInput/types.d.ts +4 -0
  11. package/dist/components/Form/SelectInput/SelectInput.d.ts +1 -2
  12. package/dist/components/Form/SelectInput/index.d.ts +2 -0
  13. package/dist/components/Form/SelectInput/types.d.ts +2 -14
  14. package/dist/components/Form/TextInput/TextInput.d.ts +7 -0
  15. package/dist/components/Form/TextInput/index.d.ts +2 -0
  16. package/dist/components/Form/TextInput/types.d.ts +5 -0
  17. package/dist/components/Form/index.d.ts +6 -4
  18. package/dist/components/Form/types.d.ts +15 -0
  19. package/dist/components/Form/utils.d.ts +3 -3
  20. package/dist/components/Loading/Loading.d.ts +1 -7
  21. package/dist/components/Loading/index.d.ts +1 -1
  22. package/dist/components/Loading/types.d.ts +6 -0
  23. package/dist/components/SvgIcons/ChevronDown.d.ts +2 -0
  24. package/dist/components/SvgIcons/ChevronLeft.d.ts +2 -0
  25. package/dist/components/SvgIcons/ChevronRight.d.ts +2 -0
  26. package/dist/components/SvgIcons/ChevronUp.d.ts +2 -0
  27. package/dist/components/SvgIcons/Close.d.ts +2 -0
  28. package/dist/components/SvgIcons/Filters.d.ts +2 -0
  29. package/dist/components/SvgIcons/index.d.ts +7 -0
  30. package/dist/components/{Chevron → SvgIcons}/types.d.ts +1 -1
  31. package/dist/components/Table/components/Columns.d.ts +2 -2
  32. package/dist/components/Table/components/FilterPopup/FilterPopup.d.ts +2 -0
  33. package/dist/components/Table/components/FilterPopup/index.d.ts +3 -0
  34. package/dist/components/Table/components/FilterPopup/types.d.ts +7 -0
  35. package/dist/components/Table/components/FilterPopup/utils.d.ts +3 -0
  36. package/dist/components/Table/components/Footer/CountOfTotal.d.ts +1 -0
  37. package/dist/components/Table/components/Footer/Footer.d.ts +4 -0
  38. package/dist/components/Table/components/Footer/JumpToPage.d.ts +5 -0
  39. package/dist/components/Table/components/Footer/Navigation.d.ts +1 -0
  40. package/dist/components/Table/components/Footer/index.d.ts +4 -0
  41. package/dist/components/Table/components/Rows.d.ts +3 -0
  42. package/dist/components/Table/components/Widgets/AutocompleteWidget.d.ts +2 -0
  43. package/dist/components/Table/components/Widgets/CheckWidget.d.ts +2 -0
  44. package/dist/components/Table/components/Widgets/DateWidget.d.ts +2 -0
  45. package/dist/components/Table/components/Widgets/NumberWidget.d.ts +2 -0
  46. package/dist/components/Table/components/Widgets/SelectWidget.d.ts +2 -0
  47. package/dist/components/Table/components/Widgets/TextWidget.d.ts +2 -0
  48. package/dist/components/Table/components/Widgets/index.d.ts +7 -0
  49. package/dist/components/Table/components/Widgets/types.d.ts +14 -0
  50. package/dist/components/Table/components/index.d.ts +6 -0
  51. package/dist/components/Table/components/types.d.ts +37 -0
  52. package/dist/components/Table/index.d.ts +3 -4
  53. package/dist/components/Table/types.d.ts +6 -26
  54. package/dist/components/Tooltip/Tooltip.d.ts +1 -6
  55. package/dist/components/Tooltip/index.d.ts +2 -0
  56. package/dist/components/Tooltip/types.d.ts +5 -0
  57. package/dist/components/index.d.ts +6 -6
  58. package/dist/dashboard.cjs +1 -1
  59. package/dist/dashboard.js +886 -301
  60. package/dist/lib/filters.d.ts +45 -0
  61. package/dist/lib/index.d.ts +2 -0
  62. package/dist/main.css +1 -1
  63. package/dist/providers/FiltersProvider/FiltersProvider.d.ts +8 -0
  64. package/dist/providers/FiltersProvider/index.d.ts +3 -0
  65. package/dist/providers/FiltersProvider/types.d.ts +18 -0
  66. package/dist/providers/FiltersProvider/utils.d.ts +5 -0
  67. package/dist/{components/Table/hooks → providers/TableOptions}/TableOptionsProvider.d.ts +1 -1
  68. package/dist/providers/TableOptions/index.d.ts +2 -0
  69. package/dist/{components/Table/hooks → providers/TableOptions}/types.d.ts +9 -3
  70. package/dist/providers/Translation/index.d.ts +2 -0
  71. package/dist/providers/index.d.ts +3 -2
  72. package/package.json +1 -1
  73. package/dist/components/Chevron/ChevronDown.d.ts +0 -3
  74. package/dist/components/Chevron/ChevronUp.d.ts +0 -3
  75. package/dist/components/Chevron/index.d.ts +0 -3
  76. package/dist/components/Table/components/Navigation.d.ts +0 -5
  77. /package/dist/components/Table/components/{PageSize.d.ts → Footer/PageSize.d.ts} +0 -0
  78. /package/dist/lib/{models/query.d.ts → query.d.ts} +0 -0
package/dist/dashboard.js CHANGED
@@ -1,383 +1,968 @@
1
1
  import "./main.css";
2
- import { jsx as t, jsxs as d, Fragment as S } from "react/jsx-runtime";
3
- import { createContext as z, useState as x, useCallback as B, useContext as P, useMemo as $, forwardRef as D, useEffect as M } from "react";
4
- var f = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(f || {});
5
- const L = [20, 50, 100], T = z({}), O = (e) => {
6
- const { children: a } = e, [l, n] = x(0), [s, r] = x(20), [m, p] = x(0), [b, v] = x("id"), [i, o] = x(f.DESC), g = {
7
- onSort: B(
8
- (c) => {
9
- let C = i;
10
- if (b === c)
11
- switch (i) {
12
- case f.ASC:
13
- C = f.DESC;
14
- break;
15
- default:
16
- C = f.ASC;
17
- break;
18
- }
19
- v(c), o(C);
20
- },
21
- [b, i]
22
- ),
23
- total: l,
24
- setTotal: n,
25
- sortingBy: b,
26
- setSortingBy: v,
27
- sortingOrder: i,
28
- setSortingOrder: o,
29
- pageSize: s,
30
- pageSizes: L,
31
- setPageSize: r,
32
- currentPage: m,
33
- setCurrentPage: p
34
- };
35
- return /* @__PURE__ */ t(T.Provider, { value: g, children: a });
36
- }, k = () => {
37
- const e = P(T);
38
- if (e === void 0)
39
- throw new Error("tableOptionsContext must be used within a Provider");
40
- return e;
41
- }, _ = z({});
42
- function ee(e) {
43
- const { children: a, t: l } = e;
44
- return /* @__PURE__ */ t(_.Provider, { value: { t: l }, children: a });
45
- }
46
- const y = () => {
47
- const e = P(_);
48
- if (e === void 0)
49
- throw new Error("translationContext must be used within a Provider");
50
- return e;
51
- };
52
- function j(e) {
53
- const { content: a, children: l } = e;
54
- return /* @__PURE__ */ d("div", { className: "tooltip-container", children: [
55
- l,
56
- /* @__PURE__ */ t("div", { className: "tooltip-text", children: a })
57
- ] });
58
- }
59
- function F(e) {
60
- const {
61
- color: a = "stroke-blue-800",
62
- loaderClass: l,
63
- strokeWidth: n = "4",
64
- ...s
65
- } = e;
66
- return /* @__PURE__ */ t("div", { ...s, className: `loading ${s.className}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${l}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
67
- "circle",
2
+ import { jsx as t, jsxs as b, Fragment as M } from "react/jsx-runtime";
3
+ import { forwardRef as j, useEffect as A, useState as P, useRef as H, useCallback as x, createContext as I, useContext as q, useReducer as ne, useMemo as C } from "react";
4
+ function se(e) {
5
+ const { className: s = "" } = e;
6
+ return /* @__PURE__ */ t(
7
+ "svg",
68
8
  {
69
- className: `path ${a}`,
70
- cx: "50",
71
- cy: "50",
72
- r: "20",
73
- fill: "none",
74
- strokeWidth: n,
75
- strokeMiterlimit: "10"
9
+ className: s,
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ viewBox: "0 0 512 512",
12
+ fill: "currentColor",
13
+ 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" })
76
14
  }
77
- ) }) }) }) });
78
- }
79
- function I() {
80
- const { t: e } = y();
81
- return /* @__PURE__ */ t("div", { className: "table-empty", children: /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.empty") }) });
15
+ );
82
16
  }
83
- function R(e) {
84
- const { className: a } = e;
17
+ function re(e) {
18
+ const { className: s = "" } = e;
85
19
  return /* @__PURE__ */ t(
86
20
  "svg",
87
21
  {
88
- className: a,
22
+ className: s,
89
23
  xmlns: "http://www.w3.org/2000/svg",
90
24
  viewBox: "0 0 512 512",
25
+ fill: "currentColor",
91
26
  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" })
92
27
  }
93
28
  );
94
29
  }
95
- function U(e) {
96
- const { className: a } = e;
30
+ function ae(e) {
31
+ const { className: s = "" } = e;
97
32
  return /* @__PURE__ */ t(
98
33
  "svg",
99
34
  {
100
- className: a,
35
+ className: s,
101
36
  xmlns: "http://www.w3.org/2000/svg",
102
- viewBox: "0 0 512 512",
103
- 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" })
37
+ viewBox: "0 0 320 512",
38
+ fill: "currentColor",
39
+ 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" })
104
40
  }
105
41
  );
106
42
  }
107
- function W(e) {
108
- const { t: a } = y(), { entity: l = "", columns: n = [], hasAction: s = !0, columnsOptions: r } = e, { onSort: m, sortingOrder: p, sortingBy: b } = k(), v = $(() => {
109
- const { noSortableColumns: i = {}, columnClassNames: o = {} } = r ?? {};
110
- return n == null ? void 0 : n.map((h) => ({
111
- id: h.key,
112
- label: h.label,
113
- className: o[h.key] ?? "",
114
- sortable: !i[h.key]
115
- }));
116
- }, [n, r, l, a]);
117
- return /* @__PURE__ */ t("thead", { className: "table-headers-row", children: /* @__PURE__ */ d("tr", { children: [
118
- v.map((i) => {
119
- var o, h, g, c;
120
- return /* @__PURE__ */ t(
121
- "th",
122
- {
123
- scope: "col",
124
- className: `table-headers-column ${i.className}`,
125
- children: /* @__PURE__ */ d(
126
- "button",
127
- {
128
- disabled: !i.sortable,
129
- onClick: () => m(i.id),
130
- className: "table-headers-cell",
131
- children: [
132
- /* @__PURE__ */ t("span", { className: "table-headers-label", children: i.label }),
133
- i.sortable && /* @__PURE__ */ t(
134
- "span",
135
- {
136
- className: `${b === i.id ? "table-headers-sort-on" : "table-headers-sort"}`,
137
- children: p === f.ASC ? ((o = r == null ? void 0 : r.icons) == null ? void 0 : o.asc) ?? /* @__PURE__ */ t(
138
- R,
139
- {
140
- className: ((h = r == null ? void 0 : r.icons) == null ? void 0 : h.className) ?? "table-headers-sort-indicator"
141
- }
142
- ) : ((g = r == null ? void 0 : r.icons) == null ? void 0 : g.desc) ?? /* @__PURE__ */ t(
143
- U,
144
- {
145
- className: ((c = r == null ? void 0 : r.icons) == null ? void 0 : c.className) ?? "table-headers-sort-indicator"
146
- }
147
- )
148
- }
149
- )
150
- ]
151
- }
152
- )
153
- },
154
- i.id
155
- );
156
- }),
157
- s && /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-action", children: a("_accessibility:labels.actions") })
158
- ] }) });
43
+ function le(e) {
44
+ const { className: s = "" } = e;
45
+ return /* @__PURE__ */ t(
46
+ "svg",
47
+ {
48
+ className: s,
49
+ xmlns: "http://www.w3.org/2000/svg",
50
+ viewBox: "0 0 320 512",
51
+ fill: "currentColor",
52
+ 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" })
53
+ }
54
+ );
159
55
  }
160
- var E = /* @__PURE__ */ ((e) => (e.error = "error", e.good = "good", e.default = "default", e))(E || {});
161
- const q = (e) => {
56
+ const oe = (e) => {
57
+ const { className: s = "" } = e;
58
+ return /* @__PURE__ */ t("svg", { className: s, 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" }) });
59
+ };
60
+ function K(e) {
61
+ const { className: s = "" } = e;
62
+ return /* @__PURE__ */ t(
63
+ "svg",
64
+ {
65
+ className: s,
66
+ xmlns: "http://www.w3.org/2000/svg",
67
+ viewBox: "0 0 384 512",
68
+ fill: "currentColor",
69
+ 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" })
70
+ }
71
+ );
72
+ }
73
+ var R = /* @__PURE__ */ ((e) => (e.error = "error", e.good = "good", e.default = "default", e))(R || {});
74
+ const Q = (e) => {
162
75
  switch (e) {
163
76
  case "error":
164
- return "border-red-500 text-red-900 placeholder-red-700 focus:ring-red-500 focus:border-red-500";
77
+ return "input-error";
165
78
  case "good":
166
- return "border-green-500 text-green-900 placeholder-green-700 focus:ring-green-500 focus:border-green-500";
79
+ return "input-good";
167
80
  default:
168
- return "text-gray-900 border-gray-300 focus:border-blue-600";
81
+ return "input-normal";
169
82
  }
170
- }, G = (e) => {
83
+ }, V = (e) => {
171
84
  switch (e) {
172
85
  case "error":
173
- return "peer-focus:text-red-700 text-red-700";
86
+ return "input-label-error";
174
87
  case "good":
175
- return "peer-focus:text-green-700 text-green-700";
88
+ return "input-label-good";
176
89
  default:
177
- return "peer-focus:text-blue-600 text-gray-500";
90
+ return "input-label-normal";
178
91
  }
179
- }, H = (e) => {
92
+ }, X = (e) => {
180
93
  switch (e) {
181
94
  case "error":
182
- return "text-red-600";
95
+ return "input-helper-text-error";
183
96
  case "good":
184
- return "text-green-600";
97
+ return "input-helper-text-good";
185
98
  default:
186
- return "text-gray-500";
99
+ return "input-helper-text-normal";
187
100
  }
188
101
  };
189
- const J = D(function(e, a) {
102
+ const J = j(function(e, s) {
190
103
  const {
191
- value: l,
104
+ value: a,
192
105
  onChange: n,
193
- options: s,
194
- containerClassName: r = "",
195
- inputClassName: m = "",
196
- labelClassName: p = "",
197
- helperText: b = "",
198
- helperTextClassName: v = "",
199
- placeholder: i = "",
200
- label: o = "",
201
- name: h = "",
202
- id: g = "",
203
- state: c = E.default,
204
- ...C
106
+ options: r,
107
+ containerClassName: l = "",
108
+ inputClassName: c = "",
109
+ labelClassName: o = "",
110
+ helperText: i = "",
111
+ helperTextClassName: m = "",
112
+ placeholder: d = "",
113
+ label: u = "",
114
+ name: N = "",
115
+ id: h = "",
116
+ state: p = R.default,
117
+ ...v
205
118
  } = e;
206
- return M(() => {
207
- var N;
208
- (!l || l === "") && (s != null && s.length) && n({ target: { value: (N = s[0]) == null ? void 0 : N.id } });
209
- }, [n, s, l]), /* @__PURE__ */ d("div", { className: `select-input-container ${r}`, children: [
119
+ return A(() => {
120
+ var f;
121
+ (!a || a === "") && (r != null && r.length) && n({ target: { value: (f = r[0]) == null ? void 0 : f.id } });
122
+ }, [n, r, a]), /* @__PURE__ */ b("div", { className: `select-input-container ${l}`, children: [
210
123
  /* @__PURE__ */ t(
211
124
  "select",
212
125
  {
213
- ...C,
214
- id: g,
215
- ref: a,
216
- name: h,
217
- value: l,
126
+ ...v,
127
+ id: h,
128
+ ref: s,
129
+ name: N,
130
+ value: a,
218
131
  onChange: n,
219
- className: `select-input ${q(c)} peer ${m}`,
220
- children: s == null ? void 0 : s.map((N) => /* @__PURE__ */ t("option", { value: N.id, children: N.value }, N.id))
132
+ className: `select-input ${Q(p)} peer ${c}`,
133
+ children: r == null ? void 0 : r.map((f) => /* @__PURE__ */ t("option", { value: f.id, children: f.value }, f.id))
221
134
  }
222
135
  ),
223
136
  /* @__PURE__ */ t(
224
137
  "label",
225
138
  {
226
- htmlFor: h,
227
- className: `select-input-label ${G(c)} ${p}`,
228
- children: o
139
+ htmlFor: N,
140
+ className: `select-input-label ${V(p)} ${o}`,
141
+ children: u
142
+ }
143
+ ),
144
+ /* @__PURE__ */ t(
145
+ "p",
146
+ {
147
+ className: `select-input-helper-text ${X(p)} ${m}`,
148
+ children: p !== "error" && p !== "good" ? d : i
149
+ }
150
+ )
151
+ ] });
152
+ });
153
+ const U = j(function(e, s) {
154
+ const {
155
+ children: a,
156
+ value: n,
157
+ onChange: r,
158
+ state: l = R.default,
159
+ name: c = "",
160
+ id: o = "",
161
+ type: i = "text",
162
+ label: m = "",
163
+ required: d = !1,
164
+ placeholder: u = "",
165
+ containerClassName: N = "",
166
+ inputClassName: h = "",
167
+ labelClassName: p = "",
168
+ helperText: v = "",
169
+ helperTextClassName: f = "",
170
+ ...y
171
+ } = e;
172
+ return /* @__PURE__ */ b("div", { className: `text-input-container ${N}`, children: [
173
+ /* @__PURE__ */ t(
174
+ "input",
175
+ {
176
+ ref: s,
177
+ type: i,
178
+ name: c,
179
+ id: o,
180
+ className: `text-input ${Q(l)} peer ${h}`,
181
+ placeholder: "",
182
+ required: d,
183
+ value: n,
184
+ onChange: r,
185
+ ...y
186
+ }
187
+ ),
188
+ /* @__PURE__ */ b(
189
+ "label",
190
+ {
191
+ htmlFor: c,
192
+ className: `text-input-label ${V(l)} ${p}`,
193
+ children: [
194
+ m,
195
+ d ? " *" : ""
196
+ ]
229
197
  }
230
198
  ),
199
+ a,
231
200
  /* @__PURE__ */ t(
232
201
  "p",
233
202
  {
234
- className: `select-input-helper-text ${H(c)} ${v}`,
235
- children: c !== "error" && c !== "good" ? i : b
203
+ className: `text-input-helper-text ${X(l)} ${f}`,
204
+ children: l !== "error" && l !== "good" ? u : v
236
205
  }
237
206
  )
238
207
  ] });
239
- }), K = J;
240
- function Q() {
241
- const { t: e } = y(), { pageSizes: a, pageSize: l, setPageSize: n } = k(), s = $(
242
- () => a == null ? void 0 : a.map((r) => ({ id: r, value: r })),
243
- [a]
208
+ });
209
+ const ce = j(function(e, s) {
210
+ const {
211
+ checked: a,
212
+ onChange: n,
213
+ state: r = R.default,
214
+ name: l = "",
215
+ id: c = "",
216
+ type: o = "text",
217
+ label: i = "",
218
+ containerClassName: m = "",
219
+ inputClassName: d = "",
220
+ labelClassName: u = "",
221
+ helperText: N = "",
222
+ helperTextClassName: h = "",
223
+ ...p
224
+ } = e;
225
+ return /* @__PURE__ */ b("label", { className: `input-check-container ${m}`, children: [
226
+ /* @__PURE__ */ t(
227
+ "input",
228
+ {
229
+ id: c,
230
+ ref: s,
231
+ name: l,
232
+ type: "checkbox",
233
+ checked: a,
234
+ onChange: n,
235
+ className: `input-check ${d}`,
236
+ ...p
237
+ }
238
+ ),
239
+ /* @__PURE__ */ t("span", { className: `input-check-label ${u}`, children: i })
240
+ ] });
241
+ });
242
+ const ie = j(function(e, s) {
243
+ const {
244
+ state: a,
245
+ value: n,
246
+ onChange: r,
247
+ options: l = [],
248
+ name: c = "",
249
+ id: o = "",
250
+ label: i = "",
251
+ containerClassName: m = "",
252
+ inputContainerClassName: d = "",
253
+ helperText: u = "",
254
+ placeholder: N = "",
255
+ multiple: h = !1,
256
+ ...p
257
+ } = e, [v, f] = P(""), [y, w] = P(!1), $ = l.filter((g) => {
258
+ const S = String(g.value).toLowerCase().includes(v == null ? void 0 : v.toLowerCase());
259
+ return n && n.length ? n != null && n.some ? !(n != null && n.some((W) => W.id === g.id)) : (n == null ? void 0 : n.id) !== g.id : S;
260
+ }), _ = H(null);
261
+ A(() => {
262
+ const g = (D) => {
263
+ _.current && !_.current.contains(D.target) && w(!1);
264
+ }, S = (D) => {
265
+ D.key === "Escape" && w(!1);
266
+ };
267
+ return document.addEventListener("click", g), document.addEventListener("keydown", S), () => {
268
+ document.removeEventListener("click", g), document.removeEventListener("keydown", S);
269
+ };
270
+ }, []);
271
+ const B = (g) => {
272
+ f(g.target.value);
273
+ }, G = x(
274
+ (g) => {
275
+ f(""), r(g ? h ? n ? [...n, g] : [g] : g : null), w(!1);
276
+ },
277
+ [h, r, n]
278
+ ), te = x(
279
+ (g) => {
280
+ const S = n.filter((D, W) => W !== g);
281
+ S.length ? r(S) : r(null);
282
+ },
283
+ [r, n]
244
284
  );
245
- return /* @__PURE__ */ d("div", { className: "page-size", children: [
285
+ return /* @__PURE__ */ b(
286
+ "div",
287
+ {
288
+ className: `autocomplete-input-container ${m}`,
289
+ ref: _,
290
+ children: [
291
+ /* @__PURE__ */ t(
292
+ U,
293
+ {
294
+ state: a,
295
+ name: c,
296
+ id: o,
297
+ value: !h && n ? n.value : v,
298
+ onChange: B,
299
+ placeholder: N,
300
+ helperText: u,
301
+ onFocus: () => w(!0),
302
+ label: i,
303
+ containerClassName: `autocomplete-text-input ${d}`,
304
+ ref: s,
305
+ ...p,
306
+ children: !h && n && /* @__PURE__ */ t(
307
+ "button",
308
+ {
309
+ type: "button",
310
+ className: "autocomplete-delete-button",
311
+ onClick: () => G(),
312
+ children: /* @__PURE__ */ t(K, {})
313
+ }
314
+ )
315
+ }
316
+ ),
317
+ y && /* @__PURE__ */ t("ul", { className: "autocomplete-suggestions-container", children: $.map((g) => /* @__PURE__ */ t(
318
+ "li",
319
+ {
320
+ className: "autocomplete-suggestion-item hover:bg-primary/20",
321
+ onClick: () => G(g),
322
+ children: g.value
323
+ },
324
+ g.id
325
+ )) }),
326
+ h && Array.isArray(n) && n.length ? /* @__PURE__ */ t("ul", { className: "autocomplete-value-container", children: n.map((g, S) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
327
+ Te,
328
+ {
329
+ label: String(g.value),
330
+ onDelete: () => te(S)
331
+ }
332
+ ) }, g.value)) }) : null
333
+ ]
334
+ }
335
+ );
336
+ });
337
+ function de(e) {
338
+ const {
339
+ color: s = "stroke-blue-800",
340
+ loaderClass: a,
341
+ strokeWidth: n = "4",
342
+ ...r
343
+ } = e;
344
+ return /* @__PURE__ */ t("div", { ...r, className: `loading ${r.className}`, children: /* @__PURE__ */ t("div", { className: "loader-container", children: /* @__PURE__ */ t("div", { className: `loader ${a}`, children: /* @__PURE__ */ t("svg", { className: "circular", viewBox: "25 25 50 50", children: /* @__PURE__ */ t(
345
+ "circle",
346
+ {
347
+ className: `path ${s}`,
348
+ cx: "50",
349
+ cy: "50",
350
+ r: "20",
351
+ fill: "none",
352
+ strokeWidth: n,
353
+ strokeMiterlimit: "10"
354
+ }
355
+ ) }) }) }) });
356
+ }
357
+ const Y = I({});
358
+ function Me(e) {
359
+ const { children: s, t: a } = e;
360
+ return /* @__PURE__ */ t(Y.Provider, { value: { t: a }, children: s });
361
+ }
362
+ const E = () => {
363
+ const e = q(Y);
364
+ if (e === void 0)
365
+ throw new Error("translationContext must be used within a Provider");
366
+ return e;
367
+ };
368
+ var O = /* @__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))(O || {}), T = /* @__PURE__ */ ((e) => (e.ASC = "ASC", e.DESC = "DESC", e))(T || {});
369
+ const ue = [20, 50, 100], Z = I({}), Ae = (e) => {
370
+ const { children: s } = e, [a, n] = P(0), [r, l] = P(20), [c, o] = P(0), [i, m] = P("id"), [d, u] = P(T.DESC), [N, h] = P({}), p = x(
371
+ (y, w) => {
372
+ let $ = d;
373
+ if (i === y)
374
+ switch (d) {
375
+ case T.ASC:
376
+ $ = T.DESC;
377
+ break;
378
+ default:
379
+ $ = T.ASC;
380
+ break;
381
+ }
382
+ m(y), u($), w && w(y, $);
383
+ },
384
+ [i, d]
385
+ ), v = x((y) => {
386
+ const w = Object.entries(y).reduce(
387
+ ($, [_, B]) => (B && typeof B.value < "u" && ($[_] = B.value), $),
388
+ {}
389
+ );
390
+ h(w);
391
+ }, []), f = {
392
+ onSort: p,
393
+ total: a,
394
+ setTotal: n,
395
+ sortingBy: i,
396
+ setSortingBy: m,
397
+ sortingOrder: d,
398
+ setSortingOrder: u,
399
+ pageSize: r,
400
+ pageSizes: ue,
401
+ setPageSize: l,
402
+ currentPage: c,
403
+ setCurrentPage: o,
404
+ filters: N,
405
+ onFilterApply: v
406
+ };
407
+ return /* @__PURE__ */ t(Z.Provider, { value: f, children: s });
408
+ }, L = () => {
409
+ const e = q(Z);
410
+ if (e === void 0)
411
+ throw new Error("tableOptionsContext must be used within a Provider");
412
+ return e;
413
+ };
414
+ var k = /* @__PURE__ */ ((e) => (e[e.update = 0] = "update", e[e.reset = 1] = "reset", e))(k || {});
415
+ const pe = (e) => {
416
+ const s = {}, a = Object.keys(e);
417
+ return a == null || a.forEach((n) => {
418
+ s[n] = { value: e[n] };
419
+ }), s;
420
+ };
421
+ function he(e, s) {
422
+ const { type: a } = s;
423
+ switch (a) {
424
+ case k.reset: {
425
+ const { filters: n } = s, r = {};
426
+ return n == null || n.forEach(({ propertyName: l, defaultValue: c }) => {
427
+ r[l] = { value: c };
428
+ }), { ...e, ...r };
429
+ }
430
+ case k.update: {
431
+ const { toUpdate: n } = s;
432
+ return { ...e, ...n };
433
+ }
434
+ default:
435
+ return e;
436
+ }
437
+ }
438
+ const ee = I({}), me = (e) => {
439
+ const { children: s } = e, { filters: a } = L(), [n, r] = ne(
440
+ he,
441
+ pe(a)
442
+ ), l = {
443
+ currentFilters: n,
444
+ setCurrentFilters: r
445
+ };
446
+ return /* @__PURE__ */ t(ee.Provider, { value: l, children: s });
447
+ }, F = () => {
448
+ const e = q(ee);
449
+ if (e === void 0)
450
+ throw new Error("tableOptionsContext must be used within a Provider");
451
+ return e;
452
+ };
453
+ function be(e) {
454
+ const { t: s } = E(), { entity: a = "", columns: n = [], hasAction: r = !0, onSortCallback: l } = e, { onSort: c, sortingOrder: o, sortingBy: i } = L(), m = C(() => {
455
+ var d;
456
+ return (d = n.sort((u, N) => (N.pos ?? 0) - (u.pos ?? 0)).filter((u) => u.display !== "none")) == null ? void 0 : d.map((u) => ({
457
+ id: u.key,
458
+ label: u.label,
459
+ className: u.className ?? "",
460
+ sortable: u.sortable ?? !0,
461
+ sortOptions: u.sortOptions
462
+ }));
463
+ }, [n, a, s]);
464
+ return /* @__PURE__ */ t("thead", { className: "table-headers-row", children: /* @__PURE__ */ b("tr", { children: [
465
+ m.map((d) => {
466
+ var u, N, h, p, v, f, y, w;
467
+ return /* @__PURE__ */ t(
468
+ "th",
469
+ {
470
+ scope: "col",
471
+ className: `table-headers-column ${d.className}`,
472
+ children: /* @__PURE__ */ b(
473
+ "button",
474
+ {
475
+ disabled: !d.sortable,
476
+ onClick: () => c(d.id, l),
477
+ className: "table-headers-cell",
478
+ children: [
479
+ /* @__PURE__ */ t("span", { className: "table-headers-label", children: d.label }),
480
+ d.sortable && /* @__PURE__ */ t(
481
+ "span",
482
+ {
483
+ className: `${i === d.id ? "table-headers-sort-on" : "table-headers-sort"}`,
484
+ children: o === T.ASC ? ((N = (u = d.sortOptions) == null ? void 0 : u.icons) == null ? void 0 : N.asc) ?? /* @__PURE__ */ t(
485
+ re,
486
+ {
487
+ className: ((p = (h = d.sortOptions) == null ? void 0 : h.icons) == null ? void 0 : p.className) ?? "table-headers-sort-indicator"
488
+ }
489
+ ) : ((f = (v = d.sortOptions) == null ? void 0 : v.icons) == null ? void 0 : f.desc) ?? /* @__PURE__ */ t(
490
+ se,
491
+ {
492
+ className: ((w = (y = d.sortOptions) == null ? void 0 : y.icons) == null ? void 0 : w.className) ?? "table-headers-sort-indicator"
493
+ }
494
+ )
495
+ }
496
+ )
497
+ ]
498
+ }
499
+ )
500
+ },
501
+ d.id
502
+ );
503
+ }),
504
+ r && /* @__PURE__ */ t("th", { scope: "col", className: "table-headers-action", children: s("_accessibility:labels.actions") })
505
+ ] }) });
506
+ }
507
+ function ge() {
508
+ const { t: e } = E();
509
+ return /* @__PURE__ */ t("div", { className: "table-empty", children: /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.empty") }) });
510
+ }
511
+ const ve = () => {
512
+ const { t: e } = E(), { total: s, pageSize: a, currentPage: n, setCurrentPage: r } = L();
513
+ return /* @__PURE__ */ b("div", { className: "table-navigation-pages", children: [
514
+ /* @__PURE__ */ t(
515
+ "button",
516
+ {
517
+ className: "table-navigation-buttons",
518
+ disabled: n === 0,
519
+ "aria-label": e("_accessibility:buttons.previous"),
520
+ name: e("_accessibility:buttons.previous"),
521
+ onClick: () => r(n - 1),
522
+ children: /* @__PURE__ */ t(le, { className: "w-2.5" })
523
+ }
524
+ ),
525
+ /* @__PURE__ */ t(
526
+ "button",
527
+ {
528
+ disabled: Math.floor(s / ((n + 1) * a)) === 0,
529
+ className: "table-navigation-buttons",
530
+ name: e("_accessibility:buttons.next"),
531
+ "aria-label": e("_accessibility:buttons.next"),
532
+ onClick: () => r(n + 1),
533
+ children: /* @__PURE__ */ t(ae, { className: "w-2.5" })
534
+ }
535
+ )
536
+ ] });
537
+ }, Ne = () => {
538
+ const { t: e } = E(), { total: s, pageSize: a, pageSizes: n, currentPage: r } = L(), l = (r + 1) * a > s ? s : (r + 1) * a;
539
+ return /* @__PURE__ */ b("div", { className: "table-navigation-sizes", children: [
540
+ n[0] < s && /* @__PURE__ */ t(M, { children: /* @__PURE__ */ b("p", { children: [
541
+ r * a + 1,
542
+ " - ",
543
+ l,
544
+ " ",
545
+ e("_accessibility:components.table.of")
546
+ ] }) }),
547
+ /* @__PURE__ */ t("p", { children: s })
548
+ ] });
549
+ };
550
+ function fe() {
551
+ const { t: e } = E(), { pageSizes: s, pageSize: a, setPageSize: n } = L(), r = C(
552
+ () => s == null ? void 0 : s.map((l) => ({ id: l, value: l })),
553
+ [s]
554
+ );
555
+ return /* @__PURE__ */ b("div", { className: "page-size", children: [
246
556
  /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
247
557
  /* @__PURE__ */ t(
248
- K,
558
+ J,
249
559
  {
250
- value: l,
251
- options: s,
560
+ value: a,
561
+ options: r,
252
562
  inputClassName: "page-size-input",
253
563
  containerClassName: "page-size-input-container",
254
564
  helperTextClassName: "hidden",
255
- onChange: (r) => n(r.target.value)
565
+ onChange: (l) => n(l.target.value)
256
566
  }
257
567
  )
258
568
  ] });
259
569
  }
260
- function V() {
261
- const { t: e } = y(), { total: a, pageSize: l, pageSizes: n, currentPage: s, setCurrentPage: r } = k(), m = (s + 1) * l > a ? a : (s + 1) * l;
262
- return /* @__PURE__ */ d("div", { className: "table-navigation", children: [
263
- /* @__PURE__ */ d("div", { className: "table-navigation-sizes", children: [
264
- /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.pageSizes") }),
265
- n[0] < a && /* @__PURE__ */ t(S, { children: /* @__PURE__ */ d("p", { children: [
266
- e("_accessibility:components.table.from"),
267
- " ",
268
- s * l + 1,
269
- " ",
270
- e("_accessibility:components.table.to"),
271
- " ",
272
- m,
273
- " ",
274
- e("_accessibility:components.table.of")
275
- ] }) }),
276
- /* @__PURE__ */ d("p", { children: [
277
- a,
278
- " ",
279
- e("_accessibility:components.table.results")
280
- ] })
281
- ] }),
282
- /* @__PURE__ */ d("div", { className: "table-navigation-pages", children: [
283
- /* @__PURE__ */ t(
284
- "button",
285
- {
286
- className: "table-navigation-buttons",
287
- disabled: s === 0,
288
- onClick: () => r(s - 1),
289
- children: e("_accessibility:buttons.previous")
570
+ function Ce() {
571
+ const { t: e } = E(), { total: s, pageSize: a, currentPage: n, setCurrentPage: r } = L(), l = C(() => {
572
+ const c = Math.ceil(s / a);
573
+ return Array.from({ length: c }, (o, i) => ({
574
+ id: i,
575
+ value: i + 1
576
+ }));
577
+ }, [s, a]);
578
+ return /* @__PURE__ */ b("div", { className: "jump-to-page", children: [
579
+ /* @__PURE__ */ t("p", { children: e("_accessibility:components.table.jumpToPage") }),
580
+ /* @__PURE__ */ t(
581
+ J,
582
+ {
583
+ value: n,
584
+ options: l,
585
+ inputClassName: "jump-to-page-input",
586
+ containerClassName: "jump-to-page-input-container",
587
+ helperTextClassName: "hidden",
588
+ onChange: (c) => r(Number(c.target.value))
589
+ }
590
+ )
591
+ ] });
592
+ }
593
+ function ye() {
594
+ return /* @__PURE__ */ b("div", { className: "table-footer", children: [
595
+ /* @__PURE__ */ t(Ce, {}),
596
+ /* @__PURE__ */ t(fe, {}),
597
+ /* @__PURE__ */ t(Ne, {}),
598
+ /* @__PURE__ */ t(ve, {})
599
+ ] });
600
+ }
601
+ function we(e) {
602
+ const { propertyName: s, options: a, label: n } = e, { currentFilters: r, setCurrentFilters: l } = F(), c = C(() => {
603
+ var i;
604
+ return ((i = r[s]) == null ? void 0 : i.value) ?? a[0];
605
+ }, [r]), o = x((i) => {
606
+ l({
607
+ type: k.update,
608
+ toUpdate: { [s]: { value: i.target.value } }
609
+ });
610
+ }, []);
611
+ return /* @__PURE__ */ t(
612
+ J,
613
+ {
614
+ value: c,
615
+ label: n,
616
+ options: a,
617
+ helperTextClassName: "hidden",
618
+ containerClassName: "options-widget-container",
619
+ onChange: o
620
+ }
621
+ );
622
+ }
623
+ const xe = (e) => {
624
+ const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = F(), l = C(() => {
625
+ var o;
626
+ return ((o = n[s]) == null ? void 0 : o.value) ?? "";
627
+ }, [n]), c = x((o) => {
628
+ r({
629
+ type: k.update,
630
+ toUpdate: { [s]: { value: o.target.value } }
631
+ });
632
+ }, []);
633
+ return /* @__PURE__ */ t(
634
+ U,
635
+ {
636
+ value: l ?? "",
637
+ label: a,
638
+ onChange: c,
639
+ containerClassName: "input-widget-container",
640
+ helperTextClassName: ""
641
+ }
642
+ );
643
+ }, ke = (e) => {
644
+ const { propertyName: s, label: a, min: n, max: r } = e, { currentFilters: l, setCurrentFilters: c } = F(), o = C(() => {
645
+ var m;
646
+ return ((m = l[s]) == null ? void 0 : m.value) ?? "";
647
+ }, [l]), i = x(
648
+ (m) => {
649
+ c({
650
+ type: k.update,
651
+ toUpdate: {
652
+ [s]: { value: m.target.value }
290
653
  }
291
- ),
292
- /* @__PURE__ */ t(
293
- "button",
294
- {
295
- disabled: Math.floor(a / ((s + 1) * l)) === 0,
296
- className: "table-navigation-buttons",
297
- onClick: () => r(s + 1),
298
- children: e("_accessibility:buttons.next")
654
+ });
655
+ },
656
+ [o]
657
+ );
658
+ return /* @__PURE__ */ t(
659
+ U,
660
+ {
661
+ value: o ?? "",
662
+ min: n,
663
+ max: r,
664
+ type: "number",
665
+ label: a,
666
+ containerClassName: "input-widget-container",
667
+ onChange: i,
668
+ helperTextClassName: ""
669
+ }
670
+ );
671
+ }, $e = (e) => {
672
+ const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = F(), l = C(() => {
673
+ var o;
674
+ return ((o = n[s]) == null ? void 0 : o.value) ?? "";
675
+ }, [n]), c = x((o) => {
676
+ r({
677
+ type: k.update,
678
+ toUpdate: { [s]: { value: o.target.checked } }
679
+ });
680
+ }, []);
681
+ return /* @__PURE__ */ t(ce, { label: a, checked: l ?? !1, onChange: c });
682
+ };
683
+ function Se(e) {
684
+ const { propertyName: s, label: a, options: n, multiple: r = !0 } = e, { currentFilters: l, setCurrentFilters: c } = F(), o = C(() => l[s] ?? n[0], [l]), i = x(
685
+ (m) => {
686
+ c({
687
+ type: k.update,
688
+ toUpdate: {
689
+ [s]: {
690
+ value: m
691
+ }
299
692
  }
300
- )
301
- ] })
302
- ] });
693
+ });
694
+ },
695
+ [r]
696
+ );
697
+ return /* @__PURE__ */ t(
698
+ ie,
699
+ {
700
+ value: o == null ? void 0 : o.value,
701
+ label: a,
702
+ options: n,
703
+ multiple: r,
704
+ helperTextClassName: "hidden",
705
+ containerClassName: "options-widget-container",
706
+ onChange: i
707
+ }
708
+ );
303
709
  }
304
- function te(e) {
305
- const { t: a } = y(), {
306
- title: l = "",
307
- rows: n,
308
- parseRows: s,
309
- entity: r = "",
310
- isLoading: m = !1,
311
- actions: p,
312
- columns: b = [],
313
- contentClassName: v = "",
314
- className: i = "",
315
- columnsOptions: o,
316
- softDeleteProperty: h = "deleted"
317
- } = e, g = $(
318
- () => (n == null ? void 0 : n.map((c) => s(c))) ?? [],
319
- [s, n, a]
710
+ const Pe = (e) => {
711
+ const { propertyName: s, label: a } = e, { currentFilters: n, setCurrentFilters: r } = F(), l = C(() => {
712
+ var o, i;
713
+ return (o = n[s]) != null && o.value ? new Date(String((i = n[s]) == null ? void 0 : i.value)).toISOString().slice(0, 10) : "";
714
+ }, [n]), c = x((o) => {
715
+ r({
716
+ type: k.update,
717
+ toUpdate: { [s]: { value: o.target.value } }
718
+ });
719
+ }, []);
720
+ return /* @__PURE__ */ t(
721
+ U,
722
+ {
723
+ value: l ?? "",
724
+ label: a,
725
+ type: "date",
726
+ onChange: c,
727
+ containerClassName: "input-widget-container",
728
+ helperTextClassName: ""
729
+ }
320
730
  );
321
- return /* @__PURE__ */ d("div", { className: `${i} table-main`, children: [
322
- /* @__PURE__ */ t("div", { className: "table-header", children: /* @__PURE__ */ d("div", { children: [
323
- /* @__PURE__ */ t("h1", { className: "table-header-title", children: l }),
324
- n != null && n.length && !m ? /* @__PURE__ */ t(Q, {}) : null
325
- ] }) }),
326
- m ? /* @__PURE__ */ t(F, { className: "table-loading" }) : /* @__PURE__ */ t(S, { children: n != null && n.length ? /* @__PURE__ */ d(S, { children: [
327
- /* @__PURE__ */ t("div", { className: `${v} table-body`, children: /* @__PURE__ */ d("table", { className: "table-content", children: [
731
+ }, ze = (e) => {
732
+ switch (e.type) {
733
+ case O.text:
734
+ return /* @__PURE__ */ t(xe, { ...e });
735
+ case O.number:
736
+ return /* @__PURE__ */ t(ke, { ...e });
737
+ case O.select:
738
+ return /* @__PURE__ */ t(we, { ...e });
739
+ case O.autocomplete:
740
+ return /* @__PURE__ */ t(Se, { ...e });
741
+ case O.date:
742
+ return /* @__PURE__ */ t(Pe, { ...e });
743
+ case O.check:
744
+ return /* @__PURE__ */ t($e, { ...e });
745
+ }
746
+ return /* @__PURE__ */ t(M, {});
747
+ };
748
+ const Oe = (e) => {
749
+ const { align: s = "right", filters: a = [], icon: n } = e, [r, l] = P(!1), { onFilterApply: c, filters: o } = L(), { currentFilters: i, setCurrentFilters: m } = F(), { t: d } = E(), u = H(null), N = H(null);
750
+ return A(() => {
751
+ const h = ({ target: p }) => {
752
+ var v, f;
753
+ N.current && (!r || (v = N.current) != null && v.contains(p) || (f = u == null ? void 0 : u.current) != null && f.contains(p) || l(!1));
754
+ };
755
+ return document.addEventListener("click", h), () => document.removeEventListener("click", h);
756
+ }), A(() => {
757
+ const h = (p) => {
758
+ !r || p.code !== "Escape" || l(!1);
759
+ };
760
+ return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
761
+ }), /* @__PURE__ */ b("div", { className: "filter-dropdown-main", children: [
762
+ /* @__PURE__ */ b(
763
+ "button",
764
+ {
765
+ ref: u,
766
+ className: "filter-dropdown-button normal filter-dropdown-trigger",
767
+ "aria-haspopup": "true",
768
+ onClick: () => l(!r),
769
+ "aria-expanded": r,
770
+ children: [
771
+ /* @__PURE__ */ t("span", { className: "sr-only", children: d("_accessibility:buttons.filters") }),
772
+ /* @__PURE__ */ t("wbr", {}),
773
+ n ?? /* @__PURE__ */ t(oe, { className: "filter-dropdown-trigger-icon" })
774
+ ]
775
+ }
776
+ ),
777
+ /* @__PURE__ */ t(
778
+ "div",
779
+ {
780
+ className: `filter-dropdown-transition ${r ? "opened" : "closed"} ${s === "right" ? "right" : "left"}`,
781
+ children: /* @__PURE__ */ b("div", { ref: N, children: [
782
+ /* @__PURE__ */ t("div", { className: "filter-title", children: d("_accessibility:buttons.filters") }),
783
+ /* @__PURE__ */ t("ul", { className: "filter-container", children: a.map((h) => /* @__PURE__ */ t("li", { className: "filter-container-item", children: ze(h) }, h.propertyName)) }),
784
+ /* @__PURE__ */ t("div", { className: "filter-footer", children: /* @__PURE__ */ b("ul", { className: "filter-buttons-row", children: [
785
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
786
+ "button",
787
+ {
788
+ onClick: () => m({ type: k.reset }),
789
+ className: "filter-dropdown-button small filter-dropdown-cancel",
790
+ children: d("_accessibility:buttons.clear")
791
+ }
792
+ ) }),
793
+ /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
794
+ "button",
795
+ {
796
+ className: "filter-dropdown-button small filter-dropdown-submit bg-primary hover:bg-light-primary",
797
+ onClick: () => {
798
+ l(!1), c(i);
799
+ },
800
+ onBlur: () => l(!1),
801
+ children: d("_accessibility:buttons.applyFilters")
802
+ }
803
+ ) })
804
+ ] }) })
805
+ ] })
806
+ }
807
+ )
808
+ ] });
809
+ }, Ee = (e) => e, Le = (e) => {
810
+ const { columns: s, softDeleteProperty: a = "deleted", data: n, actions: r } = e, l = C(
811
+ () => s.sort((c, o) => (o.pos ?? 0) - (c.pos ?? 0)).filter((c) => c.display !== "none"),
812
+ [s]
813
+ );
814
+ return n == null ? void 0 : n.map((c) => {
815
+ var o;
816
+ return /* @__PURE__ */ b(
817
+ "tr",
818
+ {
819
+ className: `table-row ${c[a] ? "deleted-class" : ""}`,
820
+ children: [
821
+ l == null ? void 0 : l.map((i, m) => /* @__PURE__ */ t(
822
+ "td",
823
+ {
824
+ className: `table-row-cell ${m === 0 ? "basic" : ""} ${i.className ?? ""}`,
825
+ children: i.renderBody ? i.renderBody(c[i.key], c) : Ee(c[i.key])
826
+ },
827
+ i.key
828
+ )),
829
+ r ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "table-row-cell-action", children: (o = r(c).filter((i) => !i.hidden)) == null ? void 0 : o.map((i) => /* @__PURE__ */ t(Fe, { content: i.tooltip, children: /* @__PURE__ */ t("button", { onClick: i.onClick, children: i.icon }) }, i.id)) }) }) : null
830
+ ]
831
+ },
832
+ c.id
833
+ );
834
+ });
835
+ };
836
+ function je(e) {
837
+ const {
838
+ title: s = "",
839
+ data: a,
840
+ onSort: n,
841
+ entity: r = "",
842
+ isLoading: l = !1,
843
+ actions: c,
844
+ columns: o = [],
845
+ contentClassName: i = "",
846
+ className: m = "",
847
+ toolbar: d = /* @__PURE__ */ t(M, {}),
848
+ softDeleteProperty: u = "deleted"
849
+ } = e, N = C(() => o ? o.sort((p, v) => (v.pos ?? 0) - (p.pos ?? 0)).filter((p) => !!p.filterOptions).map((p) => {
850
+ var v;
851
+ return {
852
+ ...p.filterOptions,
853
+ label: ((v = p.filterOptions) == null ? void 0 : v.label) ?? p.label,
854
+ propertyName: p.key
855
+ };
856
+ }) : [], [o]), h = C(() => !(a != null && a.length), [a]);
857
+ return /* @__PURE__ */ t(me, { children: /* @__PURE__ */ b("div", { className: `${m} table-main`, children: [
858
+ /* @__PURE__ */ b("div", { className: "table-header", children: [
859
+ /* @__PURE__ */ t("h1", { className: "table-header-title", children: s }),
860
+ l ? null : /* @__PURE__ */ b("div", { className: "table-header-right", children: [
861
+ d,
862
+ /* @__PURE__ */ t(Oe, { filters: N })
863
+ ] })
864
+ ] }),
865
+ l ? /* @__PURE__ */ t(de, { className: "table-loading" }) : /* @__PURE__ */ t(M, { children: h ? /* @__PURE__ */ t(ge, {}) : /* @__PURE__ */ b(M, { children: [
866
+ /* @__PURE__ */ t("div", { className: `${i} table-body`, children: /* @__PURE__ */ b("table", { className: "table-content", children: [
328
867
  /* @__PURE__ */ t(
329
- W,
868
+ be,
330
869
  {
331
870
  entity: r,
332
- columns: b,
333
- columnsOptions: o,
334
- hasAction: !!p
871
+ columns: o,
872
+ onSortCallback: n,
873
+ hasAction: !!c
335
874
  }
336
875
  ),
337
- /* @__PURE__ */ t("tbody", { children: g == null ? void 0 : g.map((c) => {
338
- var C, N;
339
- return /* @__PURE__ */ d(
340
- "tr",
341
- {
342
- className: `table-row ${(C = c[h]) != null && C.value ? "deleted-class" : ""}`,
343
- children: [
344
- b == null ? void 0 : b.map((u, A) => {
345
- var w;
346
- return /* @__PURE__ */ t(
347
- "td",
348
- {
349
- className: `table-row-cell ${A === 0 ? "basic" : ""} ${o != null && o.columnClassNames ? o == null ? void 0 : o.columnClassNames[u.key] : ""}`,
350
- children: ((w = c[u.key]) == null ? void 0 : w.render) ?? c[u.key]
351
- },
352
- u.key
353
- );
354
- }),
355
- p ? /* @__PURE__ */ t("td", { children: /* @__PURE__ */ t("div", { className: "table-row-cell-action", children: (N = p(c).filter((u) => !u.hidden)) == null ? void 0 : N.map((u) => /* @__PURE__ */ t(
356
- j,
357
- {
358
- content: u.tooltip,
359
- children: /* @__PURE__ */ t("button", { onClick: u.onClick, children: u.icon })
360
- },
361
- u.id
362
- )) }) }) : null
363
- ]
364
- },
365
- c.id
366
- );
367
- }) })
876
+ /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t(
877
+ Le,
878
+ {
879
+ data: a,
880
+ actions: c,
881
+ columns: o,
882
+ softDeleteProperty: u
883
+ }
884
+ ) })
368
885
  ] }) }),
369
- /* @__PURE__ */ t(V, {})
370
- ] }) : /* @__PURE__ */ t(I, {}) })
886
+ /* @__PURE__ */ t(ye, {})
887
+ ] }) })
888
+ ] }) });
889
+ }
890
+ function Fe(e) {
891
+ const { content: s, children: a } = e;
892
+ return /* @__PURE__ */ b("div", { className: "tooltip-container", children: [
893
+ a,
894
+ /* @__PURE__ */ t("div", { className: "tooltip-text", children: s })
895
+ ] });
896
+ }
897
+ var z = /* @__PURE__ */ ((e) => (e.empty = "empty", e.outlined = "outlined", e.default = "default", e))(z || {});
898
+ function Te(e) {
899
+ const {
900
+ label: s,
901
+ onDelete: a,
902
+ className: n = "",
903
+ spanClassName: r = "",
904
+ variant: l = z.default
905
+ } = e, c = C(() => {
906
+ switch (l) {
907
+ case z.empty:
908
+ return "text-primary bg-transparent";
909
+ case z.outlined:
910
+ return "border border-primary";
911
+ case z.default:
912
+ default:
913
+ return "text-white bg-primary";
914
+ }
915
+ }, [l]), o = C(() => {
916
+ switch (l) {
917
+ case z.empty:
918
+ case z.outlined:
919
+ return "chip-delete-button-svg";
920
+ case z.default:
921
+ default:
922
+ return "filled-chip-delete-button-svg";
923
+ }
924
+ }, [l]);
925
+ return /* @__PURE__ */ b("div", { className: `chip-main ${c} ${n}`, children: [
926
+ /* @__PURE__ */ t("span", { className: r, children: s }),
927
+ a ? /* @__PURE__ */ t("button", { type: "button", className: "chip-delete-button", onClick: a, children: /* @__PURE__ */ t(K, { className: o }) }) : null
371
928
  ] });
372
929
  }
373
930
  export {
374
- U as ChevronDown,
375
- R as ChevronUp,
376
- F as Loading,
377
- te as Table,
378
- O as TableOptionsProvider,
379
- j as Tooltip,
380
- ee as TranslationProvider,
381
- k as useTableOptions,
382
- y as useTranslation
931
+ ie as AutocompleteInput,
932
+ ce as CheckInput,
933
+ se as ChevronDown,
934
+ le as ChevronLeft,
935
+ ae as ChevronRight,
936
+ re as ChevronUp,
937
+ Te as Chip,
938
+ z as ChipVariant,
939
+ K as Close,
940
+ be as Columns,
941
+ Ne as CountOfTotal,
942
+ ge as Empty,
943
+ Oe as FilterPopup,
944
+ oe as Filters,
945
+ k as FiltersActions,
946
+ me as FiltersProvider,
947
+ ye as Footer,
948
+ de as Loading,
949
+ ve as Navigation,
950
+ fe as PageSize,
951
+ Le as Rows,
952
+ J as SelectInput,
953
+ R as State,
954
+ je as Table,
955
+ Ae as TableOptionsProvider,
956
+ U as TextInput,
957
+ Fe as Tooltip,
958
+ Me as TranslationProvider,
959
+ he as filtersReducer,
960
+ X as helperTextStateClassName,
961
+ pe as initializer,
962
+ Q as inputStateClassName,
963
+ V as labelStateClassName,
964
+ ze as renderFilterComponent,
965
+ F as useFilters,
966
+ L as useTableOptions,
967
+ E as useTranslation
383
968
  };