@starasia/date 4.0.0 → 5.0.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/Date/FieldWrapper.d.ts +14 -0
- package/dist/date.es.js +794 -637
- package/dist/date.umd.js +79 -3
- package/dist/interfaces.d.ts +9 -0
- package/package.json +1 -1
package/dist/date.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as N, jsx as r, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useRef as A, useEffect as $, forwardRef as G } from "react";
|
|
3
|
+
const P = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
|
|
4
4
|
|
|
5
5
|
* {
|
|
6
6
|
margin: 0;
|
|
@@ -29,11 +29,87 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
29
29
|
}
|
|
30
30
|
.sa-calendar-wrapper {
|
|
31
31
|
position: relative;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* === DATE FIELD WRAPPER === */
|
|
36
|
+
.sa-date-field {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 6px;
|
|
32
40
|
width: max-content;
|
|
41
|
+
font-family: "Poppins", sans-serif;
|
|
33
42
|
}
|
|
34
|
-
.sa-
|
|
43
|
+
.sa-date-field-fullwidth {
|
|
35
44
|
width: 100%;
|
|
36
45
|
}
|
|
46
|
+
.sa-date-field-left {
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
align-items: flex-start;
|
|
49
|
+
gap: 16px;
|
|
50
|
+
}
|
|
51
|
+
.sa-date-field-left-label {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 4px;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
width: 35%;
|
|
57
|
+
padding-top: 8px;
|
|
58
|
+
}
|
|
59
|
+
.sa-date-field-input-wrap {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 6px;
|
|
63
|
+
flex: 1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
}
|
|
66
|
+
.sa-date-field-label-row {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 6px;
|
|
70
|
+
flex-wrap: wrap;
|
|
71
|
+
}
|
|
72
|
+
.sa-date-field-label-text {
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
color: var(--sa-date-text-primary);
|
|
76
|
+
line-height: 1.3;
|
|
77
|
+
}
|
|
78
|
+
.sa-date-field-required {
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
color: var(--sa-date-border-error);
|
|
82
|
+
line-height: 1;
|
|
83
|
+
}
|
|
84
|
+
.sa-date-field-optional-badge {
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
padding: 0 6px;
|
|
89
|
+
border: 0.8px solid var(--sa-date-border-color);
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
background-color: transparent;
|
|
92
|
+
font-size: 10px;
|
|
93
|
+
font-weight: 500;
|
|
94
|
+
color: var(--sa-date-text-subtle);
|
|
95
|
+
line-height: 18px;
|
|
96
|
+
text-transform: lowercase;
|
|
97
|
+
}
|
|
98
|
+
.sa-date-field-helper-top,
|
|
99
|
+
.sa-date-field-helper {
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
font-weight: 400;
|
|
102
|
+
color: var(--sa-date-text-subtle);
|
|
103
|
+
line-height: 1.4;
|
|
104
|
+
margin: 0;
|
|
105
|
+
}
|
|
106
|
+
.sa-date-field-error-msg {
|
|
107
|
+
font-size: 12px;
|
|
108
|
+
font-weight: 400;
|
|
109
|
+
color: var(--sa-date-border-error);
|
|
110
|
+
line-height: 1.4;
|
|
111
|
+
margin: 0;
|
|
112
|
+
}
|
|
37
113
|
|
|
38
114
|
.sa-calendar {
|
|
39
115
|
border-radius: var(--sa-date-radius);
|
|
@@ -282,7 +358,7 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
282
358
|
outline: 2px solid var(--sa-date-brand);
|
|
283
359
|
outline-offset: 1px;
|
|
284
360
|
}
|
|
285
|
-
`,
|
|
361
|
+
`, ee = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], z = [
|
|
286
362
|
"January",
|
|
287
363
|
"February",
|
|
288
364
|
"March",
|
|
@@ -295,7 +371,7 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
295
371
|
"October",
|
|
296
372
|
"November",
|
|
297
373
|
"December"
|
|
298
|
-
],
|
|
374
|
+
], se = [
|
|
299
375
|
"Jan",
|
|
300
376
|
"Feb",
|
|
301
377
|
"Mar",
|
|
@@ -309,56 +385,56 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
309
385
|
"Nov",
|
|
310
386
|
"Dec"
|
|
311
387
|
];
|
|
312
|
-
function
|
|
313
|
-
const [
|
|
314
|
-
|
|
388
|
+
function ne(a) {
|
|
389
|
+
const [n, t] = j(a), s = A(null), l = (p) => {
|
|
390
|
+
s.current && !s.current.contains(p.target) && t(!1);
|
|
315
391
|
};
|
|
316
|
-
return
|
|
317
|
-
document.removeEventListener("click",
|
|
318
|
-
}), []), { ref:
|
|
392
|
+
return $(() => (document.addEventListener("click", l, !0), () => {
|
|
393
|
+
document.removeEventListener("click", l, !0);
|
|
394
|
+
}), []), { ref: s, isComponentVisible: n, setIsComponentVisible: t };
|
|
319
395
|
}
|
|
320
|
-
const
|
|
321
|
-
if (!document.getElementById(
|
|
322
|
-
const
|
|
323
|
-
|
|
396
|
+
const K = "sa-calendar-input-styles", oe = (a) => {
|
|
397
|
+
if (!document.getElementById(K)) {
|
|
398
|
+
const n = document.createElement("style");
|
|
399
|
+
n.id = K, n.textContent = a, document.head.appendChild(n);
|
|
324
400
|
}
|
|
325
401
|
};
|
|
326
|
-
|
|
327
|
-
const
|
|
402
|
+
oe(P);
|
|
403
|
+
const W = (a) => {
|
|
328
404
|
if (a === "sm")
|
|
329
405
|
return 16;
|
|
330
406
|
if (a === "md")
|
|
331
407
|
return 16;
|
|
332
408
|
if (a === "lg")
|
|
333
409
|
return 20;
|
|
334
|
-
},
|
|
410
|
+
}, le = (a) => {
|
|
335
411
|
const {
|
|
336
|
-
size:
|
|
337
|
-
status:
|
|
338
|
-
variant:
|
|
339
|
-
clearable:
|
|
340
|
-
onClear:
|
|
341
|
-
...
|
|
342
|
-
} = a,
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
|
|
412
|
+
size: n = "md",
|
|
413
|
+
status: t = "default",
|
|
414
|
+
variant: s = "outline",
|
|
415
|
+
clearable: l,
|
|
416
|
+
onClear: p,
|
|
417
|
+
...d
|
|
418
|
+
} = a, g = A(null), i = () => {
|
|
419
|
+
g.current && d.onClick && (g.current.focus(), d.onClick(""));
|
|
420
|
+
}, e = t === "disable" || d.disabled, w = !!d.value, y = l && w && !e, k = (M) => {
|
|
421
|
+
M.stopPropagation(), p == null || p();
|
|
346
422
|
};
|
|
347
|
-
return /* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ N(
|
|
348
424
|
"div",
|
|
349
425
|
{
|
|
350
|
-
className: `sa-calendar-input-container sa-calendar-input-${
|
|
351
|
-
onClick:
|
|
426
|
+
className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
|
|
427
|
+
onClick: i,
|
|
352
428
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
429
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
|
|
354
430
|
"svg",
|
|
355
431
|
{
|
|
356
432
|
xmlns: "http://www.w3.org/2000/svg",
|
|
357
|
-
width:
|
|
358
|
-
height:
|
|
433
|
+
width: W(n),
|
|
434
|
+
height: W(n),
|
|
359
435
|
viewBox: "0 0 20 20",
|
|
360
436
|
fill: "none",
|
|
361
|
-
children: /* @__PURE__ */
|
|
437
|
+
children: /* @__PURE__ */ r(
|
|
362
438
|
"path",
|
|
363
439
|
{
|
|
364
440
|
d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
|
|
@@ -370,32 +446,32 @@ const E = (a) => {
|
|
|
370
446
|
)
|
|
371
447
|
}
|
|
372
448
|
) }),
|
|
373
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
|
|
374
450
|
"input",
|
|
375
451
|
{
|
|
376
452
|
className: "sa-calendar-input",
|
|
377
|
-
...
|
|
378
|
-
disabled:
|
|
379
|
-
value:
|
|
380
|
-
ref:
|
|
453
|
+
...d,
|
|
454
|
+
disabled: e,
|
|
455
|
+
value: d.value,
|
|
456
|
+
ref: g
|
|
381
457
|
}
|
|
382
458
|
) }),
|
|
383
|
-
|
|
459
|
+
y ? /* @__PURE__ */ r(
|
|
384
460
|
"button",
|
|
385
461
|
{
|
|
386
462
|
type: "button",
|
|
387
463
|
"aria-label": "Clear date",
|
|
388
464
|
className: "sa-calendar-input-clear",
|
|
389
|
-
onClick:
|
|
390
|
-
children: /* @__PURE__ */
|
|
465
|
+
onClick: k,
|
|
466
|
+
children: /* @__PURE__ */ r(
|
|
391
467
|
"svg",
|
|
392
468
|
{
|
|
393
469
|
xmlns: "http://www.w3.org/2000/svg",
|
|
394
|
-
width:
|
|
395
|
-
height:
|
|
470
|
+
width: W(n),
|
|
471
|
+
height: W(n),
|
|
396
472
|
viewBox: "0 0 20 20",
|
|
397
473
|
fill: "none",
|
|
398
|
-
children: /* @__PURE__ */
|
|
474
|
+
children: /* @__PURE__ */ r(
|
|
399
475
|
"path",
|
|
400
476
|
{
|
|
401
477
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -408,15 +484,15 @@ const E = (a) => {
|
|
|
408
484
|
}
|
|
409
485
|
)
|
|
410
486
|
}
|
|
411
|
-
) : /* @__PURE__ */
|
|
487
|
+
) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
|
|
412
488
|
"svg",
|
|
413
489
|
{
|
|
414
490
|
xmlns: "http://www.w3.org/2000/svg",
|
|
415
|
-
width:
|
|
416
|
-
height:
|
|
491
|
+
width: W(n),
|
|
492
|
+
height: W(n),
|
|
417
493
|
viewBox: "0 0 20 20",
|
|
418
494
|
fill: "none",
|
|
419
|
-
children: /* @__PURE__ */
|
|
495
|
+
children: /* @__PURE__ */ r(
|
|
420
496
|
"path",
|
|
421
497
|
{
|
|
422
498
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -431,178 +507,178 @@ const E = (a) => {
|
|
|
431
507
|
]
|
|
432
508
|
}
|
|
433
509
|
);
|
|
434
|
-
},
|
|
510
|
+
}, ie = ({
|
|
435
511
|
date: a,
|
|
436
|
-
setDate:
|
|
437
|
-
dateRange:
|
|
438
|
-
setDateRange:
|
|
439
|
-
onChange:
|
|
440
|
-
minDate:
|
|
441
|
-
maxDate:
|
|
442
|
-
input:
|
|
512
|
+
setDate: n,
|
|
513
|
+
dateRange: t,
|
|
514
|
+
setDateRange: s,
|
|
515
|
+
onChange: l,
|
|
516
|
+
minDate: p,
|
|
517
|
+
maxDate: d,
|
|
518
|
+
input: g
|
|
443
519
|
}) => {
|
|
444
|
-
var
|
|
445
|
-
let
|
|
446
|
-
const
|
|
447
|
-
for (let
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
) :
|
|
451
|
-
let
|
|
452
|
-
currentMonth:
|
|
453
|
-
date: new Date(
|
|
454
|
-
month:
|
|
455
|
-
number:
|
|
456
|
-
selected:
|
|
457
|
-
year:
|
|
458
|
-
isDisabled:
|
|
520
|
+
var f, o, c;
|
|
521
|
+
let i = new Date(a.getFullYear(), a.getMonth(), 1), e = i.getDay(), w = [];
|
|
522
|
+
const y = a.getMonth();
|
|
523
|
+
for (let h = 0; h < 42; h++) {
|
|
524
|
+
h === 0 && e === 0 ? i.setDate(i.getDate() - 7) : h === 0 ? i.setDate(
|
|
525
|
+
i.getDate() + (h - e)
|
|
526
|
+
) : i.setDate(i.getDate() + 1);
|
|
527
|
+
let b = {
|
|
528
|
+
currentMonth: i.getMonth() === y,
|
|
529
|
+
date: new Date(i),
|
|
530
|
+
month: i.getMonth(),
|
|
531
|
+
number: i.getDate(),
|
|
532
|
+
selected: i.toDateString() === ((f = t.from) == null ? void 0 : f.toDateString()) || i.toDateString() === (((o = t.to) == null ? void 0 : o.toDateString()) || ((c = t.from) == null ? void 0 : c.toDateString())),
|
|
533
|
+
year: i.getFullYear(),
|
|
534
|
+
isDisabled: p && i < p || d && i > d
|
|
459
535
|
};
|
|
460
|
-
|
|
536
|
+
w.push(b);
|
|
461
537
|
}
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
},
|
|
465
|
-
var
|
|
466
|
-
let
|
|
467
|
-
if (
|
|
468
|
-
|
|
538
|
+
const k = (h) => {
|
|
539
|
+
n(h);
|
|
540
|
+
}, M = (h) => {
|
|
541
|
+
var u;
|
|
542
|
+
let b = { ...t };
|
|
543
|
+
if (b.from && b.to)
|
|
544
|
+
b = { from: h, to: null };
|
|
469
545
|
else {
|
|
470
|
-
const
|
|
471
|
-
|
|
546
|
+
const m = ((u = b.from) == null ? void 0 : u.getTime()) || 0;
|
|
547
|
+
h.getTime() > m ? b = { from: b.from, to: h } : b = { from: h, to: b.from };
|
|
472
548
|
}
|
|
473
|
-
|
|
549
|
+
s(b), l(b);
|
|
474
550
|
};
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
var
|
|
479
|
-
const
|
|
480
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ N("div", { className: "sa-calendar-days-preivew", children: [
|
|
552
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((h, b) => /* @__PURE__ */ r("p", { children: h }, b)) }),
|
|
553
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: w.map((h, b) => {
|
|
554
|
+
var x;
|
|
555
|
+
const u = h.date.getTime() > t.from.getTime() && h.date.getTime() < (((x = t.to) == null ? void 0 : x.getTime()) || t.from.getTime()), m = h.isDisabled;
|
|
556
|
+
return /* @__PURE__ */ r(
|
|
481
557
|
"p",
|
|
482
558
|
{
|
|
483
|
-
className: `${
|
|
559
|
+
className: `${h.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${h.selected ? "sa-calendar-days-active" : ""}`,
|
|
484
560
|
style: {
|
|
485
|
-
backgroundColor:
|
|
486
|
-
pointerEvents:
|
|
487
|
-
cursor:
|
|
488
|
-
color:
|
|
489
|
-
...
|
|
561
|
+
backgroundColor: u ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
562
|
+
pointerEvents: m ? "none" : void 0,
|
|
563
|
+
cursor: m ? "not-allowed" : "pointer",
|
|
564
|
+
color: m ? "var(--sa-color-gray-400, #b7b9be)" : u ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
565
|
+
...g ? {} : { width: "100%" }
|
|
490
566
|
},
|
|
491
567
|
onClick: () => {
|
|
492
|
-
|
|
568
|
+
m || (k(h.date), M(h.date));
|
|
493
569
|
},
|
|
494
|
-
children:
|
|
570
|
+
children: h.number
|
|
495
571
|
},
|
|
496
|
-
|
|
572
|
+
b
|
|
497
573
|
);
|
|
498
574
|
}) })
|
|
499
575
|
] });
|
|
500
|
-
},
|
|
576
|
+
}, de = ({
|
|
501
577
|
date: a,
|
|
502
|
-
setDate:
|
|
503
|
-
filter:
|
|
504
|
-
setViews:
|
|
505
|
-
dateRange:
|
|
506
|
-
setDateRange:
|
|
507
|
-
onChange:
|
|
508
|
-
minDate:
|
|
509
|
-
maxDate:
|
|
510
|
-
input:
|
|
578
|
+
setDate: n,
|
|
579
|
+
filter: t,
|
|
580
|
+
setViews: s,
|
|
581
|
+
dateRange: l,
|
|
582
|
+
setDateRange: p,
|
|
583
|
+
onChange: d,
|
|
584
|
+
minDate: g,
|
|
585
|
+
maxDate: i,
|
|
586
|
+
input: e
|
|
511
587
|
}) => {
|
|
512
|
-
const
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
var
|
|
516
|
-
let
|
|
517
|
-
if (
|
|
518
|
-
|
|
588
|
+
const w = l.from.getFullYear(), y = a.getFullYear(), k = (f) => {
|
|
589
|
+
t ? (M(f), n(f)) : (s("days"), n(f));
|
|
590
|
+
}, M = (f) => {
|
|
591
|
+
var c;
|
|
592
|
+
let o = { ...l };
|
|
593
|
+
if (o.from && o.to)
|
|
594
|
+
o = { from: f, to: null };
|
|
519
595
|
else {
|
|
520
|
-
const
|
|
521
|
-
|
|
596
|
+
const h = ((c = o.from) == null ? void 0 : c.getTime()) || 0;
|
|
597
|
+
f.getTime() > h ? o = { from: o.from, to: f } : o = { from: f, to: o.from };
|
|
522
598
|
}
|
|
523
|
-
|
|
599
|
+
p(o), d(o);
|
|
524
600
|
};
|
|
525
|
-
return /* @__PURE__ */
|
|
526
|
-
var
|
|
527
|
-
const
|
|
528
|
-
return /* @__PURE__ */
|
|
601
|
+
return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: z.map((f, o) => {
|
|
602
|
+
var b, u, m;
|
|
603
|
+
const c = new Date(y, o).getTime() > l.from.getTime() && new Date(y, o).getTime() < (((b = l.to) == null ? void 0 : b.getTime()) || l.from.getTime()), h = g && new Date(y, o) < g || i && new Date(y, o) > i;
|
|
604
|
+
return /* @__PURE__ */ r(
|
|
529
605
|
"p",
|
|
530
606
|
{
|
|
531
|
-
className:
|
|
607
|
+
className: w === y && (o === ((u = l.from) == null ? void 0 : u.getMonth()) || o === ((m = l.to) == null ? void 0 : m.getMonth())) ? "sa-calendar-months-active" : "",
|
|
532
608
|
style: {
|
|
533
|
-
backgroundColor:
|
|
534
|
-
pointerEvents:
|
|
535
|
-
cursor:
|
|
536
|
-
color:
|
|
537
|
-
...
|
|
609
|
+
backgroundColor: c ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
610
|
+
pointerEvents: h ? "none" : void 0,
|
|
611
|
+
cursor: h ? "not-allowed" : "pointer",
|
|
612
|
+
color: h ? "var(--sa-color-gray-400, #b7b9be)" : c ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
613
|
+
...e ? {} : { width: "100%" }
|
|
538
614
|
},
|
|
539
615
|
onClick: () => {
|
|
540
|
-
|
|
616
|
+
h || k(new Date(y, o));
|
|
541
617
|
},
|
|
542
|
-
children:
|
|
618
|
+
children: f.slice(0, 3)
|
|
543
619
|
},
|
|
544
|
-
|
|
620
|
+
o
|
|
545
621
|
);
|
|
546
622
|
}) });
|
|
547
|
-
},
|
|
548
|
-
const
|
|
549
|
-
return { start:
|
|
550
|
-
},
|
|
623
|
+
}, U = (a) => {
|
|
624
|
+
const n = Math.floor(a / 10) * 10, t = n + 10;
|
|
625
|
+
return { start: n, end: t };
|
|
626
|
+
}, ce = ({
|
|
551
627
|
date: a,
|
|
552
|
-
filter:
|
|
553
|
-
setViews:
|
|
554
|
-
setDate:
|
|
555
|
-
dateRange:
|
|
556
|
-
setDateRange:
|
|
557
|
-
onChange:
|
|
558
|
-
minDate:
|
|
559
|
-
maxDate:
|
|
560
|
-
input:
|
|
628
|
+
filter: n,
|
|
629
|
+
setViews: t,
|
|
630
|
+
setDate: s,
|
|
631
|
+
dateRange: l,
|
|
632
|
+
setDateRange: p,
|
|
633
|
+
onChange: d,
|
|
634
|
+
minDate: g,
|
|
635
|
+
maxDate: i,
|
|
636
|
+
input: e
|
|
561
637
|
}) => {
|
|
562
|
-
var
|
|
563
|
-
let
|
|
564
|
-
const
|
|
565
|
-
for (let
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
year:
|
|
569
|
-
active:
|
|
570
|
-
highlight:
|
|
571
|
-
disabled: !
|
|
638
|
+
var b;
|
|
639
|
+
let w = [];
|
|
640
|
+
const y = a.getFullYear(), { start: k, end: M } = U(y), f = l.from.getFullYear(), o = (b = l.to) == null ? void 0 : b.getFullYear();
|
|
641
|
+
for (let u = k; u < M; u++) {
|
|
642
|
+
const m = new Date(u, 0), x = (!g || m >= g) && (!i || m <= i), F = u === f || u === o, L = m > l.from && m < l.to;
|
|
643
|
+
w.push({
|
|
644
|
+
year: u,
|
|
645
|
+
active: F && x,
|
|
646
|
+
highlight: L && x,
|
|
647
|
+
disabled: !x
|
|
572
648
|
});
|
|
573
649
|
}
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
},
|
|
577
|
-
var
|
|
578
|
-
let
|
|
579
|
-
if (
|
|
580
|
-
|
|
650
|
+
const c = (u) => {
|
|
651
|
+
n ? (h(u), s(u)) : (s(u), t("months"));
|
|
652
|
+
}, h = (u) => {
|
|
653
|
+
var x;
|
|
654
|
+
let m = { ...l };
|
|
655
|
+
if (m.from && m.to)
|
|
656
|
+
m = { from: u, to: null };
|
|
581
657
|
else {
|
|
582
|
-
const
|
|
583
|
-
|
|
658
|
+
const F = ((x = m.from) == null ? void 0 : x.getTime()) || 0;
|
|
659
|
+
u.getTime() > F ? m = { from: m.from, to: u } : m = { from: u, to: m.from };
|
|
584
660
|
}
|
|
585
|
-
|
|
661
|
+
p(m), d(m);
|
|
586
662
|
};
|
|
587
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((u, m) => /* @__PURE__ */ r(
|
|
588
664
|
"p",
|
|
589
665
|
{
|
|
590
|
-
className: `${
|
|
666
|
+
className: `${u.active ? "sa-calendar-months-active" : ""} ${u.highlight ? "sa-calendar-months-highlight" : ""} ${u.disabled ? "sa-calendar-disabled" : ""}`,
|
|
591
667
|
onClick: () => {
|
|
592
|
-
|
|
668
|
+
u.disabled || c(new Date(u.year, 0));
|
|
593
669
|
},
|
|
594
670
|
style: {
|
|
595
|
-
backgroundColor:
|
|
596
|
-
color:
|
|
597
|
-
cursor:
|
|
598
|
-
pointerEvents:
|
|
599
|
-
...
|
|
671
|
+
backgroundColor: u.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
672
|
+
color: u.highlight ? "var(--sa-color-gray-500, #8c8f97)" : u.active ? "" : u.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
|
|
673
|
+
cursor: u.disabled ? "not-allowed" : "pointer",
|
|
674
|
+
pointerEvents: u.disbled ? "none" : "all",
|
|
675
|
+
...e ? {} : { width: "100%" }
|
|
600
676
|
},
|
|
601
|
-
children:
|
|
677
|
+
children: u.year
|
|
602
678
|
},
|
|
603
|
-
|
|
679
|
+
m
|
|
604
680
|
)) });
|
|
605
|
-
},
|
|
681
|
+
}, ae = ({ ...a }) => /* @__PURE__ */ r(
|
|
606
682
|
"svg",
|
|
607
683
|
{
|
|
608
684
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -611,7 +687,7 @@ const E = (a) => {
|
|
|
611
687
|
viewBox: "0 0 20 20",
|
|
612
688
|
fill: "none",
|
|
613
689
|
...a,
|
|
614
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ r(
|
|
615
691
|
"path",
|
|
616
692
|
{
|
|
617
693
|
d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
|
|
@@ -622,7 +698,7 @@ const E = (a) => {
|
|
|
622
698
|
}
|
|
623
699
|
)
|
|
624
700
|
}
|
|
625
|
-
),
|
|
701
|
+
), re = ({ ...a }) => /* @__PURE__ */ r(
|
|
626
702
|
"svg",
|
|
627
703
|
{
|
|
628
704
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -631,7 +707,7 @@ const E = (a) => {
|
|
|
631
707
|
viewBox: "0 0 20 20",
|
|
632
708
|
fill: "none",
|
|
633
709
|
...a,
|
|
634
|
-
children: /* @__PURE__ */
|
|
710
|
+
children: /* @__PURE__ */ r(
|
|
635
711
|
"path",
|
|
636
712
|
{
|
|
637
713
|
d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
|
|
@@ -642,205 +718,254 @@ const E = (a) => {
|
|
|
642
718
|
}
|
|
643
719
|
)
|
|
644
720
|
}
|
|
645
|
-
),
|
|
721
|
+
), he = ({
|
|
646
722
|
setViews: a,
|
|
647
|
-
views:
|
|
648
|
-
filter:
|
|
649
|
-
date:
|
|
650
|
-
setDate:
|
|
723
|
+
views: n,
|
|
724
|
+
filter: t,
|
|
725
|
+
date: s,
|
|
726
|
+
setDate: l
|
|
651
727
|
}) => {
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
},
|
|
655
|
-
if (
|
|
656
|
-
|
|
728
|
+
const p = () => {
|
|
729
|
+
t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
|
|
730
|
+
}, d = () => {
|
|
731
|
+
if (n === "years") {
|
|
732
|
+
l((e) => new Date(e.getFullYear() + 10, 0));
|
|
657
733
|
return;
|
|
658
734
|
}
|
|
659
|
-
if (
|
|
660
|
-
|
|
735
|
+
if (n === "months") {
|
|
736
|
+
l((e) => new Date(e.getFullYear() + 1, e.getMonth()));
|
|
661
737
|
return;
|
|
662
738
|
}
|
|
663
|
-
|
|
664
|
-
},
|
|
665
|
-
if (
|
|
666
|
-
|
|
739
|
+
l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
|
|
740
|
+
}, g = () => {
|
|
741
|
+
if (n === "years") {
|
|
742
|
+
l((e) => new Date(e.getFullYear() - 10, 0));
|
|
667
743
|
return;
|
|
668
744
|
}
|
|
669
|
-
if (
|
|
670
|
-
|
|
745
|
+
if (n === "months") {
|
|
746
|
+
l((e) => new Date(e.getFullYear() - 1, e.getMonth()));
|
|
671
747
|
return;
|
|
672
748
|
}
|
|
673
|
-
|
|
674
|
-
(
|
|
675
|
-
|
|
676
|
-
|
|
749
|
+
l(
|
|
750
|
+
(e) => new Date(
|
|
751
|
+
e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
|
|
752
|
+
e.getMonth() === 0 ? 11 : e.getMonth() - 1
|
|
677
753
|
)
|
|
678
754
|
);
|
|
679
755
|
};
|
|
680
|
-
return /* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
683
|
-
if (
|
|
684
|
-
return `${
|
|
685
|
-
if (
|
|
686
|
-
return `${
|
|
687
|
-
if (
|
|
688
|
-
return `${
|
|
756
|
+
return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
|
|
757
|
+
/* @__PURE__ */ r(ae, { onClick: () => g() }),
|
|
758
|
+
/* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: p, children: (() => {
|
|
759
|
+
if (n === "days")
|
|
760
|
+
return `${z[s.getMonth()]} ${s.getFullYear()}`;
|
|
761
|
+
if (n === "months")
|
|
762
|
+
return `${s.getFullYear()}`;
|
|
763
|
+
if (n === "years")
|
|
764
|
+
return `${U(s.getFullYear()).start} ~ ${U(s.getFullYear()).end}`;
|
|
689
765
|
})() }),
|
|
690
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ r(re, { onClick: () => d() })
|
|
691
767
|
] });
|
|
692
768
|
};
|
|
693
|
-
function
|
|
694
|
-
const
|
|
695
|
-
return `${
|
|
769
|
+
function H(a) {
|
|
770
|
+
const n = new Date(a), t = n.getFullYear(), s = n.getMonth();
|
|
771
|
+
return `${n.getDate().toString().padStart(2, "0")} ${se[s]} ${t}`;
|
|
696
772
|
}
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
773
|
+
const te = ({
|
|
774
|
+
label: a,
|
|
775
|
+
labelPosition: n = "outside-top",
|
|
776
|
+
required: t,
|
|
777
|
+
optional: s,
|
|
778
|
+
description: l,
|
|
779
|
+
helperText: p,
|
|
780
|
+
errorText: d,
|
|
781
|
+
fullWidth: g,
|
|
782
|
+
children: i
|
|
783
|
+
}) => {
|
|
784
|
+
const e = [
|
|
785
|
+
"sa-date-field",
|
|
786
|
+
g ? "sa-date-field-fullwidth" : ""
|
|
787
|
+
].filter(Boolean).join(" "), w = a ? /* @__PURE__ */ N("div", { className: "sa-date-field-label-row", children: [
|
|
788
|
+
/* @__PURE__ */ r("span", { className: "sa-date-field-label-text", children: a }),
|
|
789
|
+
s && /* @__PURE__ */ r("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
|
|
790
|
+
t && /* @__PURE__ */ r("span", { className: "sa-date-field-required", children: "*" })
|
|
791
|
+
] }) : null, y = /* @__PURE__ */ N(_, { children: [
|
|
792
|
+
p && !d && /* @__PURE__ */ r("p", { className: "sa-date-field-helper", children: p }),
|
|
793
|
+
d && /* @__PURE__ */ r("p", { className: "sa-date-field-error-msg", children: d })
|
|
794
|
+
] });
|
|
795
|
+
return a ? n === "outside-left" ? /* @__PURE__ */ N("div", { className: `${e} sa-date-field-left`, children: [
|
|
796
|
+
/* @__PURE__ */ N("div", { className: "sa-date-field-left-label", children: [
|
|
797
|
+
w,
|
|
798
|
+
l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l })
|
|
799
|
+
] }),
|
|
800
|
+
/* @__PURE__ */ N("div", { className: "sa-date-field-input-wrap", children: [
|
|
801
|
+
i,
|
|
802
|
+
y
|
|
803
|
+
] })
|
|
804
|
+
] }) : /* @__PURE__ */ N("div", { className: e, children: [
|
|
805
|
+
w,
|
|
806
|
+
l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
|
|
807
|
+
i,
|
|
808
|
+
y
|
|
809
|
+
] }) : /* @__PURE__ */ N("div", { className: e, children: [
|
|
810
|
+
l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
|
|
811
|
+
i,
|
|
812
|
+
y
|
|
813
|
+
] });
|
|
814
|
+
}, Q = "sa-calendar-styles", ue = (a) => {
|
|
815
|
+
if (!document.getElementById(Q)) {
|
|
816
|
+
const n = document.createElement("style");
|
|
817
|
+
n.id = Q, n.textContent = a, document.head.appendChild(n);
|
|
701
818
|
}
|
|
702
819
|
};
|
|
703
|
-
|
|
704
|
-
const
|
|
820
|
+
ue(P);
|
|
821
|
+
const pe = G(
|
|
705
822
|
({
|
|
706
823
|
value: a,
|
|
707
|
-
onChange:
|
|
708
|
-
filter:
|
|
709
|
-
input:
|
|
710
|
-
disabled:
|
|
711
|
-
minDate:
|
|
712
|
-
maxDate:
|
|
713
|
-
placeholder:
|
|
714
|
-
size:
|
|
715
|
-
status:
|
|
716
|
-
clearable:
|
|
717
|
-
fullWidth:
|
|
718
|
-
|
|
719
|
-
|
|
824
|
+
onChange: n,
|
|
825
|
+
filter: t,
|
|
826
|
+
input: s = !0,
|
|
827
|
+
disabled: l,
|
|
828
|
+
minDate: p,
|
|
829
|
+
maxDate: d,
|
|
830
|
+
placeholder: g,
|
|
831
|
+
size: i,
|
|
832
|
+
status: e,
|
|
833
|
+
clearable: w,
|
|
834
|
+
fullWidth: y = !0,
|
|
835
|
+
label: k,
|
|
836
|
+
labelPosition: M,
|
|
837
|
+
required: f,
|
|
838
|
+
optional: o,
|
|
839
|
+
description: c,
|
|
840
|
+
helperText: h,
|
|
841
|
+
errorText: b
|
|
842
|
+
}, u) => {
|
|
843
|
+
const m = b ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = j("days"), [Y, E] = j(/* @__PURE__ */ new Date()), [D, I] = j({
|
|
720
844
|
from: (a == null ? void 0 : a.from) || /* @__PURE__ */ new Date(),
|
|
721
845
|
to: (a == null ? void 0 : a.to) || /* @__PURE__ */ new Date()
|
|
722
846
|
});
|
|
723
|
-
|
|
724
|
-
a ? (
|
|
847
|
+
$(() => {
|
|
848
|
+
a ? (E(a.from), I(a)) : (E(/* @__PURE__ */ new Date()), I({
|
|
725
849
|
from: /* @__PURE__ */ new Date(),
|
|
726
850
|
to: /* @__PURE__ */ new Date()
|
|
727
851
|
}));
|
|
728
|
-
}, [a]),
|
|
729
|
-
|
|
730
|
-
}, [
|
|
731
|
-
|
|
732
|
-
}, [
|
|
733
|
-
|
|
734
|
-
}, [
|
|
735
|
-
const
|
|
736
|
-
var v,
|
|
852
|
+
}, [a]), $(() => {
|
|
853
|
+
t && S(t);
|
|
854
|
+
}, [t]), $(() => {
|
|
855
|
+
t || S("days");
|
|
856
|
+
}, [F]), $(() => {
|
|
857
|
+
s || L(!0);
|
|
858
|
+
}, [s]);
|
|
859
|
+
const J = () => {
|
|
860
|
+
var v, T;
|
|
737
861
|
if (!a)
|
|
738
862
|
return "";
|
|
739
|
-
if (
|
|
740
|
-
if (
|
|
741
|
-
return `${
|
|
742
|
-
if (
|
|
743
|
-
return `${
|
|
744
|
-
if (
|
|
745
|
-
return `${(v =
|
|
863
|
+
if (t) {
|
|
864
|
+
if (V === "days")
|
|
865
|
+
return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
|
|
866
|
+
if (V === "months")
|
|
867
|
+
return `${z[D.from.getMonth()]} ~ ${D.to ? z[D.to.getMonth()] : "-"}`;
|
|
868
|
+
if (V === "years")
|
|
869
|
+
return `${(v = D.from) == null ? void 0 : v.getFullYear()} ~ ${((T = D.to) == null ? void 0 : T.getFullYear()) || "-"}`;
|
|
746
870
|
} else
|
|
747
|
-
return `${
|
|
748
|
-
},
|
|
749
|
-
if (
|
|
750
|
-
const v =
|
|
751
|
-
window.innerWidth < v.left +
|
|
871
|
+
return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
|
|
872
|
+
}, B = () => {
|
|
873
|
+
if (C.current && x.current && s) {
|
|
874
|
+
const v = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
|
|
875
|
+
window.innerWidth < v.left + T.width ? C.current.style.left = `${v.left - T.width + v.width}px` : C.current.style.left = `${v.left}px`, v.top + T.height > window.innerHeight ? C.current.style.top = `${v.y - (v.height + T.height - 28)}px` : C.current.style.top = `${v.y + v.height}px`;
|
|
752
876
|
}
|
|
753
877
|
};
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}, [
|
|
757
|
-
const v =
|
|
758
|
-
return v && v.addEventListener("scroll",
|
|
759
|
-
v && v.removeEventListener("scroll",
|
|
878
|
+
$(() => {
|
|
879
|
+
C.current && x.current && s && B();
|
|
880
|
+
}, [C, x, F]), $(() => {
|
|
881
|
+
const v = u == null ? void 0 : u.current;
|
|
882
|
+
return v && v.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
|
|
883
|
+
v && v.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
|
|
760
884
|
};
|
|
761
|
-
}, [])
|
|
885
|
+
}, []);
|
|
886
|
+
const R = /* @__PURE__ */ N(
|
|
762
887
|
"div",
|
|
763
888
|
{
|
|
764
|
-
className:
|
|
765
|
-
style: { height:
|
|
766
|
-
ref:
|
|
889
|
+
className: "sa-calendar-wrapper",
|
|
890
|
+
style: { height: s ? "auto" : "100%" },
|
|
891
|
+
ref: s ? x : null,
|
|
767
892
|
children: [
|
|
768
|
-
|
|
769
|
-
|
|
893
|
+
s ? /* @__PURE__ */ r(
|
|
894
|
+
le,
|
|
770
895
|
{
|
|
771
|
-
value:
|
|
896
|
+
value: J(),
|
|
772
897
|
inputMode: "none",
|
|
773
898
|
onClick: () => {
|
|
774
|
-
|
|
899
|
+
L(!0);
|
|
775
900
|
},
|
|
776
901
|
onChange: () => {
|
|
777
902
|
},
|
|
778
|
-
disabled:
|
|
779
|
-
placeholder:
|
|
780
|
-
size:
|
|
781
|
-
status:
|
|
782
|
-
clearable:
|
|
783
|
-
onClear: () =>
|
|
903
|
+
disabled: l,
|
|
904
|
+
placeholder: g,
|
|
905
|
+
size: i,
|
|
906
|
+
status: m,
|
|
907
|
+
clearable: w,
|
|
908
|
+
onClear: () => n(void 0)
|
|
784
909
|
}
|
|
785
910
|
) : null,
|
|
786
|
-
|
|
911
|
+
F ? /* @__PURE__ */ N(
|
|
787
912
|
"div",
|
|
788
913
|
{
|
|
789
|
-
className: `sa-calendar ${
|
|
790
|
-
ref:
|
|
914
|
+
className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
|
|
915
|
+
ref: C,
|
|
791
916
|
children: [
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
|
|
917
|
+
/* @__PURE__ */ r(
|
|
918
|
+
he,
|
|
794
919
|
{
|
|
795
|
-
setViews:
|
|
796
|
-
views:
|
|
797
|
-
filter:
|
|
798
|
-
date:
|
|
799
|
-
setDate:
|
|
920
|
+
setViews: S,
|
|
921
|
+
views: V,
|
|
922
|
+
filter: t,
|
|
923
|
+
date: Y,
|
|
924
|
+
setDate: E
|
|
800
925
|
}
|
|
801
926
|
),
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
|
|
927
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
|
|
928
|
+
ie,
|
|
804
929
|
{
|
|
805
|
-
date:
|
|
806
|
-
setDate:
|
|
807
|
-
setIsComponentVisible:
|
|
808
|
-
dateRange:
|
|
809
|
-
setDateRange:
|
|
810
|
-
input:
|
|
811
|
-
onChange:
|
|
812
|
-
minDate:
|
|
813
|
-
maxDate:
|
|
930
|
+
date: Y,
|
|
931
|
+
setDate: E,
|
|
932
|
+
setIsComponentVisible: L,
|
|
933
|
+
dateRange: D,
|
|
934
|
+
setDateRange: I,
|
|
935
|
+
input: s,
|
|
936
|
+
onChange: n,
|
|
937
|
+
minDate: p,
|
|
938
|
+
maxDate: d
|
|
814
939
|
}
|
|
815
|
-
) :
|
|
816
|
-
|
|
940
|
+
) : V === "months" ? /* @__PURE__ */ r(
|
|
941
|
+
de,
|
|
817
942
|
{
|
|
818
|
-
date:
|
|
819
|
-
setDate:
|
|
820
|
-
filter:
|
|
821
|
-
setViews:
|
|
822
|
-
dateRange:
|
|
823
|
-
setDateRange:
|
|
824
|
-
setIsComponentVisible:
|
|
825
|
-
input:
|
|
826
|
-
onChange:
|
|
827
|
-
minDate:
|
|
828
|
-
maxDate:
|
|
943
|
+
date: Y,
|
|
944
|
+
setDate: E,
|
|
945
|
+
filter: t,
|
|
946
|
+
setViews: S,
|
|
947
|
+
dateRange: D,
|
|
948
|
+
setDateRange: I,
|
|
949
|
+
setIsComponentVisible: L,
|
|
950
|
+
input: s,
|
|
951
|
+
onChange: n,
|
|
952
|
+
minDate: p,
|
|
953
|
+
maxDate: d
|
|
829
954
|
}
|
|
830
|
-
) : /* @__PURE__ */
|
|
831
|
-
|
|
955
|
+
) : /* @__PURE__ */ r(
|
|
956
|
+
ce,
|
|
832
957
|
{
|
|
833
|
-
date:
|
|
834
|
-
setDate:
|
|
835
|
-
filter:
|
|
836
|
-
setViews:
|
|
837
|
-
dateRange:
|
|
838
|
-
setDateRange:
|
|
839
|
-
setIsComponentVisible:
|
|
840
|
-
input:
|
|
841
|
-
onChange:
|
|
842
|
-
minDate:
|
|
843
|
-
maxDate:
|
|
958
|
+
date: Y,
|
|
959
|
+
setDate: E,
|
|
960
|
+
filter: t,
|
|
961
|
+
setViews: S,
|
|
962
|
+
dateRange: D,
|
|
963
|
+
setDateRange: I,
|
|
964
|
+
setIsComponentVisible: L,
|
|
965
|
+
input: s,
|
|
966
|
+
onChange: n,
|
|
967
|
+
minDate: p,
|
|
968
|
+
maxDate: d
|
|
844
969
|
}
|
|
845
970
|
) })
|
|
846
971
|
]
|
|
@@ -849,49 +974,63 @@ const re = W(
|
|
|
849
974
|
]
|
|
850
975
|
}
|
|
851
976
|
);
|
|
977
|
+
return /* @__PURE__ */ r(
|
|
978
|
+
te,
|
|
979
|
+
{
|
|
980
|
+
label: k,
|
|
981
|
+
labelPosition: M,
|
|
982
|
+
required: f,
|
|
983
|
+
optional: o,
|
|
984
|
+
description: c,
|
|
985
|
+
helperText: h,
|
|
986
|
+
errorText: b,
|
|
987
|
+
fullWidth: y,
|
|
988
|
+
children: R
|
|
989
|
+
}
|
|
990
|
+
);
|
|
852
991
|
}
|
|
853
|
-
),
|
|
854
|
-
if (!document.getElementById(
|
|
855
|
-
const
|
|
856
|
-
|
|
992
|
+
), X = "sa-calendar-input-styles", ge = (a) => {
|
|
993
|
+
if (!document.getElementById(X)) {
|
|
994
|
+
const n = document.createElement("style");
|
|
995
|
+
n.id = X, n.textContent = a, document.head.appendChild(n);
|
|
857
996
|
}
|
|
858
997
|
};
|
|
859
|
-
|
|
860
|
-
const
|
|
998
|
+
ge(P);
|
|
999
|
+
const O = (a) => {
|
|
861
1000
|
if (a === "sm")
|
|
862
1001
|
return 16;
|
|
863
1002
|
if (a === "md")
|
|
864
1003
|
return 16;
|
|
865
1004
|
if (a === "lg")
|
|
866
1005
|
return 20;
|
|
867
|
-
},
|
|
1006
|
+
}, fe = (a) => {
|
|
868
1007
|
const {
|
|
869
|
-
size:
|
|
870
|
-
status:
|
|
871
|
-
variant:
|
|
872
|
-
clearable:
|
|
873
|
-
onClear:
|
|
874
|
-
...
|
|
875
|
-
} = a,
|
|
876
|
-
|
|
877
|
-
},
|
|
878
|
-
|
|
1008
|
+
size: n = "md",
|
|
1009
|
+
status: t = "default",
|
|
1010
|
+
variant: s = "outline",
|
|
1011
|
+
clearable: l,
|
|
1012
|
+
onClear: p,
|
|
1013
|
+
...d
|
|
1014
|
+
} = a, g = A(null), i = () => {
|
|
1015
|
+
g.current && d.onClick && (g.current.focus(), d.onClick(""));
|
|
1016
|
+
}, e = t === "disable" || d.disabled, w = !!d.value, y = l && w && !e, k = (M) => {
|
|
1017
|
+
M.stopPropagation(), p == null || p();
|
|
879
1018
|
};
|
|
880
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ N(
|
|
881
1020
|
"div",
|
|
882
1021
|
{
|
|
883
|
-
className: `sa-calendar-input-container sa-calendar-input-${
|
|
884
|
-
onClick:
|
|
1022
|
+
className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
|
|
1023
|
+
onClick: i,
|
|
885
1024
|
children: [
|
|
886
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
|
|
887
1026
|
"svg",
|
|
888
1027
|
{
|
|
889
1028
|
xmlns: "http://www.w3.org/2000/svg",
|
|
890
|
-
width:
|
|
891
|
-
height:
|
|
1029
|
+
width: O(n),
|
|
1030
|
+
height: O(n),
|
|
892
1031
|
viewBox: "0 0 20 20",
|
|
893
1032
|
fill: "none",
|
|
894
|
-
children: /* @__PURE__ */
|
|
1033
|
+
children: /* @__PURE__ */ r(
|
|
895
1034
|
"path",
|
|
896
1035
|
{
|
|
897
1036
|
d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
|
|
@@ -903,32 +1042,32 @@ const I = (a) => {
|
|
|
903
1042
|
)
|
|
904
1043
|
}
|
|
905
1044
|
) }),
|
|
906
|
-
/* @__PURE__ */
|
|
1045
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
|
|
907
1046
|
"input",
|
|
908
1047
|
{
|
|
909
1048
|
className: "sa-calendar-input",
|
|
910
|
-
...
|
|
911
|
-
disabled:
|
|
912
|
-
value:
|
|
913
|
-
ref:
|
|
1049
|
+
...d,
|
|
1050
|
+
disabled: e,
|
|
1051
|
+
value: d.value,
|
|
1052
|
+
ref: g
|
|
914
1053
|
}
|
|
915
1054
|
) }),
|
|
916
|
-
|
|
1055
|
+
y ? /* @__PURE__ */ r(
|
|
917
1056
|
"button",
|
|
918
1057
|
{
|
|
919
1058
|
type: "button",
|
|
920
1059
|
"aria-label": "Clear date",
|
|
921
1060
|
className: "sa-calendar-input-clear",
|
|
922
|
-
onClick:
|
|
923
|
-
children: /* @__PURE__ */
|
|
1061
|
+
onClick: k,
|
|
1062
|
+
children: /* @__PURE__ */ r(
|
|
924
1063
|
"svg",
|
|
925
1064
|
{
|
|
926
1065
|
xmlns: "http://www.w3.org/2000/svg",
|
|
927
|
-
width:
|
|
928
|
-
height:
|
|
1066
|
+
width: O(n),
|
|
1067
|
+
height: O(n),
|
|
929
1068
|
viewBox: "0 0 20 20",
|
|
930
1069
|
fill: "none",
|
|
931
|
-
children: /* @__PURE__ */
|
|
1070
|
+
children: /* @__PURE__ */ r(
|
|
932
1071
|
"path",
|
|
933
1072
|
{
|
|
934
1073
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -941,15 +1080,15 @@ const I = (a) => {
|
|
|
941
1080
|
}
|
|
942
1081
|
)
|
|
943
1082
|
}
|
|
944
|
-
) : /* @__PURE__ */
|
|
1083
|
+
) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
|
|
945
1084
|
"svg",
|
|
946
1085
|
{
|
|
947
1086
|
xmlns: "http://www.w3.org/2000/svg",
|
|
948
|
-
width:
|
|
949
|
-
height:
|
|
1087
|
+
width: O(n),
|
|
1088
|
+
height: O(n),
|
|
950
1089
|
viewBox: "0 0 20 20",
|
|
951
1090
|
fill: "none",
|
|
952
|
-
children: /* @__PURE__ */
|
|
1091
|
+
children: /* @__PURE__ */ r(
|
|
953
1092
|
"path",
|
|
954
1093
|
{
|
|
955
1094
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -964,316 +1103,324 @@ const I = (a) => {
|
|
|
964
1103
|
]
|
|
965
1104
|
}
|
|
966
1105
|
);
|
|
967
|
-
},
|
|
1106
|
+
}, me = ({
|
|
968
1107
|
date: a,
|
|
969
|
-
setDate:
|
|
970
|
-
previewDate:
|
|
971
|
-
setPreviewDate:
|
|
972
|
-
setIsComponentVisible:
|
|
973
|
-
minDate:
|
|
974
|
-
maxDate:
|
|
975
|
-
input:
|
|
976
|
-
onChange:
|
|
1108
|
+
setDate: n,
|
|
1109
|
+
previewDate: t,
|
|
1110
|
+
setPreviewDate: s,
|
|
1111
|
+
setIsComponentVisible: l,
|
|
1112
|
+
minDate: p,
|
|
1113
|
+
maxDate: d,
|
|
1114
|
+
input: g,
|
|
1115
|
+
onChange: i
|
|
977
1116
|
}) => {
|
|
978
|
-
let
|
|
979
|
-
|
|
980
|
-
|
|
1117
|
+
let e = new Date(
|
|
1118
|
+
t.getFullYear(),
|
|
1119
|
+
t.getMonth(),
|
|
981
1120
|
1
|
|
982
|
-
),
|
|
983
|
-
const
|
|
984
|
-
for (let
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
) :
|
|
988
|
-
let
|
|
989
|
-
currentMonth:
|
|
990
|
-
date: new Date(
|
|
991
|
-
month:
|
|
992
|
-
number:
|
|
993
|
-
selected:
|
|
994
|
-
year:
|
|
995
|
-
isDisabled:
|
|
1121
|
+
), w = e.getDay(), y = [];
|
|
1122
|
+
const k = a.toDateString(), M = t.getMonth();
|
|
1123
|
+
for (let o = 0; o < 42; o++) {
|
|
1124
|
+
o === 0 && w === 0 ? e.setDate(e.getDate() - 7) : o === 0 ? e.setDate(
|
|
1125
|
+
e.getDate() + (o - w)
|
|
1126
|
+
) : e.setDate(e.getDate() + 1);
|
|
1127
|
+
let c = {
|
|
1128
|
+
currentMonth: e.getMonth() === M,
|
|
1129
|
+
date: new Date(e),
|
|
1130
|
+
month: e.getMonth(),
|
|
1131
|
+
number: e.getDate(),
|
|
1132
|
+
selected: e.toDateString() === k,
|
|
1133
|
+
year: e.getFullYear(),
|
|
1134
|
+
isDisabled: p && e < p || d && e > d
|
|
996
1135
|
};
|
|
997
|
-
|
|
1136
|
+
y.push(c);
|
|
998
1137
|
}
|
|
999
|
-
const
|
|
1000
|
-
(!
|
|
1138
|
+
const f = (o) => {
|
|
1139
|
+
(!p || o >= p) && (!d || o <= d) && (n(o), i(o), s(o), g && l(!1));
|
|
1001
1140
|
};
|
|
1002
|
-
return /* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
const
|
|
1006
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ N("div", { className: "sa-calendar-days-preivew", children: [
|
|
1142
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((o, c) => /* @__PURE__ */ r("p", { children: o }, c)) }),
|
|
1143
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: y.map((o, c) => {
|
|
1144
|
+
const h = o.isDisabled;
|
|
1145
|
+
return /* @__PURE__ */ r(
|
|
1007
1146
|
"p",
|
|
1008
1147
|
{
|
|
1009
|
-
className: `${
|
|
1148
|
+
className: `${o.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${o.selected ? "sa-calendar-days-active" : ""}`,
|
|
1010
1149
|
style: {
|
|
1011
|
-
color:
|
|
1012
|
-
pointerEvents:
|
|
1013
|
-
cursor:
|
|
1014
|
-
...
|
|
1150
|
+
color: h ? "#ccc" : void 0,
|
|
1151
|
+
pointerEvents: h ? "none" : void 0,
|
|
1152
|
+
cursor: h ? "not-allowed" : "pointer",
|
|
1153
|
+
...g ? {} : { width: "100%" }
|
|
1015
1154
|
},
|
|
1016
1155
|
onClick: () => {
|
|
1017
|
-
|
|
1156
|
+
h || f(o.date);
|
|
1018
1157
|
},
|
|
1019
|
-
children:
|
|
1158
|
+
children: o.number
|
|
1020
1159
|
},
|
|
1021
|
-
|
|
1160
|
+
c
|
|
1022
1161
|
);
|
|
1023
1162
|
}) })
|
|
1024
1163
|
] });
|
|
1025
|
-
},
|
|
1164
|
+
}, ve = ({
|
|
1026
1165
|
date: a,
|
|
1027
|
-
setDate:
|
|
1028
|
-
filter:
|
|
1029
|
-
setViews:
|
|
1030
|
-
onChange:
|
|
1031
|
-
previewDate:
|
|
1032
|
-
setPreviewDate:
|
|
1033
|
-
minDate:
|
|
1034
|
-
maxDate:
|
|
1035
|
-
input:
|
|
1166
|
+
setDate: n,
|
|
1167
|
+
filter: t,
|
|
1168
|
+
setViews: s,
|
|
1169
|
+
onChange: l,
|
|
1170
|
+
previewDate: p,
|
|
1171
|
+
setPreviewDate: d,
|
|
1172
|
+
minDate: g,
|
|
1173
|
+
maxDate: i,
|
|
1174
|
+
input: e
|
|
1036
1175
|
}) => {
|
|
1037
|
-
const
|
|
1038
|
-
(!
|
|
1176
|
+
const w = a.getMonth(), y = a.getFullYear(), k = p.getFullYear(), M = (f) => {
|
|
1177
|
+
(!g || f >= g) && (!i || f <= i) && (t ? (l(f), n(f), d(f)) : (s("days"), d(f)));
|
|
1039
1178
|
};
|
|
1040
|
-
return /* @__PURE__ */
|
|
1041
|
-
const
|
|
1042
|
-
return /* @__PURE__ */
|
|
1179
|
+
return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: z.map((f, o) => {
|
|
1180
|
+
const c = g && new Date(k, o, 1) < g || i && new Date(k, o + 1, 0) > i;
|
|
1181
|
+
return /* @__PURE__ */ r(
|
|
1043
1182
|
"p",
|
|
1044
1183
|
{
|
|
1045
|
-
className:
|
|
1184
|
+
className: o === w && k === y ? "sa-calendar-months-active" : "",
|
|
1046
1185
|
style: {
|
|
1047
|
-
color:
|
|
1048
|
-
pointerEvents:
|
|
1049
|
-
cursor:
|
|
1050
|
-
...
|
|
1186
|
+
color: c ? "#ccc" : void 0,
|
|
1187
|
+
pointerEvents: c ? "none" : void 0,
|
|
1188
|
+
cursor: c ? "not-allowed" : "pointer",
|
|
1189
|
+
...e ? {} : { width: "100%" }
|
|
1051
1190
|
},
|
|
1052
1191
|
onClick: () => {
|
|
1053
|
-
|
|
1192
|
+
c || M(new Date(k, o));
|
|
1054
1193
|
},
|
|
1055
|
-
children:
|
|
1194
|
+
children: f.slice(0, 3)
|
|
1056
1195
|
},
|
|
1057
|
-
|
|
1196
|
+
o
|
|
1058
1197
|
);
|
|
1059
1198
|
}) });
|
|
1060
|
-
},
|
|
1061
|
-
const
|
|
1062
|
-
return { start:
|
|
1063
|
-
},
|
|
1199
|
+
}, q = (a) => {
|
|
1200
|
+
const n = Math.floor(a / 10) * 10, t = n + 10;
|
|
1201
|
+
return { start: n, end: t };
|
|
1202
|
+
}, ye = ({
|
|
1064
1203
|
date: a,
|
|
1065
|
-
filter:
|
|
1066
|
-
setViews:
|
|
1067
|
-
setDate:
|
|
1068
|
-
onChange:
|
|
1069
|
-
previewDate:
|
|
1070
|
-
setPreviewDate:
|
|
1071
|
-
minDate:
|
|
1072
|
-
maxDate:
|
|
1073
|
-
input:
|
|
1204
|
+
filter: n,
|
|
1205
|
+
setViews: t,
|
|
1206
|
+
setDate: s,
|
|
1207
|
+
onChange: l,
|
|
1208
|
+
previewDate: p,
|
|
1209
|
+
setPreviewDate: d,
|
|
1210
|
+
minDate: g,
|
|
1211
|
+
maxDate: i,
|
|
1212
|
+
input: e
|
|
1074
1213
|
}) => {
|
|
1075
|
-
let
|
|
1076
|
-
const
|
|
1077
|
-
for (let
|
|
1078
|
-
let
|
|
1079
|
-
|
|
1214
|
+
let w = [];
|
|
1215
|
+
const y = p.getFullYear(), { start: k, end: M } = q(y), f = a.getFullYear();
|
|
1216
|
+
for (let c = k; c < M; c++) {
|
|
1217
|
+
let h = g && new Date(c, 0, 1) < g || i && new Date(c, 11, 31) > i;
|
|
1218
|
+
w.push({ year: c, active: c === f, isDisabled: h });
|
|
1080
1219
|
}
|
|
1081
|
-
const
|
|
1082
|
-
(!
|
|
1220
|
+
const o = (c) => {
|
|
1221
|
+
(!g || c >= g) && (!i || c <= i) && (n ? (l(c), s(c), d(c)) : (t("months"), d(c)));
|
|
1083
1222
|
};
|
|
1084
|
-
return /* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((c, h) => /* @__PURE__ */ r(
|
|
1085
1224
|
"p",
|
|
1086
1225
|
{
|
|
1087
|
-
className:
|
|
1226
|
+
className: c.active ? "sa-calendar-months-active" : "",
|
|
1088
1227
|
style: {
|
|
1089
|
-
color:
|
|
1090
|
-
pointerEvents:
|
|
1091
|
-
cursor:
|
|
1092
|
-
...
|
|
1228
|
+
color: c.isDisabled ? "#ccc" : void 0,
|
|
1229
|
+
pointerEvents: c.isDisabled ? "none" : void 0,
|
|
1230
|
+
cursor: c.isDisabled ? "not-allowed" : "pointer",
|
|
1231
|
+
...e ? {} : { width: "100%" }
|
|
1093
1232
|
},
|
|
1094
1233
|
onClick: () => {
|
|
1095
|
-
|
|
1234
|
+
c.isDisabled || o(new Date(c.year, 0));
|
|
1096
1235
|
},
|
|
1097
|
-
children:
|
|
1236
|
+
children: c.year
|
|
1098
1237
|
},
|
|
1099
|
-
|
|
1238
|
+
h
|
|
1100
1239
|
)) });
|
|
1101
|
-
},
|
|
1240
|
+
}, be = ({
|
|
1102
1241
|
setViews: a,
|
|
1103
|
-
views:
|
|
1104
|
-
filter:
|
|
1105
|
-
previewDate:
|
|
1106
|
-
setPreviewDate:
|
|
1242
|
+
views: n,
|
|
1243
|
+
filter: t,
|
|
1244
|
+
previewDate: s,
|
|
1245
|
+
setPreviewDate: l
|
|
1107
1246
|
}) => {
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
},
|
|
1111
|
-
if (
|
|
1112
|
-
|
|
1247
|
+
const p = () => {
|
|
1248
|
+
t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
|
|
1249
|
+
}, d = () => {
|
|
1250
|
+
if (n === "years") {
|
|
1251
|
+
l((e) => new Date(e.getFullYear() + 10, 0));
|
|
1113
1252
|
return;
|
|
1114
1253
|
}
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
(
|
|
1254
|
+
if (n === "months") {
|
|
1255
|
+
l(
|
|
1256
|
+
(e) => new Date(e.getFullYear() + 1, e.getMonth())
|
|
1118
1257
|
);
|
|
1119
1258
|
return;
|
|
1120
1259
|
}
|
|
1121
|
-
|
|
1122
|
-
},
|
|
1123
|
-
if (
|
|
1124
|
-
|
|
1260
|
+
l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
|
|
1261
|
+
}, g = () => {
|
|
1262
|
+
if (n === "years") {
|
|
1263
|
+
l((e) => new Date(e.getFullYear() - 10, 0));
|
|
1125
1264
|
return;
|
|
1126
1265
|
}
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1129
|
-
(
|
|
1266
|
+
if (n === "months") {
|
|
1267
|
+
l(
|
|
1268
|
+
(e) => new Date(e.getFullYear() - 1, e.getMonth())
|
|
1130
1269
|
);
|
|
1131
1270
|
return;
|
|
1132
1271
|
}
|
|
1133
|
-
|
|
1134
|
-
(
|
|
1135
|
-
|
|
1136
|
-
|
|
1272
|
+
l(
|
|
1273
|
+
(e) => new Date(
|
|
1274
|
+
e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
|
|
1275
|
+
e.getMonth() === 0 ? 11 : e.getMonth() - 1
|
|
1137
1276
|
)
|
|
1138
1277
|
);
|
|
1139
1278
|
};
|
|
1140
|
-
return /* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
if (
|
|
1144
|
-
return `${
|
|
1145
|
-
if (
|
|
1146
|
-
return `${
|
|
1147
|
-
if (
|
|
1148
|
-
return `${
|
|
1279
|
+
return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
|
|
1280
|
+
/* @__PURE__ */ r(ae, { onClick: () => g() }),
|
|
1281
|
+
/* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: p, children: (() => {
|
|
1282
|
+
if (n === "days")
|
|
1283
|
+
return `${z[s.getMonth()]} ${s.getFullYear()}`;
|
|
1284
|
+
if (n === "months")
|
|
1285
|
+
return `${s.getFullYear()}`;
|
|
1286
|
+
if (n === "years")
|
|
1287
|
+
return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
|
|
1149
1288
|
})() }),
|
|
1150
|
-
/* @__PURE__ */
|
|
1289
|
+
/* @__PURE__ */ r(re, { onClick: () => d() })
|
|
1151
1290
|
] });
|
|
1152
|
-
},
|
|
1153
|
-
if (!document.getElementById(
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1291
|
+
}, Z = "sa-calendar-styles", we = (a) => {
|
|
1292
|
+
if (!document.getElementById(Z)) {
|
|
1293
|
+
const n = document.createElement("style");
|
|
1294
|
+
n.id = Z, n.textContent = a, document.head.appendChild(n);
|
|
1156
1295
|
}
|
|
1157
1296
|
};
|
|
1158
|
-
|
|
1159
|
-
const
|
|
1297
|
+
we(P);
|
|
1298
|
+
const xe = G(
|
|
1160
1299
|
({
|
|
1161
1300
|
value: a,
|
|
1162
|
-
onChange:
|
|
1163
|
-
filter:
|
|
1164
|
-
input:
|
|
1165
|
-
disabled:
|
|
1166
|
-
minDate:
|
|
1167
|
-
maxDate:
|
|
1168
|
-
placeholder:
|
|
1169
|
-
size:
|
|
1170
|
-
status:
|
|
1171
|
-
clearable:
|
|
1172
|
-
fullWidth:
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
}, [
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1301
|
+
onChange: n,
|
|
1302
|
+
filter: t,
|
|
1303
|
+
input: s = !0,
|
|
1304
|
+
disabled: l,
|
|
1305
|
+
minDate: p,
|
|
1306
|
+
maxDate: d,
|
|
1307
|
+
placeholder: g,
|
|
1308
|
+
size: i,
|
|
1309
|
+
status: e,
|
|
1310
|
+
clearable: w,
|
|
1311
|
+
fullWidth: y = !0,
|
|
1312
|
+
label: k,
|
|
1313
|
+
labelPosition: M,
|
|
1314
|
+
required: f,
|
|
1315
|
+
optional: o,
|
|
1316
|
+
description: c,
|
|
1317
|
+
helperText: h,
|
|
1318
|
+
errorText: b
|
|
1319
|
+
}, u) => {
|
|
1320
|
+
const m = b ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = j("days"), [Y, E] = j(/* @__PURE__ */ new Date()), [D, I] = j(/* @__PURE__ */ new Date());
|
|
1321
|
+
$(() => {
|
|
1322
|
+
a ? (E(a), I(a)) : (E(/* @__PURE__ */ new Date()), I(/* @__PURE__ */ new Date()));
|
|
1323
|
+
}, [a]), $(() => {
|
|
1324
|
+
t && S(t);
|
|
1325
|
+
}, [t]), $(() => {
|
|
1326
|
+
t || S("days");
|
|
1327
|
+
}, [F]), $(() => {
|
|
1328
|
+
s || L(!0);
|
|
1329
|
+
}, [s]);
|
|
1330
|
+
const J = () => a ? t === "days" ? H(Y) : t === "months" ? `${z[Y.getMonth()]} ${Y.getFullYear()}` : t === "years" ? Y.getFullYear() : H(Y) : "", B = () => {
|
|
1331
|
+
if (C.current && x.current && s) {
|
|
1332
|
+
const v = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
|
|
1333
|
+
window.innerWidth < v.left + T.width ? C.current.style.left = `${v.left - T.width + v.width}px` : C.current.style.left = `${v.left}px`, v.top + T.height > window.innerHeight ? C.current.style.top = `${v.y - (v.height + T.height - 28)}px` : C.current.style.top = `${v.y + v.height}px`;
|
|
1188
1334
|
}
|
|
1189
1335
|
};
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
}, [
|
|
1193
|
-
const v =
|
|
1194
|
-
return v && v.addEventListener("scroll",
|
|
1195
|
-
v && v.removeEventListener("scroll",
|
|
1336
|
+
$(() => {
|
|
1337
|
+
C.current && x.current && s && B();
|
|
1338
|
+
}, [C, x, F]), $(() => {
|
|
1339
|
+
const v = u == null ? void 0 : u.current;
|
|
1340
|
+
return v && v.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
|
|
1341
|
+
v && v.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
|
|
1196
1342
|
};
|
|
1197
|
-
}, [])
|
|
1343
|
+
}, []);
|
|
1344
|
+
const R = /* @__PURE__ */ N(
|
|
1198
1345
|
"div",
|
|
1199
1346
|
{
|
|
1200
|
-
className:
|
|
1201
|
-
style: { height:
|
|
1202
|
-
ref:
|
|
1347
|
+
className: "sa-calendar-wrapper",
|
|
1348
|
+
style: { height: s ? "auto" : "100%" },
|
|
1349
|
+
ref: s ? x : null,
|
|
1203
1350
|
children: [
|
|
1204
|
-
|
|
1205
|
-
|
|
1351
|
+
s ? /* @__PURE__ */ r(
|
|
1352
|
+
fe,
|
|
1206
1353
|
{
|
|
1207
|
-
value:
|
|
1208
|
-
onClick: () =>
|
|
1354
|
+
value: J(),
|
|
1355
|
+
onClick: () => L(!0),
|
|
1209
1356
|
onChange: () => {
|
|
1210
1357
|
},
|
|
1211
|
-
placeholder:
|
|
1212
|
-
disabled:
|
|
1213
|
-
size:
|
|
1214
|
-
status:
|
|
1358
|
+
placeholder: g,
|
|
1359
|
+
disabled: l,
|
|
1360
|
+
size: i,
|
|
1361
|
+
status: m,
|
|
1215
1362
|
inputMode: "none",
|
|
1216
|
-
clearable:
|
|
1217
|
-
onClear: () =>
|
|
1363
|
+
clearable: w,
|
|
1364
|
+
onClear: () => n(void 0)
|
|
1218
1365
|
}
|
|
1219
1366
|
) : null,
|
|
1220
|
-
|
|
1367
|
+
F ? /* @__PURE__ */ N(
|
|
1221
1368
|
"div",
|
|
1222
1369
|
{
|
|
1223
|
-
className: `sa-calendar ${
|
|
1224
|
-
ref:
|
|
1370
|
+
className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
|
|
1371
|
+
ref: C,
|
|
1225
1372
|
children: [
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
|
|
1373
|
+
/* @__PURE__ */ r(
|
|
1374
|
+
be,
|
|
1228
1375
|
{
|
|
1229
|
-
setViews:
|
|
1230
|
-
views:
|
|
1231
|
-
filter:
|
|
1232
|
-
previewDate:
|
|
1233
|
-
setPreviewDate:
|
|
1234
|
-
isComponentVisible:
|
|
1376
|
+
setViews: S,
|
|
1377
|
+
views: V,
|
|
1378
|
+
filter: t,
|
|
1379
|
+
previewDate: D,
|
|
1380
|
+
setPreviewDate: I,
|
|
1381
|
+
isComponentVisible: F
|
|
1235
1382
|
}
|
|
1236
1383
|
),
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
|
|
1384
|
+
/* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
|
|
1385
|
+
me,
|
|
1239
1386
|
{
|
|
1240
|
-
date:
|
|
1241
|
-
setDate:
|
|
1242
|
-
previewDate:
|
|
1243
|
-
setPreviewDate:
|
|
1244
|
-
setIsComponentVisible:
|
|
1245
|
-
input:
|
|
1246
|
-
minDate:
|
|
1247
|
-
maxDate:
|
|
1248
|
-
onChange:
|
|
1387
|
+
date: Y,
|
|
1388
|
+
setDate: E,
|
|
1389
|
+
previewDate: D,
|
|
1390
|
+
setPreviewDate: I,
|
|
1391
|
+
setIsComponentVisible: L,
|
|
1392
|
+
input: s,
|
|
1393
|
+
minDate: p,
|
|
1394
|
+
maxDate: d,
|
|
1395
|
+
onChange: n
|
|
1249
1396
|
}
|
|
1250
|
-
) :
|
|
1251
|
-
|
|
1397
|
+
) : V === "months" ? /* @__PURE__ */ r(
|
|
1398
|
+
ve,
|
|
1252
1399
|
{
|
|
1253
|
-
date:
|
|
1254
|
-
setDate:
|
|
1255
|
-
previewDate:
|
|
1256
|
-
setPreviewDate:
|
|
1257
|
-
filter:
|
|
1258
|
-
setViews:
|
|
1259
|
-
onChange:
|
|
1260
|
-
minDate:
|
|
1261
|
-
maxDate:
|
|
1262
|
-
input:
|
|
1400
|
+
date: Y,
|
|
1401
|
+
setDate: E,
|
|
1402
|
+
previewDate: D,
|
|
1403
|
+
setPreviewDate: I,
|
|
1404
|
+
filter: t,
|
|
1405
|
+
setViews: S,
|
|
1406
|
+
onChange: n,
|
|
1407
|
+
minDate: p,
|
|
1408
|
+
maxDate: d,
|
|
1409
|
+
input: s
|
|
1263
1410
|
}
|
|
1264
|
-
) : /* @__PURE__ */
|
|
1265
|
-
|
|
1411
|
+
) : /* @__PURE__ */ r(
|
|
1412
|
+
ye,
|
|
1266
1413
|
{
|
|
1267
|
-
date:
|
|
1268
|
-
setDate:
|
|
1269
|
-
previewDate:
|
|
1270
|
-
setPreviewDate:
|
|
1271
|
-
filter:
|
|
1272
|
-
setViews:
|
|
1273
|
-
onChange:
|
|
1274
|
-
minDate:
|
|
1275
|
-
maxDate:
|
|
1276
|
-
input:
|
|
1414
|
+
date: Y,
|
|
1415
|
+
setDate: E,
|
|
1416
|
+
previewDate: D,
|
|
1417
|
+
setPreviewDate: I,
|
|
1418
|
+
filter: t,
|
|
1419
|
+
setViews: S,
|
|
1420
|
+
onChange: n,
|
|
1421
|
+
minDate: p,
|
|
1422
|
+
maxDate: d,
|
|
1423
|
+
input: s
|
|
1277
1424
|
}
|
|
1278
1425
|
) })
|
|
1279
1426
|
]
|
|
@@ -1282,58 +1429,68 @@ const ue = W(
|
|
|
1282
1429
|
]
|
|
1283
1430
|
}
|
|
1284
1431
|
);
|
|
1432
|
+
return /* @__PURE__ */ r(
|
|
1433
|
+
te,
|
|
1434
|
+
{
|
|
1435
|
+
label: k,
|
|
1436
|
+
labelPosition: M,
|
|
1437
|
+
required: f,
|
|
1438
|
+
optional: o,
|
|
1439
|
+
description: c,
|
|
1440
|
+
helperText: h,
|
|
1441
|
+
errorText: b,
|
|
1442
|
+
fullWidth: y,
|
|
1443
|
+
children: R
|
|
1444
|
+
}
|
|
1445
|
+
);
|
|
1285
1446
|
}
|
|
1286
|
-
),
|
|
1447
|
+
), Ce = G(
|
|
1287
1448
|
({
|
|
1288
1449
|
value: a,
|
|
1289
|
-
onChange:
|
|
1290
|
-
filter:
|
|
1291
|
-
input:
|
|
1292
|
-
rangedDate:
|
|
1293
|
-
disabled:
|
|
1294
|
-
minDate:
|
|
1295
|
-
maxDate:
|
|
1296
|
-
placeholder:
|
|
1297
|
-
size:
|
|
1298
|
-
status:
|
|
1299
|
-
clearable:
|
|
1300
|
-
fullWidth:
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
maxDate: f,
|
|
1312
|
-
placeholder: u,
|
|
1313
|
-
size: n,
|
|
1314
|
-
status: M,
|
|
1315
|
-
clearable: k,
|
|
1316
|
-
fullWidth: x
|
|
1317
|
-
}
|
|
1318
|
-
) : /* @__PURE__ */ t(
|
|
1319
|
-
ue,
|
|
1320
|
-
{
|
|
1321
|
-
onChange: e,
|
|
1450
|
+
onChange: n,
|
|
1451
|
+
filter: t,
|
|
1452
|
+
input: s = !0,
|
|
1453
|
+
rangedDate: l,
|
|
1454
|
+
disabled: p,
|
|
1455
|
+
minDate: d,
|
|
1456
|
+
maxDate: g,
|
|
1457
|
+
placeholder: i,
|
|
1458
|
+
size: e,
|
|
1459
|
+
status: w,
|
|
1460
|
+
clearable: y,
|
|
1461
|
+
fullWidth: k,
|
|
1462
|
+
label: M,
|
|
1463
|
+
labelPosition: f,
|
|
1464
|
+
required: o,
|
|
1465
|
+
optional: c,
|
|
1466
|
+
description: h,
|
|
1467
|
+
helperText: b,
|
|
1468
|
+
errorText: u
|
|
1469
|
+
}, m) => {
|
|
1470
|
+
const x = {
|
|
1471
|
+
onChange: n,
|
|
1322
1472
|
value: a,
|
|
1323
|
-
input:
|
|
1324
|
-
filter:
|
|
1325
|
-
disabled:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1473
|
+
input: s,
|
|
1474
|
+
filter: t,
|
|
1475
|
+
disabled: p,
|
|
1476
|
+
minDate: d,
|
|
1477
|
+
maxDate: g,
|
|
1478
|
+
placeholder: i,
|
|
1479
|
+
size: e,
|
|
1480
|
+
status: w,
|
|
1481
|
+
clearable: y,
|
|
1482
|
+
fullWidth: k,
|
|
1483
|
+
label: M,
|
|
1484
|
+
labelPosition: f,
|
|
1485
|
+
required: o,
|
|
1486
|
+
optional: c,
|
|
1487
|
+
description: h,
|
|
1488
|
+
helperText: b,
|
|
1489
|
+
errorText: u
|
|
1490
|
+
};
|
|
1491
|
+
return /* @__PURE__ */ r(_, { children: l ? /* @__PURE__ */ r(pe, { ...x, ref: m }) : /* @__PURE__ */ r(xe, { ...x, ref: m }) });
|
|
1492
|
+
}
|
|
1336
1493
|
);
|
|
1337
1494
|
export {
|
|
1338
|
-
|
|
1495
|
+
Ce as StarasiaDate
|
|
1339
1496
|
};
|