@sito/dashboard 0.0.70 → 0.0.71

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.
package/dist/Form.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TextInput-C27RFuya.cjs"),t=require("./FileInput-CqzVk1gQ.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./SelectInput-j7riQ8_P.cjs"),t=require("./FileInput-CqzVk1gQ.cjs");exports.AutocompleteInput=e.AutocompleteInput;exports.CheckInput=e.CheckInput;exports.SelectInput=e.SelectInput;exports.State=e.State;exports.TextInput=e.TextInput;exports.helperTextStateClassName=e.helperTextStateClassName;exports.inputStateClassName=e.inputStateClassName;exports.labelStateClassName=e.labelStateClassName;exports.FileInput=t.FileInput;
package/dist/Form.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, C as s, S as l, a as p, T as u, h as m, i as n, l as o } from "./TextInput-DPYxzgm3.js";
1
+ import { A as e, C as s, S as l, a as p, T as u, h as m, i as n, l as o } from "./SelectInput-B0Ffd39D.js";
2
2
  import { F as r } from "./FileInput-Cr4TxWUg.js";
3
3
  export {
4
4
  e as AutocompleteInput,
@@ -0,0 +1,525 @@
1
+ import "./SelectInput.css";
2
+ import { jsxs as T, jsx as a, Fragment as Y } from "react/jsx-runtime";
3
+ import { forwardRef as K, useState as F, useEffect as O, useMemo as j, useRef as W, useCallback as $, useLayoutEffect as Z } from "react";
4
+ import { C as M } from "./Chip-C5ogKbFn.js";
5
+ import { I as ee } from "./IconButton-BpsTEj0z.js";
6
+ import { C as te } from "./Close-rKC9AcNX.js";
7
+ const ie = K(function(l, h) {
8
+ const {
9
+ state: p,
10
+ value: t,
11
+ onChange: r,
12
+ options: b = [],
13
+ name: A = "",
14
+ id: k = "",
15
+ label: v = "",
16
+ containerClassName: S = "",
17
+ inputContainerClassName: x = "",
18
+ helperText: D = "",
19
+ placeholder: L = "",
20
+ multiple: d = !1,
21
+ ...I
22
+ } = l, [u, m] = F("");
23
+ O(() => {
24
+ if (!d && t && !Array.isArray(t)) {
25
+ m(String(t.value ?? t.name ?? ""));
26
+ return;
27
+ }
28
+ m("");
29
+ }, [d, t]);
30
+ const [f, g] = F(!1), [C, y] = F(-1), o = j(
31
+ () => b.filter((e) => {
32
+ const n = String(e.value ?? e.name).toLowerCase().includes(u?.toLowerCase());
33
+ return Array.isArray(t) && t.length ? n && !t.some((c) => c.id === e.id) : t && !Array.isArray(t) ? n && t.id !== e.id : n;
34
+ }),
35
+ [b, t, u]
36
+ );
37
+ O(() => {
38
+ if (!f || !o.length) {
39
+ y(-1);
40
+ return;
41
+ }
42
+ y(0);
43
+ }, [f, o]);
44
+ const i = W(null), N = W(null), [E, w] = F(!1), s = W(null);
45
+ O(() => {
46
+ const e = (c) => {
47
+ i.current && !i.current.contains(c.target) && g(!1);
48
+ }, n = (c) => {
49
+ c.key === "Escape" && g(!1);
50
+ };
51
+ return document.addEventListener("mousedown", e), document.addEventListener("keydown", n), () => {
52
+ document.removeEventListener("mousedown", e), document.removeEventListener("keydown", n);
53
+ };
54
+ }, []);
55
+ const R = $((e) => {
56
+ m(e.target.value);
57
+ }, []), B = $(
58
+ (e) => {
59
+ e ? d ? (m(""), Array.isArray(t) && t.length ? r([...t, e]) : r([e])) : (m(String(e.name ?? e.value ?? "")), r(e)) : r(null), g(!1);
60
+ },
61
+ [d, r, t]
62
+ ), P = $(
63
+ (e) => {
64
+ if (!o.length) {
65
+ e.key === "Escape" && g(!1);
66
+ return;
67
+ }
68
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
69
+ if (e.preventDefault(), !f) {
70
+ g(!0), y(0);
71
+ return;
72
+ }
73
+ y((n) => {
74
+ const c = n >= 0 ? n : 0;
75
+ return e.key === "ArrowDown" ? (c + 1 + o.length) % o.length : (c - 1 + o.length) % o.length;
76
+ });
77
+ return;
78
+ }
79
+ if (e.key === "Enter" && f) {
80
+ e.preventDefault();
81
+ const n = C >= 0 ? C : 0;
82
+ B(o[n]);
83
+ return;
84
+ }
85
+ e.key === "Escape" && f && (e.preventDefault(), g(!1));
86
+ },
87
+ [
88
+ B,
89
+ C,
90
+ f,
91
+ o
92
+ ]
93
+ ), H = $(
94
+ (e) => {
95
+ if (!Array.isArray(t)) {
96
+ r(null);
97
+ return;
98
+ }
99
+ const n = t.filter((c, z) => z !== e);
100
+ n.length ? r(n) : r(null);
101
+ },
102
+ [r, t]
103
+ ), V = $(() => {
104
+ Array.isArray(t) && r([t[0]]);
105
+ }, [r, t]);
106
+ return Z(() => {
107
+ const e = s.current?.offsetWidth ?? 0, n = i.current?.offsetWidth ?? 0;
108
+ w(e > n * 0.4);
109
+ }, [t]), /* @__PURE__ */ T(
110
+ "div",
111
+ {
112
+ className: `autocomplete-input-container ${S}`,
113
+ ref: i,
114
+ children: [
115
+ /* @__PURE__ */ T("div", { className: "autocomplete-value-input-container", children: [
116
+ /* @__PURE__ */ a(
117
+ Q,
118
+ {
119
+ state: p,
120
+ name: A,
121
+ id: k,
122
+ value: u,
123
+ onChange: R,
124
+ placeholder: L,
125
+ helperText: D,
126
+ onFocus: () => g(!0),
127
+ onKeyDown: P,
128
+ label: v,
129
+ containerClassName: `autocomplete-text-input ${x}`,
130
+ ref: h ?? N,
131
+ ...I,
132
+ children: !d && t && !Array.isArray(t) && (t.value || t.name) && /* @__PURE__ */ a(
133
+ ee,
134
+ {
135
+ icon: /* @__PURE__ */ a(te, {}),
136
+ className: "autocomplete-delete-button",
137
+ onClick: (e) => {
138
+ B(), e.stopPropagation();
139
+ }
140
+ }
141
+ )
142
+ }
143
+ ),
144
+ d && Array.isArray(t) && t.length ? /* @__PURE__ */ a("ul", { ref: s, className: "autocomplete-value-container", children: E ? /* @__PURE__ */ T(Y, { children: [
145
+ /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
146
+ M,
147
+ {
148
+ text: t[0]?.value ?? t[0]?.name,
149
+ onDelete: (e) => {
150
+ H(0), e.stopPropagation();
151
+ }
152
+ }
153
+ ) }),
154
+ t.length > 1 && /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
155
+ M,
156
+ {
157
+ text: `+${t.length - 1}`,
158
+ onDelete: (e) => {
159
+ V(), e.stopPropagation();
160
+ }
161
+ }
162
+ ) })
163
+ ] }) : t.map((e, n) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a(
164
+ M,
165
+ {
166
+ text: String(e.value ?? e.name),
167
+ onDelete: (c) => {
168
+ H(n), c.stopPropagation();
169
+ }
170
+ }
171
+ ) }, e.id ?? e.value ?? e.name)) }) : null
172
+ ] }),
173
+ f && /* @__PURE__ */ a(
174
+ "ul",
175
+ {
176
+ className: "autocomplete-suggestions-container",
177
+ style: { width: i.current?.offsetWidth },
178
+ children: o.map((e) => /* @__PURE__ */ a(
179
+ "li",
180
+ {
181
+ className: `autocomplete-suggestion-item ${e.id === o[C]?.id ? "highlighted" : ""}`,
182
+ onMouseEnter: () => y(
183
+ o.findIndex((n) => n.id === e.id)
184
+ ),
185
+ onClick: (n) => {
186
+ B(e), n.stopPropagation();
187
+ },
188
+ children: e.value ?? e.name
189
+ },
190
+ e.id ?? e.value ?? e.name
191
+ ))
192
+ }
193
+ )
194
+ ]
195
+ }
196
+ );
197
+ });
198
+ var U = /* @__PURE__ */ ((l) => (l.error = "error", l.good = "good", l.default = "default", l))(U || {});
199
+ const q = (l) => {
200
+ switch (l) {
201
+ case "error":
202
+ return "input-error";
203
+ case "good":
204
+ return "input-good";
205
+ default:
206
+ return "input-normal";
207
+ }
208
+ }, _ = (l) => {
209
+ switch (l) {
210
+ case "error":
211
+ return "input-label-error";
212
+ case "good":
213
+ return "input-label-good";
214
+ default:
215
+ return "input-label-normal";
216
+ }
217
+ }, J = (l) => {
218
+ switch (l) {
219
+ case "error":
220
+ return "input-helper-text-error";
221
+ case "good":
222
+ return "input-helper-text-good";
223
+ default:
224
+ return "input-helper-text-normal";
225
+ }
226
+ }, ce = K(function(l, h) {
227
+ const {
228
+ checked: p,
229
+ onChange: t,
230
+ name: r = "",
231
+ id: b = "",
232
+ label: A = "",
233
+ state: k = U.default,
234
+ containerClassName: v = "",
235
+ inputClassName: S = "",
236
+ labelClassName: x = "",
237
+ ...D
238
+ } = l;
239
+ return /* @__PURE__ */ T("label", { className: `input-check-container ${v}`, children: [
240
+ /* @__PURE__ */ a(
241
+ "input",
242
+ {
243
+ id: b,
244
+ ref: h,
245
+ name: r,
246
+ type: "checkbox",
247
+ checked: p,
248
+ onChange: t,
249
+ className: `input-check ${q(k)} ${S}`,
250
+ ...D
251
+ }
252
+ ),
253
+ /* @__PURE__ */ a(
254
+ "span",
255
+ {
256
+ className: `input-check-label ${_(k)} ${x}`,
257
+ children: A
258
+ }
259
+ )
260
+ ] });
261
+ }), G = (l) => l == null ? !1 : Array.isArray(l) ? l.length > 0 : `${l}`.length > 0, Q = K(function(l, h) {
262
+ const {
263
+ children: p,
264
+ state: t = U.default,
265
+ label: r = "",
266
+ containerClassName: b = "",
267
+ inputClassName: A = "",
268
+ labelClassName: k = "",
269
+ helperText: v = "",
270
+ helperTextClassName: S = "",
271
+ value: x,
272
+ defaultValue: D,
273
+ onChange: L,
274
+ onFocus: d,
275
+ onBlur: I,
276
+ ...u
277
+ } = l, m = x !== void 0, [f, g] = F(
278
+ () => G(D)
279
+ ), [C, y] = F(!1), o = m ? G(x) : f, i = !!u.placeholder || C, N = (s) => {
280
+ m || g(s.currentTarget.value.length > 0), L?.(s);
281
+ }, E = (s) => {
282
+ C || y(!0), d?.(s);
283
+ }, w = (s) => {
284
+ C || y(!0), I?.(s);
285
+ };
286
+ return /* @__PURE__ */ T("div", { className: `text-input-container ${b}`, children: [
287
+ /* @__PURE__ */ a(
288
+ "input",
289
+ {
290
+ ref: h,
291
+ defaultValue: D,
292
+ onChange: N,
293
+ onFocus: E,
294
+ onBlur: w,
295
+ ...m ? { value: x } : {},
296
+ className: `text-input ${q(t)} ${A} ${o ? "has-value" : ""} ${u.placeholder ? "has-placeholder" : ""} ${i ? "keep-label-up" : ""}`,
297
+ ...u
298
+ }
299
+ ),
300
+ !!r && /* @__PURE__ */ T(
301
+ "label",
302
+ {
303
+ htmlFor: u.id,
304
+ className: `text-input-label ${_(t)} ${k}`,
305
+ children: [
306
+ r,
307
+ u.required ? " *" : ""
308
+ ]
309
+ }
310
+ ),
311
+ p,
312
+ !!v && /* @__PURE__ */ a(
313
+ "p",
314
+ {
315
+ className: `text-input-helper-text ${J(t)} ${S}`,
316
+ children: v
317
+ }
318
+ )
319
+ ] });
320
+ }), ue = K(function(l, h) {
321
+ const {
322
+ value: p,
323
+ onChange: t,
324
+ options: r,
325
+ containerClassName: b = "",
326
+ inputClassName: A = "",
327
+ labelClassName: k = "",
328
+ helperText: v = "",
329
+ helperTextClassName: S = "",
330
+ label: x = "",
331
+ placeholder: D = "",
332
+ name: L = "",
333
+ id: d = "",
334
+ state: I = U.default,
335
+ native: u = !0,
336
+ disabled: m,
337
+ required: f,
338
+ autoFocus: g,
339
+ children: C,
340
+ ...y
341
+ } = l, o = W(null), [i, N] = F(!1), [E, w] = F(-1), s = j(
342
+ () => r.findIndex(
343
+ (e) => String(e.id) === String(p ?? r[0]?.id ?? "")
344
+ ),
345
+ [r, p]
346
+ ), R = j(
347
+ () => s >= 0 ? r[s] : void 0,
348
+ [r, s]
349
+ );
350
+ O(() => {
351
+ if (!(u || !i)) {
352
+ if (!r.length) {
353
+ w(-1);
354
+ return;
355
+ }
356
+ w(s >= 0 ? s : 0);
357
+ }
358
+ }, [u, r.length, s, i]), O(() => {
359
+ if (u) return;
360
+ const e = (n) => {
361
+ o.current && !o.current.contains(n.target) && N(!1);
362
+ };
363
+ return document.addEventListener("mousedown", e), () => {
364
+ document.removeEventListener("mousedown", e);
365
+ };
366
+ }, [u]);
367
+ const B = $(
368
+ (e) => {
369
+ h && (typeof h == "function" ? h(e) : h.current = e);
370
+ },
371
+ [h]
372
+ ), P = $(
373
+ (e) => {
374
+ if (!t) return;
375
+ const n = {
376
+ target: { value: String(e) },
377
+ currentTarget: { value: String(e) }
378
+ };
379
+ t(n);
380
+ },
381
+ [t]
382
+ ), H = $(
383
+ (e) => {
384
+ const n = r[e];
385
+ n && (P(n.id), N(!1));
386
+ },
387
+ [P, r]
388
+ ), V = $(
389
+ (e) => {
390
+ if (r.length) {
391
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
392
+ if (e.preventDefault(), !i) {
393
+ N(!0);
394
+ const n = s >= 0 ? s : 0;
395
+ w(n);
396
+ return;
397
+ }
398
+ w((n) => {
399
+ const c = n >= 0 ? n : s;
400
+ return e.key === "ArrowDown" ? (c + 1 + r.length) % r.length : (c - 1 + r.length) % r.length;
401
+ });
402
+ return;
403
+ }
404
+ if (e.key === "Enter") {
405
+ if (!i) {
406
+ e.preventDefault(), N(!0), w(s >= 0 ? s : 0);
407
+ return;
408
+ }
409
+ e.preventDefault(), H(E >= 0 ? E : 0);
410
+ return;
411
+ }
412
+ e.key === "Escape" && i && (e.preventDefault(), N(!1));
413
+ }
414
+ },
415
+ [E, r, H, s, i]
416
+ );
417
+ return u ? /* @__PURE__ */ T("div", { className: `select-input-container ${b}`, children: [
418
+ /* @__PURE__ */ a(
419
+ "select",
420
+ {
421
+ ...y,
422
+ id: d,
423
+ ref: B,
424
+ name: L,
425
+ value: p,
426
+ onChange: t,
427
+ className: `select-input ${q(I)} peer ${A}`,
428
+ children: r?.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.value ?? e.name ?? e.id }, e.id))
429
+ }
430
+ ),
431
+ /* @__PURE__ */ a(
432
+ "label",
433
+ {
434
+ htmlFor: d,
435
+ className: `select-input-label ${_(I)} ${k}`,
436
+ children: x
437
+ }
438
+ ),
439
+ C,
440
+ v && /* @__PURE__ */ a(
441
+ "p",
442
+ {
443
+ className: `select-input-helper-text ${J(I)} ${S}`,
444
+ children: v
445
+ }
446
+ )
447
+ ] }) : /* @__PURE__ */ T(
448
+ "div",
449
+ {
450
+ ref: o,
451
+ className: `select-input-container ${b}`,
452
+ children: [
453
+ /* @__PURE__ */ a(
454
+ "select",
455
+ {
456
+ ...y,
457
+ ref: B,
458
+ name: L,
459
+ id: d,
460
+ value: p,
461
+ onChange: t,
462
+ className: "select-input-native-hidden",
463
+ tabIndex: -1,
464
+ "aria-hidden": !0,
465
+ children: r?.map((e) => /* @__PURE__ */ a("option", { value: e.id, children: e.value ?? e.name ?? e.id }, e.id))
466
+ }
467
+ ),
468
+ /* @__PURE__ */ a(
469
+ Q,
470
+ {
471
+ id: d,
472
+ name: L,
473
+ state: I,
474
+ value: String(R?.value ?? R?.name ?? ""),
475
+ readOnly: !0,
476
+ label: x,
477
+ helperText: v,
478
+ containerClassName: "select-input-text-container",
479
+ inputClassName: `select-input-text ${A}`,
480
+ labelClassName: k,
481
+ helperTextClassName: S,
482
+ placeholder: D,
483
+ disabled: m,
484
+ required: f,
485
+ autoFocus: g,
486
+ onClick: () => N((e) => !e),
487
+ onKeyDown: V,
488
+ onFocus: () => N(!0),
489
+ role: "combobox",
490
+ "aria-expanded": i,
491
+ "aria-haspopup": "listbox",
492
+ children: C
493
+ }
494
+ ),
495
+ i && /* @__PURE__ */ a("ul", { className: "select-input-options-container", role: "listbox", children: r.map((e, n) => {
496
+ const c = String(e.id) === String(p);
497
+ return /* @__PURE__ */ a(
498
+ "li",
499
+ {
500
+ role: "option",
501
+ "aria-selected": c,
502
+ className: `select-input-option-item ${n === E ? "highlighted" : ""}`,
503
+ onMouseEnter: () => w(n),
504
+ onClick: (X) => {
505
+ H(n), X.stopPropagation();
506
+ },
507
+ children: e.value ?? e.name ?? e.id
508
+ },
509
+ e.id
510
+ );
511
+ }) })
512
+ ]
513
+ }
514
+ );
515
+ });
516
+ export {
517
+ ie as A,
518
+ ce as C,
519
+ ue as S,
520
+ Q as T,
521
+ U as a,
522
+ J as h,
523
+ q as i,
524
+ _ as l
525
+ };
@@ -0,0 +1 @@
1
+ var X=require("./SelectInput.css");const l=require("react/jsx-runtime"),r=require("react"),M=require("./Chip-D17UJHW6.cjs"),_=require("./IconButton-CVnmT2E9.cjs"),z=require("./Close-O9P7wJGf.cjs"),G=r.forwardRef(function(s,p){const{state:f,value:t,onChange:a,options:w=[],name:S="",id:j="",label:b="",containerClassName:$="",inputContainerClassName:k="",helperText:A="",placeholder:E="",multiple:h=!1,...I}=s,[d,m]=r.useState("");r.useEffect(()=>{if(!h&&t&&!Array.isArray(t)){m(String(t.value??t.name??""));return}m("")},[h,t]);const[g,x]=r.useState(!1),[C,N]=r.useState(-1),i=r.useMemo(()=>w.filter(e=>{const n=String(e.value??e.name).toLowerCase().includes(d?.toLowerCase());return Array.isArray(t)&&t.length?n&&!t.some(c=>c.id===e.id):t&&!Array.isArray(t)?n&&t.id!==e.id:n}),[w,t,d]);r.useEffect(()=>{if(!g||!i.length){N(-1);return}N(0)},[g,i]);const u=r.useRef(null),y=r.useRef(null),[D,v]=r.useState(!1),o=r.useRef(null);r.useEffect(()=>{const e=c=>{u.current&&!u.current.contains(c.target)&&x(!1)},n=c=>{c.key==="Escape"&&x(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",n)}},[]);const L=r.useCallback(e=>{m(e.target.value)},[]),R=r.useCallback(e=>{e?h?(m(""),Array.isArray(t)&&t.length?a([...t,e]):a([e])):(m(String(e.name??e.value??"")),a(e)):a(null),x(!1)},[h,a,t]),B=r.useCallback(e=>{if(!i.length){e.key==="Escape"&&x(!1);return}if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!g){x(!0),N(0);return}N(n=>{const c=n>=0?n:0;return e.key==="ArrowDown"?(c+1+i.length)%i.length:(c-1+i.length)%i.length});return}if(e.key==="Enter"&&g){e.preventDefault();const n=C>=0?C:0;R(i[n]);return}e.key==="Escape"&&g&&(e.preventDefault(),x(!1))},[R,C,g,i]),T=r.useCallback(e=>{if(!Array.isArray(t)){a(null);return}const n=t.filter((c,P)=>P!==e);n.length?a(n):a(null)},[a,t]),H=r.useCallback(()=>{Array.isArray(t)&&a([t[0]])},[a,t]);return r.useLayoutEffect(()=>{const e=o.current?.offsetWidth??0,n=u.current?.offsetWidth??0;v(e>n*.4)},[t]),l.jsxs("div",{className:`autocomplete-input-container ${$}`,ref:u,children:[l.jsxs("div",{className:"autocomplete-value-input-container",children:[l.jsx(K,{state:f,name:S,id:j,value:d,onChange:L,placeholder:E,helperText:A,onFocus:()=>x(!0),onKeyDown:B,label:b,containerClassName:`autocomplete-text-input ${k}`,ref:p??y,...I,children:!h&&t&&!Array.isArray(t)&&(t.value||t.name)&&l.jsx(_.IconButton,{icon:l.jsx(z.Close,{}),className:"autocomplete-delete-button",onClick:e=>{R(),e.stopPropagation()}})}),h&&Array.isArray(t)&&t.length?l.jsx("ul",{ref:o,className:"autocomplete-value-container",children:D?l.jsxs(l.Fragment,{children:[l.jsx("li",{children:l.jsx(M.Chip,{text:t[0]?.value??t[0]?.name,onDelete:e=>{T(0),e.stopPropagation()}})}),t.length>1&&l.jsx("li",{children:l.jsx(M.Chip,{text:`+${t.length-1}`,onDelete:e=>{H(),e.stopPropagation()}})})]}):t.map((e,n)=>l.jsx("li",{children:l.jsx(M.Chip,{text:String(e.value??e.name),onDelete:c=>{T(n),c.stopPropagation()}})},e.id??e.value??e.name))}):null]}),g&&l.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:u.current?.offsetWidth},children:i.map(e=>l.jsx("li",{className:`autocomplete-suggestion-item ${e.id===i[C]?.id?"highlighted":""}`,onMouseEnter:()=>N(i.findIndex(n=>n.id===e.id)),onClick:n=>{R(e),n.stopPropagation()},children:e.value??e.name},e.id??e.value??e.name))})]})});var F=(s=>(s.error="error",s.good="good",s.default="default",s))(F||{});const q=s=>{switch(s){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},O=s=>{switch(s){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},W=s=>{switch(s){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},J=r.forwardRef(function(s,p){const{checked:f,onChange:t,name:a="",id:w="",label:S="",state:j=F.default,containerClassName:b="",inputClassName:$="",labelClassName:k="",...A}=s;return l.jsxs("label",{className:`input-check-container ${b}`,children:[l.jsx("input",{id:w,ref:p,name:a,type:"checkbox",checked:f,onChange:t,className:`input-check ${q(j)} ${$}`,...A}),l.jsx("span",{className:`input-check-label ${O(j)} ${k}`,children:S})]})}),U=s=>s==null?!1:Array.isArray(s)?s.length>0:`${s}`.length>0,K=r.forwardRef(function(s,p){const{children:f,state:t=F.default,label:a="",containerClassName:w="",inputClassName:S="",labelClassName:j="",helperText:b="",helperTextClassName:$="",value:k,defaultValue:A,onChange:E,onFocus:h,onBlur:I,...d}=s,m=k!==void 0,[g,x]=r.useState(()=>U(A)),[C,N]=r.useState(!1),i=m?U(k):g,u=!!d.placeholder||C,y=o=>{m||x(o.currentTarget.value.length>0),E?.(o)},D=o=>{C||N(!0),h?.(o)},v=o=>{C||N(!0),I?.(o)};return l.jsxs("div",{className:`text-input-container ${w}`,children:[l.jsx("input",{ref:p,defaultValue:A,onChange:y,onFocus:D,onBlur:v,...m?{value:k}:{},className:`text-input ${q(t)} ${S} ${i?"has-value":""} ${d.placeholder?"has-placeholder":""} ${u?"keep-label-up":""}`,...d}),!!a&&l.jsxs("label",{htmlFor:d.id,className:`text-input-label ${O(t)} ${j}`,children:[a,d.required?" *":""]}),f,!!b&&l.jsx("p",{className:`text-input-helper-text ${W(t)} ${$}`,children:b})]})}),Q=r.forwardRef(function(s,p){const{value:f,onChange:t,options:a,containerClassName:w="",inputClassName:S="",labelClassName:j="",helperText:b="",helperTextClassName:$="",label:k="",placeholder:A="",name:E="",id:h="",state:I=F.default,native:d=!0,disabled:m,required:g,autoFocus:x,children:C,...N}=s,i=r.useRef(null),[u,y]=r.useState(!1),[D,v]=r.useState(-1),o=r.useMemo(()=>a.findIndex(e=>String(e.id)===String(f??a[0]?.id??"")),[a,f]),L=r.useMemo(()=>o>=0?a[o]:void 0,[a,o]);r.useEffect(()=>{if(!(d||!u)){if(!a.length){v(-1);return}v(o>=0?o:0)}},[d,a.length,o,u]),r.useEffect(()=>{if(d)return;const e=n=>{i.current&&!i.current.contains(n.target)&&y(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[d]);const R=r.useCallback(e=>{p&&(typeof p=="function"?p(e):p.current=e)},[p]),B=r.useCallback(e=>{if(!t)return;const n={target:{value:String(e)},currentTarget:{value:String(e)}};t(n)},[t]),T=r.useCallback(e=>{const n=a[e];n&&(B(n.id),y(!1))},[B,a]),H=r.useCallback(e=>{if(a.length){if(e.key==="ArrowDown"||e.key==="ArrowUp"){if(e.preventDefault(),!u){y(!0);const n=o>=0?o:0;v(n);return}v(n=>{const c=n>=0?n:o;return e.key==="ArrowDown"?(c+1+a.length)%a.length:(c-1+a.length)%a.length});return}if(e.key==="Enter"){if(!u){e.preventDefault(),y(!0),v(o>=0?o:0);return}e.preventDefault(),T(D>=0?D:0);return}e.key==="Escape"&&u&&(e.preventDefault(),y(!1))}},[D,a,T,o,u]);return d?l.jsxs("div",{className:`select-input-container ${w}`,children:[l.jsx("select",{...N,id:h,ref:R,name:E,value:f,onChange:t,className:`select-input ${q(I)} peer ${S}`,children:a?.map(e=>l.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),l.jsx("label",{htmlFor:h,className:`select-input-label ${O(I)} ${j}`,children:k}),C,b&&l.jsx("p",{className:`select-input-helper-text ${W(I)} ${$}`,children:b})]}):l.jsxs("div",{ref:i,className:`select-input-container ${w}`,children:[l.jsx("select",{...N,ref:R,name:E,id:h,value:f,onChange:t,className:"select-input-native-hidden",tabIndex:-1,"aria-hidden":!0,children:a?.map(e=>l.jsx("option",{value:e.id,children:e.value??e.name??e.id},e.id))}),l.jsx(K,{id:h,name:E,state:I,value:String(L?.value??L?.name??""),readOnly:!0,label:k,helperText:b,containerClassName:"select-input-text-container",inputClassName:`select-input-text ${S}`,labelClassName:j,helperTextClassName:$,placeholder:A,disabled:m,required:g,autoFocus:x,onClick:()=>y(e=>!e),onKeyDown:H,onFocus:()=>y(!0),role:"combobox","aria-expanded":u,"aria-haspopup":"listbox",children:C}),u&&l.jsx("ul",{className:"select-input-options-container",role:"listbox",children:a.map((e,n)=>{const c=String(e.id)===String(f),P=n===D;return l.jsx("li",{role:"option","aria-selected":c,className:`select-input-option-item ${P?"highlighted":""}`,onMouseEnter:()=>v(n),onClick:V=>{T(n),V.stopPropagation()},children:e.value??e.name??e.id},e.id)})})]})});exports.AutocompleteInput=G;exports.CheckInput=J;exports.SelectInput=Q;exports.State=F;exports.TextInput=K;exports.helperTextStateClassName=W;exports.inputStateClassName=q;exports.labelStateClassName=O;
@@ -1 +1 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.autocomplete-input-container{margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%}.autocomplete-value-input-container{width:100%;position:relative}.autocomplete-text-input{margin-bottom:calc(var(--spacing,.25rem) * 0)!important}.autocomplete-delete-button{top:50%;right:calc(var(--spacing,.25rem) * 2);--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y);justify-content:center;align-items:center;display:flex;position:absolute}.autocomplete-delete-button svg{height:calc(var(--spacing,.25rem) * 3);width:calc(var(--spacing,.25rem) * 3)}.autocomplete-suggestions-container{z-index:30;margin:calc(var(--spacing,.25rem) * 0);max-height:calc(var(--spacing,.25rem) * 44);width:100%;padding:calc(var(--spacing,.25rem) * 0);--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);position:absolute;overflow:auto}.autocomplete-suggestion-item{cursor:pointer;padding:calc(var(--spacing,.25rem) * 2)}.autocomplete-value-container{top:50%;right:calc(var(--spacing,.25rem) * 2);justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 2);flex-wrap:wrap;display:flex;position:absolute;transform:translateY(-50%)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-font-weight:initial}}}.input-check-container{align-items:center;display:flex}.input-check{border-style:var(--tw-border-style);border-width:1px;border-radius:.25rem}.input-check:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.input-check-label{margin-left:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.select-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.select-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.select-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.select-input-label{top:calc(var(--spacing,.25rem) * 3);z-index:-10;transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.select-input-label:is(:where(.peer):placeholder-shown~*){--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.select-input-label:is(:where(.peer):focus~*){--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}.select-input-label:where(:dir(rtl),[dir=rtl],[dir=rtl] *):is(:where(.peer):focus~*){--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.select-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.text-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.text-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.text-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.text-input-label{top:calc(var(--spacing,.25rem) * 3);transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.text-input:focus~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}[dir=rtl] .text-input.keep-label-up~.text-input-label,[dir=rtl] .text-input:focus~.text-input-label{--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.text-input.keep-label-up~.text-input-label,.text-input.has-placeholder~.text-input-label,.text-input.has-value~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}.text-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}.autocomplete-input-container{margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%}.autocomplete-value-input-container{width:100%;position:relative}.autocomplete-text-input{margin-bottom:calc(var(--spacing,.25rem) * 0)!important}.autocomplete-delete-button{top:50%;right:calc(var(--spacing,.25rem) * 2);--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y);justify-content:center;align-items:center;display:flex;position:absolute}.autocomplete-delete-button svg{height:calc(var(--spacing,.25rem) * 3);width:calc(var(--spacing,.25rem) * 3)}.autocomplete-suggestions-container{z-index:30;margin:calc(var(--spacing,.25rem) * 0);max-height:calc(var(--spacing,.25rem) * 44);width:100%;padding:calc(var(--spacing,.25rem) * 0);--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);position:absolute;overflow:auto}.autocomplete-suggestion-item{cursor:pointer;padding:calc(var(--spacing,.25rem) * 2)}.autocomplete-value-container{top:50%;right:calc(var(--spacing,.25rem) * 2);justify-content:flex-start;align-items:center;gap:calc(var(--spacing,.25rem) * 2);flex-wrap:wrap;display:flex;position:absolute;transform:translateY(-50%)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-font-weight:initial}}}.input-check-container{align-items:center;display:flex}.input-check{border-style:var(--tw-border-style);border-width:1px;border-radius:.25rem}.input-check:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.input-check-label{margin-left:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.select-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.select-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.select-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.select-input-label{top:calc(var(--spacing,.25rem) * 3);z-index:-10;transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.select-input-label:is(:where(.peer):placeholder-shown~*){--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.select-input-label:is(:where(.peer):focus~*){--tw-translate-y:calc(var(--spacing,.25rem) * -6);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}.select-input-label:where(:dir(rtl),[dir=rtl],[dir=rtl] *):is(:where(.peer):focus~*){--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.select-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}.select-input-native-hidden{pointer-events:none;height:calc(var(--spacing,.25rem) * 0);width:calc(var(--spacing,.25rem) * 0);opacity:0;position:absolute}.select-input-text-container{margin-bottom:calc(var(--spacing,.25rem) * 0)}.select-input-text{cursor:pointer}.select-input-options-container{z-index:30;margin:calc(var(--spacing,.25rem) * 0);max-height:calc(var(--spacing,.25rem) * 44);width:100%;padding:calc(var(--spacing,.25rem) * 0);--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);position:absolute;overflow:auto}.select-input-option-item{cursor:pointer;padding:calc(var(--spacing,.25rem) * 2)}@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-duration:initial;--tw-font-weight:initial}}}.text-input-container{z-index:0;margin-bottom:calc(var(--spacing,.25rem) * 5);width:100%;position:relative}.text-input{appearance:none;border-style:var(--tw-border-style);border-width:0;border-bottom-style:var(--tw-border-style);width:100%;padding-inline:calc(var(--spacing,.25rem) * 0);padding-block:calc(var(--spacing,.25rem) * 2.5);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));background-color:#0000;border-bottom-width:2px;display:block}.text-input:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-outline-style:none;outline-style:none}.text-input-label{top:calc(var(--spacing,.25rem) * 3);transform-origin:0;--tw-translate-y:calc(var(--spacing,.25rem) * 0);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y);transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)));--tw-duration:.3s;transition-duration:.3s;position:absolute}.text-input:focus~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}[dir=rtl] .text-input.keep-label-up~.text-input-label,[dir=rtl] .text-input:focus~.text-input-label{--tw-translate-x: 25% ;translate:var(--tw-translate-x) var(--tw-translate-y);left:auto}.text-input.keep-label-up~.text-input-label,.text-input.has-placeholder~.text-input-label,.text-input.has-value~.text-input-label{--tw-translate-y:calc(var(--spacing,.25rem) * -7);translate:var(--tw-translate-x) var(--tw-translate-y);--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x) var(--tw-scale-y);--tw-font-weight:var(--font-weight-medium,500);font-weight:var(--font-weight-medium,500);inset-inline-start:calc(var(--spacing,.25rem) * 0)}.text-input-helper-text{margin-top:calc(var(--spacing,.25rem) * 2);font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,calc(1.25 / .875)))}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}
@@ -3,7 +3,7 @@ import { jsxs as b, jsx as e, Fragment as q } from "react/jsx-runtime";
3
3
  import { useState as M, useRef as j, useEffect as I, useMemo as S, useCallback as x, Fragment as de } from "react";
4
4
  import { u as G, a as B, F as ue } from "./FiltersProvider-BV023mmu.js";
5
5
  import { E as pe, c as le, C as ae, T as me, a as he, b as fe, B as be, F as ge } from "./TableColumns-CIddkosX.js";
6
- import { C as ie, A as Ne, S as ee, T as Y } from "./TextInput-DPYxzgm3.js";
6
+ import { C as ie, A as Ne, S as ee, T as Y } from "./SelectInput-B0Ffd39D.js";
7
7
  import { u as P } from "./TableOptionsProvider-BgnISoXx.js";
8
8
  import { u as O } from "./TranslationProvider-BR4s--Vu.js";
9
9
  import { I as H } from "./IconButton-BpsTEj0z.js";
@@ -0,0 +1 @@
1
+ var Oe=require("./Table.css");const e=require("react/jsx-runtime"),r=require("react"),k=require("./FiltersProvider-DVMj0LV0.cjs"),O=require("./TableColumns-BjTNomZf.cjs"),P=require("./SelectInput-j7riQ8_P.cjs"),I=require("./TableOptionsProvider-i4uVLLwH.cjs"),A=require("./TranslationProvider-Czr0WIDH.cjs"),D=require("./IconButton-CVnmT2E9.cjs"),fe=require("./Badge-Z78MlGoQ.cjs"),z=require("./lib.cjs"),G=require("./Button-BlYa3uPc.cjs"),J=require("./Chip-D17UJHW6.cjs"),Y=require("./Tooltip-BSKAgRkc.cjs"),je=require("./query-81BrXp3i.cjs"),ge=require("./Dropdown-CR8mco5s.cjs"),Ce=require("./Loading-CNECRan-.cjs");function X(n){const{id:t,icon:a,tooltip:s,onClick:l,children:i,hidden:p=!1,disabled:c=!1,showText:u=!1,showTooltips:o=!0,className:m=""}=n;return p?null:e.jsxs("button",{type:"button",id:t,className:`action ${u?"text-action":"icon-action"} ${m}`,disabled:c,"aria-label":s,onClick:d=>{d.stopPropagation(),l?.()},"aria-disabled":c,"data-tooltip-id":"tooltip","data-tooltip-content":o?s:"",children:[a," ",u&&s,i]})}function Z(n){const{actions:t=[],className:a="",itemClassName:s="",actionClassName:l="",showTooltips:i=!0,showActionTexts:p=!1}=n;return e.jsx("ul",{className:`actions-container ${a}`,children:t.map(c=>e.jsx("li",{className:`actions-container-item ${s}`,children:e.jsx(X,{showTooltips:i,showText:p,className:l,...c})},c.id))})}const ee=n=>{const{actions:t=[],className:a=""}=n,{t:s}=A.useTranslation(),[l,i]=r.useState(!1),[p,c]=r.useState(null);return e.jsxs("div",{className:`actions-dropdown ${a}`,children:[e.jsx(D.IconButton,{icon:e.jsx(O.Ellipsis,{}),onClick:u=>{u.stopPropagation(),c(u.currentTarget),i(o=>!o)},onMouseDown:u=>u.stopPropagation(),className:"actions-dropdown-trigger","aria-label":s("_accessibility:buttons.openActions"),name:s("_accessibility:buttons.openActions"),"data-tooltip-id":"tooltip","data-tooltip-content":s("_accessibility:buttons.openActions")}),e.jsx(ge.Dropdown,{open:l,onClose:()=>i(!1),anchorEl:p,children:e.jsx(Z,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function K(n,t=[]){return[...n].sort((a,s)=>(s.pos??0)-(a.pos??0)).filter(a=>a.display!=="none"&&!t.includes(a.key))}function te(n){const{t}=A.useTranslation(),{entity:a="",columns:s=[],hasAction:l=!0,onSortCallback:i,selectionState:p,onToggleAllRows:c}=n,u=r.useRef(null);r.useEffect(()=>{u.current&&(u.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:o,sortingOrder:m,sortingBy:d,hiddenColumns:C}=I.useTableOptions(),x=r.useMemo(()=>K(s,C).map(b=>({id:b.key,label:b.label,renderHead:b.renderHead,className:b.className??"",sortable:b.sortable??!0,sortOptions:b.sortOptions})),[s,a,t,C]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:c?e.jsx("input",{type:"checkbox",ref:u,checked:p?.allSelected??!1,onChange:c,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),x.map(b=>e.jsx("th",{scope:"col",className:`table-headers-column ${b.className}`,children:e.jsxs(G.Button,{disabled:!b.sortable,onClick:()=>o(b.id,i),className:"table-headers-cell",children:[b.renderHead?b.renderHead():e.jsx("span",{className:"table-headers-label",children:b.label}),b.sortable&&d===b.id&&e.jsx("span",{children:m===je.SortOrder.ASC?b.sortOptions?.icons?.asc??e.jsx(O.ChevronUp,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"}):b.sortOptions?.icons?.desc??e.jsx(O.ChevronDown,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},b.id))]})})}function ne(n){const{columns:t}=n,{hiddenColumns:a,toggleColumn:s}=I.useTableOptions(),{t:l}=A.useTranslation(),[i,p]=r.useState(!1),c=r.useRef(null),u=r.useMemo(()=>K(t.filter(d=>d.hideable!==!1&&d.display!=="none"),[]),[t]),o=r.useCallback(()=>{p(d=>!d)},[]),m=r.useCallback(d=>{s(d)},[s]);return u.length===0?null:e.jsxs("div",{className:"column-visibility-menu",ref:c,children:[e.jsx(D.IconButton,{icon:e.jsx(O.TableColumns,{className:"column-visibility-icon"}),className:"normal column-visibility-trigger","aria-haspopup":"true","aria-expanded":i,onClick:o,children:e.jsx("span",{className:"table-header-sr",children:l("_accessibility:buttons.columns")})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-visibility-backdrop",onClick:()=>p(!1)}),e.jsx("div",{className:"column-visibility-dropdown",role:"menu",children:u.map(d=>e.jsx(P.CheckInput,{checked:!a.includes(d.key),onChange:()=>m(d.key),label:d.label??d.key,containerClassName:"column-visibility-item"},d.key))})]})]})}const se=n=>{const{items:t,text:a,id:s,onClearFilter:l}=n;return e.jsx(J.Chip,{text:`${a}: ${t.map(i=>i.value??i.name).join(", ")}`,onDelete:()=>l(s)})},le=n=>{const{end:t,start:a,text:s,id:l,onClearFilter:i}=n,p=c=>c!==null&&typeof c<"u"&&c!=="";return e.jsx(J.Chip,{text:`${s}: ${p(a)?a:"♾️"} - ${p(t)?t:"♾️"}`,onDelete:()=>i(l)})},Ne=n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&("start"in n||"end"in n),ae=n=>{const{filtersDefinition:t}=n,a=r.useMemo(()=>{const c={};return t.forEach(u=>{c[u.propertyName]=u.label??u.propertyName}),c},[t]),{filters:s,clearFilters:l}=I.useTableOptions(),i=r.useMemo(()=>Object.keys(s),[s]),p=r.useCallback(c=>{const u=s[c];return Ne(u)?e.jsx(le,{id:c,text:a[c],start:u.start,end:u.end,onClearFilter:l}):Array.isArray(u)?e.jsx(se,{id:c,text:a[c],items:u,onClearFilter:l}):e.jsx(J.Chip,{text:`${a[c]}: ${u?.value??u?.name??u}`,onDelete:()=>l(c)})},[s,a,l]);return e.jsx("ul",{className:"active-filters-main",children:i?.map(c=>e.jsx("li",{children:p(c)},c))})};function ye(n){const{propertyName:t,label:a,placeholder:s,options:l,multiple:i=!0}=n,{currentFilters:p,setCurrentFilters:c}=k.useFilters(),u=r.useMemo(()=>{const m=p[t]?.value;return typeof m>"u"?null:m},[p,t]),o=r.useCallback(m=>{c({type:k.FiltersActions.update,toUpdate:{[t]:{value:m}}})},[t,c]);return e.jsx(P.AutocompleteInput,{value:u,label:a,options:l,multiple:i,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:o,placeholder:s})}const ve=n=>{const{propertyName:t,label:a}=n,{currentFilters:s,setCurrentFilters:l}=k.useFilters(),i=r.useMemo(()=>s[t]?.value??"",[s]),p=r.useCallback(c=>{l({type:k.FiltersActions.update,toUpdate:{[t]:{value:c.target.checked}}})},[]);return e.jsx(P.CheckInput,{label:a,checked:i??!1,onChange:p})};function we(n){const{propertyName:t,options:a,label:s,placeholder:l}=n,{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useMemo(()=>{const o=i[t]?.value;if(o===null||typeof o>"u")return a[0]?.id??"";if(typeof o=="object"&&!Array.isArray(o)){const m=o;return m.id??m.value??""}return o},[i,a,t]),u=r.useCallback(o=>{const m=a.find(d=>String(d.id)===o.target.value);p({type:k.FiltersActions.update,toUpdate:{[t]:{value:m?.id??o.target.value}}})},[a,t,p]);return e.jsx(P.SelectInput,{value:c,label:s,options:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u,placeholder:l})}const Te=n=>{const{propertyName:t,label:a,placeholder:s}=n,{currentFilters:l,setCurrentFilters:i}=k.useFilters(),p=r.useMemo(()=>l[t]?.value??"",[l]),c=r.useCallback(u=>{i({type:k.FiltersActions.update,toUpdate:{[t]:{value:u.target.value}}})},[]);return e.jsx(P.TextInput,{value:p??"",label:a,onChange:c,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:s})},Q=n=>{const{propertyName:t,label:a,inputType:s}=n,{t:l}=A.useTranslation(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useRef(null),u=r.useRef(null),o=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{end:u?.current?.value??null,start:d.target.value}}}})},[]),m=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{start:c?.current?.value??null,end:d.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:a}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(P.TextInput,{value:i[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:s,ref:c,onChange:o,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(P.TextInput,{value:i[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:s,ref:u,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},ie=n=>{switch(n.type){case z.FilterTypes.text:return e.jsx(Te,{...n});case z.FilterTypes.number:return e.jsx(Q,{...n,inputType:"number"});case z.FilterTypes.date:return e.jsx(Q,{...n,inputType:"date"});case z.FilterTypes.select:return e.jsx(we,{...n});case z.FilterTypes.autocomplete:return e.jsx(ye,{...n});case z.FilterTypes.check:return e.jsx(ve,{...n})}return e.jsx(e.Fragment,{})},re=n=>{const{filters:t=[],show:a,handleShow:s}=n,{onFilterApply:l}=I.useTableOptions(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),{t:c}=A.useTranslation(),u=r.useRef(null);return r.useEffect(()=>{const o=({target:d})=>{u.current&&(d?.closest(".filter-dropdown-trigger")||!a||u.current.contains(d)||s(!1))},m=({code:d})=>{!a||d!=="Escape"||s(!1)};return document.addEventListener("click",o),document.addEventListener("keydown",m),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",m)}},[s,a]),e.jsx("div",{className:`filter-dropdown-backdrop ${a?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:u,children:[e.jsx("div",{className:"filter-title",children:c("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(o=>e.jsx("li",{className:"filter-container-item",children:ie(o)},o.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",onClick:()=>p({type:k.FiltersActions.reset,filters:t}),className:"filter-dropdown-button filter-dropdown-cancel",children:c("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",color:"primary",className:"filter-dropdown-button filter-dropdown-submit",onClick:()=>{s(!1),l(i)},children:c("_accessibility:buttons.applyFilters")})})]})})]})})},oe=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,pageSizes:s,currentPage:l}=I.useTableOptions(),i=(l+1)*a>t?t:(l+1)*a;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*a+1," - ",i," ",n("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function Se(){const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=r.useMemo(()=>{const p=Math.ceil(t/a);return Array.from({length:p},(c,u)=>({id:u,value:u+1}))},[t,a]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:n("_accessibility:components.table.jumpToPage")}),e.jsx(P.SelectInput,{value:s,options:i,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ce=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=Math.ceil(t/a),p=s<i-1;return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(D.IconButton,{icon:e.jsx(O.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:s===0,"aria-label":n("_accessibility:buttons.previous"),name:n("_accessibility:buttons.previous"),onClick:()=>l(s-1)}),e.jsx(D.IconButton,{icon:e.jsx(O.ChevronRight,{className:"table-navigation-icon"}),disabled:!p,className:"table-navigation-buttons",name:n("_accessibility:buttons.next"),"aria-label":n("_accessibility:buttons.next"),onClick:()=>{p&&l(s+1)}})]})};function ue(){const{t:n}=A.useTranslation(),{pageSizes:t,pageSize:a,setPageSize:s}=I.useTableOptions(),l=r.useMemo(()=>t?.map(i=>({id:i,value:i})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:n("_accessibility:components.table.pageSizes")}),e.jsx(P.SelectInput,{value:a,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:i=>s(Number(i.target.value))})]})}function de(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(Se,{}),e.jsx(ue,{}),e.jsx(oe,{}),e.jsx(ce,{})]})}const ke=n=>n,pe=n=>{const{t}=A.useTranslation(),{hiddenColumns:a}=I.useTableOptions(),{columns:s,softDeleteProperty:l="deletedAt",data:i,actions:p,selectedRows:c,expandedRows:u=[],onRowSelectionChange:o,onRowExpand:m}=n,d=r.useMemo(()=>K(s,a),[s,a]),C=r.useMemo(()=>new Map(u.map(x=>[x.rowId,x])),[u]);return i?.map(x=>{const b=c.has(x.id),y=C.get(x.id),R=!!y,_=d.length+1+(p?1:0);return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{className:`table-row ${m?"expandable":""} ${x[l]?"deleted-class":""} ${b?"selected":""} ${R?"expanded":""}`,onClick:()=>m?.(x),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:b,onClick:v=>v.stopPropagation(),onChange:()=>o(x),"aria-label":t("_accessibility:components.table.selectRow")})}),p?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const v=p(x).filter(g=>!g.hidden),j=v.filter(g=>g.sticky),w=v.filter(g=>!g.sticky);return e.jsxs(e.Fragment,{children:[j.map(g=>e.jsx(Y.Tooltip,{content:g.tooltip,children:e.jsx(X,{...g,onClick:()=>g.onClick(x),className:"row-table-action"})},g.id)),w.length>0&&e.jsx(ee,{actions:w})]})})()})}):null,d?.map((v,j)=>{const w=x[v.key],g=v.renderBody?v.renderBody(w,x):ke(w);return e.jsx("td",{className:`table-row-cell ${j===0?"basic":""} ${v.className??""}`,children:m&&j===0?e.jsxs("div",{className:"table-row-expand-content",children:[e.jsx("span",{className:"table-row-expand-indicator","aria-hidden":!0,"data-state":R?"expanded":"collapsed",children:R?e.jsx(O.ChevronUp,{className:"table-row-expand-chevron"}):e.jsx(O.ChevronDown,{className:"table-row-expand-chevron"})}),e.jsx("div",{className:"table-row-expand-value",children:g})]}):g},v.key)})]}),R&&y?.content!==null&&typeof y?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:_,children:e.jsx("div",{className:`table-row-expanded-content ${y.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:y.content})})})})]},x.id)})};function me(){const{t:n}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:n("_accessibility:components.table.empty")})})}const he=n=>{const{columns:t,title:a,isLoading:s,toolbar:l,filterOptions:i,canHideColumns:p=!1,canReset:c=!1}=n,{countOfFilters:u,resetTableOptions:o}=I.useTableOptions(),{t:m}=A.useTranslation(),d=r.useMemo(()=>t?[...t].sort((j,w)=>(w.pos??0)-(j.pos??0)).filter(j=>!!j.filterOptions).map(j=>({...j.filterOptions,label:j.filterOptions?.label??j.label,propertyName:j.key})):[],[t]),[C,x]=r.useState(!1),b=r.useCallback(j=>{i?.dropdown?.setOpened?i.dropdown.setOpened(j??!1):x(j??!1)},[i]),y=r.useMemo(()=>i?.dropdown?.opened??C,[i,C]),R=d.length>0,_=R&&i?.button?.hide!==!0,v=R&&y;return e.jsxs("div",{className:`table-header ${v?"showing-filters":""}`,children:[e.jsxs("div",{children:[a&&e.jsx("h1",{className:"table-header-title",children:a}),s?null:e.jsxs("div",{className:"table-header-content",children:[l,p&&t&&e.jsx(ne,{columns:t}),c&&e.jsx(D.IconButton,{icon:e.jsx(O.BarsStaggered,{className:"reset-table-icon"}),className:"normal",onClick:o,children:e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.reset")})}),_&&e.jsxs(D.IconButton,{icon:i?.button?.icon??e.jsx(O.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>b(!y),"aria-expanded":y,children:[e.jsx(fe.Badge,{count:u,className:`${u>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),R&&e.jsx(re,{filters:d,show:v,handleShow:b,options:i}),e.jsx(ae,{filtersDefinition:d})]})};function be({count:n,multiActions:t,onActionClick:a}){const{t:s}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:s("_accessibility:components.table.selectedCount",{count:n})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(Y.Tooltip,{content:l.tooltip,children:e.jsx(D.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>a(l),disabled:l.disabled,"aria-label":l.tooltip})},l.id))})]})}const W=220;function Re({data:n,allowMultipleExpandedRows:t,controlledExpandedRowId:a,onExpandedRowChange:s,onRowExpand:l,findRowById:i}){const[p,c]=r.useState(null),[u,o]=r.useState(null),[m,d]=r.useState(null),[C,x]=r.useState(null),[b,y]=r.useState(!1),[R,_]=r.useState(new Set),[v,j]=r.useState([]),w=r.useRef(null),g=r.useRef(null),q=r.useRef(new Map),E=typeof a<"u",M=t&&!E,T=E?a??null:p,V=r.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),F=r.useCallback(h=>{if(typeof h<"u"){const f=q.current.get(h);if(!f)return;clearTimeout(f),q.current.delete(h);return}q.current.forEach(f=>clearTimeout(f)),q.current.clear()},[]),L=r.useCallback(h=>{F(h),j(f=>f.some(S=>S.rowId===h)?f.map(S=>S.rowId===h?{...S,isVisible:!1}:S):f),q.current.set(h,setTimeout(()=>{j(f=>f.filter(N=>N.rowId!==h)),q.current.delete(h)},W))},[F]),U=r.useCallback((h,f)=>{F(h),j(N=>N.some($=>$.rowId===h)?N.map($=>$.rowId===h?{...$,content:f,isVisible:!1}:$):[...N,{rowId:h,content:f,isVisible:!1}]),requestAnimationFrame(()=>{j(N=>N.map(S=>S.rowId===h?{...S,isVisible:!0}:S))})},[F]);r.useEffect(()=>{if(!M)return;const h=new Set(n.map(f=>f.id));_(f=>{const N=new Set;return f.forEach(S=>{if(h.has(S)){N.add(S);return}F(S)}),N}),j(f=>(f.forEach(N=>{h.has(N.rowId)||F(N.rowId)}),f.filter(N=>h.has(N.rowId))))},[n,M,F]),r.useEffect(()=>{if(M)return;if(T===null){o(null),E&&(w.current=null);return}i(T)||(E||c(null),o(null),E&&(w.current=null))},[n,T,i,E,M]),r.useEffect(()=>{if(!M){if(V(),T===null||u===null){if(m===null){y(!1),x(null);return}y(!1),g.current=setTimeout(()=>{d(null),x(null),g.current=null},W);return}if(m===null){d(T),x(u),requestAnimationFrame(()=>y(!0));return}if(m===T){x(u),requestAnimationFrame(()=>y(!0));return}y(!1),g.current=setTimeout(()=>{d(T),x(u),requestAnimationFrame(()=>y(!0)),g.current=null},W)}},[V,u,T,M,m]),r.useEffect(()=>()=>{V(),F()},[V,F]),r.useEffect(()=>{if(!E)return;if(T===null){o(null),w.current=null;return}const h=i(T);if(!h){o(null),w.current=null;return}const f=w.current;o(l?.(h,f)??null),w.current=h},[T,i,E,l]);const xe=r.useCallback(h=>{if(M){if(R.has(h.id)){_(H=>{const B=new Set(H);return B.delete(h.id),B}),L(h.id),s?.(null,h);return}_(H=>{const B=new Set(H);return B.add(h.id),B});const $=l?.(h,null)??null;$!==null&&typeof $<"u"?U(h.id,$):(F(h.id),j(H=>H.filter(B=>B.rowId!==h.id))),s?.(h,null);return}const f=T===h.id,N=f?h:i(T);if(E){s?.(f?null:h,N);return}if(f){c(null),o(null),s?.(null,h);return}c(h.id),o(l?.(h,N)??null),s?.(h,N)},[T,L,F,U,i,R,E,M,s,l]);return{expandedRowsToRender:r.useMemo(()=>M?v:m===null||C===null||typeof C>"u"?[]:[{rowId:m,content:C,isVisible:b}],[b,M,C,m,v]),onRowExpandChange:xe}}function Fe({actions:n,selectedRowsData:t}){const a=r.useMemo(()=>!n||!t.length?[]:t.reduce((l,i,p)=>{const c=n(i).filter(o=>o.multiple&&!o.hidden);if(p===0)return c;const u=new Map(l.map(o=>[o.id,o]));return c.reduce((o,m)=>{const d=u.get(m.id);return d&&o.push({...d,...m,disabled:m.disabled||d.disabled}),o},[])},[]),[n,t]),s=r.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(i=>l.onClick(i))}},[t]);return{multiActions:a,handleMultipleActionClick:s}}function Ae({data:n,onRowSelect:t,onSelectedRowsChange:a}){const[s,l]=r.useState(new Set),i=r.useMemo(()=>n?.filter(o=>s.has(o.id))??[],[n,s]);r.useEffect(()=>{if(!n?.length){l(new Set);return}l(o=>{const m=new Set,d=new Set(n.map(C=>C.id));return o.forEach(C=>{d.has(C)&&m.add(C)}),m})},[n]),r.useEffect(()=>{a&&a(i)},[i,a]);const p=r.useCallback(o=>{l(m=>{const d=new Set(m);return d.has(o.id)?(d.delete(o.id),t?.(o,!1)):(d.add(o.id),t?.(o,!0)),d})},[t]),c=r.useCallback(()=>{l(o=>{const m=new Set(o),d=n??[],C=d.every(x=>m.has(x.id));return d.forEach(x=>{const b=m.has(x.id);C?b&&(m.delete(x.id),t?.(x,!1)):b||(m.add(x.id),t?.(x,!0))}),m})},[n,t]),u=r.useMemo(()=>{if(!n?.length)return{allSelected:!1,hasSomeSelected:!1};const o=n.every(d=>s.has(d.id)),m=n.some(d=>s.has(d.id));return{allSelected:o,hasSomeSelected:m}},[n,s]);return{selectedRows:s,selectedRowsData:i,selectionState:u,onRowSelectionChange:p,onToggleAllRows:c}}function Ee(n){const{data:t,onSort:a,entity:s="",isLoading:l=!1,actions:i,columns:p=[],contentClassName:c="",className:u="",softDeleteProperty:o="deletedAt",onRowSelect:m,onSelectedRowsChange:d,allowMultipleExpandedRows:C=!1,expandedRowId:x,onExpandedRowChange:b,onRowExpand:y,...R}=n,_=r.useMemo(()=>!t?.length,[t]),v=r.useCallback(L=>L===null?null:t.find(U=>U.id===L)??null,[t]),{selectedRows:j,selectedRowsData:w,selectionState:g,onRowSelectionChange:q,onToggleAllRows:E}=Ae({data:t,onRowSelect:m,onSelectedRowsChange:d}),{expandedRowsToRender:M,onRowExpandChange:T}=Re({data:t,allowMultipleExpandedRows:C,controlledExpandedRowId:x,onExpandedRowChange:b,onRowExpand:y,findRowById:v}),{multiActions:V,handleMultipleActionClick:F}=Fe({actions:i,selectedRowsData:w});return e.jsx(k.FiltersProvider,{children:e.jsxs("div",{className:`${u} table-main`,children:[e.jsx(he,{columns:p,isLoading:l,...R}),l?e.jsx(Ce.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:_?e.jsx(me,{}):e.jsxs(e.Fragment,{children:[!!w.length&&e.jsx(be,{count:w.length,multiActions:V,onActionClick:F}),e.jsx("div",{className:`${c} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(te,{entity:s,columns:p,onSortCallback:a,hasAction:!!i,selectionState:g,onToggleAllRows:E}),e.jsx("tbody",{children:e.jsx(pe,{data:t,actions:i,columns:p,softDeleteProperty:o,selectedRows:j,expandedRows:M,onRowSelectionChange:q,onRowExpand:y?T:void 0})})]})}),e.jsx(de,{})]})})]})})}exports.Action=X;exports.Actions=Z;exports.ActionsDropdown=ee;exports.ActiveFilters=ae;exports.ArrayChip=se;exports.ColumnVisibilityMenu=ne;exports.Columns=te;exports.CountOfTotal=oe;exports.FilterDropdown=re;exports.Footer=de;exports.Navigation=ce;exports.PageSize=ue;exports.RangeChip=le;exports.Rows=pe;exports.Table=Ee;exports.TableEmpty=me;exports.TableHeader=he;exports.TableSelectionBar=be;exports.renderFilterComponent=ie;
package/dist/Table.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-CWcHaZeQ.cjs");exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Table-BnZYZLy_.cjs");exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;
package/dist/Table.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, b as o, a as i, C as r, c as t, F as l, d as n, N as C, P as b, R as p, e as T, h as m, T as F, f as d, g, r as u } from "./Table-LcN-UV8f.js";
1
+ import { A as s, b as o, a as i, C as r, c as t, F as l, d as n, N as C, P as b, R as p, e as T, h as m, T as F, f as d, g, r as u } from "./Table-B_Jbnu1-.js";
2
2
  export {
3
3
  s as ActiveFilters,
4
4
  o as ArrayChip,
@@ -7,4 +7,5 @@ export type Option = {
7
7
  };
8
8
  export interface SelectInputPropsType extends Omit<HTMLProps<HTMLSelectElement>, "value" | "label">, BaseInputPropsType<string | number | readonly string[] | undefined> {
9
9
  options: Option[];
10
+ native?: boolean;
10
11
  }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var h=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./lib.cjs"),s=require("./query-81BrXp3i.cjs"),e=require("./Table-CWcHaZeQ.cjs"),a=require("./Badge-Z78MlGoQ.cjs"),u=require("./Button-BlYa3uPc.cjs"),p=require("./Chip-D17UJHW6.cjs"),c=require("./Dropdown-CR8mco5s.cjs"),t=require("./TextInput-C27RFuya.cjs"),C=require("./FileInput-CqzVk1gQ.cjs"),T=require("./IconButton-CVnmT2E9.cjs"),d=require("./Loading-CNECRan-.cjs"),r=require("./TableColumns-BjTNomZf.cjs"),F=require("./Close-O9P7wJGf.cjs"),b=require("./File-_Hjw2d3F.cjs"),v=require("./Tooltip-BSKAgRkc.cjs"),o=require("./FiltersProvider-DVMj0LV0.cjs"),i=require("./TableOptionsProvider-i4uVLLwH.cjs"),n=require("./TranslationProvider-Czr0WIDH.cjs");exports.FilterTypes=l.FilterTypes;exports.SortOrder=s.SortOrder;exports.Action=e.Action;exports.Actions=e.Actions;exports.ActionsDropdown=e.ActionsDropdown;exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;exports.Badge=a.Badge;exports.Button=u.Button;exports.Chip=p.Chip;exports.Dropdown=c.Dropdown;exports.AutocompleteInput=t.AutocompleteInput;exports.CheckInput=t.CheckInput;exports.SelectInput=t.SelectInput;exports.State=t.State;exports.TextInput=t.TextInput;exports.helperTextStateClassName=t.helperTextStateClassName;exports.inputStateClassName=t.inputStateClassName;exports.labelStateClassName=t.labelStateClassName;exports.FileInput=C.FileInput;exports.IconButton=T.IconButton;exports.Loading=d.Loading;exports.BarsStaggered=r.BarsStaggered;exports.ChevronDown=r.ChevronDown;exports.ChevronLeft=r.ChevronLeft;exports.ChevronRight=r.ChevronRight;exports.ChevronUp=r.ChevronUp;exports.Ellipsis=r.Ellipsis;exports.Filters=r.Filters;exports.TableColumns=r.TableColumns;exports.Close=F.Close;exports.File=b.File;exports.Tooltip=v.Tooltip;exports.FiltersActions=o.FiltersActions;exports.FiltersProvider=o.FiltersProvider;exports.filtersReducer=o.filtersReducer;exports.initializer=o.initializer;exports.useFilters=o.useFilters;exports.TableOptionsProvider=i.TableOptionsProvider;exports.useTableOptions=i.useTableOptions;exports.TranslationProvider=n.TranslationProvider;exports.useTranslation=n.useTranslation;
1
+ var h=require("./index.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./lib.cjs"),s=require("./query-81BrXp3i.cjs"),e=require("./Table-BnZYZLy_.cjs"),a=require("./Badge-Z78MlGoQ.cjs"),u=require("./Button-BlYa3uPc.cjs"),p=require("./Chip-D17UJHW6.cjs"),c=require("./Dropdown-CR8mco5s.cjs"),t=require("./SelectInput-j7riQ8_P.cjs"),C=require("./FileInput-CqzVk1gQ.cjs"),d=require("./IconButton-CVnmT2E9.cjs"),T=require("./Loading-CNECRan-.cjs"),r=require("./TableColumns-BjTNomZf.cjs"),F=require("./Close-O9P7wJGf.cjs"),b=require("./File-_Hjw2d3F.cjs"),v=require("./Tooltip-BSKAgRkc.cjs"),o=require("./FiltersProvider-DVMj0LV0.cjs"),i=require("./TableOptionsProvider-i4uVLLwH.cjs"),n=require("./TranslationProvider-Czr0WIDH.cjs");exports.FilterTypes=l.FilterTypes;exports.SortOrder=s.SortOrder;exports.Action=e.Action;exports.Actions=e.Actions;exports.ActionsDropdown=e.ActionsDropdown;exports.ActiveFilters=e.ActiveFilters;exports.ArrayChip=e.ArrayChip;exports.ColumnVisibilityMenu=e.ColumnVisibilityMenu;exports.Columns=e.Columns;exports.CountOfTotal=e.CountOfTotal;exports.FilterDropdown=e.FilterDropdown;exports.Footer=e.Footer;exports.Navigation=e.Navigation;exports.PageSize=e.PageSize;exports.RangeChip=e.RangeChip;exports.Rows=e.Rows;exports.Table=e.Table;exports.TableEmpty=e.TableEmpty;exports.TableHeader=e.TableHeader;exports.TableSelectionBar=e.TableSelectionBar;exports.renderFilterComponent=e.renderFilterComponent;exports.Badge=a.Badge;exports.Button=u.Button;exports.Chip=p.Chip;exports.Dropdown=c.Dropdown;exports.AutocompleteInput=t.AutocompleteInput;exports.CheckInput=t.CheckInput;exports.SelectInput=t.SelectInput;exports.State=t.State;exports.TextInput=t.TextInput;exports.helperTextStateClassName=t.helperTextStateClassName;exports.inputStateClassName=t.inputStateClassName;exports.labelStateClassName=t.labelStateClassName;exports.FileInput=C.FileInput;exports.IconButton=d.IconButton;exports.Loading=T.Loading;exports.BarsStaggered=r.BarsStaggered;exports.ChevronDown=r.ChevronDown;exports.ChevronLeft=r.ChevronLeft;exports.ChevronRight=r.ChevronRight;exports.ChevronUp=r.ChevronUp;exports.Ellipsis=r.Ellipsis;exports.Filters=r.Filters;exports.TableColumns=r.TableColumns;exports.Close=F.Close;exports.File=b.File;exports.Tooltip=v.Tooltip;exports.FiltersActions=o.FiltersActions;exports.FiltersProvider=o.FiltersProvider;exports.filtersReducer=o.filtersReducer;exports.initializer=o.initializer;exports.useFilters=o.useFilters;exports.TableOptionsProvider=i.TableOptionsProvider;exports.useTableOptions=i.useTableOptions;exports.TranslationProvider=n.TranslationProvider;exports.useTranslation=n.useTranslation;
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-500:oklch(72.3% .219 149.579);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-500:oklch(58.5% .233 277.117);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#041e42;--color-bg-primary:#021327;--color-hover-primary:#0a2f66;--color-secondary:#cd212a;--color-bg-secondary:#8f151b;--color-hover-secondary:#e03a42;--color-tertiary:#00997b;--color-bg-tertiary:#006654;--color-hover-tertiary:#1ab89a;--color-quaternary:#d7942e;--color-bg-quaternary:#9e6a1f;--color-hover-quaternary:#ebb04a;--color-base-dark:#e6e6e6;--color-base:#f2f2f2;--color-base-light:#fff;--color-text:#0d0d0d;--color-border:#ccc;--color-text-muted:#4d4d4d;--color-bg-info:#0070ba;--color-info:#fbfbfb;--color-bg-success:#1d9a5b;--color-success:#fbfbfb;--color-bg-warning:orange;--color-warning:#000;--color-bg-error:#c14444;--color-error:#fbfbfb;--breakpoint-xs:28rem}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.z-10{z-index:10}.z-20{z-index:20}.container{width:100%}@media(min-width:28rem){.container{max-width:28rem}}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing) * 2)}.\!hidden{display:none!important}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.table-row{display:table-row}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-20{height:calc(var(--spacing) * 20)}.max-h-\[70vh\]{max-height:70vh}.min-h-44{min-height:calc(var(--spacing) * 44)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-sm{max-width:var(--container-sm)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-56{min-width:calc(var(--spacing) * 56)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-border{border-color:var(--color-border)}.bg-base{background-color:var(--color-base)}.bg-base-dark\/60{background-color:#e6e6e699}@supports (color:color-mix(in lab,red,red)){.bg-base-dark\/60{background-color:color-mix(in oklab,var(--color-base-dark) 60%,transparent)}}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.from-primary\/8{--tw-gradient-from:#041e4214}@supports (color:color-mix(in lab,red,red)){.from-primary\/8{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 8%, transparent)}}.from-primary\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-secondary\/8{--tw-gradient-to:#cd212a14}@supports (color:color-mix(in lab,red,red)){.to-secondary\/8{--tw-gradient-to:color-mix(in oklab, var(--color-secondary) 8%, transparent)}}.to-secondary\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.stroke-blue-800{stroke:var(--color-blue-800)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-blue-500{color:var(--color-blue-500)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-green-500{color:var(--color-green-500)}.text-indigo-500{color:var(--color-indigo-500)}.text-red-500{color:var(--color-red-500)}.text-sky-500{color:var(--color-sky-500)}.text-text{color:var(--color-text)}.text-text-muted{color:var(--color-text-muted)}.capitalize{text-transform:capitalize}.underline{text-decoration-line:underline}.opacity-70{opacity:.7}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.input-error{border-color:var(--color-bg-error,#c14444);color:var(--color-bg-error,#c14444)}.input-error:focus{border-color:var(--color-bg-error,#c14444)}.input-good{border-color:var(--color-bg-success,#1d9a5b);color:var(--color-bg-success,#1d9a5b)}.input-good:focus{border-color:var(--color-bg-success,#1d9a5b)}.input-normal{border-color:var(--color-border,#ccc);color:var(--color-text,#0d0d0d)}.input-normal:focus{border-color:var(--color-primary,#041e42)}.input-label-error{color:var(--color-secondary,#cd212a)}.input-label-good{color:var(--color-bg-success,#1d9a5b)}.input-label-normal{color:var(--color-text-muted,#4d4d4d)}.input-label-normal:is(:where(.peer):focus~*){color:var(--color-primary,#041e42)}.input-helper-text-error{color:var(--color-bg-error,#c14444)}.input-helper-text-good{color:var(--color-bg-success,#1d9a5b)}.input-helper-text-normal{color:var(--color-text-muted,#4d4d4d)}.autocomplete-suggestions-container{background-color:var(--color-base-light,#fff)}.autocomplete-suggestion-item:hover{background-color:var(--color-base-dark,#e6e6e6)}.autocomplete-delete-button{color:var(--color-text,#0d0d0d)}@media(hover:hover){.autocomplete-delete-button:hover{color:var(--color-secondary,#cd212a)}}.chip-main{background-color:var(--color-base-dark,#e6e6e6);color:var(--color-text,#0d0d0d)}.chip-delete-button:hover{color:var(--color-secondary,#cd212a)}.badge-main{background-color:var(--color-bg-error,#c14444);color:var(--color-error,#fbfbfb)}.table-loading{background-color:var(--color-base-light,#fff)}.table-row{border-bottom-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff)}.table-headers-row{background-color:var(--color-base,#f2f2f2);color:var(--color-text-muted,#4d4d4d)}.table-content{color:var(--color-text-muted,#4d4d4d)}.table-row-cell.basic{color:var(--color-text,#0d0d0d)}.table-navigation-buttons:disabled{color:var(--color-text-muted,#4d4d4d)}.filter-popup{background-color:var(--color-base-light,#fff)}.filter-title{color:var(--color-text-muted,#4d4d4d)}.filter-footer{border-color:var(--color-border,#ccc);background-color:var(--color-base-dark,#e6e6e6)}.table-headers-cell{border-color:var(--color-border,#ccc)}@media(hover:hover){.table-headers-cell:hover{background-color:var(--color-base-dark,#e6e6e6)}}
1
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--color-green-500:oklch(72.3% .219 149.579);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-500:oklch(58.5% .233 277.117);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--container-sm:24rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#041e42;--color-bg-primary:#021327;--color-hover-primary:#0a2f66;--color-secondary:#cd212a;--color-bg-secondary:#8f151b;--color-hover-secondary:#e03a42;--color-tertiary:#00997b;--color-bg-tertiary:#006654;--color-hover-tertiary:#1ab89a;--color-quaternary:#d7942e;--color-bg-quaternary:#9e6a1f;--color-hover-quaternary:#ebb04a;--color-base-dark:#e6e6e6;--color-base:#f2f2f2;--color-base-light:#fff;--color-text:#0d0d0d;--color-border:#ccc;--color-text-muted:#4d4d4d;--color-bg-info:#0070ba;--color-info:#fbfbfb;--color-bg-success:#1d9a5b;--color-success:#fbfbfb;--color-bg-warning:orange;--color-warning:#000;--color-bg-error:#c14444;--color-error:#fbfbfb;--breakpoint-xs:28rem}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.z-10{z-index:10}.z-20{z-index:20}.container{width:100%}@media(min-width:28rem){.container{max-width:28rem}}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.mt-2{margin-top:calc(var(--spacing) * 2)}.\!hidden{display:none!important}.flex{display:flex}.hidden{display:none}.inline{display:inline}.table{display:table}.table-row{display:table-row}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-20{height:calc(var(--spacing) * 20)}.max-h-\[70vh\]{max-height:70vh}.min-h-44{min-height:calc(var(--spacing) * 44)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-full{width:100%}.w-px{width:1px}.max-w-3xl{max-width:var(--container-3xl)}.max-w-sm{max-width:var(--container-sm)}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-56{min-width:calc(var(--spacing) * 56)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-border{border-color:var(--color-border)}.bg-base{background-color:var(--color-base)}.bg-base-dark\/60{background-color:#e6e6e699}@supports (color:color-mix(in lab,red,red)){.bg-base-dark\/60{background-color:color-mix(in oklab,var(--color-base-dark) 60%,transparent)}}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.from-primary\/8{--tw-gradient-from:#041e4214}@supports (color:color-mix(in lab,red,red)){.from-primary\/8{--tw-gradient-from:color-mix(in oklab, var(--color-primary) 8%, transparent)}}.from-primary\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-secondary\/8{--tw-gradient-to:#cd212a14}@supports (color:color-mix(in lab,red,red)){.to-secondary\/8{--tw-gradient-to:color-mix(in oklab, var(--color-secondary) 8%, transparent)}}.to-secondary\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.stroke-blue-800{stroke:var(--color-blue-800)}.p-2{padding:calc(var(--spacing) * 2)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-10{padding:calc(var(--spacing) * 10)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-blue-500{color:var(--color-blue-500)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-green-500{color:var(--color-green-500)}.text-indigo-500{color:var(--color-indigo-500)}.text-red-500{color:var(--color-red-500)}.text-sky-500{color:var(--color-sky-500)}.text-text{color:var(--color-text)}.text-text-muted{color:var(--color-text-muted)}.capitalize{text-transform:capitalize}.underline{text-decoration-line:underline}.opacity-70{opacity:.7}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}.input-error{border-color:var(--color-bg-error,#c14444);color:var(--color-bg-error,#c14444)}.input-error:focus{border-color:var(--color-bg-error,#c14444)}.input-good{border-color:var(--color-bg-success,#1d9a5b);color:var(--color-bg-success,#1d9a5b)}.input-good:focus{border-color:var(--color-bg-success,#1d9a5b)}.input-normal{border-color:var(--color-border,#ccc);color:var(--color-text,#0d0d0d)}.input-normal:focus{border-color:var(--color-primary,#041e42)}.input-label-error{color:var(--color-secondary,#cd212a)}.input-label-good{color:var(--color-bg-success,#1d9a5b)}.input-label-normal{color:var(--color-text-muted,#4d4d4d)}.input-label-normal:is(:where(.peer):focus~*){color:var(--color-primary,#041e42)}.input-helper-text-error{color:var(--color-bg-error,#c14444)}.input-helper-text-good{color:var(--color-bg-success,#1d9a5b)}.input-helper-text-normal{color:var(--color-text-muted,#4d4d4d)}.select-input-options-container,.autocomplete-suggestions-container{background-color:var(--color-base-light,#fff)}.select-input-option-item:hover,.autocomplete-suggestion-item:hover{background-color:var(--color-base-dark,#e6e6e6)}.autocomplete-delete-button{color:var(--color-text,#0d0d0d)}@media(hover:hover){.autocomplete-delete-button:hover{color:var(--color-secondary,#cd212a)}}.select-input-option-item.highlighted,.autocomplete-suggestion-item.highlighted{background-color:var(--color-slate-200,oklch(92.9% .013 255.508))}.chip-main{background-color:var(--color-base-dark,#e6e6e6);color:var(--color-text,#0d0d0d)}.chip-delete-button:hover{color:var(--color-secondary,#cd212a)}.badge-main{background-color:var(--color-bg-error,#c14444);color:var(--color-error,#fbfbfb)}.table-loading{background-color:var(--color-base-light,#fff)}.table-row{border-bottom-color:var(--color-border,#ccc);background-color:var(--color-base-light,#fff)}.table-headers-row{background-color:var(--color-base,#f2f2f2);color:var(--color-text-muted,#4d4d4d)}.table-content{color:var(--color-text-muted,#4d4d4d)}.table-row-cell.basic{color:var(--color-text,#0d0d0d)}.table-navigation-buttons:disabled{color:var(--color-text-muted,#4d4d4d)}.table-headers-cell{border-color:var(--color-border,#ccc)}@media(hover:hover){.table-headers-cell:hover{background-color:var(--color-base-dark,#e6e6e6)}}.filter-popup{background-color:var(--color-base-light,#fff)}.filter-title{color:var(--color-text-muted,#4d4d4d)}.filter-footer{border-color:var(--color-border,#ccc);background-color:var(--color-base-dark,#e6e6e6)}
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import "./index.css";
2
2
  import { FilterTypes as o } from "./lib.js";
3
3
  import { S as t } from "./query-CwuehjY1.js";
4
- import { i as p, j as l, k as n, A as m, b as f, a as C, C as u, c as x, F as T, d as F, N as d, P as c, R as h, e as b, h as S, T as g, f as v, g as A, r as B } from "./Table-LcN-UV8f.js";
4
+ import { i as p, j as l, k as n, A as m, b as f, a as C, C as u, c as x, F as T, d as F, N as d, P as c, R as h, e as b, h as S, T as g, f as v, g as A, r as B } from "./Table-B_Jbnu1-.js";
5
5
  import { B as w } from "./Badge-CIeYthEy.js";
6
6
  import { B as N } from "./Button-D73-swfo.js";
7
7
  import { C as R } from "./Chip-C5ogKbFn.js";
8
8
  import { D as O } from "./Dropdown-D-fYEGo2.js";
9
- import { A as L, C as k, S as z, a as j, T as H, h as M, i as U, l as V } from "./TextInput-DPYxzgm3.js";
9
+ import { A as L, C as k, S as z, a as j, T as H, h as M, i as U, l as V } from "./SelectInput-B0Ffd39D.js";
10
10
  import { F as G } from "./FileInput-Cr4TxWUg.js";
11
11
  import { I as K } from "./IconButton-BpsTEj0z.js";
12
12
  import { L as W } from "./Loading-B_c_4XLr.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sito/dashboard",
3
3
  "private": false,
4
- "version": "0.0.70",
4
+ "version": "0.0.71",
5
5
  "type": "module",
6
6
  "description": "UI library with custom components for dashboards",
7
7
  "main": "dist/index.cjs",
@@ -1 +0,0 @@
1
- var Oe=require("./Table.css");const e=require("react/jsx-runtime"),r=require("react"),k=require("./FiltersProvider-DVMj0LV0.cjs"),O=require("./TableColumns-BjTNomZf.cjs"),P=require("./TextInput-C27RFuya.cjs"),I=require("./TableOptionsProvider-i4uVLLwH.cjs"),A=require("./TranslationProvider-Czr0WIDH.cjs"),D=require("./IconButton-CVnmT2E9.cjs"),fe=require("./Badge-Z78MlGoQ.cjs"),z=require("./lib.cjs"),G=require("./Button-BlYa3uPc.cjs"),J=require("./Chip-D17UJHW6.cjs"),Y=require("./Tooltip-BSKAgRkc.cjs"),je=require("./query-81BrXp3i.cjs"),ge=require("./Dropdown-CR8mco5s.cjs"),Ce=require("./Loading-CNECRan-.cjs");function X(n){const{id:t,icon:a,tooltip:s,onClick:l,children:i,hidden:p=!1,disabled:c=!1,showText:u=!1,showTooltips:o=!0,className:m=""}=n;return p?null:e.jsxs("button",{type:"button",id:t,className:`action ${u?"text-action":"icon-action"} ${m}`,disabled:c,"aria-label":s,onClick:d=>{d.stopPropagation(),l?.()},"aria-disabled":c,"data-tooltip-id":"tooltip","data-tooltip-content":o?s:"",children:[a," ",u&&s,i]})}function Z(n){const{actions:t=[],className:a="",itemClassName:s="",actionClassName:l="",showTooltips:i=!0,showActionTexts:p=!1}=n;return e.jsx("ul",{className:`actions-container ${a}`,children:t.map(c=>e.jsx("li",{className:`actions-container-item ${s}`,children:e.jsx(X,{showTooltips:i,showText:p,className:l,...c})},c.id))})}const ee=n=>{const{actions:t=[],className:a=""}=n,{t:s}=A.useTranslation(),[l,i]=r.useState(!1),[p,c]=r.useState(null);return e.jsxs("div",{className:`actions-dropdown ${a}`,children:[e.jsx(D.IconButton,{icon:e.jsx(O.Ellipsis,{}),onClick:u=>{u.stopPropagation(),c(u.currentTarget),i(o=>!o)},onMouseDown:u=>u.stopPropagation(),className:"actions-dropdown-trigger","aria-label":s("_accessibility:buttons.openActions"),name:s("_accessibility:buttons.openActions"),"data-tooltip-id":"tooltip","data-tooltip-content":s("_accessibility:buttons.openActions")}),e.jsx(ge.Dropdown,{open:l,onClose:()=>i(!1),anchorEl:p,children:e.jsx(Z,{showActionTexts:!0,actions:t,itemClassName:"w-full",actionClassName:"action-dropdown-item",className:"actions-dropdown-list",showTooltips:!1})})]})};function K(n,t=[]){return[...n].sort((a,s)=>(s.pos??0)-(a.pos??0)).filter(a=>a.display!=="none"&&!t.includes(a.key))}function te(n){const{t}=A.useTranslation(),{entity:a="",columns:s=[],hasAction:l=!0,onSortCallback:i,selectionState:p,onToggleAllRows:c}=n,u=r.useRef(null);r.useEffect(()=>{u.current&&(u.current.indeterminate=!!(p?.hasSomeSelected&&!p?.allSelected))},[p]);const{onSort:o,sortingOrder:m,sortingBy:d,hiddenColumns:C}=I.useTableOptions(),x=r.useMemo(()=>K(s,C).map(b=>({id:b.key,label:b.label,renderHead:b.renderHead,className:b.className??"",sortable:b.sortable??!0,sortOptions:b.sortOptions})),[s,a,t,C]);return e.jsx("thead",{className:"table-headers-row",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"table-headers-column table-headers-checkbox",children:c?e.jsx("input",{type:"checkbox",ref:u,checked:p?.allSelected??!1,onChange:c,"aria-label":t("_accessibility:components.table.selectAllRows")}):null}),l&&e.jsx("th",{scope:"col",className:"table-headers-action",children:e.jsx("span",{children:t("_accessibility:labels.actions")})}),x.map(b=>e.jsx("th",{scope:"col",className:`table-headers-column ${b.className}`,children:e.jsxs(G.Button,{disabled:!b.sortable,onClick:()=>o(b.id,i),className:"table-headers-cell",children:[b.renderHead?b.renderHead():e.jsx("span",{className:"table-headers-label",children:b.label}),b.sortable&&d===b.id&&e.jsx("span",{children:m===je.SortOrder.ASC?b.sortOptions?.icons?.asc??e.jsx(O.ChevronUp,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"}):b.sortOptions?.icons?.desc??e.jsx(O.ChevronDown,{className:b.sortOptions?.icons?.className??"table-headers-sort-indicator"})})]})},b.id))]})})}function ne(n){const{columns:t}=n,{hiddenColumns:a,toggleColumn:s}=I.useTableOptions(),{t:l}=A.useTranslation(),[i,p]=r.useState(!1),c=r.useRef(null),u=r.useMemo(()=>K(t.filter(d=>d.hideable!==!1&&d.display!=="none"),[]),[t]),o=r.useCallback(()=>{p(d=>!d)},[]),m=r.useCallback(d=>{s(d)},[s]);return u.length===0?null:e.jsxs("div",{className:"column-visibility-menu",ref:c,children:[e.jsx(D.IconButton,{icon:e.jsx(O.TableColumns,{className:"column-visibility-icon"}),className:"normal column-visibility-trigger","aria-haspopup":"true","aria-expanded":i,onClick:o,children:e.jsx("span",{className:"table-header-sr",children:l("_accessibility:buttons.columns")})}),i&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"column-visibility-backdrop",onClick:()=>p(!1)}),e.jsx("div",{className:"column-visibility-dropdown",role:"menu",children:u.map(d=>e.jsx(P.CheckInput,{checked:!a.includes(d.key),onChange:()=>m(d.key),label:d.label??d.key,containerClassName:"column-visibility-item"},d.key))})]})]})}const se=n=>{const{items:t,text:a,id:s,onClearFilter:l}=n;return e.jsx(J.Chip,{text:`${a}: ${t.map(i=>i.value??i.name).join(", ")}`,onDelete:()=>l(s)})},le=n=>{const{end:t,start:a,text:s,id:l,onClearFilter:i}=n,p=c=>c!==null&&typeof c<"u"&&c!=="";return e.jsx(J.Chip,{text:`${s}: ${p(a)?a:"♾️"} - ${p(t)?t:"♾️"}`,onDelete:()=>i(l)})},Ne=n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&("start"in n||"end"in n),ae=n=>{const{filtersDefinition:t}=n,a=r.useMemo(()=>{const c={};return t.forEach(u=>{c[u.propertyName]=u.label??u.propertyName}),c},[t]),{filters:s,clearFilters:l}=I.useTableOptions(),i=r.useMemo(()=>Object.keys(s),[s]),p=r.useCallback(c=>{const u=s[c];return Ne(u)?e.jsx(le,{id:c,text:a[c],start:u.start,end:u.end,onClearFilter:l}):Array.isArray(u)?e.jsx(se,{id:c,text:a[c],items:u,onClearFilter:l}):e.jsx(J.Chip,{text:`${a[c]}: ${u?.value??u?.name??u}`,onDelete:()=>l(c)})},[s,a,l]);return e.jsx("ul",{className:"active-filters-main",children:i?.map(c=>e.jsx("li",{children:p(c)},c))})};function ye(n){const{propertyName:t,label:a,placeholder:s,options:l,multiple:i=!0}=n,{currentFilters:p,setCurrentFilters:c}=k.useFilters(),u=r.useMemo(()=>{const m=p[t]?.value;return typeof m>"u"?null:m},[p,t]),o=r.useCallback(m=>{c({type:k.FiltersActions.update,toUpdate:{[t]:{value:m}}})},[t,c]);return e.jsx(P.AutocompleteInput,{value:u,label:a,options:l,multiple:i,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:o,placeholder:s})}const ve=n=>{const{propertyName:t,label:a}=n,{currentFilters:s,setCurrentFilters:l}=k.useFilters(),i=r.useMemo(()=>s[t]?.value??"",[s]),p=r.useCallback(c=>{l({type:k.FiltersActions.update,toUpdate:{[t]:{value:c.target.checked}}})},[]);return e.jsx(P.CheckInput,{label:a,checked:i??!1,onChange:p})};function we(n){const{propertyName:t,options:a,label:s,placeholder:l}=n,{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useMemo(()=>{const o=i[t]?.value;if(o===null||typeof o>"u")return a[0]?.id??"";if(typeof o=="object"&&!Array.isArray(o)){const m=o;return m.id??m.value??""}return o},[i,a,t]),u=r.useCallback(o=>{const m=a.find(d=>String(d.id)===o.target.value);p({type:k.FiltersActions.update,toUpdate:{[t]:{value:m?.id??o.target.value}}})},[a,t,p]);return e.jsx(P.SelectInput,{value:c,label:s,options:a,helperTextClassName:"hidden",containerClassName:"options-widget-container",onChange:u,placeholder:l})}const Te=n=>{const{propertyName:t,label:a,placeholder:s}=n,{currentFilters:l,setCurrentFilters:i}=k.useFilters(),p=r.useMemo(()=>l[t]?.value??"",[l]),c=r.useCallback(u=>{i({type:k.FiltersActions.update,toUpdate:{[t]:{value:u.target.value}}})},[]);return e.jsx(P.TextInput,{value:p??"",label:a,onChange:c,containerClassName:"input-widget-container",helperTextClassName:"",placeholder:s})},Q=n=>{const{propertyName:t,label:a,inputType:s}=n,{t:l}=A.useTranslation(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),c=r.useRef(null),u=r.useRef(null),o=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{end:u?.current?.value??null,start:d.target.value}}}})},[]),m=r.useCallback(d=>{p({type:k.FiltersActions.update,toUpdate:{[t]:{value:{start:c?.current?.value??null,end:d.target.value}}}})},[]);return e.jsxs("div",{className:"range-widget-container",children:[e.jsx("p",{className:"text-input-label input-widget-label input-label-normal",children:a}),e.jsxs("div",{className:"range-widget-row",children:[e.jsx(P.TextInput,{value:i[t]?.value?.start??"",placeholder:l("_accessibility:components.table.filters.range.start"),type:s,ref:c,onChange:o,containerClassName:"input-widget-container",helperTextClassName:""}),e.jsx(P.TextInput,{value:i[t]?.value?.end??"",placeholder:l("_accessibility:components.table.filters.range.end"),type:s,ref:u,onChange:m,containerClassName:"input-widget-container",helperTextClassName:""})]})]})},ie=n=>{switch(n.type){case z.FilterTypes.text:return e.jsx(Te,{...n});case z.FilterTypes.number:return e.jsx(Q,{...n,inputType:"number"});case z.FilterTypes.date:return e.jsx(Q,{...n,inputType:"date"});case z.FilterTypes.select:return e.jsx(we,{...n});case z.FilterTypes.autocomplete:return e.jsx(ye,{...n});case z.FilterTypes.check:return e.jsx(ve,{...n})}return e.jsx(e.Fragment,{})},re=n=>{const{filters:t=[],show:a,handleShow:s}=n,{onFilterApply:l}=I.useTableOptions(),{currentFilters:i,setCurrentFilters:p}=k.useFilters(),{t:c}=A.useTranslation(),u=r.useRef(null);return r.useEffect(()=>{const o=({target:d})=>{u.current&&(d?.closest(".filter-dropdown-trigger")||!a||u.current.contains(d)||s(!1))},m=({code:d})=>{!a||d!=="Escape"||s(!1)};return document.addEventListener("click",o),document.addEventListener("keydown",m),()=>{document.removeEventListener("click",o),document.removeEventListener("keydown",m)}},[s,a]),e.jsx("div",{className:`filter-dropdown-backdrop ${a?"opened":"closed"}`,children:e.jsxs("div",{className:"filter-popup",ref:u,children:[e.jsx("div",{className:"filter-title",children:c("_accessibility:buttons.filters")}),e.jsx("ul",{className:"filter-container",children:t.map(o=>e.jsx("li",{className:"filter-container-item",children:ie(o)},o.propertyName))}),e.jsx("div",{className:"filter-footer",children:e.jsxs("ul",{className:"filter-buttons-row",children:[e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",onClick:()=>p({type:k.FiltersActions.reset,filters:t}),className:"filter-dropdown-button filter-dropdown-cancel",children:c("_accessibility:buttons.clear")})}),e.jsx("li",{children:e.jsx(G.Button,{type:"button",variant:"submit",color:"primary",className:"filter-dropdown-button filter-dropdown-submit",onClick:()=>{s(!1),l(i)},children:c("_accessibility:buttons.applyFilters")})})]})})]})})},oe=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,pageSizes:s,currentPage:l}=I.useTableOptions(),i=(l+1)*a>t?t:(l+1)*a;return e.jsxs("div",{className:"table-navigation-sizes",children:[s[0]<t&&e.jsx(e.Fragment,{children:e.jsxs("p",{children:[l*a+1," - ",i," ",n("_accessibility:components.table.of")]})}),e.jsx("p",{children:t})]})};function Se(){const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=r.useMemo(()=>{const p=Math.ceil(t/a);return Array.from({length:p},(c,u)=>({id:u,value:u+1}))},[t,a]);return e.jsxs("div",{className:"jump-to-page",children:[e.jsx("p",{children:n("_accessibility:components.table.jumpToPage")}),e.jsx(P.SelectInput,{value:s,options:i,inputClassName:"jump-to-page-input",containerClassName:"jump-to-page-input-container",helperTextClassName:"hidden",onChange:p=>l(Number(p.target.value))})]})}const ce=()=>{const{t:n}=A.useTranslation(),{total:t,pageSize:a,currentPage:s,setCurrentPage:l}=I.useTableOptions(),i=Math.ceil(t/a),p=s<i-1;return e.jsxs("div",{className:"table-navigation-pages",children:[e.jsx(D.IconButton,{icon:e.jsx(O.ChevronLeft,{className:"table-navigation-icon"}),className:"table-navigation-buttons",disabled:s===0,"aria-label":n("_accessibility:buttons.previous"),name:n("_accessibility:buttons.previous"),onClick:()=>l(s-1)}),e.jsx(D.IconButton,{icon:e.jsx(O.ChevronRight,{className:"table-navigation-icon"}),disabled:!p,className:"table-navigation-buttons",name:n("_accessibility:buttons.next"),"aria-label":n("_accessibility:buttons.next"),onClick:()=>{p&&l(s+1)}})]})};function ue(){const{t:n}=A.useTranslation(),{pageSizes:t,pageSize:a,setPageSize:s}=I.useTableOptions(),l=r.useMemo(()=>t?.map(i=>({id:i,value:i})),[t]);return e.jsxs("div",{className:"page-size",children:[e.jsx("p",{children:n("_accessibility:components.table.pageSizes")}),e.jsx(P.SelectInput,{value:a,options:l,inputClassName:"page-size-input",containerClassName:"page-size-input-container",helperTextClassName:"hidden",onChange:i=>s(Number(i.target.value))})]})}function de(){return e.jsxs("div",{className:"table-footer",children:[e.jsx(Se,{}),e.jsx(ue,{}),e.jsx(oe,{}),e.jsx(ce,{})]})}const ke=n=>n,pe=n=>{const{t}=A.useTranslation(),{hiddenColumns:a}=I.useTableOptions(),{columns:s,softDeleteProperty:l="deletedAt",data:i,actions:p,selectedRows:c,expandedRows:u=[],onRowSelectionChange:o,onRowExpand:m}=n,d=r.useMemo(()=>K(s,a),[s,a]),C=r.useMemo(()=>new Map(u.map(x=>[x.rowId,x])),[u]);return i?.map(x=>{const b=c.has(x.id),y=C.get(x.id),R=!!y,_=d.length+1+(p?1:0);return e.jsxs(r.Fragment,{children:[e.jsxs("tr",{className:`table-row ${m?"expandable":""} ${x[l]?"deleted-class":""} ${b?"selected":""} ${R?"expanded":""}`,onClick:()=>m?.(x),children:[e.jsx("td",{className:"table-row-cell table-row-checkbox",children:e.jsx("input",{type:"checkbox",checked:b,onClick:v=>v.stopPropagation(),onChange:()=>o(x),"aria-label":t("_accessibility:components.table.selectRow")})}),p?e.jsx("td",{className:"w-px",children:e.jsx("div",{className:"table-row-cell-action",children:(()=>{const v=p(x).filter(g=>!g.hidden),j=v.filter(g=>g.sticky),w=v.filter(g=>!g.sticky);return e.jsxs(e.Fragment,{children:[j.map(g=>e.jsx(Y.Tooltip,{content:g.tooltip,children:e.jsx(X,{...g,onClick:()=>g.onClick(x),className:"row-table-action"})},g.id)),w.length>0&&e.jsx(ee,{actions:w})]})})()})}):null,d?.map((v,j)=>{const w=x[v.key],g=v.renderBody?v.renderBody(w,x):ke(w);return e.jsx("td",{className:`table-row-cell ${j===0?"basic":""} ${v.className??""}`,children:m&&j===0?e.jsxs("div",{className:"table-row-expand-content",children:[e.jsx("span",{className:"table-row-expand-indicator","aria-hidden":!0,"data-state":R?"expanded":"collapsed",children:R?e.jsx(O.ChevronUp,{className:"table-row-expand-chevron"}):e.jsx(O.ChevronDown,{className:"table-row-expand-chevron"})}),e.jsx("div",{className:"table-row-expand-value",children:g})]}):g},v.key)})]}),R&&y?.content!==null&&typeof y?.content<"u"&&e.jsx("tr",{className:"table-row-expanded",children:e.jsx("td",{className:"table-row-expanded-cell",colSpan:_,children:e.jsx("div",{className:`table-row-expanded-content ${y.isVisible?"open":"closed"}`,children:e.jsx("div",{className:"table-row-expanded-inner",children:y.content})})})})]},x.id)})};function me(){const{t:n}=A.useTranslation();return e.jsx("div",{className:"table-empty",children:e.jsx("p",{children:n("_accessibility:components.table.empty")})})}const he=n=>{const{columns:t,title:a,isLoading:s,toolbar:l,filterOptions:i,canHideColumns:p=!1,canReset:c=!1}=n,{countOfFilters:u,resetTableOptions:o}=I.useTableOptions(),{t:m}=A.useTranslation(),d=r.useMemo(()=>t?[...t].sort((j,w)=>(w.pos??0)-(j.pos??0)).filter(j=>!!j.filterOptions).map(j=>({...j.filterOptions,label:j.filterOptions?.label??j.label,propertyName:j.key})):[],[t]),[C,x]=r.useState(!1),b=r.useCallback(j=>{i?.dropdown?.setOpened?i.dropdown.setOpened(j??!1):x(j??!1)},[i]),y=r.useMemo(()=>i?.dropdown?.opened??C,[i,C]),R=d.length>0,_=R&&i?.button?.hide!==!0,v=R&&y;return e.jsxs("div",{className:`table-header ${v?"showing-filters":""}`,children:[e.jsxs("div",{children:[a&&e.jsx("h1",{className:"table-header-title",children:a}),s?null:e.jsxs("div",{className:"table-header-content",children:[l,p&&t&&e.jsx(ne,{columns:t}),c&&e.jsx(D.IconButton,{icon:e.jsx(O.BarsStaggered,{className:"reset-table-icon"}),className:"normal",onClick:o,children:e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.reset")})}),_&&e.jsxs(D.IconButton,{icon:i?.button?.icon??e.jsx(O.Filters,{className:"filter-dropdown-trigger-icon"}),className:"filter-dropdown-button normal filter-dropdown-trigger","aria-haspopup":"true",onClick:()=>b(!y),"aria-expanded":y,children:[e.jsx(fe.Badge,{count:u,className:`${u>0?"show":"hide"} `}),e.jsx("span",{className:"table-header-sr",children:m("_accessibility:buttons.filters")}),e.jsx("wbr",{})]})]})]}),R&&e.jsx(re,{filters:d,show:v,handleShow:b,options:i}),e.jsx(ae,{filtersDefinition:d})]})};function be({count:n,multiActions:t,onActionClick:a}){const{t:s}=A.useTranslation();return e.jsxs("div",{className:"table-selection-bar",children:[e.jsx("p",{className:"table-selection-bar-count",children:s("_accessibility:components.table.selectedCount",{count:n})}),t.length>0&&e.jsx("div",{className:"table-selection-bar-actions",children:t.map(l=>e.jsx(Y.Tooltip,{content:l.tooltip,children:e.jsx(D.IconButton,{icon:l.icon,className:"multi-table-action",onClick:()=>a(l),disabled:l.disabled,"aria-label":l.tooltip})},l.id))})]})}const W=220;function Re({data:n,allowMultipleExpandedRows:t,controlledExpandedRowId:a,onExpandedRowChange:s,onRowExpand:l,findRowById:i}){const[p,c]=r.useState(null),[u,o]=r.useState(null),[m,d]=r.useState(null),[C,x]=r.useState(null),[b,y]=r.useState(!1),[R,_]=r.useState(new Set),[v,j]=r.useState([]),w=r.useRef(null),g=r.useRef(null),q=r.useRef(new Map),E=typeof a<"u",M=t&&!E,T=E?a??null:p,V=r.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),F=r.useCallback(h=>{if(typeof h<"u"){const f=q.current.get(h);if(!f)return;clearTimeout(f),q.current.delete(h);return}q.current.forEach(f=>clearTimeout(f)),q.current.clear()},[]),L=r.useCallback(h=>{F(h),j(f=>f.some(S=>S.rowId===h)?f.map(S=>S.rowId===h?{...S,isVisible:!1}:S):f),q.current.set(h,setTimeout(()=>{j(f=>f.filter(N=>N.rowId!==h)),q.current.delete(h)},W))},[F]),U=r.useCallback((h,f)=>{F(h),j(N=>N.some($=>$.rowId===h)?N.map($=>$.rowId===h?{...$,content:f,isVisible:!1}:$):[...N,{rowId:h,content:f,isVisible:!1}]),requestAnimationFrame(()=>{j(N=>N.map(S=>S.rowId===h?{...S,isVisible:!0}:S))})},[F]);r.useEffect(()=>{if(!M)return;const h=new Set(n.map(f=>f.id));_(f=>{const N=new Set;return f.forEach(S=>{if(h.has(S)){N.add(S);return}F(S)}),N}),j(f=>(f.forEach(N=>{h.has(N.rowId)||F(N.rowId)}),f.filter(N=>h.has(N.rowId))))},[n,M,F]),r.useEffect(()=>{if(M)return;if(T===null){o(null),E&&(w.current=null);return}i(T)||(E||c(null),o(null),E&&(w.current=null))},[n,T,i,E,M]),r.useEffect(()=>{if(!M){if(V(),T===null||u===null){if(m===null){y(!1),x(null);return}y(!1),g.current=setTimeout(()=>{d(null),x(null),g.current=null},W);return}if(m===null){d(T),x(u),requestAnimationFrame(()=>y(!0));return}if(m===T){x(u),requestAnimationFrame(()=>y(!0));return}y(!1),g.current=setTimeout(()=>{d(T),x(u),requestAnimationFrame(()=>y(!0)),g.current=null},W)}},[V,u,T,M,m]),r.useEffect(()=>()=>{V(),F()},[V,F]),r.useEffect(()=>{if(!E)return;if(T===null){o(null),w.current=null;return}const h=i(T);if(!h){o(null),w.current=null;return}const f=w.current;o(l?.(h,f)??null),w.current=h},[T,i,E,l]);const xe=r.useCallback(h=>{if(M){if(R.has(h.id)){_(H=>{const B=new Set(H);return B.delete(h.id),B}),L(h.id),s?.(null,h);return}_(H=>{const B=new Set(H);return B.add(h.id),B});const $=l?.(h,null)??null;$!==null&&typeof $<"u"?U(h.id,$):(F(h.id),j(H=>H.filter(B=>B.rowId!==h.id))),s?.(h,null);return}const f=T===h.id,N=f?h:i(T);if(E){s?.(f?null:h,N);return}if(f){c(null),o(null),s?.(null,h);return}c(h.id),o(l?.(h,N)??null),s?.(h,N)},[T,L,F,U,i,R,E,M,s,l]);return{expandedRowsToRender:r.useMemo(()=>M?v:m===null||C===null||typeof C>"u"?[]:[{rowId:m,content:C,isVisible:b}],[b,M,C,m,v]),onRowExpandChange:xe}}function Fe({actions:n,selectedRowsData:t}){const a=r.useMemo(()=>!n||!t.length?[]:t.reduce((l,i,p)=>{const c=n(i).filter(o=>o.multiple&&!o.hidden);if(p===0)return c;const u=new Map(l.map(o=>[o.id,o]));return c.reduce((o,m)=>{const d=u.get(m.id);return d&&o.push({...d,...m,disabled:m.disabled||d.disabled}),o},[])},[]),[n,t]),s=r.useCallback(l=>{if(t.length){if(l.onMultipleClick){l.onMultipleClick(t);return}t.forEach(i=>l.onClick(i))}},[t]);return{multiActions:a,handleMultipleActionClick:s}}function Ae({data:n,onRowSelect:t,onSelectedRowsChange:a}){const[s,l]=r.useState(new Set),i=r.useMemo(()=>n?.filter(o=>s.has(o.id))??[],[n,s]);r.useEffect(()=>{if(!n?.length){l(new Set);return}l(o=>{const m=new Set,d=new Set(n.map(C=>C.id));return o.forEach(C=>{d.has(C)&&m.add(C)}),m})},[n]),r.useEffect(()=>{a&&a(i)},[i,a]);const p=r.useCallback(o=>{l(m=>{const d=new Set(m);return d.has(o.id)?(d.delete(o.id),t?.(o,!1)):(d.add(o.id),t?.(o,!0)),d})},[t]),c=r.useCallback(()=>{l(o=>{const m=new Set(o),d=n??[],C=d.every(x=>m.has(x.id));return d.forEach(x=>{const b=m.has(x.id);C?b&&(m.delete(x.id),t?.(x,!1)):b||(m.add(x.id),t?.(x,!0))}),m})},[n,t]),u=r.useMemo(()=>{if(!n?.length)return{allSelected:!1,hasSomeSelected:!1};const o=n.every(d=>s.has(d.id)),m=n.some(d=>s.has(d.id));return{allSelected:o,hasSomeSelected:m}},[n,s]);return{selectedRows:s,selectedRowsData:i,selectionState:u,onRowSelectionChange:p,onToggleAllRows:c}}function Ee(n){const{data:t,onSort:a,entity:s="",isLoading:l=!1,actions:i,columns:p=[],contentClassName:c="",className:u="",softDeleteProperty:o="deletedAt",onRowSelect:m,onSelectedRowsChange:d,allowMultipleExpandedRows:C=!1,expandedRowId:x,onExpandedRowChange:b,onRowExpand:y,...R}=n,_=r.useMemo(()=>!t?.length,[t]),v=r.useCallback(L=>L===null?null:t.find(U=>U.id===L)??null,[t]),{selectedRows:j,selectedRowsData:w,selectionState:g,onRowSelectionChange:q,onToggleAllRows:E}=Ae({data:t,onRowSelect:m,onSelectedRowsChange:d}),{expandedRowsToRender:M,onRowExpandChange:T}=Re({data:t,allowMultipleExpandedRows:C,controlledExpandedRowId:x,onExpandedRowChange:b,onRowExpand:y,findRowById:v}),{multiActions:V,handleMultipleActionClick:F}=Fe({actions:i,selectedRowsData:w});return e.jsx(k.FiltersProvider,{children:e.jsxs("div",{className:`${u} table-main`,children:[e.jsx(he,{columns:p,isLoading:l,...R}),l?e.jsx(Ce.Loading,{className:"table-loading"}):e.jsx(e.Fragment,{children:_?e.jsx(me,{}):e.jsxs(e.Fragment,{children:[!!w.length&&e.jsx(be,{count:w.length,multiActions:V,onActionClick:F}),e.jsx("div",{className:`${c} table-body`,children:e.jsxs("table",{className:"table-content",children:[e.jsx(te,{entity:s,columns:p,onSortCallback:a,hasAction:!!i,selectionState:g,onToggleAllRows:E}),e.jsx("tbody",{children:e.jsx(pe,{data:t,actions:i,columns:p,softDeleteProperty:o,selectedRows:j,expandedRows:M,onRowSelectionChange:q,onRowExpand:y?T:void 0})})]})}),e.jsx(de,{})]})})]})})}exports.Action=X;exports.Actions=Z;exports.ActionsDropdown=ee;exports.ActiveFilters=ae;exports.ArrayChip=se;exports.ColumnVisibilityMenu=ne;exports.Columns=te;exports.CountOfTotal=oe;exports.FilterDropdown=re;exports.Footer=de;exports.Navigation=ce;exports.PageSize=ue;exports.RangeChip=le;exports.Rows=pe;exports.Table=Ee;exports.TableEmpty=me;exports.TableHeader=he;exports.TableSelectionBar=be;exports.renderFilterComponent=ie;
@@ -1 +0,0 @@
1
- var G=require("./TextInput.css");const a=require("react/jsx-runtime"),l=require("react"),L=require("./Chip-D17UJHW6.cjs"),U=require("./IconButton-CVnmT2E9.cjs"),M=require("./Close-O9P7wJGf.cjs"),O=l.forwardRef(function(n,N){const{state:v,value:e,onChange:s,options:p=[],name:g="",id:m="",label:i="",containerClassName:j="",inputContainerClassName:d="",helperText:f="",placeholder:b="",multiple:u=!1,...y}=n,[c,r]=l.useState("");l.useEffect(()=>{if(!u&&e&&!Array.isArray(e)){r(String(e.value??e.name??""));return}r("")},[u,e]);const[T,$]=l.useState(!1),k=l.useMemo(()=>p.filter(t=>{const o=String(t.value??t.name).toLowerCase().includes(c?.toLowerCase());return Array.isArray(e)&&e.length?o&&!e.some(C=>C.id===t.id):e&&!Array.isArray(e)?o&&e.id!==t.id:o}),[p,e,c]),x=l.useRef(null),R=l.useRef(null),[F,E]=l.useState(!1),S=l.useRef(null);l.useEffect(()=>{const t=C=>{x.current&&!x.current.contains(C.target)&&$(!1)},o=C=>{C.key==="Escape"&&$(!1)};return document.addEventListener("mousedown",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("keydown",o)}},[]);const B=l.useCallback(t=>{r(t.target.value)},[]),h=l.useCallback(t=>{t?u?(r(""),Array.isArray(e)&&e.length?s([...e,t]):s([t])):(r(String(t.name??t.value??"")),s(t)):s(null),$(!1)},[u,s,e]),D=l.useCallback(t=>{if(!Array.isArray(e)){s(null);return}const o=e.filter((C,H)=>H!==t);o.length?s(o):s(null)},[s,e]),W=l.useCallback(()=>{Array.isArray(e)&&s([e[0]])},[s,e]);return l.useLayoutEffect(()=>{const t=S.current?.offsetWidth??0,o=x.current?.offsetWidth??0;E(t>o*.4)},[e]),a.jsxs("div",{className:`autocomplete-input-container ${j}`,ref:x,children:[a.jsxs("div",{className:"autocomplete-value-input-container",children:[a.jsx(V,{state:v,name:g,id:m,value:c,onChange:B,placeholder:b,helperText:f,onFocus:()=>$(!0),label:i,containerClassName:`autocomplete-text-input ${d}`,ref:N??R,...y,children:!u&&e&&!Array.isArray(e)&&(e.value||e.name)&&a.jsx(U.IconButton,{icon:a.jsx(M.Close,{}),className:"autocomplete-delete-button",onClick:t=>{h(),t.stopPropagation()}})}),u&&Array.isArray(e)&&e.length?a.jsx("ul",{ref:S,className:"autocomplete-value-container",children:F?a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(L.Chip,{text:e[0]?.value??e[0]?.name,onDelete:t=>{D(0),t.stopPropagation()}})}),e.length>1&&a.jsx("li",{children:a.jsx(L.Chip,{text:`+${e.length-1}`,onDelete:t=>{W(),t.stopPropagation()}})})]}):e.map((t,o)=>a.jsx("li",{children:a.jsx(L.Chip,{text:String(t.value??t.name),onDelete:C=>{D(o),C.stopPropagation()}})},t.id??t.value??t.name))}):null]}),T&&a.jsx("ul",{className:"autocomplete-suggestions-container",style:{width:x.current?.offsetWidth},children:k.map(t=>a.jsx("li",{className:"autocomplete-suggestion-item",onClick:o=>{h(t),o.stopPropagation()},children:t.value??t.name},t.id??t.value??t.name))})]})});var A=(n=>(n.error="error",n.good="good",n.default="default",n))(A||{});const w=n=>{switch(n){case"error":return"input-error";case"good":return"input-good";default:return"input-normal"}},I=n=>{switch(n){case"error":return"input-label-error";case"good":return"input-label-good";default:return"input-label-normal"}},q=n=>{switch(n){case"error":return"input-helper-text-error";case"good":return"input-helper-text-good";default:return"input-helper-text-normal"}},_=l.forwardRef(function(n,N){const{checked:v,onChange:e,name:s="",id:p="",label:g="",state:m=A.default,containerClassName:i="",inputClassName:j="",labelClassName:d="",...f}=n;return a.jsxs("label",{className:`input-check-container ${i}`,children:[a.jsx("input",{id:p,ref:N,name:s,type:"checkbox",checked:v,onChange:e,className:`input-check ${w(m)} ${j}`,...f}),a.jsx("span",{className:`input-check-label ${I(m)} ${d}`,children:g})]})}),z=l.forwardRef(function(n,N){const{value:v,onChange:e,options:s,containerClassName:p="",inputClassName:g="",labelClassName:m="",helperText:i="",helperTextClassName:j="",label:d="",name:f="",id:b="",state:u=A.default,children:y,...c}=n;return a.jsxs("div",{className:`select-input-container ${p}`,children:[a.jsx("select",{...c,id:b,ref:N,name:f,value:v,onChange:e,className:`select-input ${w(u)} peer ${g}`,children:s?.map(r=>a.jsx("option",{value:r.id,children:r.value??r.name??r.id},r.id))}),a.jsx("label",{htmlFor:b,className:`select-input-label ${I(u)} ${m}`,children:d}),y,i&&a.jsx("p",{className:`select-input-helper-text ${q(u)} ${j}`,children:i})]})}),P=n=>n==null?!1:Array.isArray(n)?n.length>0:`${n}`.length>0,V=l.forwardRef(function(n,N){const{children:v,state:e=A.default,label:s="",containerClassName:p="",inputClassName:g="",labelClassName:m="",helperText:i="",helperTextClassName:j="",value:d,defaultValue:f,onChange:b,onFocus:u,onBlur:y,...c}=n,r=d!==void 0,[T,$]=l.useState(()=>P(f)),[k,x]=l.useState(!1),R=r?P(d):T,F=!!c.placeholder||k,E=h=>{r||$(h.currentTarget.value.length>0),b?.(h)},S=h=>{k||x(!0),u?.(h)},B=h=>{k||x(!0),y?.(h)};return a.jsxs("div",{className:`text-input-container ${p}`,children:[a.jsx("input",{ref:N,defaultValue:f,onChange:E,onFocus:S,onBlur:B,...r?{value:d}:{},className:`text-input ${w(e)} ${g} ${R?"has-value":""} ${c.placeholder?"has-placeholder":""} ${F?"keep-label-up":""}`,...c}),!!s&&a.jsxs("label",{htmlFor:c.id,className:`text-input-label ${I(e)} ${m}`,children:[s,c.required?" *":""]}),v,!!i&&a.jsx("p",{className:`text-input-helper-text ${q(e)} ${j}`,children:i})]})});exports.AutocompleteInput=O;exports.CheckInput=_;exports.SelectInput=z;exports.State=A;exports.TextInput=V;exports.helperTextStateClassName=q;exports.inputStateClassName=w;exports.labelStateClassName=I;
@@ -1,335 +0,0 @@
1
- import "./TextInput.css";
2
- import { jsxs as x, jsx as n, Fragment as z } from "react/jsx-runtime";
3
- import { forwardRef as F, useState as w, useEffect as U, useMemo as G, useRef as R, useCallback as T, useLayoutEffect as J } from "react";
4
- import { C as V } from "./Chip-C5ogKbFn.js";
5
- import { I as K } from "./IconButton-BpsTEj0z.js";
6
- import { C as Q } from "./Close-rKC9AcNX.js";
7
- const le = F(function(a, N) {
8
- const {
9
- state: v,
10
- value: e,
11
- onChange: l,
12
- options: h = [],
13
- name: g = "",
14
- id: m = "",
15
- label: i = "",
16
- containerClassName: $ = "",
17
- inputContainerClassName: u = "",
18
- helperText: p = "",
19
- placeholder: y = "",
20
- multiple: o = !1,
21
- ...A
22
- } = a, [c, r] = w("");
23
- U(() => {
24
- if (!o && e && !Array.isArray(e)) {
25
- r(String(e.value ?? e.name ?? ""));
26
- return;
27
- }
28
- r("");
29
- }, [o, e]);
30
- const [E, b] = w(!1), k = G(
31
- () => h.filter((t) => {
32
- const s = String(t.value ?? t.name).toLowerCase().includes(c?.toLowerCase());
33
- return Array.isArray(e) && e.length ? s && !e.some((C) => C.id === t.id) : e && !Array.isArray(e) ? s && e.id !== t.id : s;
34
- }),
35
- [h, e, c]
36
- ), f = R(null), L = R(null), [B, D] = w(!1), S = R(null);
37
- U(() => {
38
- const t = (C) => {
39
- f.current && !f.current.contains(C.target) && b(!1);
40
- }, s = (C) => {
41
- C.key === "Escape" && b(!1);
42
- };
43
- return document.addEventListener("mousedown", t), document.addEventListener("keydown", s), () => {
44
- document.removeEventListener("mousedown", t), document.removeEventListener("keydown", s);
45
- };
46
- }, []);
47
- const P = T((t) => {
48
- r(t.target.value);
49
- }, []), d = T(
50
- (t) => {
51
- t ? o ? (r(""), Array.isArray(e) && e.length ? l([...e, t]) : l([t])) : (r(String(t.name ?? t.value ?? "")), l(t)) : l(null), b(!1);
52
- },
53
- [o, l, e]
54
- ), j = T(
55
- (t) => {
56
- if (!Array.isArray(e)) {
57
- l(null);
58
- return;
59
- }
60
- const s = e.filter((C, _) => _ !== t);
61
- s.length ? l(s) : l(null);
62
- },
63
- [l, e]
64
- ), O = T(() => {
65
- Array.isArray(e) && l([e[0]]);
66
- }, [l, e]);
67
- return J(() => {
68
- const t = S.current?.offsetWidth ?? 0, s = f.current?.offsetWidth ?? 0;
69
- D(t > s * 0.4);
70
- }, [e]), /* @__PURE__ */ x(
71
- "div",
72
- {
73
- className: `autocomplete-input-container ${$}`,
74
- ref: f,
75
- children: [
76
- /* @__PURE__ */ x("div", { className: "autocomplete-value-input-container", children: [
77
- /* @__PURE__ */ n(
78
- X,
79
- {
80
- state: v,
81
- name: g,
82
- id: m,
83
- value: c,
84
- onChange: P,
85
- placeholder: y,
86
- helperText: p,
87
- onFocus: () => b(!0),
88
- label: i,
89
- containerClassName: `autocomplete-text-input ${u}`,
90
- ref: N ?? L,
91
- ...A,
92
- children: !o && e && !Array.isArray(e) && (e.value || e.name) && /* @__PURE__ */ n(
93
- K,
94
- {
95
- icon: /* @__PURE__ */ n(Q, {}),
96
- className: "autocomplete-delete-button",
97
- onClick: (t) => {
98
- d(), t.stopPropagation();
99
- }
100
- }
101
- )
102
- }
103
- ),
104
- o && Array.isArray(e) && e.length ? /* @__PURE__ */ n("ul", { ref: S, className: "autocomplete-value-container", children: B ? /* @__PURE__ */ x(z, { children: [
105
- /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
106
- V,
107
- {
108
- text: e[0]?.value ?? e[0]?.name,
109
- onDelete: (t) => {
110
- j(0), t.stopPropagation();
111
- }
112
- }
113
- ) }),
114
- e.length > 1 && /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
115
- V,
116
- {
117
- text: `+${e.length - 1}`,
118
- onDelete: (t) => {
119
- O(), t.stopPropagation();
120
- }
121
- }
122
- ) })
123
- ] }) : e.map((t, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(
124
- V,
125
- {
126
- text: String(t.value ?? t.name),
127
- onDelete: (C) => {
128
- j(s), C.stopPropagation();
129
- }
130
- }
131
- ) }, t.id ?? t.value ?? t.name)) }) : null
132
- ] }),
133
- E && /* @__PURE__ */ n(
134
- "ul",
135
- {
136
- className: "autocomplete-suggestions-container",
137
- style: { width: f.current?.offsetWidth },
138
- children: k.map((t) => /* @__PURE__ */ n(
139
- "li",
140
- {
141
- className: "autocomplete-suggestion-item",
142
- onClick: (s) => {
143
- d(t), s.stopPropagation();
144
- },
145
- children: t.value ?? t.name
146
- },
147
- t.id ?? t.value ?? t.name
148
- ))
149
- }
150
- )
151
- ]
152
- }
153
- );
154
- });
155
- var I = /* @__PURE__ */ ((a) => (a.error = "error", a.good = "good", a.default = "default", a))(I || {});
156
- const W = (a) => {
157
- switch (a) {
158
- case "error":
159
- return "input-error";
160
- case "good":
161
- return "input-good";
162
- default:
163
- return "input-normal";
164
- }
165
- }, H = (a) => {
166
- switch (a) {
167
- case "error":
168
- return "input-label-error";
169
- case "good":
170
- return "input-label-good";
171
- default:
172
- return "input-label-normal";
173
- }
174
- }, M = (a) => {
175
- switch (a) {
176
- case "error":
177
- return "input-helper-text-error";
178
- case "good":
179
- return "input-helper-text-good";
180
- default:
181
- return "input-helper-text-normal";
182
- }
183
- }, re = F(function(a, N) {
184
- const {
185
- checked: v,
186
- onChange: e,
187
- name: l = "",
188
- id: h = "",
189
- label: g = "",
190
- state: m = I.default,
191
- containerClassName: i = "",
192
- inputClassName: $ = "",
193
- labelClassName: u = "",
194
- ...p
195
- } = a;
196
- return /* @__PURE__ */ x("label", { className: `input-check-container ${i}`, children: [
197
- /* @__PURE__ */ n(
198
- "input",
199
- {
200
- id: h,
201
- ref: N,
202
- name: l,
203
- type: "checkbox",
204
- checked: v,
205
- onChange: e,
206
- className: `input-check ${W(m)} ${$}`,
207
- ...p
208
- }
209
- ),
210
- /* @__PURE__ */ n(
211
- "span",
212
- {
213
- className: `input-check-label ${H(m)} ${u}`,
214
- children: g
215
- }
216
- )
217
- ] });
218
- }), se = F(function(a, N) {
219
- const {
220
- value: v,
221
- onChange: e,
222
- options: l,
223
- containerClassName: h = "",
224
- inputClassName: g = "",
225
- labelClassName: m = "",
226
- helperText: i = "",
227
- helperTextClassName: $ = "",
228
- label: u = "",
229
- name: p = "",
230
- id: y = "",
231
- state: o = I.default,
232
- children: A,
233
- ...c
234
- } = a;
235
- return /* @__PURE__ */ x("div", { className: `select-input-container ${h}`, children: [
236
- /* @__PURE__ */ n(
237
- "select",
238
- {
239
- ...c,
240
- id: y,
241
- ref: N,
242
- name: p,
243
- value: v,
244
- onChange: e,
245
- className: `select-input ${W(o)} peer ${g}`,
246
- children: l?.map((r) => /* @__PURE__ */ n("option", { value: r.id, children: r.value ?? r.name ?? r.id }, r.id))
247
- }
248
- ),
249
- /* @__PURE__ */ n(
250
- "label",
251
- {
252
- htmlFor: y,
253
- className: `select-input-label ${H(o)} ${m}`,
254
- children: u
255
- }
256
- ),
257
- A,
258
- i && /* @__PURE__ */ n(
259
- "p",
260
- {
261
- className: `select-input-helper-text ${M(o)} ${$}`,
262
- children: i
263
- }
264
- )
265
- ] });
266
- }), q = (a) => a == null ? !1 : Array.isArray(a) ? a.length > 0 : `${a}`.length > 0, X = F(function(a, N) {
267
- const {
268
- children: v,
269
- state: e = I.default,
270
- label: l = "",
271
- containerClassName: h = "",
272
- inputClassName: g = "",
273
- labelClassName: m = "",
274
- helperText: i = "",
275
- helperTextClassName: $ = "",
276
- value: u,
277
- defaultValue: p,
278
- onChange: y,
279
- onFocus: o,
280
- onBlur: A,
281
- ...c
282
- } = a, r = u !== void 0, [E, b] = w(
283
- () => q(p)
284
- ), [k, f] = w(!1), L = r ? q(u) : E, B = !!c.placeholder || k, D = (d) => {
285
- r || b(d.currentTarget.value.length > 0), y?.(d);
286
- }, S = (d) => {
287
- k || f(!0), o?.(d);
288
- }, P = (d) => {
289
- k || f(!0), A?.(d);
290
- };
291
- return /* @__PURE__ */ x("div", { className: `text-input-container ${h}`, children: [
292
- /* @__PURE__ */ n(
293
- "input",
294
- {
295
- ref: N,
296
- defaultValue: p,
297
- onChange: D,
298
- onFocus: S,
299
- onBlur: P,
300
- ...r ? { value: u } : {},
301
- className: `text-input ${W(e)} ${g} ${L ? "has-value" : ""} ${c.placeholder ? "has-placeholder" : ""} ${B ? "keep-label-up" : ""}`,
302
- ...c
303
- }
304
- ),
305
- !!l && /* @__PURE__ */ x(
306
- "label",
307
- {
308
- htmlFor: c.id,
309
- className: `text-input-label ${H(e)} ${m}`,
310
- children: [
311
- l,
312
- c.required ? " *" : ""
313
- ]
314
- }
315
- ),
316
- v,
317
- !!i && /* @__PURE__ */ n(
318
- "p",
319
- {
320
- className: `text-input-helper-text ${M(e)} ${$}`,
321
- children: i
322
- }
323
- )
324
- ] });
325
- });
326
- export {
327
- le as A,
328
- re as C,
329
- se as S,
330
- X as T,
331
- I as a,
332
- M as h,
333
- W as i,
334
- H as l
335
- };