@bertimatteodev/astra-ui 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/astra-ui.cjs +1 -1
  2. package/dist/astra-ui.js +860 -116
  3. package/dist/index.css +1 -1
  4. package/dist/types/components/Badge/Badge.d.ts +7 -0
  5. package/dist/types/components/Badge/Badge.d.ts.map +1 -0
  6. package/dist/types/components/Badge/index.d.ts +3 -0
  7. package/dist/types/components/Badge/index.d.ts.map +1 -0
  8. package/dist/types/components/CalculatorKeypad/CalculatorKeypad.d.ts +3 -1
  9. package/dist/types/components/CalculatorKeypad/CalculatorKeypad.d.ts.map +1 -1
  10. package/dist/types/components/DataTable/DataTable.d.ts +58 -0
  11. package/dist/types/components/DataTable/DataTable.d.ts.map +1 -0
  12. package/dist/types/components/DataTable/index.d.ts +3 -0
  13. package/dist/types/components/DataTable/index.d.ts.map +1 -0
  14. package/dist/types/components/DatePicker/DatePicker.d.ts +18 -0
  15. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -0
  16. package/dist/types/components/DatePicker/index.d.ts +3 -0
  17. package/dist/types/components/DatePicker/index.d.ts.map +1 -0
  18. package/dist/types/components/Dropdown/Dropdown.d.ts +18 -0
  19. package/dist/types/components/Dropdown/Dropdown.d.ts.map +1 -0
  20. package/dist/types/components/Dropdown/index.d.ts +3 -0
  21. package/dist/types/components/Dropdown/index.d.ts.map +1 -0
  22. package/dist/types/components/IconButton/IconButton.d.ts +3 -1
  23. package/dist/types/components/IconButton/IconButton.d.ts.map +1 -1
  24. package/dist/types/components/MultiSelect/MultiSelect.d.ts +18 -0
  25. package/dist/types/components/MultiSelect/MultiSelect.d.ts.map +1 -0
  26. package/dist/types/components/MultiSelect/index.d.ts +3 -0
  27. package/dist/types/components/MultiSelect/index.d.ts.map +1 -0
  28. package/dist/types/components/Switch/Switch.d.ts +11 -0
  29. package/dist/types/components/Switch/Switch.d.ts.map +1 -0
  30. package/dist/types/components/Switch/index.d.ts +3 -0
  31. package/dist/types/components/Switch/index.d.ts.map +1 -0
  32. package/dist/types/index.d.ts +12 -0
  33. package/dist/types/index.d.ts.map +1 -1
  34. package/package.json +1 -1
package/dist/astra-ui.js CHANGED
@@ -1,6 +1,6 @@
1
- import { forwardRef as e, useId as t } from "react";
2
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
3
- import './index.css';var i = {
1
+ import { createContext as e, createElement as t, forwardRef as n, useContext as r, useEffect as i, useId as a, useMemo as o, useRef as s, useState as c } from "react";
2
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
3
+ import './index.css';var d = {
4
4
  button: "_button_gjxjz_1",
5
5
  sizeSm: "_sizeSm_gjxjz_31",
6
6
  sizeMd: "_sizeMd_gjxjz_37",
@@ -15,52 +15,52 @@ import './index.css';var i = {
15
15
  label: "_label_gjxjz_106",
16
16
  spinner: "_spinner_gjxjz_111",
17
17
  spin: "_spin_gjxjz_111"
18
- }, a = {
19
- primary: i.variantPrimary,
20
- secondary: i.variantSecondary,
21
- ghost: i.variantGhost,
22
- danger: i.variantDanger
23
- }, o = {
24
- sm: i.sizeSm,
25
- md: i.sizeMd,
26
- lg: i.sizeLg
18
+ }, f = {
19
+ primary: d.variantPrimary,
20
+ secondary: d.variantSecondary,
21
+ ghost: d.variantGhost,
22
+ danger: d.variantDanger
23
+ }, p = {
24
+ sm: d.sizeSm,
25
+ md: d.sizeMd,
26
+ lg: d.sizeLg
27
27
  };
28
- function s(...e) {
28
+ function m(...e) {
29
29
  return e.filter(Boolean).join(" ");
30
30
  }
31
- var c = e(function({ children: e, className: t, variant: c = "primary", size: l = "md", fullWidth: u = !1, isLoading: d = !1, startIcon: f, endIcon: p, disabled: m, type: h = "button", ...g }, _) {
32
- let v = m || d;
33
- return /* @__PURE__ */ r("button", {
31
+ var h = n(function({ children: e, className: t, variant: n = "primary", size: r = "md", fullWidth: i = !1, isLoading: a = !1, startIcon: o, endIcon: s, disabled: c, type: h = "button", ...g }, _) {
32
+ let v = c || a;
33
+ return /* @__PURE__ */ u("button", {
34
34
  ref: _,
35
35
  type: h,
36
- className: s(i.button, a[c], o[l], u && i.fullWidth, d && i.loading, t),
36
+ className: m(d.button, f[n], p[r], i && d.fullWidth, a && d.loading, t),
37
37
  disabled: v,
38
- "aria-busy": d || void 0,
38
+ "aria-busy": a || void 0,
39
39
  ...g,
40
40
  children: [
41
- d ? /* @__PURE__ */ n("span", {
42
- className: i.spinner,
41
+ a ? /* @__PURE__ */ l("span", {
42
+ className: d.spinner,
43
43
  "aria-hidden": "true"
44
44
  }) : null,
45
- !d && f ? /* @__PURE__ */ n("span", {
46
- className: i.icon,
45
+ !a && o ? /* @__PURE__ */ l("span", {
46
+ className: d.icon,
47
47
  "aria-hidden": "true",
48
- children: f
48
+ children: o
49
49
  }) : null,
50
- /* @__PURE__ */ n("span", {
51
- className: i.label,
50
+ /* @__PURE__ */ l("span", {
51
+ className: d.label,
52
52
  children: e
53
53
  }),
54
- !d && p ? /* @__PURE__ */ n("span", {
55
- className: i.icon,
54
+ !a && s ? /* @__PURE__ */ l("span", {
55
+ className: d.icon,
56
56
  "aria-hidden": "true",
57
- children: p
57
+ children: s
58
58
  }) : null
59
59
  ]
60
60
  });
61
61
  });
62
- c.displayName = "Button";
63
- var l = {
62
+ h.displayName = "Button";
63
+ var g = {
64
64
  card: "_card_1ex3y_1",
65
65
  paddingNone: "_paddingNone_1ex3y_9",
66
66
  paddingSm: "_paddingSm_1ex3y_13",
@@ -69,76 +69,420 @@ var l = {
69
69
  elevationNone: "_elevationNone_1ex3y_26",
70
70
  elevationSm: "_elevationSm_1ex3y_30",
71
71
  elevationMd: "_elevationMd_1ex3y_34"
72
- }, u = {
73
- none: l.paddingNone,
74
- sm: l.paddingSm,
75
- md: l.paddingMd,
76
- lg: l.paddingLg
77
- }, d = {
78
- none: l.elevationNone,
79
- sm: l.elevationSm,
80
- md: l.elevationMd
72
+ }, _ = {
73
+ none: g.paddingNone,
74
+ sm: g.paddingSm,
75
+ md: g.paddingMd,
76
+ lg: g.paddingLg
77
+ }, v = {
78
+ none: g.elevationNone,
79
+ sm: g.elevationSm,
80
+ md: g.elevationMd
81
81
  };
82
- function f(...e) {
82
+ function y(...e) {
83
83
  return e.filter(Boolean).join(" ");
84
84
  }
85
- var p = e(function({ children: e, className: t, padding: r = "md", elevation: i = "sm", ...a }, o) {
86
- return /* @__PURE__ */ n("div", {
87
- ref: o,
88
- className: f(l.card, u[r], d[i], t),
89
- ...a,
85
+ var b = n(function({ children: e, className: t, padding: n = "md", elevation: r = "sm", ...i }, a) {
86
+ return /* @__PURE__ */ l("div", {
87
+ ref: a,
88
+ className: y(g.card, _[n], v[r], t),
89
+ ...i,
90
90
  children: e
91
91
  });
92
92
  });
93
- p.displayName = "Card";
94
- var m = {
95
- button: "_button_cnvt9_1",
96
- sizeSm: "_sizeSm_cnvt9_27",
97
- sizeMd: "_sizeMd_cnvt9_32",
98
- sizeLg: "_sizeLg_cnvt9_37",
99
- variantPrimary: "_variantPrimary_cnvt9_42",
100
- variantSecondary: "_variantSecondary_cnvt9_51",
101
- variantGhost: "_variantGhost_cnvt9_61",
102
- variantDanger: "_variantDanger_cnvt9_70",
103
- icon: "_icon_cnvt9_78",
104
- spinner: "_spinner_cnvt9_90",
105
- spin: "_spin_cnvt9_90",
106
- loading: "_loading_cnvt9_99"
107
- }, h = {
108
- primary: m.variantPrimary,
109
- secondary: m.variantSecondary,
110
- ghost: m.variantGhost,
111
- danger: m.variantDanger
112
- }, g = {
113
- sm: m.sizeSm,
114
- md: m.sizeMd,
115
- lg: m.sizeLg
93
+ b.displayName = "Card";
94
+ //#endregion
95
+ //#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
96
+ var x = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), S = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), C = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), w = (e) => {
97
+ let t = C(e);
98
+ return t.charAt(0).toUpperCase() + t.slice(1);
99
+ }, T = {
100
+ xmlns: "http://www.w3.org/2000/svg",
101
+ width: 24,
102
+ height: 24,
103
+ viewBox: "0 0 24 24",
104
+ fill: "none",
105
+ stroke: "currentColor",
106
+ strokeWidth: 2,
107
+ strokeLinecap: "round",
108
+ strokeLinejoin: "round"
109
+ }, E = (e) => {
110
+ for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
111
+ return !1;
112
+ }, D = e({}), O = () => r(D), k = n(({ color: e, size: n, strokeWidth: r, absoluteStrokeWidth: i, className: a = "", children: o, iconNode: s, ...c }, l) => {
113
+ let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = O() ?? {}, h = i ?? f ? Number(r ?? d) * 24 / Number(n ?? u) : r ?? d;
114
+ return t("svg", {
115
+ ref: l,
116
+ ...T,
117
+ width: n ?? u ?? T.width,
118
+ height: n ?? u ?? T.height,
119
+ stroke: e ?? p,
120
+ strokeWidth: h,
121
+ className: x("lucide", m, a),
122
+ ...!o && !E(c) && { "aria-hidden": "true" },
123
+ ...c
124
+ }, [...s.map(([e, n]) => t(e, n)), ...Array.isArray(o) ? o : [o]]);
125
+ }), A = (e, r) => {
126
+ let i = n(({ className: n, ...i }, a) => t(k, {
127
+ ref: a,
128
+ iconNode: r,
129
+ className: x(`lucide-${S(w(e))}`, `lucide-${e}`, n),
130
+ ...i
131
+ }));
132
+ return i.displayName = w(e), i;
133
+ }, ee = A("calendar-days", [
134
+ ["path", {
135
+ d: "M8 2v3",
136
+ key: "1ioesn"
137
+ }],
138
+ ["path", {
139
+ d: "M16 2v3",
140
+ key: "otl347"
141
+ }],
142
+ ["rect", {
143
+ x: "3",
144
+ y: "3",
145
+ width: "18",
146
+ height: "18",
147
+ rx: "2",
148
+ key: "h1oib"
149
+ }],
150
+ ["path", {
151
+ d: "M3 9h18",
152
+ key: "1pudct"
153
+ }],
154
+ ["path", {
155
+ d: "M8 13h.01",
156
+ key: "1sbv64"
157
+ }],
158
+ ["path", {
159
+ d: "M12 13h.01",
160
+ key: "y0uutt"
161
+ }],
162
+ ["path", {
163
+ d: "M16 13h.01",
164
+ key: "wip0gl"
165
+ }],
166
+ ["path", {
167
+ d: "M8 17h.01",
168
+ key: "p3bg7i"
169
+ }],
170
+ ["path", {
171
+ d: "M12 17h.01",
172
+ key: "p32p05"
173
+ }],
174
+ ["path", {
175
+ d: "M16 17h.01",
176
+ key: "ql8jdd"
177
+ }]
178
+ ]), j = A("chevron-down", [["path", {
179
+ d: "m6 9 6 6 6-6",
180
+ key: "qrunsl"
181
+ }]]), M = A("chevron-left", [["path", {
182
+ d: "m15 18-6-6 6-6",
183
+ key: "1wnfg3"
184
+ }]]), N = A("chevron-right", [["path", {
185
+ d: "m9 18 6-6-6-6",
186
+ key: "mthhwq"
187
+ }]]), P = A("chevron-up", [["path", {
188
+ d: "m18 15-6-6-6 6",
189
+ key: "153udz"
190
+ }]]), F = A("chevrons-up-down", [["path", {
191
+ d: "m7 15 5 5 5-5",
192
+ key: "1hf1tw"
193
+ }], ["path", {
194
+ d: "m7 9 5-5 5 5",
195
+ key: "sgt6xg"
196
+ }]]), I = {
197
+ field: "_field_t3jjk_1",
198
+ label: "_label_t3jjk_8",
199
+ trigger: "_trigger_t3jjk_15",
200
+ triggerIcon: "_triggerIcon_t3jjk_44",
201
+ triggerValue: "_triggerValue_t3jjk_50",
202
+ placeholder: "_placeholder_t3jjk_57",
203
+ isDisabled: "_isDisabled_t3jjk_61",
204
+ hasError: "_hasError_t3jjk_68",
205
+ error: "_error_t3jjk_76",
206
+ popover: "_popover_t3jjk_83",
207
+ calendarHeader: "_calendarHeader_t3jjk_98",
208
+ monthLabel: "_monthLabel_t3jjk_105",
209
+ navigationButton: "_navigationButton_t3jjk_116",
210
+ calendarGrid: "_calendarGrid_t3jjk_139",
211
+ weekDay: "_weekDay_t3jjk_145",
212
+ day: "_day_t3jjk_156",
213
+ selectedDay: "_selectedDay_t3jjk_173",
214
+ outsideMonth: "_outsideMonth_t3jjk_190",
215
+ today: "_today_t3jjk_195",
216
+ footer: "_footer_t3jjk_210",
217
+ textButton: "_textButton_t3jjk_218"
218
+ }, L = [
219
+ "Lun",
220
+ "Mar",
221
+ "Mer",
222
+ "Gio",
223
+ "Ven",
224
+ "Sab",
225
+ "Dom"
226
+ ];
227
+ function R(e) {
228
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate());
229
+ }
230
+ function z(e) {
231
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
232
+ }
233
+ function B(e, t) {
234
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
235
+ }
236
+ function V(e, t) {
237
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
238
+ }
239
+ function H(e, t, n) {
240
+ let r = R(e);
241
+ return !!(t && r < R(t) || n && r > R(n));
242
+ }
243
+ function te(e) {
244
+ let t = e.getFullYear(), n = e.getMonth(), r = new Date(t, n, 1), i = new Date(t, n + 1, 0), a = (r.getDay() + 6) % 7, o = Math.ceil((a + i.getDate()) / 7) * 7, s = new Date(t, n, 1 - a);
245
+ return Array.from({ length: o }, (e, t) => new Date(s.getFullYear(), s.getMonth(), s.getDate() + t));
246
+ }
247
+ function ne(e, t) {
248
+ let n = new Intl.DateTimeFormat(t, {
249
+ month: "long",
250
+ year: "numeric"
251
+ }).format(e);
252
+ return n.charAt(0).toUpperCase() + n.slice(1);
253
+ }
254
+ function re(e, t) {
255
+ return e ? new Intl.DateTimeFormat(t, {
256
+ day: "2-digit",
257
+ month: "short",
258
+ year: "numeric"
259
+ }).format(e) : "";
260
+ }
261
+ function U(...e) {
262
+ return e.filter(Boolean).join(" ");
263
+ }
264
+ function ie({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una data", locale: d = "it-IT", disabled: f = !1, minDate: p, maxDate: m, clearable: h = !1, name: g, id: _, error: v }) {
265
+ let y = a(), b = _ ?? `date-picker-${y}`, x = `${b}-dialog`, S = `${b}-error`, C = s(null), w = s(null), [T, E] = c(!1), [D, O] = c(() => R(e ?? /* @__PURE__ */ new Date())), k = o(() => te(D), [D]), A = R(/* @__PURE__ */ new Date());
266
+ i(() => {
267
+ e && O(R(e));
268
+ }, [e]), i(() => {
269
+ function e(e) {
270
+ C.current && !C.current.contains(e.target) && E(!1);
271
+ }
272
+ function t(e) {
273
+ e.key === "Escape" && (E(!1), w.current?.focus());
274
+ }
275
+ return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
276
+ document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
277
+ };
278
+ }, []);
279
+ function j() {
280
+ f || (O(R(e ?? /* @__PURE__ */ new Date())), E(!0));
281
+ }
282
+ function P(e) {
283
+ H(e, p, m) || (t(R(e)), E(!1), w.current?.focus());
284
+ }
285
+ function F(e) {
286
+ O((t) => new Date(t.getFullYear(), t.getMonth() + e, 1));
287
+ }
288
+ function ie(e, t) {
289
+ let n = new Date(t);
290
+ if (e.key === "ArrowLeft") n.setDate(t.getDate() - 1);
291
+ else if (e.key === "ArrowRight") n.setDate(t.getDate() + 1);
292
+ else if (e.key === "ArrowUp") n.setDate(t.getDate() - 7);
293
+ else if (e.key === "ArrowDown") n.setDate(t.getDate() + 7);
294
+ else if (e.key === "Home") n.setDate(t.getDate() - (t.getDay() + 6) % 7);
295
+ else if (e.key === "End") n.setDate(t.getDate() + (6 - (t.getDay() + 6) % 7));
296
+ else return;
297
+ e.preventDefault();
298
+ let r = `${b}-${z(n)}`, i = document.getElementById(r);
299
+ if (i) {
300
+ i.focus();
301
+ return;
302
+ }
303
+ O(new Date(n.getFullYear(), n.getMonth(), 1));
304
+ }
305
+ let W = re(e, d);
306
+ return /* @__PURE__ */ u("div", {
307
+ ref: C,
308
+ className: I.field,
309
+ children: [
310
+ n ? /* @__PURE__ */ l("label", {
311
+ className: I.label,
312
+ htmlFor: b,
313
+ children: n
314
+ }) : null,
315
+ /* @__PURE__ */ l("input", {
316
+ id: b,
317
+ type: "hidden",
318
+ name: g,
319
+ value: e ? z(e) : ""
320
+ }),
321
+ /* @__PURE__ */ u("button", {
322
+ ref: w,
323
+ type: "button",
324
+ className: U(I.trigger, v && I.hasError, f && I.isDisabled),
325
+ disabled: f,
326
+ "aria-haspopup": "dialog",
327
+ "aria-expanded": T,
328
+ "aria-controls": T ? x : void 0,
329
+ onClick: () => T ? E(!1) : j(),
330
+ children: [/* @__PURE__ */ l(ee, {
331
+ className: I.triggerIcon,
332
+ size: 18,
333
+ "aria-hidden": "true"
334
+ }), /* @__PURE__ */ l("span", {
335
+ className: U(I.triggerValue, !e && I.placeholder),
336
+ children: W || r
337
+ })]
338
+ }),
339
+ v ? /* @__PURE__ */ l("p", {
340
+ id: S,
341
+ className: I.error,
342
+ role: "alert",
343
+ children: v
344
+ }) : null,
345
+ T ? /* @__PURE__ */ u("div", {
346
+ id: x,
347
+ className: I.popover,
348
+ role: "dialog",
349
+ "aria-label": "Seleziona una data",
350
+ children: [
351
+ /* @__PURE__ */ u("header", {
352
+ className: I.calendarHeader,
353
+ children: [
354
+ /* @__PURE__ */ l("button", {
355
+ type: "button",
356
+ className: I.navigationButton,
357
+ "aria-label": "Mese precedente",
358
+ onClick: () => F(-1),
359
+ children: /* @__PURE__ */ l(M, {
360
+ size: 18,
361
+ "aria-hidden": "true"
362
+ })
363
+ }),
364
+ /* @__PURE__ */ l("span", {
365
+ className: I.monthLabel,
366
+ children: ne(D, d)
367
+ }),
368
+ /* @__PURE__ */ l("button", {
369
+ type: "button",
370
+ className: I.navigationButton,
371
+ "aria-label": "Mese successivo",
372
+ onClick: () => F(1),
373
+ children: /* @__PURE__ */ l(N, {
374
+ size: 18,
375
+ "aria-hidden": "true"
376
+ })
377
+ })
378
+ ]
379
+ }),
380
+ /* @__PURE__ */ u("div", {
381
+ className: I.calendarGrid,
382
+ role: "grid",
383
+ "aria-label": ne(D, d),
384
+ children: [L.map((e) => /* @__PURE__ */ l("span", {
385
+ className: I.weekDay,
386
+ role: "columnheader",
387
+ children: e
388
+ }, e)), k.map((t) => {
389
+ let n = V(t, D), r = e ? B(t, e) : !1, i = B(t, A), a = H(t, p, m), o = `${b}-${z(t)}`;
390
+ return /* @__PURE__ */ l("button", {
391
+ id: o,
392
+ type: "button",
393
+ role: "gridcell",
394
+ className: U(I.day, !n && I.outsideMonth, r && I.selectedDay, i && I.today),
395
+ disabled: a,
396
+ "aria-label": new Intl.DateTimeFormat(d, {
397
+ weekday: "long",
398
+ day: "numeric",
399
+ month: "long",
400
+ year: "numeric"
401
+ }).format(t),
402
+ "aria-selected": r,
403
+ tabIndex: r || !e && i ? 0 : -1,
404
+ onClick: () => P(t),
405
+ onKeyDown: (e) => ie(e, t),
406
+ children: t.getDate()
407
+ }, o);
408
+ })]
409
+ }),
410
+ /* @__PURE__ */ u("footer", {
411
+ className: I.footer,
412
+ children: [/* @__PURE__ */ l("button", {
413
+ type: "button",
414
+ className: I.textButton,
415
+ onClick: () => {
416
+ O(A), P(A);
417
+ },
418
+ children: "Oggi"
419
+ }), h && e ? /* @__PURE__ */ l("button", {
420
+ type: "button",
421
+ className: I.textButton,
422
+ onClick: () => {
423
+ t(null), E(!1), w.current?.focus();
424
+ },
425
+ children: "Cancella"
426
+ }) : null]
427
+ })
428
+ ]
429
+ }) : null
430
+ ]
431
+ });
432
+ }
433
+ var W = {
434
+ button: "_button_2kydv_1",
435
+ sizeSm: "_sizeSm_2kydv_27",
436
+ sizeMd: "_sizeMd_2kydv_32",
437
+ sizeLg: "_sizeLg_2kydv_37",
438
+ variantPrimary: "_variantPrimary_2kydv_42",
439
+ variantSecondary: "_variantSecondary_2kydv_51",
440
+ variantGhost: "_variantGhost_2kydv_61",
441
+ variantDanger: "_variantDanger_2kydv_70",
442
+ borderless: "_borderless_2kydv_78",
443
+ icon: "_icon_2kydv_82",
444
+ spinner: "_spinner_2kydv_94",
445
+ spin: "_spin_2kydv_94",
446
+ loading: "_loading_2kydv_103"
447
+ }, ae = {
448
+ primary: W.variantPrimary,
449
+ secondary: W.variantSecondary,
450
+ ghost: W.variantGhost,
451
+ danger: W.variantDanger
452
+ }, oe = {
453
+ sm: W.sizeSm,
454
+ md: W.sizeMd,
455
+ lg: W.sizeLg
116
456
  };
117
- function _(...e) {
457
+ function se(...e) {
118
458
  return e.filter(Boolean).join(" ");
119
459
  }
120
- var v = e(function({ icon: e, label: t, className: r, variant: i = "secondary", size: a = "md", isLoading: o = !1, disabled: s, type: c = "button", ...l }, u) {
121
- let d = s || o;
122
- return /* @__PURE__ */ n("button", {
123
- ref: u,
124
- type: c,
125
- className: _(m.button, h[i], g[a], o && m.loading, r),
126
- disabled: d,
460
+ var ce = n(function({ icon: e, label: t, className: n, variant: r = "secondary", size: i = "md", isLoading: a = !1, borderless: o = !1, backgroundColor: s, disabled: c, type: u = "button", style: d, ...f }, p) {
461
+ let m = c || a, h = s ? {
462
+ ...d,
463
+ backgroundColor: s
464
+ } : d;
465
+ return /* @__PURE__ */ l("button", {
466
+ ref: p,
467
+ type: u,
468
+ className: se(W.button, ae[r], oe[i], a && W.loading, o && W.borderless, n),
469
+ style: h,
470
+ disabled: m,
127
471
  "aria-label": t,
128
- "aria-busy": o || void 0,
129
- ...l,
130
- children: o ? /* @__PURE__ */ n("span", {
131
- className: m.spinner,
472
+ "aria-busy": a || void 0,
473
+ ...f,
474
+ children: a ? /* @__PURE__ */ l("span", {
475
+ className: W.spinner,
132
476
  "aria-hidden": "true"
133
- }) : /* @__PURE__ */ n("span", {
134
- className: m.icon,
477
+ }) : /* @__PURE__ */ l("span", {
478
+ className: W.icon,
135
479
  "aria-hidden": "true",
136
480
  children: e
137
481
  })
138
482
  });
139
483
  });
140
- v.displayName = "IconButton";
141
- var y = {
484
+ ce.displayName = "IconButton";
485
+ var G = {
142
486
  field: "_field_1pq0j_1",
143
487
  label: "_label_1pq0j_7",
144
488
  required: "_required_1pq0j_14",
@@ -152,66 +496,466 @@ var y = {
152
496
  };
153
497
  //#endregion
154
498
  //#region src/components/TextField/TextField.tsx
155
- function b(...e) {
499
+ function K(...e) {
156
500
  return e.filter(Boolean).join(" ");
157
501
  }
158
- var x = e(function({ id: e, label: i, hint: a, error: o, startAdornment: s, endAdornment: c, className: l, containerClassName: u, disabled: d, required: f, "aria-describedby": p, ...m }, h) {
159
- let g = t(), _ = e ?? `text-field-${g}`, v = `${_}-hint`, x = `${_}-error`, S = [
502
+ var le = n(function({ id: e, label: t, hint: n, error: r, startAdornment: i, endAdornment: o, className: s, containerClassName: c, disabled: d, required: f, "aria-describedby": p, ...m }, h) {
503
+ let g = a(), _ = e ?? `text-field-${g}`, v = `${_}-hint`, y = `${_}-error`, b = [
160
504
  p,
161
- a ? v : null,
162
- o ? x : null
505
+ n ? v : null,
506
+ r ? y : null
163
507
  ].filter(Boolean).join(" ");
164
- return /* @__PURE__ */ r("div", {
165
- className: b(y.field, u),
508
+ return /* @__PURE__ */ u("div", {
509
+ className: K(G.field, c),
166
510
  children: [
167
- i ? /* @__PURE__ */ r("label", {
168
- className: y.label,
511
+ t ? /* @__PURE__ */ u("label", {
512
+ className: G.label,
169
513
  htmlFor: _,
170
- children: [i, f ? /* @__PURE__ */ r("span", {
171
- className: y.required,
514
+ children: [t, f ? /* @__PURE__ */ u("span", {
515
+ className: G.required,
172
516
  "aria-hidden": "true",
173
517
  children: [" ", "*"]
174
518
  }) : null]
175
519
  }) : null,
176
- /* @__PURE__ */ r("div", {
177
- className: b(y.control, o && y.hasError, d && y.isDisabled),
520
+ /* @__PURE__ */ u("div", {
521
+ className: K(G.control, r && G.hasError, d && G.isDisabled),
178
522
  children: [
179
- s ? /* @__PURE__ */ n("span", {
180
- className: y.adornment,
523
+ i ? /* @__PURE__ */ l("span", {
524
+ className: G.adornment,
181
525
  "aria-hidden": "true",
182
- children: s
526
+ children: i
183
527
  }) : null,
184
- /* @__PURE__ */ n("input", {
528
+ /* @__PURE__ */ l("input", {
185
529
  ref: h,
186
530
  id: _,
187
- className: b(y.input, l),
531
+ className: K(G.input, s),
188
532
  disabled: d,
189
533
  required: f,
190
- "aria-invalid": o ? !0 : void 0,
191
- "aria-describedby": S || void 0,
534
+ "aria-invalid": r ? !0 : void 0,
535
+ "aria-describedby": b || void 0,
192
536
  ...m
193
537
  }),
194
- c ? /* @__PURE__ */ n("span", {
195
- className: y.adornment,
538
+ o ? /* @__PURE__ */ l("span", {
539
+ className: G.adornment,
196
540
  "aria-hidden": "true",
197
- children: c
541
+ children: o
198
542
  }) : null
199
543
  ]
200
544
  }),
201
- o ? /* @__PURE__ */ n("p", {
202
- id: x,
203
- className: y.error,
545
+ r ? /* @__PURE__ */ l("p", {
546
+ id: y,
547
+ className: G.error,
204
548
  role: "alert",
205
- children: o
549
+ children: r
206
550
  }) : null,
207
- !o && a ? /* @__PURE__ */ n("p", {
551
+ !r && n ? /* @__PURE__ */ l("p", {
208
552
  id: v,
209
- className: y.hint,
210
- children: a
553
+ className: G.hint,
554
+ children: n
211
555
  }) : null
212
556
  ]
213
557
  });
214
558
  });
215
- x.displayName = "TextField";
559
+ le.displayName = "TextField";
560
+ var q = {
561
+ field: "_field_3nnjq_1",
562
+ label: "_label_3nnjq_7",
563
+ required: "_required_3nnjq_14",
564
+ control: "_control_3nnjq_18",
565
+ nativeSelect: "_nativeSelect_3nnjq_34",
566
+ trigger: "_trigger_3nnjq_45",
567
+ indicator: "_indicator_3nnjq_66",
568
+ placeholder: "_placeholder_3nnjq_78",
569
+ menu: "_menu_3nnjq_82",
570
+ option: "_option_3nnjq_98",
571
+ activeOption: "_activeOption_3nnjq_110",
572
+ selectedOption: "_selectedOption_3nnjq_114",
573
+ isOpen: "_isOpen_3nnjq_124",
574
+ hint: "_hint_3nnjq_129",
575
+ error: "_error_3nnjq_130",
576
+ hasError: "_hasError_3nnjq_144",
577
+ isDisabled: "_isDisabled_3nnjq_152"
578
+ };
579
+ //#endregion
580
+ //#region src/components/Dropdown/Dropdown.tsx
581
+ function J(...e) {
582
+ return e.filter(Boolean).join(" ");
583
+ }
584
+ var ue = n(function({ id: e, options: t, label: n, hint: r, error: o, placeholder: d, className: f, containerClassName: p, disabled: m, required: h, value: g, defaultValue: _, onChange: v, onValueChange: y, "aria-describedby": b, ...x }, S) {
585
+ let C = a(), w = e ?? `dropdown-${C}`, T = `${w}-hint`, E = `${w}-error`, D = `${w}-label`, O = `${w}-listbox`, k = [
586
+ b,
587
+ r ? T : null,
588
+ o ? E : null
589
+ ].filter(Boolean).join(" "), A = typeof g == "string" ? g : void 0, [ee, j] = c(typeof _ == "string" ? _ : ""), [M, N] = c(!1), [P, F] = c(0), I = s(null), L = A ?? ee, R = t.find((e) => e.value === L), z = t.reduce((e, t, n) => (t.disabled || e.push(n), e), []);
590
+ i(() => {
591
+ function e(e) {
592
+ I.current?.contains(e.target) || N(!1);
593
+ }
594
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
595
+ }, []);
596
+ function B(e) {
597
+ v?.(e), y?.(e.target.value);
598
+ }
599
+ function V(e) {
600
+ A === void 0 && j(e), y?.(e), N(!1);
601
+ }
602
+ function H(e) {
603
+ if (!m) {
604
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
605
+ e.preventDefault(), N(!0);
606
+ let t = (z.indexOf(P) + (e.key === "ArrowDown" ? 1 : -1) + z.length) % z.length;
607
+ F(z[t] ?? 0);
608
+ }
609
+ if (e.key === "Enter" || e.key === " ") {
610
+ if (e.preventDefault(), M) {
611
+ let e = t[P];
612
+ e && !e.disabled && V(e.value);
613
+ } else N(!0);
614
+ }
615
+ e.key === "Escape" && N(!1);
616
+ }
617
+ }
618
+ return /* @__PURE__ */ u("div", {
619
+ className: J(q.field, p),
620
+ children: [
621
+ n ? /* @__PURE__ */ u("label", {
622
+ id: D,
623
+ className: q.label,
624
+ htmlFor: w,
625
+ children: [n, h ? /* @__PURE__ */ u("span", {
626
+ className: q.required,
627
+ "aria-hidden": "true",
628
+ children: [" ", "*"]
629
+ }) : null]
630
+ }) : null,
631
+ /* @__PURE__ */ u("div", {
632
+ ref: I,
633
+ className: J(q.control, o && q.hasError, m && q.isDisabled, M && q.isOpen),
634
+ children: [
635
+ /* @__PURE__ */ u("select", {
636
+ ref: S,
637
+ id: w,
638
+ className: q.nativeSelect,
639
+ disabled: m,
640
+ required: h,
641
+ value: L,
642
+ "aria-invalid": o ? !0 : void 0,
643
+ "aria-describedby": k || void 0,
644
+ onChange: B,
645
+ ...x,
646
+ children: [d ? /* @__PURE__ */ l("option", {
647
+ value: "",
648
+ disabled: !0,
649
+ children: d
650
+ }) : null, t.map((e) => /* @__PURE__ */ l("option", {
651
+ value: e.value,
652
+ disabled: e.disabled,
653
+ children: e.label
654
+ }, e.value))]
655
+ }),
656
+ /* @__PURE__ */ u("button", {
657
+ type: "button",
658
+ className: J(q.trigger, f),
659
+ disabled: m,
660
+ "aria-haspopup": "listbox",
661
+ "aria-expanded": M,
662
+ "aria-controls": O,
663
+ "aria-labelledby": n ? D : void 0,
664
+ "aria-describedby": k || void 0,
665
+ "aria-invalid": o ? !0 : void 0,
666
+ onClick: () => N((e) => !e),
667
+ onKeyDown: H,
668
+ children: [/* @__PURE__ */ l("span", {
669
+ className: R ? void 0 : q.placeholder,
670
+ children: R?.label ?? d
671
+ }), /* @__PURE__ */ l("span", {
672
+ className: q.indicator,
673
+ "aria-hidden": "true"
674
+ })]
675
+ }),
676
+ M ? /* @__PURE__ */ u("div", {
677
+ id: O,
678
+ className: q.menu,
679
+ role: "listbox",
680
+ children: [d ? /* @__PURE__ */ l("button", {
681
+ type: "button",
682
+ className: J(q.option, !L && q.selectedOption),
683
+ role: "option",
684
+ "aria-selected": !L,
685
+ onClick: () => V(""),
686
+ children: d
687
+ }) : null, t.map((e, t) => /* @__PURE__ */ l("button", {
688
+ type: "button",
689
+ className: J(q.option, e.value === L && q.selectedOption, t === P && q.activeOption),
690
+ role: "option",
691
+ "aria-selected": e.value === L,
692
+ disabled: e.disabled,
693
+ onMouseEnter: () => F(t),
694
+ onClick: () => V(e.value),
695
+ children: e.label
696
+ }, e.value))]
697
+ }) : null
698
+ ]
699
+ }),
700
+ o ? /* @__PURE__ */ l("p", {
701
+ id: E,
702
+ className: q.error,
703
+ role: "alert",
704
+ children: o
705
+ }) : null,
706
+ !o && r ? /* @__PURE__ */ l("p", {
707
+ id: T,
708
+ className: q.hint,
709
+ children: r
710
+ }) : null
711
+ ]
712
+ });
713
+ });
714
+ ue.displayName = "Dropdown";
715
+ var Y = {
716
+ group: "_group_1fqa2_1",
717
+ option: "_option_1fqa2_8",
718
+ selected: "_selected_1fqa2_41",
719
+ count: "_count_1fqa2_52"
720
+ };
721
+ //#endregion
722
+ //#region src/components/MultiSelect/MultiSelect.tsx
723
+ function de(...e) {
724
+ return e.filter(Boolean).join(" ");
725
+ }
726
+ var fe = n(function({ options: e, value: t, defaultValue: n = [], multiple: r = !1, disabled: i = !1, className: a, onValueChange: o, "aria-label": s = r ? "Selezione multipla" : "Selezione singola", ...d }, f) {
727
+ let [p, m] = c(n), h = t ?? p, g = r ? h : h.slice(0, 1);
728
+ function _(e) {
729
+ let n = g.includes(e), i = r ? n ? g.filter((t) => t !== e) : [...g, e] : n ? [] : [e];
730
+ t === void 0 && m(i), o?.(i);
731
+ }
732
+ return /* @__PURE__ */ l("div", {
733
+ ref: f,
734
+ role: "group",
735
+ "aria-label": s,
736
+ className: de(Y.group, a),
737
+ ...d,
738
+ children: e.map((e) => {
739
+ let t = g.includes(e.value), n = i || e.disabled, r = e.selectedColor ? {
740
+ "--multi-select-selected-color": e.selectedColor,
741
+ "--multi-select-selected-background": `color-mix(in srgb, ${e.selectedColor} 14%, transparent)`
742
+ } : void 0;
743
+ return /* @__PURE__ */ u("button", {
744
+ type: "button",
745
+ className: de(Y.option, t && Y.selected),
746
+ disabled: n,
747
+ "aria-pressed": t,
748
+ style: r,
749
+ onClick: () => _(e.value),
750
+ children: [e.count === void 0 ? null : /* @__PURE__ */ l("span", {
751
+ className: Y.count,
752
+ children: e.count
753
+ }), /* @__PURE__ */ l("span", { children: e.label })]
754
+ }, e.value);
755
+ })
756
+ });
757
+ });
758
+ fe.displayName = "MultiSelect";
759
+ var pe = { badge: "_badge_3xnd3_1" };
760
+ //#endregion
761
+ //#region src/components/Badge/Badge.tsx
762
+ function me(...e) {
763
+ return e.filter(Boolean).join(" ");
764
+ }
765
+ var he = n(function({ text: e, color: t, className: n, style: r, ...i }, a) {
766
+ let o = t ? {
767
+ ...r,
768
+ "--badge-color": t,
769
+ "--badge-background": `color-mix(in srgb, ${t} 14%, transparent)`
770
+ } : r;
771
+ return /* @__PURE__ */ l("span", {
772
+ ref: a,
773
+ className: me(pe.badge, n),
774
+ style: o,
775
+ ...i,
776
+ children: e
777
+ });
778
+ });
779
+ he.displayName = "Badge";
780
+ var X = {
781
+ switch: "_switch_1u3md_1",
782
+ input: "_input_1u3md_14",
783
+ track: "_track_1u3md_24",
784
+ thumb: "_thumb_1u3md_31",
785
+ sizeSm: "_sizeSm_1u3md_57",
786
+ sizeMd: "_sizeMd_1u3md_64",
787
+ sizeLg: "_sizeLg_1u3md_71",
788
+ disabled: "_disabled_1u3md_78"
789
+ };
790
+ //#endregion
791
+ //#region src/components/Switch/Switch.tsx
792
+ function ge(...e) {
793
+ return e.filter(Boolean).join(" ");
794
+ }
795
+ var Z = n(function({ label: e, className: t, color: n, size: r = "md", disabled: i = !1, onChange: a, onCheckedChange: o, "aria-label": s = "Interruttore", style: c, ...d }, f) {
796
+ function p(e) {
797
+ a?.(e), o?.(e.target.checked);
798
+ }
799
+ let m = n ? {
800
+ ...c,
801
+ "--switch-color": n
802
+ } : c;
803
+ return /* @__PURE__ */ u("label", {
804
+ className: ge(X.switch, X[`size${r[0].toUpperCase()}${r.slice(1)}`], i && X.disabled, t),
805
+ style: m,
806
+ children: [
807
+ /* @__PURE__ */ l("input", {
808
+ ref: f,
809
+ type: "checkbox",
810
+ className: X.input,
811
+ disabled: i,
812
+ "aria-label": s,
813
+ onChange: p,
814
+ ...d
815
+ }),
816
+ /* @__PURE__ */ l("span", {
817
+ className: X.track,
818
+ "aria-hidden": "true",
819
+ children: /* @__PURE__ */ l("span", { className: X.thumb })
820
+ }),
821
+ e ? /* @__PURE__ */ l("span", {
822
+ className: X.label,
823
+ children: e
824
+ }) : null
825
+ ]
826
+ });
827
+ });
828
+ Z.displayName = "Switch";
829
+ var Q = {
830
+ wrapper: "_wrapper_1ly5u_1",
831
+ table: "_table_1ly5u_11",
832
+ caption: "_caption_1ly5u_19",
833
+ head: "_head_1ly5u_31",
834
+ headerCell: "_headerCell_1ly5u_35",
835
+ cell: "_cell_1ly5u_47",
836
+ body: "_body_1ly5u_56",
837
+ row: "_row_1ly5u_56",
838
+ interactiveRow: "_interactiveRow_1ly5u_65",
839
+ alignLeft: "_alignLeft_1ly5u_78",
840
+ alignCenter: "_alignCenter_1ly5u_82",
841
+ alignRight: "_alignRight_1ly5u_86",
842
+ numeric: "_numeric_1ly5u_90",
843
+ sortButton: "_sortButton_1ly5u_96",
844
+ sortIcon: "_sortIcon_1ly5u_119",
845
+ statusCell: "_statusCell_1ly5u_128",
846
+ hideOnMobile: "_hideOnMobile_1ly5u_137"
847
+ };
848
+ //#endregion
849
+ //#region src/components/DataTable/DataTable.tsx
850
+ function $(...e) {
851
+ return e.filter(Boolean).join(" ");
852
+ }
853
+ function _e(e, t) {
854
+ return e == null ? 1 : t == null ? -1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t), "it-IT", {
855
+ numeric: !0,
856
+ sensitivity: "base"
857
+ });
858
+ }
859
+ function ve({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "Non sono disponibili dati da visualizzare.", isLoading: a = !1, sortable: s = !0, onRowClick: d, rowAriaLabel: f, className: p, containerClassName: m, ...h }) {
860
+ let [g, _] = c(null), v = o(() => {
861
+ if (!g?.column.sortValue) return t;
862
+ let { column: e, direction: n } = g, r = n === "ascending" ? 1 : -1;
863
+ return [...t].sort((t, n) => _e(e.sortValue?.(t), e.sortValue?.(n)) * r);
864
+ }, [t, g]);
865
+ function y(e) {
866
+ !s || !e.sortable || !e.sortValue || _((t) => t?.column.id === e.id ? t.direction === "ascending" ? {
867
+ column: e,
868
+ direction: "descending"
869
+ } : null : {
870
+ column: e,
871
+ direction: "ascending"
872
+ });
873
+ }
874
+ function b(e) {
875
+ return g?.column.id === e.id ? g.direction : "none";
876
+ }
877
+ function x(e) {
878
+ return g?.column.id === e.id ? g.direction === "ascending" ? /* @__PURE__ */ l(P, {
879
+ size: 15,
880
+ "aria-hidden": "true"
881
+ }) : /* @__PURE__ */ l(j, {
882
+ size: 15,
883
+ "aria-hidden": "true"
884
+ }) : /* @__PURE__ */ l(F, {
885
+ size: 15,
886
+ "aria-hidden": "true"
887
+ });
888
+ }
889
+ return /* @__PURE__ */ l("div", {
890
+ className: $(Q.wrapper, m),
891
+ children: /* @__PURE__ */ u("table", {
892
+ className: $(Q.table, p),
893
+ ...h,
894
+ children: [
895
+ r ? /* @__PURE__ */ l("caption", {
896
+ className: Q.caption,
897
+ children: r
898
+ }) : null,
899
+ /* @__PURE__ */ l("colgroup", { children: e.map((e) => /* @__PURE__ */ l("col", { style: e.width ? { width: e.width } : void 0 }, e.id)) }),
900
+ /* @__PURE__ */ l("thead", {
901
+ className: Q.head,
902
+ children: /* @__PURE__ */ l("tr", { children: e.map((e) => {
903
+ let t = s && e.sortable && !!e.sortValue;
904
+ return /* @__PURE__ */ l("th", {
905
+ scope: "col",
906
+ "aria-sort": t ? b(e) : void 0,
907
+ className: $(Q.headerCell, Q[`align${ye(e.align ?? "left")}`], e.hideOnMobile && Q.hideOnMobile),
908
+ children: t ? /* @__PURE__ */ u("button", {
909
+ type: "button",
910
+ className: Q.sortButton,
911
+ onClick: () => y(e),
912
+ children: [/* @__PURE__ */ l("span", { children: e.header }), /* @__PURE__ */ l("span", {
913
+ className: Q.sortIcon,
914
+ children: x(e)
915
+ })]
916
+ }) : e.header
917
+ }, e.id);
918
+ }) })
919
+ }),
920
+ /* @__PURE__ */ u("tbody", {
921
+ className: Q.body,
922
+ children: [
923
+ a ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", {
924
+ className: Q.statusCell,
925
+ colSpan: e.length,
926
+ children: "Caricamento dati…"
927
+ }) }) : null,
928
+ !a && v.length === 0 ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", {
929
+ className: Q.statusCell,
930
+ colSpan: e.length,
931
+ children: i
932
+ }) }) : null,
933
+ a ? null : v.map((t, r) => {
934
+ let i = n(t, r), a = d, o = !!a, s = () => {
935
+ a?.(t, r);
936
+ };
937
+ return /* @__PURE__ */ l("tr", {
938
+ className: $(Q.row, o && Q.interactiveRow),
939
+ tabIndex: o ? 0 : void 0,
940
+ "aria-label": o ? f?.(t, r) : void 0,
941
+ onClick: o ? s : void 0,
942
+ onKeyDown: o ? (e) => {
943
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
944
+ } : void 0,
945
+ children: e.map((e) => /* @__PURE__ */ l("td", {
946
+ className: $(Q.cell, Q[`align${ye(e.align ?? "left")}`], e.numeric && Q.numeric, e.hideOnMobile && Q.hideOnMobile),
947
+ children: e.cell(t, r)
948
+ }, e.id))
949
+ }, i);
950
+ })
951
+ ]
952
+ })
953
+ ]
954
+ })
955
+ });
956
+ }
957
+ function ye(e) {
958
+ return `${e.charAt(0).toUpperCase()}${e.slice(1)}`;
959
+ }
216
960
  //#endregion
217
- export { c as Button, p as Card, v as IconButton, x as TextField };
961
+ export { he as Badge, h as Button, b as Card, ve as DataTable, ie as DatePicker, ue as Dropdown, ce as IconButton, fe as MultiSelect, Z as Switch, le as TextField };