@sito/dashboard 0.0.43 → 0.0.45

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