@bertimatteodev/astra-ui 0.4.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.
- package/dist/astra-ui.cjs +1 -1
- package/dist/astra-ui.js +786 -191
- package/dist/index.css +1 -1
- package/dist/types/components/CalculatorKeypad/CalculatorKeypad.d.ts +3 -1
- package/dist/types/components/CalculatorKeypad/CalculatorKeypad.d.ts.map +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +58 -0
- package/dist/types/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/types/components/DataTable/index.d.ts +3 -0
- package/dist/types/components/DataTable/index.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +18 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/types/components/DatePicker/index.d.ts +3 -0
- package/dist/types/components/DatePicker/index.d.ts.map +1 -0
- package/dist/types/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/types/components/Switch/Switch.d.ts +11 -0
- package/dist/types/components/Switch/Switch.d.ts.map +1 -0
- package/dist/types/components/Switch/index.d.ts +3 -0
- package/dist/types/components/Switch/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/astra-ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as
|
|
3
|
-
import './index.css';var
|
|
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 a = {
|
|
|
15
15
|
label: "_label_gjxjz_106",
|
|
16
16
|
spinner: "_spinner_gjxjz_111",
|
|
17
17
|
spin: "_spin_gjxjz_111"
|
|
18
|
-
},
|
|
19
|
-
primary:
|
|
20
|
-
secondary:
|
|
21
|
-
ghost:
|
|
22
|
-
danger:
|
|
23
|
-
},
|
|
24
|
-
sm:
|
|
25
|
-
md:
|
|
26
|
-
lg:
|
|
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
|
|
28
|
+
function m(...e) {
|
|
29
29
|
return e.filter(Boolean).join(" ");
|
|
30
30
|
}
|
|
31
|
-
var
|
|
32
|
-
let v =
|
|
33
|
-
return /* @__PURE__ */
|
|
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:
|
|
36
|
+
className: m(d.button, f[n], p[r], i && d.fullWidth, a && d.loading, t),
|
|
37
37
|
disabled: v,
|
|
38
|
-
"aria-busy":
|
|
38
|
+
"aria-busy": a || void 0,
|
|
39
39
|
...g,
|
|
40
40
|
children: [
|
|
41
|
-
|
|
42
|
-
className:
|
|
41
|
+
a ? /* @__PURE__ */ l("span", {
|
|
42
|
+
className: d.spinner,
|
|
43
43
|
"aria-hidden": "true"
|
|
44
44
|
}) : null,
|
|
45
|
-
!
|
|
46
|
-
className:
|
|
45
|
+
!a && o ? /* @__PURE__ */ l("span", {
|
|
46
|
+
className: d.icon,
|
|
47
47
|
"aria-hidden": "true",
|
|
48
|
-
children:
|
|
48
|
+
children: o
|
|
49
49
|
}) : null,
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
className:
|
|
50
|
+
/* @__PURE__ */ l("span", {
|
|
51
|
+
className: d.label,
|
|
52
52
|
children: e
|
|
53
53
|
}),
|
|
54
|
-
!
|
|
55
|
-
className:
|
|
54
|
+
!a && s ? /* @__PURE__ */ l("span", {
|
|
55
|
+
className: d.icon,
|
|
56
56
|
"aria-hidden": "true",
|
|
57
|
-
children:
|
|
57
|
+
children: s
|
|
58
58
|
}) : null
|
|
59
59
|
]
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
var
|
|
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,29 +69,368 @@ var u = {
|
|
|
69
69
|
elevationNone: "_elevationNone_1ex3y_26",
|
|
70
70
|
elevationSm: "_elevationSm_1ex3y_30",
|
|
71
71
|
elevationMd: "_elevationMd_1ex3y_34"
|
|
72
|
-
},
|
|
73
|
-
none:
|
|
74
|
-
sm:
|
|
75
|
-
md:
|
|
76
|
-
lg:
|
|
77
|
-
},
|
|
78
|
-
none:
|
|
79
|
-
sm:
|
|
80
|
-
md:
|
|
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
|
|
82
|
+
function y(...e) {
|
|
83
83
|
return e.filter(Boolean).join(" ");
|
|
84
84
|
}
|
|
85
|
-
var
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
ref:
|
|
88
|
-
className:
|
|
89
|
-
...
|
|
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
|
-
|
|
94
|
-
|
|
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 = {
|
|
95
434
|
button: "_button_2kydv_1",
|
|
96
435
|
sizeSm: "_sizeSm_2kydv_27",
|
|
97
436
|
sizeMd: "_sizeMd_2kydv_32",
|
|
@@ -105,45 +444,45 @@ var h = {
|
|
|
105
444
|
spinner: "_spinner_2kydv_94",
|
|
106
445
|
spin: "_spin_2kydv_94",
|
|
107
446
|
loading: "_loading_2kydv_103"
|
|
108
|
-
},
|
|
109
|
-
primary:
|
|
110
|
-
secondary:
|
|
111
|
-
ghost:
|
|
112
|
-
danger:
|
|
113
|
-
},
|
|
114
|
-
sm:
|
|
115
|
-
md:
|
|
116
|
-
lg:
|
|
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
|
|
117
456
|
};
|
|
118
|
-
function
|
|
457
|
+
function se(...e) {
|
|
119
458
|
return e.filter(Boolean).join(" ");
|
|
120
459
|
}
|
|
121
|
-
var
|
|
122
|
-
let m =
|
|
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 ? {
|
|
123
462
|
...d,
|
|
124
|
-
backgroundColor:
|
|
463
|
+
backgroundColor: s
|
|
125
464
|
} : d;
|
|
126
|
-
return /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ l("button", {
|
|
127
466
|
ref: p,
|
|
128
467
|
type: u,
|
|
129
|
-
className:
|
|
130
|
-
style:
|
|
468
|
+
className: se(W.button, ae[r], oe[i], a && W.loading, o && W.borderless, n),
|
|
469
|
+
style: h,
|
|
131
470
|
disabled: m,
|
|
132
471
|
"aria-label": t,
|
|
133
|
-
"aria-busy":
|
|
472
|
+
"aria-busy": a || void 0,
|
|
134
473
|
...f,
|
|
135
|
-
children:
|
|
136
|
-
className:
|
|
474
|
+
children: a ? /* @__PURE__ */ l("span", {
|
|
475
|
+
className: W.spinner,
|
|
137
476
|
"aria-hidden": "true"
|
|
138
|
-
}) : /* @__PURE__ */
|
|
139
|
-
className:
|
|
477
|
+
}) : /* @__PURE__ */ l("span", {
|
|
478
|
+
className: W.icon,
|
|
140
479
|
"aria-hidden": "true",
|
|
141
480
|
children: e
|
|
142
481
|
})
|
|
143
482
|
});
|
|
144
483
|
});
|
|
145
|
-
|
|
146
|
-
var
|
|
484
|
+
ce.displayName = "IconButton";
|
|
485
|
+
var G = {
|
|
147
486
|
field: "_field_1pq0j_1",
|
|
148
487
|
label: "_label_1pq0j_7",
|
|
149
488
|
required: "_required_1pq0j_14",
|
|
@@ -157,147 +496,223 @@ var b = {
|
|
|
157
496
|
};
|
|
158
497
|
//#endregion
|
|
159
498
|
//#region src/components/TextField/TextField.tsx
|
|
160
|
-
function
|
|
499
|
+
function K(...e) {
|
|
161
500
|
return e.filter(Boolean).join(" ");
|
|
162
501
|
}
|
|
163
|
-
var
|
|
164
|
-
let g =
|
|
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 = [
|
|
165
504
|
p,
|
|
166
|
-
|
|
167
|
-
|
|
505
|
+
n ? v : null,
|
|
506
|
+
r ? y : null
|
|
168
507
|
].filter(Boolean).join(" ");
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
className:
|
|
508
|
+
return /* @__PURE__ */ u("div", {
|
|
509
|
+
className: K(G.field, c),
|
|
171
510
|
children: [
|
|
172
|
-
|
|
173
|
-
className:
|
|
511
|
+
t ? /* @__PURE__ */ u("label", {
|
|
512
|
+
className: G.label,
|
|
174
513
|
htmlFor: _,
|
|
175
|
-
children: [
|
|
176
|
-
className:
|
|
514
|
+
children: [t, f ? /* @__PURE__ */ u("span", {
|
|
515
|
+
className: G.required,
|
|
177
516
|
"aria-hidden": "true",
|
|
178
517
|
children: [" ", "*"]
|
|
179
518
|
}) : null]
|
|
180
519
|
}) : null,
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
className:
|
|
520
|
+
/* @__PURE__ */ u("div", {
|
|
521
|
+
className: K(G.control, r && G.hasError, d && G.isDisabled),
|
|
183
522
|
children: [
|
|
184
|
-
|
|
185
|
-
className:
|
|
523
|
+
i ? /* @__PURE__ */ l("span", {
|
|
524
|
+
className: G.adornment,
|
|
186
525
|
"aria-hidden": "true",
|
|
187
|
-
children:
|
|
526
|
+
children: i
|
|
188
527
|
}) : null,
|
|
189
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ l("input", {
|
|
190
529
|
ref: h,
|
|
191
530
|
id: _,
|
|
192
|
-
className:
|
|
531
|
+
className: K(G.input, s),
|
|
193
532
|
disabled: d,
|
|
194
533
|
required: f,
|
|
195
|
-
"aria-invalid":
|
|
196
|
-
"aria-describedby":
|
|
534
|
+
"aria-invalid": r ? !0 : void 0,
|
|
535
|
+
"aria-describedby": b || void 0,
|
|
197
536
|
...m
|
|
198
537
|
}),
|
|
199
|
-
|
|
200
|
-
className:
|
|
538
|
+
o ? /* @__PURE__ */ l("span", {
|
|
539
|
+
className: G.adornment,
|
|
201
540
|
"aria-hidden": "true",
|
|
202
|
-
children:
|
|
541
|
+
children: o
|
|
203
542
|
}) : null
|
|
204
543
|
]
|
|
205
544
|
}),
|
|
206
|
-
|
|
545
|
+
r ? /* @__PURE__ */ l("p", {
|
|
207
546
|
id: y,
|
|
208
|
-
className:
|
|
547
|
+
className: G.error,
|
|
209
548
|
role: "alert",
|
|
210
|
-
children:
|
|
549
|
+
children: r
|
|
211
550
|
}) : null,
|
|
212
|
-
!
|
|
551
|
+
!r && n ? /* @__PURE__ */ l("p", {
|
|
213
552
|
id: v,
|
|
214
|
-
className:
|
|
215
|
-
children:
|
|
553
|
+
className: G.hint,
|
|
554
|
+
children: n
|
|
216
555
|
}) : null
|
|
217
556
|
]
|
|
218
557
|
});
|
|
219
558
|
});
|
|
220
|
-
|
|
221
|
-
var
|
|
222
|
-
field: "
|
|
223
|
-
label: "
|
|
224
|
-
required: "
|
|
225
|
-
control: "
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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"
|
|
232
578
|
};
|
|
233
579
|
//#endregion
|
|
234
580
|
//#region src/components/Dropdown/Dropdown.tsx
|
|
235
|
-
function
|
|
581
|
+
function J(...e) {
|
|
236
582
|
return e.filter(Boolean).join(" ");
|
|
237
583
|
}
|
|
238
|
-
var
|
|
239
|
-
let
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
].filter(Boolean).join(" ");
|
|
244
|
-
|
|
245
|
-
|
|
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
|
+
}
|
|
246
617
|
}
|
|
247
|
-
return /* @__PURE__ */
|
|
248
|
-
className:
|
|
618
|
+
return /* @__PURE__ */ u("div", {
|
|
619
|
+
className: J(q.field, p),
|
|
249
620
|
children: [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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,
|
|
255
627
|
"aria-hidden": "true",
|
|
256
628
|
children: [" ", "*"]
|
|
257
629
|
}) : null]
|
|
258
630
|
}) : null,
|
|
259
|
-
/* @__PURE__ */
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
children:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
+
]
|
|
284
699
|
}),
|
|
285
|
-
|
|
286
|
-
id:
|
|
287
|
-
className:
|
|
700
|
+
o ? /* @__PURE__ */ l("p", {
|
|
701
|
+
id: E,
|
|
702
|
+
className: q.error,
|
|
288
703
|
role: "alert",
|
|
289
|
-
children: s
|
|
290
|
-
}) : null,
|
|
291
|
-
!s && o ? /* @__PURE__ */ r("p", {
|
|
292
|
-
id: b,
|
|
293
|
-
className: C.hint,
|
|
294
704
|
children: o
|
|
705
|
+
}) : null,
|
|
706
|
+
!o && r ? /* @__PURE__ */ l("p", {
|
|
707
|
+
id: T,
|
|
708
|
+
className: q.hint,
|
|
709
|
+
children: r
|
|
295
710
|
}) : null
|
|
296
711
|
]
|
|
297
712
|
});
|
|
298
713
|
});
|
|
299
|
-
|
|
300
|
-
var
|
|
714
|
+
ue.displayName = "Dropdown";
|
|
715
|
+
var Y = {
|
|
301
716
|
group: "_group_1fqa2_1",
|
|
302
717
|
option: "_option_1fqa2_8",
|
|
303
718
|
selected: "_selected_1fqa2_41",
|
|
@@ -305,62 +720,242 @@ var E = {
|
|
|
305
720
|
};
|
|
306
721
|
//#endregion
|
|
307
722
|
//#region src/components/MultiSelect/MultiSelect.tsx
|
|
308
|
-
function
|
|
723
|
+
function de(...e) {
|
|
309
724
|
return e.filter(Boolean).join(" ");
|
|
310
725
|
}
|
|
311
|
-
var
|
|
312
|
-
let [p, m] = n
|
|
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);
|
|
313
728
|
function _(e) {
|
|
314
|
-
let n = g.includes(e),
|
|
315
|
-
t === void 0 && m(
|
|
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);
|
|
316
731
|
}
|
|
317
|
-
return /* @__PURE__ */
|
|
732
|
+
return /* @__PURE__ */ l("div", {
|
|
318
733
|
ref: f,
|
|
319
734
|
role: "group",
|
|
320
|
-
"aria-label":
|
|
321
|
-
className:
|
|
735
|
+
"aria-label": s,
|
|
736
|
+
className: de(Y.group, a),
|
|
322
737
|
...d,
|
|
323
738
|
children: e.map((e) => {
|
|
324
|
-
let t = g.includes(e.value), n =
|
|
739
|
+
let t = g.includes(e.value), n = i || e.disabled, r = e.selectedColor ? {
|
|
325
740
|
"--multi-select-selected-color": e.selectedColor,
|
|
326
741
|
"--multi-select-selected-background": `color-mix(in srgb, ${e.selectedColor} 14%, transparent)`
|
|
327
742
|
} : void 0;
|
|
328
|
-
return /* @__PURE__ */
|
|
743
|
+
return /* @__PURE__ */ u("button", {
|
|
329
744
|
type: "button",
|
|
330
|
-
className:
|
|
745
|
+
className: de(Y.option, t && Y.selected),
|
|
331
746
|
disabled: n,
|
|
332
747
|
"aria-pressed": t,
|
|
333
|
-
style:
|
|
748
|
+
style: r,
|
|
334
749
|
onClick: () => _(e.value),
|
|
335
|
-
children: [e.count === void 0 ? null : /* @__PURE__ */
|
|
336
|
-
className:
|
|
750
|
+
children: [e.count === void 0 ? null : /* @__PURE__ */ l("span", {
|
|
751
|
+
className: Y.count,
|
|
337
752
|
children: e.count
|
|
338
|
-
}), /* @__PURE__ */
|
|
753
|
+
}), /* @__PURE__ */ l("span", { children: e.label })]
|
|
339
754
|
}, e.value);
|
|
340
755
|
})
|
|
341
756
|
});
|
|
342
757
|
});
|
|
343
|
-
|
|
344
|
-
var
|
|
758
|
+
fe.displayName = "MultiSelect";
|
|
759
|
+
var pe = { badge: "_badge_3xnd3_1" };
|
|
345
760
|
//#endregion
|
|
346
761
|
//#region src/components/Badge/Badge.tsx
|
|
347
|
-
function
|
|
762
|
+
function me(...e) {
|
|
348
763
|
return e.filter(Boolean).join(" ");
|
|
349
764
|
}
|
|
350
|
-
var
|
|
351
|
-
let
|
|
352
|
-
...
|
|
765
|
+
var he = n(function({ text: e, color: t, className: n, style: r, ...i }, a) {
|
|
766
|
+
let o = t ? {
|
|
767
|
+
...r,
|
|
353
768
|
"--badge-color": t,
|
|
354
769
|
"--badge-background": `color-mix(in srgb, ${t} 14%, transparent)`
|
|
355
|
-
} :
|
|
356
|
-
return /* @__PURE__ */
|
|
357
|
-
ref:
|
|
358
|
-
className:
|
|
359
|
-
style:
|
|
360
|
-
...
|
|
770
|
+
} : r;
|
|
771
|
+
return /* @__PURE__ */ l("span", {
|
|
772
|
+
ref: a,
|
|
773
|
+
className: me(pe.badge, n),
|
|
774
|
+
style: o,
|
|
775
|
+
...i,
|
|
361
776
|
children: e
|
|
362
777
|
});
|
|
363
778
|
});
|
|
364
|
-
|
|
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
|
+
}
|
|
365
960
|
//#endregion
|
|
366
|
-
export {
|
|
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 };
|