@bertimatteodev/astra-ui 0.6.2 → 0.6.4
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 +536 -158
- package/dist/index.css +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/astra-ui.js
CHANGED
|
@@ -130,7 +130,58 @@ var S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
130
130
|
...i
|
|
131
131
|
}));
|
|
132
132
|
return i.displayName = T(e), i;
|
|
133
|
-
},
|
|
133
|
+
}, M = j("calculator", [
|
|
134
|
+
["rect", {
|
|
135
|
+
width: "16",
|
|
136
|
+
height: "20",
|
|
137
|
+
x: "4",
|
|
138
|
+
y: "2",
|
|
139
|
+
rx: "2",
|
|
140
|
+
key: "1nb95v"
|
|
141
|
+
}],
|
|
142
|
+
["line", {
|
|
143
|
+
x1: "8",
|
|
144
|
+
x2: "16",
|
|
145
|
+
y1: "6",
|
|
146
|
+
y2: "6",
|
|
147
|
+
key: "x4nwl0"
|
|
148
|
+
}],
|
|
149
|
+
["line", {
|
|
150
|
+
x1: "16",
|
|
151
|
+
x2: "16",
|
|
152
|
+
y1: "14",
|
|
153
|
+
y2: "18",
|
|
154
|
+
key: "wjye3r"
|
|
155
|
+
}],
|
|
156
|
+
["path", {
|
|
157
|
+
d: "M16 10h.01",
|
|
158
|
+
key: "1m94wz"
|
|
159
|
+
}],
|
|
160
|
+
["path", {
|
|
161
|
+
d: "M12 10h.01",
|
|
162
|
+
key: "1nrarc"
|
|
163
|
+
}],
|
|
164
|
+
["path", {
|
|
165
|
+
d: "M8 10h.01",
|
|
166
|
+
key: "19clt8"
|
|
167
|
+
}],
|
|
168
|
+
["path", {
|
|
169
|
+
d: "M12 14h.01",
|
|
170
|
+
key: "1etili"
|
|
171
|
+
}],
|
|
172
|
+
["path", {
|
|
173
|
+
d: "M8 14h.01",
|
|
174
|
+
key: "6423bh"
|
|
175
|
+
}],
|
|
176
|
+
["path", {
|
|
177
|
+
d: "M12 18h.01",
|
|
178
|
+
key: "mhygvu"
|
|
179
|
+
}],
|
|
180
|
+
["path", {
|
|
181
|
+
d: "M8 18h.01",
|
|
182
|
+
key: "lrp35t"
|
|
183
|
+
}]
|
|
184
|
+
]), N = j("calendar-days", [
|
|
134
185
|
["path", {
|
|
135
186
|
d: "M8 2v3",
|
|
136
187
|
key: "1ioesn"
|
|
@@ -175,25 +226,352 @@ var S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
175
226
|
d: "M16 17h.01",
|
|
176
227
|
key: "ql8jdd"
|
|
177
228
|
}]
|
|
178
|
-
]),
|
|
229
|
+
]), P = j("check", [["path", {
|
|
230
|
+
d: "M20 6 9 17l-5-5",
|
|
231
|
+
key: "1gmf2c"
|
|
232
|
+
}]]), F = j("chevron-down", [["path", {
|
|
179
233
|
d: "m6 9 6 6 6-6",
|
|
180
234
|
key: "qrunsl"
|
|
181
|
-
}]]),
|
|
235
|
+
}]]), I = j("chevron-left", [["path", {
|
|
182
236
|
d: "m15 18-6-6 6-6",
|
|
183
237
|
key: "1wnfg3"
|
|
184
|
-
}]]),
|
|
238
|
+
}]]), L = j("chevron-right", [["path", {
|
|
185
239
|
d: "m9 18 6-6-6-6",
|
|
186
240
|
key: "mthhwq"
|
|
187
|
-
}]]),
|
|
241
|
+
}]]), R = j("chevron-up", [["path", {
|
|
188
242
|
d: "m18 15-6-6-6 6",
|
|
189
243
|
key: "153udz"
|
|
190
|
-
}]]),
|
|
244
|
+
}]]), ee = j("chevrons-up-down", [["path", {
|
|
191
245
|
d: "m7 15 5 5 5-5",
|
|
192
246
|
key: "1hf1tw"
|
|
193
247
|
}], ["path", {
|
|
194
248
|
d: "m7 9 5-5 5 5",
|
|
195
249
|
key: "sgt6xg"
|
|
196
|
-
}]]),
|
|
250
|
+
}]]), z = j("delete", [
|
|
251
|
+
["path", {
|
|
252
|
+
d: "M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",
|
|
253
|
+
key: "1yo7s0"
|
|
254
|
+
}],
|
|
255
|
+
["path", {
|
|
256
|
+
d: "m12 9 6 6",
|
|
257
|
+
key: "anjzzh"
|
|
258
|
+
}],
|
|
259
|
+
["path", {
|
|
260
|
+
d: "m18 9-6 6",
|
|
261
|
+
key: "1fp51s"
|
|
262
|
+
}]
|
|
263
|
+
]), te = j("equal", [["line", {
|
|
264
|
+
x1: "5",
|
|
265
|
+
x2: "19",
|
|
266
|
+
y1: "9",
|
|
267
|
+
y2: "9",
|
|
268
|
+
key: "1nwqeh"
|
|
269
|
+
}], ["line", {
|
|
270
|
+
x1: "5",
|
|
271
|
+
x2: "19",
|
|
272
|
+
y1: "15",
|
|
273
|
+
y2: "15",
|
|
274
|
+
key: "g8yjpy"
|
|
275
|
+
}]]), B = {
|
|
276
|
+
field: "_field_y4qci_1",
|
|
277
|
+
label: "_label_y4qci_8",
|
|
278
|
+
trigger: "_trigger_y4qci_15",
|
|
279
|
+
triggerIcon: "_triggerIcon_y4qci_46",
|
|
280
|
+
triggerValue: "_triggerValue_y4qci_52",
|
|
281
|
+
placeholder: "_placeholder_y4qci_53",
|
|
282
|
+
calculator: "_calculator_y4qci_64",
|
|
283
|
+
display: "_display_y4qci_79",
|
|
284
|
+
expression: "_expression_y4qci_90",
|
|
285
|
+
value: "_value_y4qci_98",
|
|
286
|
+
keypad: "_keypad_y4qci_113",
|
|
287
|
+
key: "_key_y4qci_113",
|
|
288
|
+
operatorKey: "_operatorKey_y4qci_153",
|
|
289
|
+
actionKey: "_actionKey_y4qci_164",
|
|
290
|
+
confirmKey: "_confirmKey_y4qci_173",
|
|
291
|
+
submitButton: "_submitButton_y4qci_183",
|
|
292
|
+
wideKey: "_wideKey_y4qci_216"
|
|
293
|
+
}, ne = {
|
|
294
|
+
"+": "+",
|
|
295
|
+
"-": "−",
|
|
296
|
+
"*": "×",
|
|
297
|
+
"/": "÷"
|
|
298
|
+
};
|
|
299
|
+
function re(e, t) {
|
|
300
|
+
let n = String(e);
|
|
301
|
+
return t === "," ? n.replace(".", ",") : n;
|
|
302
|
+
}
|
|
303
|
+
function ie(e, t) {
|
|
304
|
+
if (!e) return null;
|
|
305
|
+
let n = t === "," ? e.replace(",", ".") : e, r = Number(n);
|
|
306
|
+
return Number.isFinite(r) ? r : null;
|
|
307
|
+
}
|
|
308
|
+
function ae(e, t, n) {
|
|
309
|
+
switch (n) {
|
|
310
|
+
case "+": return e + t;
|
|
311
|
+
case "-": return e - t;
|
|
312
|
+
case "*": return e * t;
|
|
313
|
+
case "/": return t === 0 ? null : e / t;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function oe({ initialValue: e, decimalSeparator: t = ",", label: n, placeholder: r = "Inserisci un valore", disabled: i = !1, maxFractionDigits: o = 2, onValueChange: c, onConfirm: f }) {
|
|
317
|
+
let [p, m] = l(() => e === void 0 ? "" : re(e, t)), [h, g] = l(null), [_, v] = l(null), [y, b] = l(!1), [x, S] = l(!0), [C, w] = l(!1), T = s(() => ie(p, t), [t, p]);
|
|
318
|
+
a(() => {
|
|
319
|
+
c?.(C ? null : T);
|
|
320
|
+
}, [
|
|
321
|
+
T,
|
|
322
|
+
C,
|
|
323
|
+
c
|
|
324
|
+
]);
|
|
325
|
+
let E = [
|
|
326
|
+
{
|
|
327
|
+
label: "C",
|
|
328
|
+
value: "clear",
|
|
329
|
+
kind: "action"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
label: "⌫",
|
|
333
|
+
value: "backspace",
|
|
334
|
+
kind: "action",
|
|
335
|
+
ariaLabel: "Cancella ultima cifra"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
label: "÷",
|
|
339
|
+
value: "/",
|
|
340
|
+
kind: "operator"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
label: "×",
|
|
344
|
+
value: "*",
|
|
345
|
+
kind: "operator"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
label: "7",
|
|
349
|
+
value: "7",
|
|
350
|
+
kind: "number"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
label: "8",
|
|
354
|
+
value: "8",
|
|
355
|
+
kind: "number"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
label: "9",
|
|
359
|
+
value: "9",
|
|
360
|
+
kind: "number"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
label: "−",
|
|
364
|
+
value: "-",
|
|
365
|
+
kind: "operator"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
label: "4",
|
|
369
|
+
value: "4",
|
|
370
|
+
kind: "number"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
label: "5",
|
|
374
|
+
value: "5",
|
|
375
|
+
kind: "number"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
label: "6",
|
|
379
|
+
value: "6",
|
|
380
|
+
kind: "number"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
label: "+",
|
|
384
|
+
value: "+",
|
|
385
|
+
kind: "operator"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
label: "1",
|
|
389
|
+
value: "1",
|
|
390
|
+
kind: "number"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
label: "2",
|
|
394
|
+
value: "2",
|
|
395
|
+
kind: "number"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
label: "3",
|
|
399
|
+
value: "3",
|
|
400
|
+
kind: "number"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
label: "=",
|
|
404
|
+
value: "equals",
|
|
405
|
+
kind: "confirm"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
label: "0",
|
|
409
|
+
value: "0",
|
|
410
|
+
kind: "number",
|
|
411
|
+
wide: !0
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
label: t,
|
|
415
|
+
value: "decimal",
|
|
416
|
+
kind: "number"
|
|
417
|
+
}
|
|
418
|
+
];
|
|
419
|
+
function D() {
|
|
420
|
+
m("0"), g(null), v(null), S(!0), w(!1);
|
|
421
|
+
}
|
|
422
|
+
function O(e) {
|
|
423
|
+
if (C && D(), e === "decimal") {
|
|
424
|
+
if (p.includes(t)) return;
|
|
425
|
+
m(x ? `0${t}` : `${p}${t}`), S(!1);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
let n = p.indexOf(t);
|
|
429
|
+
n >= 0 && p.length - n - 1 >= o && !x || (m(x || p === "0" ? e : (t) => `${t}${e}`), S(!1), w(!1));
|
|
430
|
+
}
|
|
431
|
+
function k() {
|
|
432
|
+
C || x || m((e) => {
|
|
433
|
+
let t = e.slice(0, -1);
|
|
434
|
+
return t === "" || t === "-" ? "0" : t;
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
function A(e) {
|
|
438
|
+
if (T === null) {
|
|
439
|
+
w(!0);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (h === null) {
|
|
443
|
+
g(T), v(e ?? null), S(!0);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (_ === null) {
|
|
447
|
+
v(e ?? null), S(!0);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
let n = ae(h, T, _);
|
|
451
|
+
if (n === null) {
|
|
452
|
+
m("Errore"), g(null), v(null), S(!0), w(!0);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
let r = re(n, t);
|
|
456
|
+
m(r), g(e ? n : null), v(e ?? null), S(!0);
|
|
457
|
+
}
|
|
458
|
+
function j() {
|
|
459
|
+
A();
|
|
460
|
+
let e = h !== null && _ !== null ? ae(h, T ?? 0, _) : T;
|
|
461
|
+
e != null && (f?.(e), b(!1));
|
|
462
|
+
}
|
|
463
|
+
function N(e) {
|
|
464
|
+
if (!i) {
|
|
465
|
+
if (e.kind === "number") {
|
|
466
|
+
O(e.value);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (e.value === "clear") {
|
|
470
|
+
D();
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (e.value === "backspace") {
|
|
474
|
+
k();
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (e.value === "equals") {
|
|
478
|
+
j();
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
A(e.value);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
let F = _ ? `${h ?? ""} ${ne[_]}` : null;
|
|
485
|
+
return /* @__PURE__ */ d("div", {
|
|
486
|
+
className: B.field,
|
|
487
|
+
children: [
|
|
488
|
+
n ? /* @__PURE__ */ u("span", {
|
|
489
|
+
className: B.label,
|
|
490
|
+
children: n
|
|
491
|
+
}) : null,
|
|
492
|
+
/* @__PURE__ */ d("button", {
|
|
493
|
+
type: "button",
|
|
494
|
+
className: B.trigger,
|
|
495
|
+
disabled: i,
|
|
496
|
+
"aria-label": y ? "Chiudi calcolatrice" : "Apri calcolatrice",
|
|
497
|
+
"aria-expanded": y,
|
|
498
|
+
onClick: () => b((e) => !e),
|
|
499
|
+
children: [/* @__PURE__ */ u(M, {
|
|
500
|
+
className: B.triggerIcon,
|
|
501
|
+
size: 20,
|
|
502
|
+
"aria-hidden": "true"
|
|
503
|
+
}), /* @__PURE__ */ u("span", {
|
|
504
|
+
className: p ? B.triggerValue : B.placeholder,
|
|
505
|
+
children: p || r
|
|
506
|
+
})]
|
|
507
|
+
}),
|
|
508
|
+
y ? /* @__PURE__ */ d("section", {
|
|
509
|
+
className: B.calculator,
|
|
510
|
+
"aria-label": "Calcolatrice",
|
|
511
|
+
children: [
|
|
512
|
+
/* @__PURE__ */ d("div", {
|
|
513
|
+
className: B.display,
|
|
514
|
+
"aria-live": "polite",
|
|
515
|
+
"aria-atomic": "true",
|
|
516
|
+
children: [/* @__PURE__ */ u("span", {
|
|
517
|
+
className: B.expression,
|
|
518
|
+
children: F ?? "\xA0"
|
|
519
|
+
}), /* @__PURE__ */ u("output", {
|
|
520
|
+
className: `${B.value} numeric`,
|
|
521
|
+
"aria-label": `Valore corrente: ${p}`,
|
|
522
|
+
children: p
|
|
523
|
+
})]
|
|
524
|
+
}),
|
|
525
|
+
/* @__PURE__ */ u("div", {
|
|
526
|
+
className: B.keypad,
|
|
527
|
+
children: E.map((e) => {
|
|
528
|
+
let t = [
|
|
529
|
+
B.key,
|
|
530
|
+
e.kind === "operator" && B.operatorKey,
|
|
531
|
+
e.kind === "action" && B.actionKey,
|
|
532
|
+
e.kind === "confirm" && B.confirmKey,
|
|
533
|
+
e.wide && B.wideKey
|
|
534
|
+
].filter(Boolean).join(" "), n = e.value === "backspace", r = e.value === "equals";
|
|
535
|
+
return /* @__PURE__ */ d("button", {
|
|
536
|
+
type: "button",
|
|
537
|
+
className: t,
|
|
538
|
+
disabled: i,
|
|
539
|
+
"aria-label": e.ariaLabel ?? e.label,
|
|
540
|
+
onClick: () => N(e),
|
|
541
|
+
children: [
|
|
542
|
+
n ? /* @__PURE__ */ u(z, {
|
|
543
|
+
size: 18,
|
|
544
|
+
strokeWidth: 1.9,
|
|
545
|
+
"aria-hidden": "true"
|
|
546
|
+
}) : null,
|
|
547
|
+
r ? /* @__PURE__ */ u(te, {
|
|
548
|
+
size: 18,
|
|
549
|
+
strokeWidth: 2,
|
|
550
|
+
"aria-hidden": "true"
|
|
551
|
+
}) : null,
|
|
552
|
+
!n && !r ? e.label : null
|
|
553
|
+
]
|
|
554
|
+
}, e.value);
|
|
555
|
+
})
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ u("button", {
|
|
558
|
+
type: "button",
|
|
559
|
+
className: B.submitButton,
|
|
560
|
+
disabled: i,
|
|
561
|
+
"aria-label": "Confirm value",
|
|
562
|
+
onClick: j,
|
|
563
|
+
children: /* @__PURE__ */ u(P, {
|
|
564
|
+
size: 18,
|
|
565
|
+
strokeWidth: 2,
|
|
566
|
+
"aria-hidden": "true"
|
|
567
|
+
})
|
|
568
|
+
})
|
|
569
|
+
]
|
|
570
|
+
}) : null
|
|
571
|
+
]
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
var V = {
|
|
197
575
|
field: "_field_t3jjk_1",
|
|
198
576
|
label: "_label_t3jjk_8",
|
|
199
577
|
trigger: "_trigger_t3jjk_15",
|
|
@@ -215,7 +593,7 @@ var S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
215
593
|
today: "_today_t3jjk_195",
|
|
216
594
|
footer: "_footer_t3jjk_210",
|
|
217
595
|
textButton: "_textButton_t3jjk_218"
|
|
218
|
-
},
|
|
596
|
+
}, se = [
|
|
219
597
|
"Lun",
|
|
220
598
|
"Mar",
|
|
221
599
|
"Mer",
|
|
@@ -224,47 +602,47 @@ var S = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
|
|
|
224
602
|
"Sab",
|
|
225
603
|
"Dom"
|
|
226
604
|
];
|
|
227
|
-
function
|
|
605
|
+
function H(e) {
|
|
228
606
|
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
229
607
|
}
|
|
230
|
-
function
|
|
608
|
+
function U(e) {
|
|
231
609
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
232
610
|
}
|
|
233
|
-
function
|
|
611
|
+
function ce(e, t) {
|
|
234
612
|
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
|
|
235
613
|
}
|
|
236
|
-
function
|
|
614
|
+
function le(e, t) {
|
|
237
615
|
return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth();
|
|
238
616
|
}
|
|
239
|
-
function
|
|
240
|
-
let r =
|
|
241
|
-
return !!(t && r <
|
|
617
|
+
function ue(e, t, n) {
|
|
618
|
+
let r = H(e);
|
|
619
|
+
return !!(t && r < H(t) || n && r > H(n));
|
|
242
620
|
}
|
|
243
|
-
function
|
|
621
|
+
function de(e) {
|
|
244
622
|
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
623
|
return Array.from({ length: o }, (e, t) => new Date(s.getFullYear(), s.getMonth(), s.getDate() + t));
|
|
246
624
|
}
|
|
247
|
-
function
|
|
625
|
+
function fe(e, t) {
|
|
248
626
|
let n = new Intl.DateTimeFormat(t, {
|
|
249
627
|
month: "long",
|
|
250
628
|
year: "numeric"
|
|
251
629
|
}).format(e);
|
|
252
630
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
253
631
|
}
|
|
254
|
-
function
|
|
632
|
+
function pe(e, t) {
|
|
255
633
|
return e ? new Intl.DateTimeFormat(t, {
|
|
256
634
|
day: "2-digit",
|
|
257
635
|
month: "short",
|
|
258
636
|
year: "numeric"
|
|
259
637
|
}).format(e) : "";
|
|
260
638
|
}
|
|
261
|
-
function
|
|
639
|
+
function me(...e) {
|
|
262
640
|
return e.filter(Boolean).join(" ");
|
|
263
641
|
}
|
|
264
|
-
function
|
|
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(() =>
|
|
642
|
+
function he({ 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 }) {
|
|
643
|
+
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(() => H(e ?? /* @__PURE__ */ new Date())), k = s(() => de(D), [D]), A = H(/* @__PURE__ */ new Date());
|
|
266
644
|
a(() => {
|
|
267
|
-
e && O(
|
|
645
|
+
e && O(H(e));
|
|
268
646
|
}, [e]), a(() => {
|
|
269
647
|
function e(e) {
|
|
270
648
|
C.current && !C.current.contains(e.target) && E(!1);
|
|
@@ -277,15 +655,15 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
277
655
|
};
|
|
278
656
|
}, []);
|
|
279
657
|
function j() {
|
|
280
|
-
f || (O(
|
|
658
|
+
f || (O(H(e ?? /* @__PURE__ */ new Date())), E(!0));
|
|
281
659
|
}
|
|
282
660
|
function M(e) {
|
|
283
|
-
|
|
661
|
+
ue(e, p, m) || (t(H(e)), E(!1), w.current?.focus());
|
|
284
662
|
}
|
|
285
|
-
function
|
|
663
|
+
function P(e) {
|
|
286
664
|
O((t) => new Date(t.getFullYear(), t.getMonth() + e, 1));
|
|
287
665
|
}
|
|
288
|
-
function
|
|
666
|
+
function F(e, t) {
|
|
289
667
|
let n = new Date(t);
|
|
290
668
|
if (e.key === "ArrowLeft") n.setDate(t.getDate() - 1);
|
|
291
669
|
else if (e.key === "ArrowRight") n.setDate(t.getDate() + 1);
|
|
@@ -295,20 +673,20 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
295
673
|
else if (e.key === "End") n.setDate(t.getDate() + (6 - (t.getDay() + 6) % 7));
|
|
296
674
|
else return;
|
|
297
675
|
e.preventDefault();
|
|
298
|
-
let r = `${b}-${
|
|
676
|
+
let r = `${b}-${U(n)}`, i = document.getElementById(r);
|
|
299
677
|
if (i) {
|
|
300
678
|
i.focus();
|
|
301
679
|
return;
|
|
302
680
|
}
|
|
303
681
|
O(new Date(n.getFullYear(), n.getMonth(), 1));
|
|
304
682
|
}
|
|
305
|
-
let
|
|
683
|
+
let R = pe(e, i);
|
|
306
684
|
return /* @__PURE__ */ d("div", {
|
|
307
685
|
ref: C,
|
|
308
|
-
className:
|
|
686
|
+
className: V.field,
|
|
309
687
|
children: [
|
|
310
688
|
n ? /* @__PURE__ */ u("label", {
|
|
311
|
-
className:
|
|
689
|
+
className: V.label,
|
|
312
690
|
htmlFor: b,
|
|
313
691
|
children: n
|
|
314
692
|
}) : null,
|
|
@@ -316,61 +694,61 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
316
694
|
id: b,
|
|
317
695
|
type: "hidden",
|
|
318
696
|
name: g,
|
|
319
|
-
value: e ?
|
|
697
|
+
value: e ? U(e) : ""
|
|
320
698
|
}),
|
|
321
699
|
/* @__PURE__ */ d("button", {
|
|
322
700
|
ref: w,
|
|
323
701
|
type: "button",
|
|
324
|
-
className:
|
|
702
|
+
className: me(V.trigger, v && V.hasError, f && V.isDisabled),
|
|
325
703
|
disabled: f,
|
|
326
704
|
"aria-haspopup": "dialog",
|
|
327
705
|
"aria-expanded": T,
|
|
328
706
|
"aria-controls": T ? x : void 0,
|
|
329
707
|
onClick: () => T ? E(!1) : j(),
|
|
330
|
-
children: [/* @__PURE__ */ u(
|
|
331
|
-
className:
|
|
708
|
+
children: [/* @__PURE__ */ u(N, {
|
|
709
|
+
className: V.triggerIcon,
|
|
332
710
|
size: 18,
|
|
333
711
|
"aria-hidden": "true"
|
|
334
712
|
}), /* @__PURE__ */ u("span", {
|
|
335
|
-
className:
|
|
336
|
-
children:
|
|
713
|
+
className: me(V.triggerValue, !e && V.placeholder),
|
|
714
|
+
children: R || r
|
|
337
715
|
})]
|
|
338
716
|
}),
|
|
339
717
|
v ? /* @__PURE__ */ u("p", {
|
|
340
718
|
id: S,
|
|
341
|
-
className:
|
|
719
|
+
className: V.error,
|
|
342
720
|
role: "alert",
|
|
343
721
|
children: v
|
|
344
722
|
}) : null,
|
|
345
723
|
T ? /* @__PURE__ */ d("div", {
|
|
346
724
|
id: x,
|
|
347
|
-
className:
|
|
725
|
+
className: V.popover,
|
|
348
726
|
role: "dialog",
|
|
349
727
|
"aria-label": "Seleziona una data",
|
|
350
728
|
children: [
|
|
351
729
|
/* @__PURE__ */ d("header", {
|
|
352
|
-
className:
|
|
730
|
+
className: V.calendarHeader,
|
|
353
731
|
children: [
|
|
354
732
|
/* @__PURE__ */ u("button", {
|
|
355
733
|
type: "button",
|
|
356
|
-
className:
|
|
734
|
+
className: V.navigationButton,
|
|
357
735
|
"aria-label": "Mese precedente",
|
|
358
|
-
onClick: () =>
|
|
359
|
-
children: /* @__PURE__ */ u(
|
|
736
|
+
onClick: () => P(-1),
|
|
737
|
+
children: /* @__PURE__ */ u(I, {
|
|
360
738
|
size: 18,
|
|
361
739
|
"aria-hidden": "true"
|
|
362
740
|
})
|
|
363
741
|
}),
|
|
364
742
|
/* @__PURE__ */ u("span", {
|
|
365
|
-
className:
|
|
366
|
-
children:
|
|
743
|
+
className: V.monthLabel,
|
|
744
|
+
children: fe(D, i)
|
|
367
745
|
}),
|
|
368
746
|
/* @__PURE__ */ u("button", {
|
|
369
747
|
type: "button",
|
|
370
|
-
className:
|
|
748
|
+
className: V.navigationButton,
|
|
371
749
|
"aria-label": "Mese successivo",
|
|
372
|
-
onClick: () =>
|
|
373
|
-
children: /* @__PURE__ */ u(
|
|
750
|
+
onClick: () => P(1),
|
|
751
|
+
children: /* @__PURE__ */ u(L, {
|
|
374
752
|
size: 18,
|
|
375
753
|
"aria-hidden": "true"
|
|
376
754
|
})
|
|
@@ -378,20 +756,20 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
378
756
|
]
|
|
379
757
|
}),
|
|
380
758
|
/* @__PURE__ */ d("div", {
|
|
381
|
-
className:
|
|
759
|
+
className: V.calendarGrid,
|
|
382
760
|
role: "grid",
|
|
383
|
-
"aria-label":
|
|
384
|
-
children: [
|
|
385
|
-
className:
|
|
761
|
+
"aria-label": fe(D, i),
|
|
762
|
+
children: [se.map((e) => /* @__PURE__ */ u("span", {
|
|
763
|
+
className: V.weekDay,
|
|
386
764
|
role: "columnheader",
|
|
387
765
|
children: e
|
|
388
766
|
}, e)), k.map((t) => {
|
|
389
|
-
let n =
|
|
767
|
+
let n = le(t, D), r = e ? ce(t, e) : !1, a = ce(t, A), o = ue(t, p, m), s = `${b}-${U(t)}`;
|
|
390
768
|
return /* @__PURE__ */ u("button", {
|
|
391
769
|
id: s,
|
|
392
770
|
type: "button",
|
|
393
771
|
role: "gridcell",
|
|
394
|
-
className:
|
|
772
|
+
className: me(V.day, !n && V.outsideMonth, r && V.selectedDay, a && V.today),
|
|
395
773
|
disabled: o,
|
|
396
774
|
"aria-label": new Intl.DateTimeFormat(i, {
|
|
397
775
|
weekday: "long",
|
|
@@ -402,23 +780,23 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
402
780
|
"aria-selected": r,
|
|
403
781
|
tabIndex: r || !e && a ? 0 : -1,
|
|
404
782
|
onClick: () => M(t),
|
|
405
|
-
onKeyDown: (e) =>
|
|
783
|
+
onKeyDown: (e) => F(e, t),
|
|
406
784
|
children: t.getDate()
|
|
407
785
|
}, s);
|
|
408
786
|
})]
|
|
409
787
|
}),
|
|
410
788
|
/* @__PURE__ */ d("footer", {
|
|
411
|
-
className:
|
|
789
|
+
className: V.footer,
|
|
412
790
|
children: [/* @__PURE__ */ u("button", {
|
|
413
791
|
type: "button",
|
|
414
|
-
className:
|
|
792
|
+
className: V.textButton,
|
|
415
793
|
onClick: () => {
|
|
416
794
|
O(A), M(A);
|
|
417
795
|
},
|
|
418
796
|
children: "Oggi"
|
|
419
797
|
}), h && e ? /* @__PURE__ */ u("button", {
|
|
420
798
|
type: "button",
|
|
421
|
-
className:
|
|
799
|
+
className: V.textButton,
|
|
422
800
|
onClick: () => {
|
|
423
801
|
t(null), E(!1), w.current?.focus();
|
|
424
802
|
},
|
|
@@ -430,7 +808,7 @@ function oe({ value: e, onChange: t, label: n, placeholder: r = "Seleziona una d
|
|
|
430
808
|
]
|
|
431
809
|
});
|
|
432
810
|
}
|
|
433
|
-
var
|
|
811
|
+
var W = {
|
|
434
812
|
button: "_button_2kydv_1",
|
|
435
813
|
sizeSm: "_sizeSm_2kydv_27",
|
|
436
814
|
sizeMd: "_sizeMd_2kydv_32",
|
|
@@ -444,20 +822,20 @@ var U = {
|
|
|
444
822
|
spinner: "_spinner_2kydv_94",
|
|
445
823
|
spin: "_spin_2kydv_94",
|
|
446
824
|
loading: "_loading_2kydv_103"
|
|
447
|
-
},
|
|
448
|
-
primary:
|
|
449
|
-
secondary:
|
|
450
|
-
ghost:
|
|
451
|
-
danger:
|
|
452
|
-
},
|
|
453
|
-
sm:
|
|
454
|
-
md:
|
|
455
|
-
lg:
|
|
825
|
+
}, ge = {
|
|
826
|
+
primary: W.variantPrimary,
|
|
827
|
+
secondary: W.variantSecondary,
|
|
828
|
+
ghost: W.variantGhost,
|
|
829
|
+
danger: W.variantDanger
|
|
830
|
+
}, _e = {
|
|
831
|
+
sm: W.sizeSm,
|
|
832
|
+
md: W.sizeMd,
|
|
833
|
+
lg: W.sizeLg
|
|
456
834
|
};
|
|
457
|
-
function
|
|
835
|
+
function ve(...e) {
|
|
458
836
|
return e.filter(Boolean).join(" ");
|
|
459
837
|
}
|
|
460
|
-
var
|
|
838
|
+
var ye = 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
839
|
let m = c || a, h = s ? {
|
|
462
840
|
...d,
|
|
463
841
|
backgroundColor: s
|
|
@@ -465,24 +843,24 @@ var ue = n(function({ icon: e, label: t, className: n, variant: r = "secondary",
|
|
|
465
843
|
return /* @__PURE__ */ u("button", {
|
|
466
844
|
ref: p,
|
|
467
845
|
type: l,
|
|
468
|
-
className:
|
|
846
|
+
className: ve(W.button, ge[r], _e[i], a && W.loading, o && W.borderless, n),
|
|
469
847
|
style: h,
|
|
470
848
|
disabled: m,
|
|
471
849
|
"aria-label": t,
|
|
472
850
|
"aria-busy": a || void 0,
|
|
473
851
|
...f,
|
|
474
852
|
children: a ? /* @__PURE__ */ u("span", {
|
|
475
|
-
className:
|
|
853
|
+
className: W.spinner,
|
|
476
854
|
"aria-hidden": "true"
|
|
477
855
|
}) : /* @__PURE__ */ u("span", {
|
|
478
|
-
className:
|
|
856
|
+
className: W.icon,
|
|
479
857
|
"aria-hidden": "true",
|
|
480
858
|
children: e
|
|
481
859
|
})
|
|
482
860
|
});
|
|
483
861
|
});
|
|
484
|
-
|
|
485
|
-
var
|
|
862
|
+
ye.displayName = "IconButton";
|
|
863
|
+
var G = {
|
|
486
864
|
field: "_field_1pq0j_1",
|
|
487
865
|
label: "_label_1pq0j_7",
|
|
488
866
|
required: "_required_1pq0j_14",
|
|
@@ -496,39 +874,39 @@ var W = {
|
|
|
496
874
|
};
|
|
497
875
|
//#endregion
|
|
498
876
|
//#region src/components/TextField/TextField.tsx
|
|
499
|
-
function
|
|
877
|
+
function be(...e) {
|
|
500
878
|
return e.filter(Boolean).join(" ");
|
|
501
879
|
}
|
|
502
|
-
var
|
|
880
|
+
var xe = 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
881
|
let g = o(), _ = e ?? `text-field-${g}`, v = `${_}-hint`, y = `${_}-error`, b = [
|
|
504
882
|
p,
|
|
505
883
|
n ? v : null,
|
|
506
884
|
r ? y : null
|
|
507
885
|
].filter(Boolean).join(" ");
|
|
508
886
|
return /* @__PURE__ */ d("div", {
|
|
509
|
-
className: G
|
|
887
|
+
className: be(G.field, c),
|
|
510
888
|
children: [
|
|
511
889
|
t ? /* @__PURE__ */ d("label", {
|
|
512
|
-
className:
|
|
890
|
+
className: G.label,
|
|
513
891
|
htmlFor: _,
|
|
514
892
|
children: [t, f ? /* @__PURE__ */ d("span", {
|
|
515
|
-
className:
|
|
893
|
+
className: G.required,
|
|
516
894
|
"aria-hidden": "true",
|
|
517
895
|
children: [" ", "*"]
|
|
518
896
|
}) : null]
|
|
519
897
|
}) : null,
|
|
520
898
|
/* @__PURE__ */ d("div", {
|
|
521
|
-
className: G
|
|
899
|
+
className: be(G.control, r && G.hasError, l && G.isDisabled),
|
|
522
900
|
children: [
|
|
523
901
|
i ? /* @__PURE__ */ u("span", {
|
|
524
|
-
className:
|
|
902
|
+
className: G.adornment,
|
|
525
903
|
"aria-hidden": "true",
|
|
526
904
|
children: i
|
|
527
905
|
}) : null,
|
|
528
906
|
/* @__PURE__ */ u("input", {
|
|
529
907
|
ref: h,
|
|
530
908
|
id: _,
|
|
531
|
-
className: G
|
|
909
|
+
className: be(G.input, s),
|
|
532
910
|
disabled: l,
|
|
533
911
|
required: f,
|
|
534
912
|
"aria-invalid": r ? !0 : void 0,
|
|
@@ -536,7 +914,7 @@ var de = n(function({ id: e, label: t, hint: n, error: r, startAdornment: i, end
|
|
|
536
914
|
...m
|
|
537
915
|
}),
|
|
538
916
|
a ? /* @__PURE__ */ u("span", {
|
|
539
|
-
className:
|
|
917
|
+
className: G.adornment,
|
|
540
918
|
"aria-hidden": "true",
|
|
541
919
|
children: a
|
|
542
920
|
}) : null
|
|
@@ -544,19 +922,19 @@ var de = n(function({ id: e, label: t, hint: n, error: r, startAdornment: i, end
|
|
|
544
922
|
}),
|
|
545
923
|
r ? /* @__PURE__ */ u("p", {
|
|
546
924
|
id: y,
|
|
547
|
-
className:
|
|
925
|
+
className: G.error,
|
|
548
926
|
role: "alert",
|
|
549
927
|
children: r
|
|
550
928
|
}) : null,
|
|
551
929
|
!r && n ? /* @__PURE__ */ u("p", {
|
|
552
930
|
id: v,
|
|
553
|
-
className:
|
|
931
|
+
className: G.hint,
|
|
554
932
|
children: n
|
|
555
933
|
}) : null
|
|
556
934
|
]
|
|
557
935
|
});
|
|
558
936
|
});
|
|
559
|
-
|
|
937
|
+
xe.displayName = "TextField";
|
|
560
938
|
var K = {
|
|
561
939
|
field: "_field_3nnjq_1",
|
|
562
940
|
label: "_label_3nnjq_7",
|
|
@@ -581,38 +959,38 @@ var K = {
|
|
|
581
959
|
function q(...e) {
|
|
582
960
|
return e.filter(Boolean).join(" ");
|
|
583
961
|
}
|
|
584
|
-
var
|
|
962
|
+
var Se = 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
963
|
let C = o(), w = e ?? `dropdown-${C}`, T = `${w}-hint`, E = `${w}-error`, D = `${w}-label`, O = `${w}-listbox`, k = [
|
|
586
964
|
b,
|
|
587
965
|
r ? T : null,
|
|
588
966
|
i ? E : null
|
|
589
|
-
].filter(Boolean).join(" "), A = typeof g == "string" ? g : void 0, [j,
|
|
967
|
+
].filter(Boolean).join(" "), A = typeof g == "string" ? g : void 0, [j, M] = l(typeof _ == "string" ? _ : ""), [N, P] = l(!1), [F, I] = l(0), L = c(null), R = A ?? j, ee = t.find((e) => e.value === R), z = t.reduce((e, t, n) => (t.disabled || e.push(n), e), []);
|
|
590
968
|
a(() => {
|
|
591
969
|
function e(e) {
|
|
592
|
-
|
|
970
|
+
L.current?.contains(e.target) || P(!1);
|
|
593
971
|
}
|
|
594
972
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
595
973
|
}, []);
|
|
596
|
-
function
|
|
974
|
+
function te(e) {
|
|
597
975
|
v?.(e), y?.(e.target.value);
|
|
598
976
|
}
|
|
599
|
-
function
|
|
600
|
-
A === void 0 &&
|
|
977
|
+
function B(e) {
|
|
978
|
+
A === void 0 && M(e), y?.(e), P(!1);
|
|
601
979
|
}
|
|
602
|
-
function
|
|
980
|
+
function ne(e) {
|
|
603
981
|
if (!m) {
|
|
604
982
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
605
|
-
e.preventDefault(),
|
|
606
|
-
let t = (z.indexOf(
|
|
607
|
-
|
|
983
|
+
e.preventDefault(), P(!0);
|
|
984
|
+
let t = (z.indexOf(F) + (e.key === "ArrowDown" ? 1 : -1) + z.length) % z.length;
|
|
985
|
+
I(z[t] ?? 0);
|
|
608
986
|
}
|
|
609
987
|
if (e.key === "Enter" || e.key === " ") {
|
|
610
|
-
if (e.preventDefault(),
|
|
611
|
-
let e = t[
|
|
612
|
-
e && !e.disabled &&
|
|
613
|
-
} else
|
|
988
|
+
if (e.preventDefault(), N) {
|
|
989
|
+
let e = t[F];
|
|
990
|
+
e && !e.disabled && B(e.value);
|
|
991
|
+
} else P(!0);
|
|
614
992
|
}
|
|
615
|
-
e.key === "Escape" &&
|
|
993
|
+
e.key === "Escape" && P(!1);
|
|
616
994
|
}
|
|
617
995
|
}
|
|
618
996
|
return /* @__PURE__ */ d("div", {
|
|
@@ -629,8 +1007,8 @@ var fe = n(function({ id: e, options: t, label: n, hint: r, error: i, placeholde
|
|
|
629
1007
|
}) : null]
|
|
630
1008
|
}) : null,
|
|
631
1009
|
/* @__PURE__ */ d("div", {
|
|
632
|
-
ref:
|
|
633
|
-
className: q(K.control, i && K.hasError, m && K.isDisabled,
|
|
1010
|
+
ref: L,
|
|
1011
|
+
className: q(K.control, i && K.hasError, m && K.isDisabled, N && K.isOpen),
|
|
634
1012
|
children: [
|
|
635
1013
|
/* @__PURE__ */ d("select", {
|
|
636
1014
|
ref: S,
|
|
@@ -638,10 +1016,10 @@ var fe = n(function({ id: e, options: t, label: n, hint: r, error: i, placeholde
|
|
|
638
1016
|
className: K.nativeSelect,
|
|
639
1017
|
disabled: m,
|
|
640
1018
|
required: h,
|
|
641
|
-
value:
|
|
1019
|
+
value: R,
|
|
642
1020
|
"aria-invalid": i ? !0 : void 0,
|
|
643
1021
|
"aria-describedby": k || void 0,
|
|
644
|
-
onChange:
|
|
1022
|
+
onChange: te,
|
|
645
1023
|
...x,
|
|
646
1024
|
children: [s ? /* @__PURE__ */ u("option", {
|
|
647
1025
|
value: "",
|
|
@@ -658,40 +1036,40 @@ var fe = n(function({ id: e, options: t, label: n, hint: r, error: i, placeholde
|
|
|
658
1036
|
className: q(K.trigger, f),
|
|
659
1037
|
disabled: m,
|
|
660
1038
|
"aria-haspopup": "listbox",
|
|
661
|
-
"aria-expanded":
|
|
1039
|
+
"aria-expanded": N,
|
|
662
1040
|
"aria-controls": O,
|
|
663
1041
|
"aria-labelledby": n ? D : void 0,
|
|
664
1042
|
"aria-describedby": k || void 0,
|
|
665
1043
|
"aria-invalid": i ? !0 : void 0,
|
|
666
|
-
onClick: () =>
|
|
667
|
-
onKeyDown:
|
|
1044
|
+
onClick: () => P((e) => !e),
|
|
1045
|
+
onKeyDown: ne,
|
|
668
1046
|
children: [/* @__PURE__ */ u("span", {
|
|
669
|
-
className:
|
|
670
|
-
children:
|
|
1047
|
+
className: ee ? void 0 : K.placeholder,
|
|
1048
|
+
children: ee?.label ?? s
|
|
671
1049
|
}), /* @__PURE__ */ u("span", {
|
|
672
1050
|
className: K.indicator,
|
|
673
1051
|
"aria-hidden": "true"
|
|
674
1052
|
})]
|
|
675
1053
|
}),
|
|
676
|
-
|
|
1054
|
+
N ? /* @__PURE__ */ d("div", {
|
|
677
1055
|
id: O,
|
|
678
1056
|
className: K.menu,
|
|
679
1057
|
role: "listbox",
|
|
680
1058
|
children: [s ? /* @__PURE__ */ u("button", {
|
|
681
1059
|
type: "button",
|
|
682
|
-
className: q(K.option, !
|
|
1060
|
+
className: q(K.option, !R && K.selectedOption),
|
|
683
1061
|
role: "option",
|
|
684
|
-
"aria-selected": !
|
|
685
|
-
onClick: () =>
|
|
1062
|
+
"aria-selected": !R,
|
|
1063
|
+
onClick: () => B(""),
|
|
686
1064
|
children: s
|
|
687
1065
|
}) : null, t.map((e, t) => /* @__PURE__ */ u("button", {
|
|
688
1066
|
type: "button",
|
|
689
|
-
className: q(K.option, e.value ===
|
|
1067
|
+
className: q(K.option, e.value === R && K.selectedOption, t === F && K.activeOption),
|
|
690
1068
|
role: "option",
|
|
691
|
-
"aria-selected": e.value ===
|
|
1069
|
+
"aria-selected": e.value === R,
|
|
692
1070
|
disabled: e.disabled,
|
|
693
|
-
onMouseEnter: () =>
|
|
694
|
-
onClick: () =>
|
|
1071
|
+
onMouseEnter: () => I(t),
|
|
1072
|
+
onClick: () => B(e.value),
|
|
695
1073
|
children: e.label
|
|
696
1074
|
}, e.value))]
|
|
697
1075
|
}) : null
|
|
@@ -711,7 +1089,7 @@ var fe = n(function({ id: e, options: t, label: n, hint: r, error: i, placeholde
|
|
|
711
1089
|
]
|
|
712
1090
|
});
|
|
713
1091
|
});
|
|
714
|
-
|
|
1092
|
+
Se.displayName = "Dropdown";
|
|
715
1093
|
var J = {
|
|
716
1094
|
group: "_group_1fqa2_1",
|
|
717
1095
|
option: "_option_1fqa2_8",
|
|
@@ -720,10 +1098,10 @@ var J = {
|
|
|
720
1098
|
};
|
|
721
1099
|
//#endregion
|
|
722
1100
|
//#region src/components/MultiSelect/MultiSelect.tsx
|
|
723
|
-
function
|
|
1101
|
+
function Ce(...e) {
|
|
724
1102
|
return e.filter(Boolean).join(" ");
|
|
725
1103
|
}
|
|
726
|
-
var
|
|
1104
|
+
var we = 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
1105
|
let [p, m] = l(n), h = t ?? p, g = r ? h : h.slice(0, 1);
|
|
728
1106
|
function _(e) {
|
|
729
1107
|
let n = g.includes(e), i = r ? n ? g.filter((t) => t !== e) : [...g, e] : n ? [] : [e];
|
|
@@ -733,7 +1111,7 @@ var me = n(function({ options: e, value: t, defaultValue: n = [], multiple: r =
|
|
|
733
1111
|
ref: f,
|
|
734
1112
|
role: "group",
|
|
735
1113
|
"aria-label": s,
|
|
736
|
-
className:
|
|
1114
|
+
className: Ce(J.group, a),
|
|
737
1115
|
...c,
|
|
738
1116
|
children: e.map((e) => {
|
|
739
1117
|
let t = g.includes(e.value), n = i || e.disabled, r = e.selectedColor ? {
|
|
@@ -742,7 +1120,7 @@ var me = n(function({ options: e, value: t, defaultValue: n = [], multiple: r =
|
|
|
742
1120
|
} : void 0;
|
|
743
1121
|
return /* @__PURE__ */ d("button", {
|
|
744
1122
|
type: "button",
|
|
745
|
-
className:
|
|
1123
|
+
className: Ce(J.option, t && J.selected),
|
|
746
1124
|
disabled: n,
|
|
747
1125
|
"aria-pressed": t,
|
|
748
1126
|
style: r,
|
|
@@ -755,41 +1133,41 @@ var me = n(function({ options: e, value: t, defaultValue: n = [], multiple: r =
|
|
|
755
1133
|
})
|
|
756
1134
|
});
|
|
757
1135
|
});
|
|
758
|
-
|
|
1136
|
+
we.displayName = "MultiSelect";
|
|
759
1137
|
var Y = {
|
|
760
|
-
carousel: "
|
|
761
|
-
navigationButton: "
|
|
762
|
-
track: "
|
|
763
|
-
label: "
|
|
764
|
-
"month-fade-in": "_month-fade-
|
|
765
|
-
srOnly: "
|
|
1138
|
+
carousel: "_carousel_17hln_1",
|
|
1139
|
+
navigationButton: "_navigationButton_17hln_13",
|
|
1140
|
+
track: "_track_17hln_51",
|
|
1141
|
+
label: "_label_17hln_60",
|
|
1142
|
+
"month-fade-in": "_month-fade-in_17hln_1",
|
|
1143
|
+
srOnly: "_srOnly_17hln_85"
|
|
766
1144
|
};
|
|
767
1145
|
//#endregion
|
|
768
1146
|
//#region src/components/MonthCarousel/MonthCarousel.tsx
|
|
769
1147
|
function X(e) {
|
|
770
1148
|
return e.year * 12 + e.month - 1;
|
|
771
1149
|
}
|
|
772
|
-
function
|
|
1150
|
+
function Te(e, t) {
|
|
773
1151
|
let n = e.year * 12 + e.month - 1 + t;
|
|
774
1152
|
return {
|
|
775
1153
|
year: Math.floor(n / 12),
|
|
776
1154
|
month: (n % 12 + 12) % 12 + 1
|
|
777
1155
|
};
|
|
778
1156
|
}
|
|
779
|
-
function
|
|
1157
|
+
function Ee(e, t) {
|
|
780
1158
|
let n = new Date(e.year, e.month - 1, 1), r = new Intl.DateTimeFormat(t, {
|
|
781
1159
|
month: "long",
|
|
782
1160
|
year: "numeric"
|
|
783
1161
|
}).format(n);
|
|
784
1162
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
785
1163
|
}
|
|
786
|
-
function
|
|
787
|
-
let i =
|
|
1164
|
+
function De(e, t, n, r) {
|
|
1165
|
+
let i = Te(t, e);
|
|
788
1166
|
return e === -1 && n ? X(i) < X(n) : e === 1 && r ? X(i) > X(r) : !1;
|
|
789
1167
|
}
|
|
790
|
-
function
|
|
791
|
-
let [p, m] = l(0), h = c(null), g = s(() =>
|
|
792
|
-
n === -1 && _ || n === 1 && v || (m(n), t(
|
|
1168
|
+
function Oe({ value: e, onChange: t, locale: n = "it-IT", minMonth: i, maxMonth: a, disabled: o = !1, ariaLabel: f = "Seleziona il mese" }) {
|
|
1169
|
+
let [p, m] = l(0), h = c(null), g = s(() => Ee(e, n), [e, n]), _ = o || De(-1, e, i, a), v = o || De(1, e, i, a), y = r((n) => {
|
|
1170
|
+
n === -1 && _ || n === 1 && v || (m(n), t(Te(e, n)));
|
|
793
1171
|
}, [
|
|
794
1172
|
v,
|
|
795
1173
|
_,
|
|
@@ -811,7 +1189,7 @@ function ve({ value: e, onChange: t, locale: n = "it-IT", minMonth: i, maxMonth:
|
|
|
811
1189
|
"aria-label": "Mese precedente",
|
|
812
1190
|
disabled: _,
|
|
813
1191
|
onClick: () => y(-1),
|
|
814
|
-
children: /* @__PURE__ */ u(
|
|
1192
|
+
children: /* @__PURE__ */ u(I, {
|
|
815
1193
|
size: 18,
|
|
816
1194
|
"aria-hidden": "true"
|
|
817
1195
|
})
|
|
@@ -830,7 +1208,7 @@ function ve({ value: e, onChange: t, locale: n = "it-IT", minMonth: i, maxMonth:
|
|
|
830
1208
|
"aria-label": "Mese successivo",
|
|
831
1209
|
disabled: v,
|
|
832
1210
|
onClick: () => y(1),
|
|
833
|
-
children: /* @__PURE__ */ u(
|
|
1211
|
+
children: /* @__PURE__ */ u(L, {
|
|
834
1212
|
size: 18,
|
|
835
1213
|
"aria-hidden": "true"
|
|
836
1214
|
})
|
|
@@ -844,13 +1222,13 @@ function ve({ value: e, onChange: t, locale: n = "it-IT", minMonth: i, maxMonth:
|
|
|
844
1222
|
]
|
|
845
1223
|
});
|
|
846
1224
|
}
|
|
847
|
-
var
|
|
1225
|
+
var ke = { badge: "_badge_3xnd3_1" };
|
|
848
1226
|
//#endregion
|
|
849
1227
|
//#region src/components/Badge/Badge.tsx
|
|
850
|
-
function
|
|
1228
|
+
function Ae(...e) {
|
|
851
1229
|
return e.filter(Boolean).join(" ");
|
|
852
1230
|
}
|
|
853
|
-
var
|
|
1231
|
+
var je = n(function({ text: e, color: t, className: n, style: r, ...i }, a) {
|
|
854
1232
|
let o = t ? {
|
|
855
1233
|
...r,
|
|
856
1234
|
"--badge-color": t,
|
|
@@ -858,13 +1236,13 @@ var xe = n(function({ text: e, color: t, className: n, style: r, ...i }, a) {
|
|
|
858
1236
|
} : r;
|
|
859
1237
|
return /* @__PURE__ */ u("span", {
|
|
860
1238
|
ref: a,
|
|
861
|
-
className:
|
|
1239
|
+
className: Ae(ke.badge, n),
|
|
862
1240
|
style: o,
|
|
863
1241
|
...i,
|
|
864
1242
|
children: e
|
|
865
1243
|
});
|
|
866
1244
|
});
|
|
867
|
-
|
|
1245
|
+
je.displayName = "Badge";
|
|
868
1246
|
var Z = {
|
|
869
1247
|
switch: "_switch_1u3md_1",
|
|
870
1248
|
input: "_input_1u3md_14",
|
|
@@ -877,10 +1255,10 @@ var Z = {
|
|
|
877
1255
|
};
|
|
878
1256
|
//#endregion
|
|
879
1257
|
//#region src/components/Switch/Switch.tsx
|
|
880
|
-
function
|
|
1258
|
+
function Me(...e) {
|
|
881
1259
|
return e.filter(Boolean).join(" ");
|
|
882
1260
|
}
|
|
883
|
-
var
|
|
1261
|
+
var Ne = 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
1262
|
function p(e) {
|
|
885
1263
|
a?.(e), o?.(e.target.checked);
|
|
886
1264
|
}
|
|
@@ -889,7 +1267,7 @@ var Ce = n(function({ label: e, className: t, color: n, size: r = "md", disabled
|
|
|
889
1267
|
"--switch-color": n
|
|
890
1268
|
} : c;
|
|
891
1269
|
return /* @__PURE__ */ d("label", {
|
|
892
|
-
className:
|
|
1270
|
+
className: Me(Z.switch, Z[`size${r[0].toUpperCase()}${r.slice(1)}`], i && Z.disabled, t),
|
|
893
1271
|
style: m,
|
|
894
1272
|
children: [
|
|
895
1273
|
/* @__PURE__ */ u("input", {
|
|
@@ -913,7 +1291,7 @@ var Ce = n(function({ label: e, className: t, color: n, size: r = "md", disabled
|
|
|
913
1291
|
]
|
|
914
1292
|
});
|
|
915
1293
|
});
|
|
916
|
-
|
|
1294
|
+
Ne.displayName = "Switch";
|
|
917
1295
|
var Q = {
|
|
918
1296
|
wrapper: "_wrapper_1ly5u_1",
|
|
919
1297
|
table: "_table_1ly5u_11",
|
|
@@ -938,17 +1316,17 @@ var Q = {
|
|
|
938
1316
|
function $(...e) {
|
|
939
1317
|
return e.filter(Boolean).join(" ");
|
|
940
1318
|
}
|
|
941
|
-
function
|
|
1319
|
+
function Pe(e, t) {
|
|
942
1320
|
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
1321
|
numeric: !0,
|
|
944
1322
|
sensitivity: "base"
|
|
945
1323
|
});
|
|
946
1324
|
}
|
|
947
|
-
function
|
|
1325
|
+
function Fe({ 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
1326
|
let [g, _] = l(null), v = s(() => {
|
|
949
1327
|
if (!g?.column.sortValue) return t;
|
|
950
1328
|
let { column: e, direction: n } = g, r = n === "ascending" ? 1 : -1;
|
|
951
|
-
return [...t].sort((t, n) =>
|
|
1329
|
+
return [...t].sort((t, n) => Pe(e.sortValue?.(t), e.sortValue?.(n)) * r);
|
|
952
1330
|
}, [t, g]);
|
|
953
1331
|
function y(e) {
|
|
954
1332
|
!o || !e.sortable || !e.sortValue || _((t) => t?.column.id === e.id ? t.direction === "ascending" ? {
|
|
@@ -963,13 +1341,13 @@ function Te({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "N
|
|
|
963
1341
|
return g?.column.id === e.id ? g.direction : "none";
|
|
964
1342
|
}
|
|
965
1343
|
function x(e) {
|
|
966
|
-
return g?.column.id === e.id ? g.direction === "ascending" ? /* @__PURE__ */ u(
|
|
1344
|
+
return g?.column.id === e.id ? g.direction === "ascending" ? /* @__PURE__ */ u(R, {
|
|
967
1345
|
size: 15,
|
|
968
1346
|
"aria-hidden": "true"
|
|
969
|
-
}) : /* @__PURE__ */ u(
|
|
1347
|
+
}) : /* @__PURE__ */ u(F, {
|
|
970
1348
|
size: 15,
|
|
971
1349
|
"aria-hidden": "true"
|
|
972
|
-
}) : /* @__PURE__ */ u(
|
|
1350
|
+
}) : /* @__PURE__ */ u(ee, {
|
|
973
1351
|
size: 15,
|
|
974
1352
|
"aria-hidden": "true"
|
|
975
1353
|
});
|
|
@@ -992,7 +1370,7 @@ function Te({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "N
|
|
|
992
1370
|
return /* @__PURE__ */ u("th", {
|
|
993
1371
|
scope: "col",
|
|
994
1372
|
"aria-sort": t ? b(e) : void 0,
|
|
995
|
-
className: $(Q.headerCell, Q[`align${
|
|
1373
|
+
className: $(Q.headerCell, Q[`align${Ie(e.align ?? "left")}`], e.hideOnMobile && Q.hideOnMobile),
|
|
996
1374
|
children: t ? /* @__PURE__ */ d("button", {
|
|
997
1375
|
type: "button",
|
|
998
1376
|
className: Q.sortButton,
|
|
@@ -1031,7 +1409,7 @@ function Te({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "N
|
|
|
1031
1409
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
|
|
1032
1410
|
} : void 0,
|
|
1033
1411
|
children: e.map((e) => /* @__PURE__ */ u("td", {
|
|
1034
|
-
className: $(Q.cell, Q[`align${
|
|
1412
|
+
className: $(Q.cell, Q[`align${Ie(e.align ?? "left")}`], e.numeric && Q.numeric, e.hideOnMobile && Q.hideOnMobile),
|
|
1035
1413
|
children: e.cell(t, r)
|
|
1036
1414
|
}, e.id))
|
|
1037
1415
|
}, i);
|
|
@@ -1042,8 +1420,8 @@ function Te({ columns: e, data: t, getRowId: n, caption: r, emptyMessage: i = "N
|
|
|
1042
1420
|
})
|
|
1043
1421
|
});
|
|
1044
1422
|
}
|
|
1045
|
-
function
|
|
1423
|
+
function Ie(e) {
|
|
1046
1424
|
return `${e.charAt(0).toUpperCase()}${e.slice(1)}`;
|
|
1047
1425
|
}
|
|
1048
1426
|
//#endregion
|
|
1049
|
-
export {
|
|
1427
|
+
export { je as Badge, g as Button, oe as CalculatorKeypad, x as Card, Fe as DataTable, he as DatePicker, Se as Dropdown, ye as IconButton, Oe as MonthCarousel, we as MultiSelect, Ne as Switch, xe as TextField };
|