@bertimatteodev/astra-ui 0.4.0 → 0.6.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 +878 -195
- 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/MonthCarousel/MonthCarousel.d.ts +15 -0
- package/dist/types/components/MonthCarousel/MonthCarousel.d.ts.map +1 -0
- package/dist/types/components/MonthCarousel/index.d.ts +3 -0
- package/dist/types/components/MonthCarousel/index.d.ts.map +1 -0
- 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 +8 -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, useCallback as r, useContext as i, useEffect as a, useId as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
2
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
3
|
+
import './index.css';var f = {
|
|
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
|
+
}, p = {
|
|
19
|
+
primary: f.variantPrimary,
|
|
20
|
+
secondary: f.variantSecondary,
|
|
21
|
+
ghost: f.variantGhost,
|
|
22
|
+
danger: f.variantDanger
|
|
23
|
+
}, m = {
|
|
24
|
+
sm: f.sizeSm,
|
|
25
|
+
md: f.sizeMd,
|
|
26
|
+
lg: f.sizeLg
|
|
27
27
|
};
|
|
28
|
-
function
|
|
28
|
+
function h(...e) {
|
|
29
29
|
return e.filter(Boolean).join(" ");
|
|
30
30
|
}
|
|
31
|
-
var
|
|
32
|
-
let v =
|
|
33
|
-
return /* @__PURE__ */
|
|
31
|
+
var g = 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: l = "button", ...g }, _) {
|
|
32
|
+
let v = c || a;
|
|
33
|
+
return /* @__PURE__ */ d("button", {
|
|
34
34
|
ref: _,
|
|
35
|
-
type:
|
|
36
|
-
className:
|
|
35
|
+
type: l,
|
|
36
|
+
className: h(f.button, p[n], m[r], i && f.fullWidth, a && f.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__ */ u("span", {
|
|
42
|
+
className: f.spinner,
|
|
43
43
|
"aria-hidden": "true"
|
|
44
44
|
}) : null,
|
|
45
|
-
!
|
|
46
|
-
className:
|
|
45
|
+
!a && o ? /* @__PURE__ */ u("span", {
|
|
46
|
+
className: f.icon,
|
|
47
47
|
"aria-hidden": "true",
|
|
48
|
-
children:
|
|
48
|
+
children: o
|
|
49
49
|
}) : null,
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
className:
|
|
50
|
+
/* @__PURE__ */ u("span", {
|
|
51
|
+
className: f.label,
|
|
52
52
|
children: e
|
|
53
53
|
}),
|
|
54
|
-
!
|
|
55
|
-
className:
|
|
54
|
+
!a && s ? /* @__PURE__ */ u("span", {
|
|
55
|
+
className: f.icon,
|
|
56
56
|
"aria-hidden": "true",
|
|
57
|
-
children:
|
|
57
|
+
children: s
|
|
58
58
|
}) : null
|
|
59
59
|
]
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
var
|
|
62
|
+
g.displayName = "Button";
|
|
63
|
+
var _ = {
|
|
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
|
+
}, v = {
|
|
73
|
+
none: _.paddingNone,
|
|
74
|
+
sm: _.paddingSm,
|
|
75
|
+
md: _.paddingMd,
|
|
76
|
+
lg: _.paddingLg
|
|
77
|
+
}, y = {
|
|
78
|
+
none: _.elevationNone,
|
|
79
|
+
sm: _.elevationSm,
|
|
80
|
+
md: _.elevationMd
|
|
81
81
|
};
|
|
82
|
-
function
|
|
82
|
+
function b(...e) {
|
|
83
83
|
return e.filter(Boolean).join(" ");
|
|
84
84
|
}
|
|
85
|
-
var
|
|
86
|
-
return /* @__PURE__ */
|
|
87
|
-
ref:
|
|
88
|
-
className:
|
|
89
|
-
...
|
|
85
|
+
var x = n(function({ children: e, className: t, padding: n = "md", elevation: r = "sm", ...i }, a) {
|
|
86
|
+
return /* @__PURE__ */ u("div", {
|
|
87
|
+
ref: a,
|
|
88
|
+
className: b(_.card, v[n], y[r], t),
|
|
89
|
+
...i,
|
|
90
90
|
children: e
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
x.displayName = "Card";
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
96
|
+
var S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), C = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), w = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), T = (e) => {
|
|
97
|
+
let t = w(e);
|
|
98
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
99
|
+
}, E = {
|
|
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
|
+
}, D = (e) => {
|
|
110
|
+
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
111
|
+
return !1;
|
|
112
|
+
}, O = e({}), k = () => i(O), A = 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 = "" } = k() ?? {}, h = i ?? f ? Number(r ?? d) * 24 / Number(n ?? u) : r ?? d;
|
|
114
|
+
return t("svg", {
|
|
115
|
+
ref: l,
|
|
116
|
+
...E,
|
|
117
|
+
width: n ?? u ?? E.width,
|
|
118
|
+
height: n ?? u ?? E.height,
|
|
119
|
+
stroke: e ?? p,
|
|
120
|
+
strokeWidth: h,
|
|
121
|
+
className: S("lucide", m, a),
|
|
122
|
+
...!o && !D(c) && { "aria-hidden": "true" },
|
|
123
|
+
...c
|
|
124
|
+
}, [...s.map(([e, n]) => t(e, n)), ...Array.isArray(o) ? o : [o]]);
|
|
125
|
+
}), j = (e, r) => {
|
|
126
|
+
let i = n(({ className: n, ...i }, a) => t(A, {
|
|
127
|
+
ref: a,
|
|
128
|
+
iconNode: r,
|
|
129
|
+
className: S(`lucide-${C(T(e))}`, `lucide-${e}`, n),
|
|
130
|
+
...i
|
|
131
|
+
}));
|
|
132
|
+
return i.displayName = T(e), i;
|
|
133
|
+
}, ee = j("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
|
+
]), M = j("chevron-down", [["path", {
|
|
179
|
+
d: "m6 9 6 6 6-6",
|
|
180
|
+
key: "qrunsl"
|
|
181
|
+
}]]), N = j("chevron-left", [["path", {
|
|
182
|
+
d: "m15 18-6-6 6-6",
|
|
183
|
+
key: "1wnfg3"
|
|
184
|
+
}]]), P = j("chevron-right", [["path", {
|
|
185
|
+
d: "m9 18 6-6-6-6",
|
|
186
|
+
key: "mthhwq"
|
|
187
|
+
}]]), F = j("chevron-up", [["path", {
|
|
188
|
+
d: "m18 15-6-6-6 6",
|
|
189
|
+
key: "153udz"
|
|
190
|
+
}]]), I = j("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
|
+
}]]), L = {
|
|
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
|
+
}, R = [
|
|
219
|
+
"Lun",
|
|
220
|
+
"Mar",
|
|
221
|
+
"Mer",
|
|
222
|
+
"Gio",
|
|
223
|
+
"Ven",
|
|
224
|
+
"Sab",
|
|
225
|
+
"Dom"
|
|
226
|
+
];
|
|
227
|
+
function z(e) {
|
|
228
|
+
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
229
|
+
}
|
|
230
|
+
function B(e) {
|
|
231
|
+
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
232
|
+
}
|
|
233
|
+
function V(e, t) {
|
|
234
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
235
|
+
}
|
|
236
|
+
function te(e, t) {
|
|
237
|
+
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
|
|
238
|
+
}
|
|
239
|
+
function ne(e, t, n) {
|
|
240
|
+
let r = z(e);
|
|
241
|
+
return !!(t && r < z(t) || n && r > z(n));
|
|
242
|
+
}
|
|
243
|
+
function re(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 ie(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 ae(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 H(...e) {
|
|
262
|
+
return e.filter(Boolean).join(" ");
|
|
263
|
+
}
|
|
264
|
+
function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una data", locale: i = "it-IT", disabled: f = !1, minDate: p, maxDate: m, clearable: h = !1, name: g, id: _, error: v }) {
|
|
265
|
+
let y = o(), b = _ ?? `date-picker-${y}`, x = `${b}-dialog`, S = `${b}-error`, C = c(null), w = c(null), [T, E] = l(!1), [D, O] = l(() => z(e ?? /* @__PURE__ */ new Date())), k = s(() => re(D), [D]), A = z(/* @__PURE__ */ new Date());
|
|
266
|
+
a(() => {
|
|
267
|
+
e && O(z(e));
|
|
268
|
+
}, [e]), a(() => {
|
|
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(z(e ?? /* @__PURE__ */ new Date())), E(!0));
|
|
281
|
+
}
|
|
282
|
+
function M(e) {
|
|
283
|
+
ne(e, p, m) || (t(z(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 I(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}-${B(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 oe = ae(e, i);
|
|
306
|
+
return /* @__PURE__ */ d("div", {
|
|
307
|
+
ref: C,
|
|
308
|
+
className: L.field,
|
|
309
|
+
children: [
|
|
310
|
+
n ? /* @__PURE__ */ u("label", {
|
|
311
|
+
className: L.label,
|
|
312
|
+
htmlFor: b,
|
|
313
|
+
children: n
|
|
314
|
+
}) : null,
|
|
315
|
+
/* @__PURE__ */ u("input", {
|
|
316
|
+
id: b,
|
|
317
|
+
type: "hidden",
|
|
318
|
+
name: g,
|
|
319
|
+
value: e ? B(e) : ""
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ d("button", {
|
|
322
|
+
ref: w,
|
|
323
|
+
type: "button",
|
|
324
|
+
className: H(L.trigger, v && L.hasError, f && L.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__ */ u(ee, {
|
|
331
|
+
className: L.triggerIcon,
|
|
332
|
+
size: 18,
|
|
333
|
+
"aria-hidden": "true"
|
|
334
|
+
}), /* @__PURE__ */ u("span", {
|
|
335
|
+
className: H(L.triggerValue, !e && L.placeholder),
|
|
336
|
+
children: oe || r
|
|
337
|
+
})]
|
|
338
|
+
}),
|
|
339
|
+
v ? /* @__PURE__ */ u("p", {
|
|
340
|
+
id: S,
|
|
341
|
+
className: L.error,
|
|
342
|
+
role: "alert",
|
|
343
|
+
children: v
|
|
344
|
+
}) : null,
|
|
345
|
+
T ? /* @__PURE__ */ d("div", {
|
|
346
|
+
id: x,
|
|
347
|
+
className: L.popover,
|
|
348
|
+
role: "dialog",
|
|
349
|
+
"aria-label": "Seleziona una data",
|
|
350
|
+
children: [
|
|
351
|
+
/* @__PURE__ */ d("header", {
|
|
352
|
+
className: L.calendarHeader,
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ u("button", {
|
|
355
|
+
type: "button",
|
|
356
|
+
className: L.navigationButton,
|
|
357
|
+
"aria-label": "Mese precedente",
|
|
358
|
+
onClick: () => F(-1),
|
|
359
|
+
children: /* @__PURE__ */ u(N, {
|
|
360
|
+
size: 18,
|
|
361
|
+
"aria-hidden": "true"
|
|
362
|
+
})
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ u("span", {
|
|
365
|
+
className: L.monthLabel,
|
|
366
|
+
children: ie(D, i)
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ u("button", {
|
|
369
|
+
type: "button",
|
|
370
|
+
className: L.navigationButton,
|
|
371
|
+
"aria-label": "Mese successivo",
|
|
372
|
+
onClick: () => F(1),
|
|
373
|
+
children: /* @__PURE__ */ u(P, {
|
|
374
|
+
size: 18,
|
|
375
|
+
"aria-hidden": "true"
|
|
376
|
+
})
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
}),
|
|
380
|
+
/* @__PURE__ */ d("div", {
|
|
381
|
+
className: L.calendarGrid,
|
|
382
|
+
role: "grid",
|
|
383
|
+
"aria-label": ie(D, i),
|
|
384
|
+
children: [R.map((e) => /* @__PURE__ */ u("span", {
|
|
385
|
+
className: L.weekDay,
|
|
386
|
+
role: "columnheader",
|
|
387
|
+
children: e
|
|
388
|
+
}, e)), k.map((t) => {
|
|
389
|
+
let n = te(t, D), r = e ? V(t, e) : !1, a = V(t, A), o = ne(t, p, m), s = `${b}-${B(t)}`;
|
|
390
|
+
return /* @__PURE__ */ u("button", {
|
|
391
|
+
id: s,
|
|
392
|
+
type: "button",
|
|
393
|
+
role: "gridcell",
|
|
394
|
+
className: H(L.day, !n && L.outsideMonth, r && L.selectedDay, a && L.today),
|
|
395
|
+
disabled: o,
|
|
396
|
+
"aria-label": new Intl.DateTimeFormat(i, {
|
|
397
|
+
weekday: "long",
|
|
398
|
+
day: "numeric",
|
|
399
|
+
month: "long",
|
|
400
|
+
year: "numeric"
|
|
401
|
+
}).format(t),
|
|
402
|
+
"aria-selected": r,
|
|
403
|
+
tabIndex: r || !e && a ? 0 : -1,
|
|
404
|
+
onClick: () => M(t),
|
|
405
|
+
onKeyDown: (e) => I(e, t),
|
|
406
|
+
children: t.getDate()
|
|
407
|
+
}, s);
|
|
408
|
+
})]
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ d("footer", {
|
|
411
|
+
className: L.footer,
|
|
412
|
+
children: [/* @__PURE__ */ u("button", {
|
|
413
|
+
type: "button",
|
|
414
|
+
className: L.textButton,
|
|
415
|
+
onClick: () => {
|
|
416
|
+
O(A), M(A);
|
|
417
|
+
},
|
|
418
|
+
children: "Oggi"
|
|
419
|
+
}), h && e ? /* @__PURE__ */ u("button", {
|
|
420
|
+
type: "button",
|
|
421
|
+
className: L.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 U = {
|
|
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
|
+
}, se = {
|
|
448
|
+
primary: U.variantPrimary,
|
|
449
|
+
secondary: U.variantSecondary,
|
|
450
|
+
ghost: U.variantGhost,
|
|
451
|
+
danger: U.variantDanger
|
|
452
|
+
}, ce = {
|
|
453
|
+
sm: U.sizeSm,
|
|
454
|
+
md: U.sizeMd,
|
|
455
|
+
lg: U.sizeLg
|
|
117
456
|
};
|
|
118
|
-
function
|
|
457
|
+
function le(...e) {
|
|
119
458
|
return e.filter(Boolean).join(" ");
|
|
120
459
|
}
|
|
121
|
-
var
|
|
122
|
-
let m =
|
|
460
|
+
var ue = 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: l = "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__ */ u("button", {
|
|
127
466
|
ref: p,
|
|
128
|
-
type:
|
|
129
|
-
className:
|
|
130
|
-
style:
|
|
467
|
+
type: l,
|
|
468
|
+
className: le(U.button, se[r], ce[i], a && U.loading, o && U.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__ */ u("span", {
|
|
475
|
+
className: U.spinner,
|
|
137
476
|
"aria-hidden": "true"
|
|
138
|
-
}) : /* @__PURE__ */
|
|
139
|
-
className:
|
|
477
|
+
}) : /* @__PURE__ */ u("span", {
|
|
478
|
+
className: U.icon,
|
|
140
479
|
"aria-hidden": "true",
|
|
141
480
|
children: e
|
|
142
481
|
})
|
|
143
482
|
});
|
|
144
483
|
});
|
|
145
|
-
|
|
146
|
-
var
|
|
484
|
+
ue.displayName = "IconButton";
|
|
485
|
+
var W = {
|
|
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 G(...e) {
|
|
161
500
|
return e.filter(Boolean).join(" ");
|
|
162
501
|
}
|
|
163
|
-
var
|
|
164
|
-
let g =
|
|
502
|
+
var de = n(function({ id: e, label: t, hint: n, error: r, startAdornment: i, endAdornment: a, className: s, containerClassName: c, disabled: l, required: f, "aria-describedby": p, ...m }, h) {
|
|
503
|
+
let g = o(), _ = 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__ */ d("div", {
|
|
509
|
+
className: G(W.field, c),
|
|
171
510
|
children: [
|
|
172
|
-
|
|
173
|
-
className:
|
|
511
|
+
t ? /* @__PURE__ */ d("label", {
|
|
512
|
+
className: W.label,
|
|
174
513
|
htmlFor: _,
|
|
175
|
-
children: [
|
|
176
|
-
className:
|
|
514
|
+
children: [t, f ? /* @__PURE__ */ d("span", {
|
|
515
|
+
className: W.required,
|
|
177
516
|
"aria-hidden": "true",
|
|
178
517
|
children: [" ", "*"]
|
|
179
518
|
}) : null]
|
|
180
519
|
}) : null,
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
className:
|
|
520
|
+
/* @__PURE__ */ d("div", {
|
|
521
|
+
className: G(W.control, r && W.hasError, l && W.isDisabled),
|
|
183
522
|
children: [
|
|
184
|
-
|
|
185
|
-
className:
|
|
523
|
+
i ? /* @__PURE__ */ u("span", {
|
|
524
|
+
className: W.adornment,
|
|
186
525
|
"aria-hidden": "true",
|
|
187
|
-
children:
|
|
526
|
+
children: i
|
|
188
527
|
}) : null,
|
|
189
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ u("input", {
|
|
190
529
|
ref: h,
|
|
191
530
|
id: _,
|
|
192
|
-
className:
|
|
193
|
-
disabled:
|
|
531
|
+
className: G(W.input, s),
|
|
532
|
+
disabled: l,
|
|
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
|
+
a ? /* @__PURE__ */ u("span", {
|
|
539
|
+
className: W.adornment,
|
|
201
540
|
"aria-hidden": "true",
|
|
202
|
-
children:
|
|
541
|
+
children: a
|
|
203
542
|
}) : null
|
|
204
543
|
]
|
|
205
544
|
}),
|
|
206
|
-
|
|
545
|
+
r ? /* @__PURE__ */ u("p", {
|
|
207
546
|
id: y,
|
|
208
|
-
className:
|
|
547
|
+
className: W.error,
|
|
209
548
|
role: "alert",
|
|
210
|
-
children:
|
|
549
|
+
children: r
|
|
211
550
|
}) : null,
|
|
212
|
-
!
|
|
551
|
+
!r && n ? /* @__PURE__ */ u("p", {
|
|
213
552
|
id: v,
|
|
214
|
-
className:
|
|
215
|
-
children:
|
|
553
|
+
className: W.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
|
+
de.displayName = "TextField";
|
|
560
|
+
var K = {
|
|
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 q(...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 fe = n(function({ id: e, options: t, label: n, hint: r, error: i, placeholder: s, className: f, containerClassName: p, disabled: m, required: h, value: g, defaultValue: _, onChange: v, onValueChange: y, "aria-describedby": b, ...x }, S) {
|
|
585
|
+
let C = o(), w = e ?? `dropdown-${C}`, T = `${w}-hint`, E = `${w}-error`, D = `${w}-label`, O = `${w}-listbox`, k = [
|
|
586
|
+
b,
|
|
587
|
+
r ? T : null,
|
|
588
|
+
i ? E : null
|
|
589
|
+
].filter(Boolean).join(" "), A = typeof g == "string" ? g : void 0, [j, ee] = l(typeof _ == "string" ? _ : ""), [M, N] = l(!1), [P, F] = l(0), I = c(null), L = A ?? j, R = t.find((e) => e.value === L), z = t.reduce((e, t, n) => (t.disabled || e.push(n), e), []);
|
|
590
|
+
a(() => {
|
|
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);
|
|
246
598
|
}
|
|
247
|
-
|
|
248
|
-
|
|
599
|
+
function V(e) {
|
|
600
|
+
A === void 0 && ee(e), y?.(e), N(!1);
|
|
601
|
+
}
|
|
602
|
+
function te(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__ */ d("div", {
|
|
619
|
+
className: q(K.field, p),
|
|
249
620
|
children: [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
621
|
+
n ? /* @__PURE__ */ d("label", {
|
|
622
|
+
id: D,
|
|
623
|
+
className: K.label,
|
|
624
|
+
htmlFor: w,
|
|
625
|
+
children: [n, h ? /* @__PURE__ */ d("span", {
|
|
626
|
+
className: K.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__ */ d("div", {
|
|
632
|
+
ref: I,
|
|
633
|
+
className: q(K.control, i && K.hasError, m && K.isDisabled, M && K.isOpen),
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ d("select", {
|
|
636
|
+
ref: S,
|
|
637
|
+
id: w,
|
|
638
|
+
className: K.nativeSelect,
|
|
639
|
+
disabled: m,
|
|
640
|
+
required: h,
|
|
641
|
+
value: L,
|
|
642
|
+
"aria-invalid": i ? !0 : void 0,
|
|
643
|
+
"aria-describedby": k || void 0,
|
|
644
|
+
onChange: B,
|
|
645
|
+
...x,
|
|
646
|
+
children: [s ? /* @__PURE__ */ u("option", {
|
|
647
|
+
value: "",
|
|
648
|
+
disabled: !0,
|
|
649
|
+
children: s
|
|
650
|
+
}) : null, t.map((e) => /* @__PURE__ */ u("option", {
|
|
651
|
+
value: e.value,
|
|
652
|
+
disabled: e.disabled,
|
|
653
|
+
children: e.label
|
|
654
|
+
}, e.value))]
|
|
655
|
+
}),
|
|
656
|
+
/* @__PURE__ */ d("button", {
|
|
657
|
+
type: "button",
|
|
658
|
+
className: q(K.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": i ? !0 : void 0,
|
|
666
|
+
onClick: () => N((e) => !e),
|
|
667
|
+
onKeyDown: te,
|
|
668
|
+
children: [/* @__PURE__ */ u("span", {
|
|
669
|
+
className: R ? void 0 : K.placeholder,
|
|
670
|
+
children: R?.label ?? s
|
|
671
|
+
}), /* @__PURE__ */ u("span", {
|
|
672
|
+
className: K.indicator,
|
|
673
|
+
"aria-hidden": "true"
|
|
674
|
+
})]
|
|
675
|
+
}),
|
|
676
|
+
M ? /* @__PURE__ */ d("div", {
|
|
677
|
+
id: O,
|
|
678
|
+
className: K.menu,
|
|
679
|
+
role: "listbox",
|
|
680
|
+
children: [s ? /* @__PURE__ */ u("button", {
|
|
681
|
+
type: "button",
|
|
682
|
+
className: q(K.option, !L && K.selectedOption),
|
|
683
|
+
role: "option",
|
|
684
|
+
"aria-selected": !L,
|
|
685
|
+
onClick: () => V(""),
|
|
686
|
+
children: s
|
|
687
|
+
}) : null, t.map((e, t) => /* @__PURE__ */ u("button", {
|
|
688
|
+
type: "button",
|
|
689
|
+
className: q(K.option, e.value === L && K.selectedOption, t === P && K.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
|
+
i ? /* @__PURE__ */ u("p", {
|
|
701
|
+
id: E,
|
|
702
|
+
className: K.error,
|
|
288
703
|
role: "alert",
|
|
289
|
-
children:
|
|
704
|
+
children: i
|
|
290
705
|
}) : null,
|
|
291
|
-
!
|
|
292
|
-
id:
|
|
293
|
-
className:
|
|
294
|
-
children:
|
|
706
|
+
!i && r ? /* @__PURE__ */ u("p", {
|
|
707
|
+
id: T,
|
|
708
|
+
className: K.hint,
|
|
709
|
+
children: r
|
|
295
710
|
}) : null
|
|
296
711
|
]
|
|
297
712
|
});
|
|
298
713
|
});
|
|
299
|
-
|
|
300
|
-
var
|
|
714
|
+
fe.displayName = "Dropdown";
|
|
715
|
+
var J = {
|
|
301
716
|
group: "_group_1fqa2_1",
|
|
302
717
|
option: "_option_1fqa2_8",
|
|
303
718
|
selected: "_selected_1fqa2_41",
|
|
@@ -305,62 +720,330 @@ var E = {
|
|
|
305
720
|
};
|
|
306
721
|
//#endregion
|
|
307
722
|
//#region src/components/MultiSelect/MultiSelect.tsx
|
|
308
|
-
function
|
|
723
|
+
function pe(...e) {
|
|
309
724
|
return e.filter(Boolean).join(" ");
|
|
310
725
|
}
|
|
311
|
-
var
|
|
312
|
-
let [p, m] = n
|
|
726
|
+
var me = 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", ...c }, f) {
|
|
727
|
+
let [p, m] = l(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__ */ u("div", {
|
|
318
733
|
ref: f,
|
|
319
734
|
role: "group",
|
|
320
|
-
"aria-label":
|
|
321
|
-
className:
|
|
322
|
-
...
|
|
735
|
+
"aria-label": s,
|
|
736
|
+
className: pe(J.group, a),
|
|
737
|
+
...c,
|
|
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__ */ d("button", {
|
|
329
744
|
type: "button",
|
|
330
|
-
className:
|
|
745
|
+
className: pe(J.option, t && J.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__ */ u("span", {
|
|
751
|
+
className: J.count,
|
|
337
752
|
children: e.count
|
|
338
|
-
}), /* @__PURE__ */
|
|
753
|
+
}), /* @__PURE__ */ u("span", { children: e.label })]
|
|
339
754
|
}, e.value);
|
|
340
755
|
})
|
|
341
756
|
});
|
|
342
757
|
});
|
|
343
|
-
|
|
344
|
-
var
|
|
758
|
+
me.displayName = "MultiSelect";
|
|
759
|
+
var Y = {
|
|
760
|
+
carousel: "_carousel_ziwqy_1",
|
|
761
|
+
navigationButton: "_navigationButton_ziwqy_11",
|
|
762
|
+
track: "_track_ziwqy_39",
|
|
763
|
+
label: "_label_ziwqy_46",
|
|
764
|
+
"month-fade-in": "_month-fade-in_ziwqy_1",
|
|
765
|
+
srOnly: "_srOnly_ziwqy_71"
|
|
766
|
+
};
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/components/MonthCarousel/MonthCarousel.tsx
|
|
769
|
+
function X(e) {
|
|
770
|
+
return e.year * 12 + e.month - 1;
|
|
771
|
+
}
|
|
772
|
+
function he(e, t) {
|
|
773
|
+
let n = e.year * 12 + e.month - 1 + t;
|
|
774
|
+
return {
|
|
775
|
+
year: Math.floor(n / 12),
|
|
776
|
+
month: (n % 12 + 12) % 12 + 1
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
function ge(e, t) {
|
|
780
|
+
let n = new Date(e.year, e.month - 1, 1), r = new Intl.DateTimeFormat(t, {
|
|
781
|
+
month: "long",
|
|
782
|
+
year: "numeric"
|
|
783
|
+
}).format(n);
|
|
784
|
+
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
785
|
+
}
|
|
786
|
+
function _e(e, t, n, r) {
|
|
787
|
+
let i = he(t, e);
|
|
788
|
+
return e === -1 && n ? X(i) < X(n) : e === 1 && r ? X(i) > X(r) : !1;
|
|
789
|
+
}
|
|
790
|
+
function ve({ value: e, onChange: t, locale: n = "it-IT", minMonth: i, maxMonth: a, disabled: o = !1, ariaLabel: f = "Seleziona il mese" }) {
|
|
791
|
+
let [p, m] = l(0), h = c(null), g = s(() => ge(e, n), [e, n]), _ = o || _e(-1, e, i, a), v = o || _e(1, e, i, a), y = r((n) => {
|
|
792
|
+
n === -1 && _ || n === 1 && v || (m(n), t(he(e, n)));
|
|
793
|
+
}, [
|
|
794
|
+
v,
|
|
795
|
+
_,
|
|
796
|
+
t,
|
|
797
|
+
e
|
|
798
|
+
]);
|
|
799
|
+
function b(e) {
|
|
800
|
+
e.key === "ArrowLeft" ? (e.preventDefault(), y(-1)) : e.key === "ArrowRight" && (e.preventDefault(), y(1));
|
|
801
|
+
}
|
|
802
|
+
return /* @__PURE__ */ d("div", {
|
|
803
|
+
className: Y.carousel,
|
|
804
|
+
role: "group",
|
|
805
|
+
"aria-label": f,
|
|
806
|
+
onKeyDown: b,
|
|
807
|
+
children: [
|
|
808
|
+
/* @__PURE__ */ u("button", {
|
|
809
|
+
type: "button",
|
|
810
|
+
className: Y.navigationButton,
|
|
811
|
+
"aria-label": "Mese precedente",
|
|
812
|
+
disabled: _,
|
|
813
|
+
onClick: () => y(-1),
|
|
814
|
+
children: /* @__PURE__ */ u(N, {
|
|
815
|
+
size: 18,
|
|
816
|
+
"aria-hidden": "true"
|
|
817
|
+
})
|
|
818
|
+
}),
|
|
819
|
+
/* @__PURE__ */ u("div", {
|
|
820
|
+
className: Y.track,
|
|
821
|
+
children: /* @__PURE__ */ u("span", {
|
|
822
|
+
className: Y.label,
|
|
823
|
+
"data-direction": p,
|
|
824
|
+
children: g
|
|
825
|
+
}, `${e.year}-${e.month}`)
|
|
826
|
+
}),
|
|
827
|
+
/* @__PURE__ */ u("button", {
|
|
828
|
+
type: "button",
|
|
829
|
+
className: Y.navigationButton,
|
|
830
|
+
"aria-label": "Mese successivo",
|
|
831
|
+
disabled: v,
|
|
832
|
+
onClick: () => y(1),
|
|
833
|
+
children: /* @__PURE__ */ u(P, {
|
|
834
|
+
size: 18,
|
|
835
|
+
"aria-hidden": "true"
|
|
836
|
+
})
|
|
837
|
+
}),
|
|
838
|
+
/* @__PURE__ */ u("span", {
|
|
839
|
+
ref: h,
|
|
840
|
+
className: Y.srOnly,
|
|
841
|
+
"aria-live": "polite",
|
|
842
|
+
children: g
|
|
843
|
+
})
|
|
844
|
+
]
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
var ye = { badge: "_badge_3xnd3_1" };
|
|
345
848
|
//#endregion
|
|
346
849
|
//#region src/components/Badge/Badge.tsx
|
|
347
|
-
function
|
|
850
|
+
function be(...e) {
|
|
348
851
|
return e.filter(Boolean).join(" ");
|
|
349
852
|
}
|
|
350
|
-
var
|
|
351
|
-
let
|
|
352
|
-
...
|
|
853
|
+
var xe = n(function({ text: e, color: t, className: n, style: r, ...i }, a) {
|
|
854
|
+
let o = t ? {
|
|
855
|
+
...r,
|
|
353
856
|
"--badge-color": t,
|
|
354
857
|
"--badge-background": `color-mix(in srgb, ${t} 14%, transparent)`
|
|
355
|
-
} :
|
|
356
|
-
return /* @__PURE__ */
|
|
357
|
-
ref:
|
|
358
|
-
className:
|
|
359
|
-
style:
|
|
360
|
-
...
|
|
858
|
+
} : r;
|
|
859
|
+
return /* @__PURE__ */ u("span", {
|
|
860
|
+
ref: a,
|
|
861
|
+
className: be(ye.badge, n),
|
|
862
|
+
style: o,
|
|
863
|
+
...i,
|
|
361
864
|
children: e
|
|
362
865
|
});
|
|
363
866
|
});
|
|
364
|
-
|
|
867
|
+
xe.displayName = "Badge";
|
|
868
|
+
var Z = {
|
|
869
|
+
switch: "_switch_1u3md_1",
|
|
870
|
+
input: "_input_1u3md_14",
|
|
871
|
+
track: "_track_1u3md_24",
|
|
872
|
+
thumb: "_thumb_1u3md_31",
|
|
873
|
+
sizeSm: "_sizeSm_1u3md_57",
|
|
874
|
+
sizeMd: "_sizeMd_1u3md_64",
|
|
875
|
+
sizeLg: "_sizeLg_1u3md_71",
|
|
876
|
+
disabled: "_disabled_1u3md_78"
|
|
877
|
+
};
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region src/components/Switch/Switch.tsx
|
|
880
|
+
function Se(...e) {
|
|
881
|
+
return e.filter(Boolean).join(" ");
|
|
882
|
+
}
|
|
883
|
+
var Ce = n(function({ label: e, className: t, color: n, size: r = "md", disabled: i = !1, onChange: a, onCheckedChange: o, "aria-label": s = "Interruttore", style: c, ...l }, f) {
|
|
884
|
+
function p(e) {
|
|
885
|
+
a?.(e), o?.(e.target.checked);
|
|
886
|
+
}
|
|
887
|
+
let m = n ? {
|
|
888
|
+
...c,
|
|
889
|
+
"--switch-color": n
|
|
890
|
+
} : c;
|
|
891
|
+
return /* @__PURE__ */ d("label", {
|
|
892
|
+
className: Se(Z.switch, Z[`size${r[0].toUpperCase()}${r.slice(1)}`], i && Z.disabled, t),
|
|
893
|
+
style: m,
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ u("input", {
|
|
896
|
+
ref: f,
|
|
897
|
+
type: "checkbox",
|
|
898
|
+
className: Z.input,
|
|
899
|
+
disabled: i,
|
|
900
|
+
"aria-label": s,
|
|
901
|
+
onChange: p,
|
|
902
|
+
...l
|
|
903
|
+
}),
|
|
904
|
+
/* @__PURE__ */ u("span", {
|
|
905
|
+
className: Z.track,
|
|
906
|
+
"aria-hidden": "true",
|
|
907
|
+
children: /* @__PURE__ */ u("span", { className: Z.thumb })
|
|
908
|
+
}),
|
|
909
|
+
e ? /* @__PURE__ */ u("span", {
|
|
910
|
+
className: Z.label,
|
|
911
|
+
children: e
|
|
912
|
+
}) : null
|
|
913
|
+
]
|
|
914
|
+
});
|
|
915
|
+
});
|
|
916
|
+
Ce.displayName = "Switch";
|
|
917
|
+
var Q = {
|
|
918
|
+
wrapper: "_wrapper_1ly5u_1",
|
|
919
|
+
table: "_table_1ly5u_11",
|
|
920
|
+
caption: "_caption_1ly5u_19",
|
|
921
|
+
head: "_head_1ly5u_31",
|
|
922
|
+
headerCell: "_headerCell_1ly5u_35",
|
|
923
|
+
cell: "_cell_1ly5u_47",
|
|
924
|
+
body: "_body_1ly5u_56",
|
|
925
|
+
row: "_row_1ly5u_56",
|
|
926
|
+
interactiveRow: "_interactiveRow_1ly5u_65",
|
|
927
|
+
alignLeft: "_alignLeft_1ly5u_78",
|
|
928
|
+
alignCenter: "_alignCenter_1ly5u_82",
|
|
929
|
+
alignRight: "_alignRight_1ly5u_86",
|
|
930
|
+
numeric: "_numeric_1ly5u_90",
|
|
931
|
+
sortButton: "_sortButton_1ly5u_96",
|
|
932
|
+
sortIcon: "_sortIcon_1ly5u_119",
|
|
933
|
+
statusCell: "_statusCell_1ly5u_128",
|
|
934
|
+
hideOnMobile: "_hideOnMobile_1ly5u_137"
|
|
935
|
+
};
|
|
936
|
+
//#endregion
|
|
937
|
+
//#region src/components/DataTable/DataTable.tsx
|
|
938
|
+
function $(...e) {
|
|
939
|
+
return e.filter(Boolean).join(" ");
|
|
940
|
+
}
|
|
941
|
+
function we(e, t) {
|
|
942
|
+
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", {
|
|
943
|
+
numeric: !0,
|
|
944
|
+
sensitivity: "base"
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function Te({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "Non sono disponibili dati da visualizzare.", isLoading: a = !1, sortable: o = !0, onRowClick: c, rowAriaLabel: f, className: p, containerClassName: m, ...h }) {
|
|
948
|
+
let [g, _] = l(null), v = s(() => {
|
|
949
|
+
if (!g?.column.sortValue) return t;
|
|
950
|
+
let { column: e, direction: n } = g, r = n === "ascending" ? 1 : -1;
|
|
951
|
+
return [...t].sort((t, n) => we(e.sortValue?.(t), e.sortValue?.(n)) * r);
|
|
952
|
+
}, [t, g]);
|
|
953
|
+
function y(e) {
|
|
954
|
+
!o || !e.sortable || !e.sortValue || _((t) => t?.column.id === e.id ? t.direction === "ascending" ? {
|
|
955
|
+
column: e,
|
|
956
|
+
direction: "descending"
|
|
957
|
+
} : null : {
|
|
958
|
+
column: e,
|
|
959
|
+
direction: "ascending"
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
function b(e) {
|
|
963
|
+
return g?.column.id === e.id ? g.direction : "none";
|
|
964
|
+
}
|
|
965
|
+
function x(e) {
|
|
966
|
+
return g?.column.id === e.id ? g.direction === "ascending" ? /* @__PURE__ */ u(F, {
|
|
967
|
+
size: 15,
|
|
968
|
+
"aria-hidden": "true"
|
|
969
|
+
}) : /* @__PURE__ */ u(M, {
|
|
970
|
+
size: 15,
|
|
971
|
+
"aria-hidden": "true"
|
|
972
|
+
}) : /* @__PURE__ */ u(I, {
|
|
973
|
+
size: 15,
|
|
974
|
+
"aria-hidden": "true"
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
return /* @__PURE__ */ u("div", {
|
|
978
|
+
className: $(Q.wrapper, m),
|
|
979
|
+
children: /* @__PURE__ */ d("table", {
|
|
980
|
+
className: $(Q.table, p),
|
|
981
|
+
...h,
|
|
982
|
+
children: [
|
|
983
|
+
r ? /* @__PURE__ */ u("caption", {
|
|
984
|
+
className: Q.caption,
|
|
985
|
+
children: r
|
|
986
|
+
}) : null,
|
|
987
|
+
/* @__PURE__ */ u("colgroup", { children: e.map((e) => /* @__PURE__ */ u("col", { style: e.width ? { width: e.width } : void 0 }, e.id)) }),
|
|
988
|
+
/* @__PURE__ */ u("thead", {
|
|
989
|
+
className: Q.head,
|
|
990
|
+
children: /* @__PURE__ */ u("tr", { children: e.map((e) => {
|
|
991
|
+
let t = o && e.sortable && !!e.sortValue;
|
|
992
|
+
return /* @__PURE__ */ u("th", {
|
|
993
|
+
scope: "col",
|
|
994
|
+
"aria-sort": t ? b(e) : void 0,
|
|
995
|
+
className: $(Q.headerCell, Q[`align${Ee(e.align ?? "left")}`], e.hideOnMobile && Q.hideOnMobile),
|
|
996
|
+
children: t ? /* @__PURE__ */ d("button", {
|
|
997
|
+
type: "button",
|
|
998
|
+
className: Q.sortButton,
|
|
999
|
+
onClick: () => y(e),
|
|
1000
|
+
children: [/* @__PURE__ */ u("span", { children: e.header }), /* @__PURE__ */ u("span", {
|
|
1001
|
+
className: Q.sortIcon,
|
|
1002
|
+
children: x(e)
|
|
1003
|
+
})]
|
|
1004
|
+
}) : e.header
|
|
1005
|
+
}, e.id);
|
|
1006
|
+
}) })
|
|
1007
|
+
}),
|
|
1008
|
+
/* @__PURE__ */ d("tbody", {
|
|
1009
|
+
className: Q.body,
|
|
1010
|
+
children: [
|
|
1011
|
+
a ? /* @__PURE__ */ u("tr", { children: /* @__PURE__ */ u("td", {
|
|
1012
|
+
className: Q.statusCell,
|
|
1013
|
+
colSpan: e.length,
|
|
1014
|
+
children: "Caricamento dati…"
|
|
1015
|
+
}) }) : null,
|
|
1016
|
+
!a && v.length === 0 ? /* @__PURE__ */ u("tr", { children: /* @__PURE__ */ u("td", {
|
|
1017
|
+
className: Q.statusCell,
|
|
1018
|
+
colSpan: e.length,
|
|
1019
|
+
children: i
|
|
1020
|
+
}) }) : null,
|
|
1021
|
+
a ? null : v.map((t, r) => {
|
|
1022
|
+
let i = n(t, r), a = c, o = !!a, s = () => {
|
|
1023
|
+
a?.(t, r);
|
|
1024
|
+
};
|
|
1025
|
+
return /* @__PURE__ */ u("tr", {
|
|
1026
|
+
className: $(Q.row, o && Q.interactiveRow),
|
|
1027
|
+
tabIndex: o ? 0 : void 0,
|
|
1028
|
+
"aria-label": o ? f?.(t, r) : void 0,
|
|
1029
|
+
onClick: o ? s : void 0,
|
|
1030
|
+
onKeyDown: o ? (e) => {
|
|
1031
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
|
|
1032
|
+
} : void 0,
|
|
1033
|
+
children: e.map((e) => /* @__PURE__ */ u("td", {
|
|
1034
|
+
className: $(Q.cell, Q[`align${Ee(e.align ?? "left")}`], e.numeric && Q.numeric, e.hideOnMobile && Q.hideOnMobile),
|
|
1035
|
+
children: e.cell(t, r)
|
|
1036
|
+
}, e.id))
|
|
1037
|
+
}, i);
|
|
1038
|
+
})
|
|
1039
|
+
]
|
|
1040
|
+
})
|
|
1041
|
+
]
|
|
1042
|
+
})
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
function Ee(e) {
|
|
1046
|
+
return `${e.charAt(0).toUpperCase()}${e.slice(1)}`;
|
|
1047
|
+
}
|
|
365
1048
|
//#endregion
|
|
366
|
-
export {
|
|
1049
|
+
export { xe as Badge, g as Button, x as Card, Te as DataTable, oe as DatePicker, fe as Dropdown, ue as IconButton, ve as MonthCarousel, me as MultiSelect, Ce as Switch, de as TextField };
|