@starasia/date 5.2.2 → 5.2.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/date.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as Y, jsx as
|
|
2
|
-
import { useState as A, useRef as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as Y, jsx as e, Fragment as en } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A, useRef as J, useEffect as B, forwardRef as K } from "react";
|
|
3
|
+
const R = `@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;
|
|
@@ -244,6 +244,7 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
244
244
|
|
|
245
245
|
.sa-calendar-days-today {
|
|
246
246
|
position: relative;
|
|
247
|
+
isolation: isolate;
|
|
247
248
|
color: var(--sa-date-brand);
|
|
248
249
|
font-weight: 700;
|
|
249
250
|
background: transparent;
|
|
@@ -255,13 +256,18 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
255
256
|
top: 50%;
|
|
256
257
|
left: 50%;
|
|
257
258
|
transform: translate(-50%, -50%);
|
|
258
|
-
width:
|
|
259
|
-
height:
|
|
259
|
+
width: 26px;
|
|
260
|
+
height: 26px;
|
|
260
261
|
background: var(--sa-date-brand-secondary);
|
|
261
262
|
border-radius: 50%;
|
|
262
263
|
z-index: -1;
|
|
263
264
|
}
|
|
264
265
|
|
|
266
|
+
.sa-calendar-days-number-preivew p.sa-calendar-days-today:hover {
|
|
267
|
+
background: transparent;
|
|
268
|
+
color: var(--sa-date-brand);
|
|
269
|
+
}
|
|
270
|
+
|
|
265
271
|
/* MONTH STYLING */
|
|
266
272
|
.sa-calendar-months-preview {
|
|
267
273
|
display: grid;
|
|
@@ -485,8 +491,8 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
485
491
|
height: 26px;
|
|
486
492
|
}
|
|
487
493
|
.sa-calendar.sa-calendar-size-sm .sa-calendar-days-today::before {
|
|
488
|
-
width:
|
|
489
|
-
height:
|
|
494
|
+
width: 22px;
|
|
495
|
+
height: 22px;
|
|
490
496
|
}
|
|
491
497
|
.sa-calendar.sa-calendar-size-sm .sa-calendar-months-preview p,
|
|
492
498
|
.sa-calendar.sa-calendar-size-sm .sa-calendar-years-preview p {
|
|
@@ -514,8 +520,8 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
514
520
|
height: 36px;
|
|
515
521
|
}
|
|
516
522
|
.sa-calendar.sa-calendar-size-lg .sa-calendar-days-today::before {
|
|
517
|
-
width:
|
|
518
|
-
height:
|
|
523
|
+
width: 30px;
|
|
524
|
+
height: 30px;
|
|
519
525
|
}
|
|
520
526
|
.sa-calendar.sa-calendar-size-lg .sa-calendar-months-preview p,
|
|
521
527
|
.sa-calendar.sa-calendar-size-lg .sa-calendar-years-preview p {
|
|
@@ -565,56 +571,56 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
565
571
|
"Nov",
|
|
566
572
|
"Dec"
|
|
567
573
|
];
|
|
568
|
-
function rn(
|
|
569
|
-
const [
|
|
570
|
-
o.current && !o.current.contains(
|
|
574
|
+
function rn(a) {
|
|
575
|
+
const [n, t] = A(a), o = J(null), l = (u) => {
|
|
576
|
+
o.current && !o.current.contains(u.target) && t(!1);
|
|
571
577
|
};
|
|
572
578
|
return B(() => (document.addEventListener("click", l, !0), () => {
|
|
573
579
|
document.removeEventListener("click", l, !0);
|
|
574
|
-
}), []), { ref: o, isComponentVisible:
|
|
580
|
+
}), []), { ref: o, isComponentVisible: n, setIsComponentVisible: t };
|
|
575
581
|
}
|
|
576
|
-
const Q = "sa-calendar-input-styles", dn = (
|
|
582
|
+
const Q = "sa-calendar-input-styles", dn = (a) => {
|
|
577
583
|
if (!document.getElementById(Q)) {
|
|
578
|
-
const
|
|
579
|
-
|
|
584
|
+
const n = document.createElement("style");
|
|
585
|
+
n.id = Q, n.textContent = a, document.head.appendChild(n);
|
|
580
586
|
}
|
|
581
587
|
};
|
|
582
|
-
dn(
|
|
583
|
-
const O = (
|
|
584
|
-
if (
|
|
588
|
+
dn(R);
|
|
589
|
+
const O = (a) => {
|
|
590
|
+
if (a === "sm")
|
|
585
591
|
return 16;
|
|
586
|
-
if (
|
|
592
|
+
if (a === "md")
|
|
587
593
|
return 16;
|
|
588
|
-
if (
|
|
594
|
+
if (a === "lg")
|
|
589
595
|
return 20;
|
|
590
|
-
}, cn = (
|
|
596
|
+
}, cn = (a) => {
|
|
591
597
|
const {
|
|
592
|
-
size:
|
|
598
|
+
size: n = "md",
|
|
593
599
|
status: t = "default",
|
|
594
600
|
variant: o = "outline",
|
|
595
601
|
clearable: l,
|
|
596
|
-
onClear:
|
|
597
|
-
...
|
|
598
|
-
} =
|
|
599
|
-
|
|
600
|
-
},
|
|
601
|
-
|
|
602
|
+
onClear: u,
|
|
603
|
+
...i
|
|
604
|
+
} = a, h = J(null), g = () => {
|
|
605
|
+
h.current && i.onClick && (h.current.focus(), i.onClick(""));
|
|
606
|
+
}, r = t === "disable" || i.disabled, d = !!i.value, y = l && d && !r, M = (k) => {
|
|
607
|
+
k.stopPropagation(), u == null || u();
|
|
602
608
|
};
|
|
603
609
|
return /* @__PURE__ */ Y(
|
|
604
610
|
"div",
|
|
605
611
|
{
|
|
606
|
-
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${t} ${
|
|
607
|
-
onClick:
|
|
612
|
+
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${t} ${n} `,
|
|
613
|
+
onClick: g,
|
|
608
614
|
children: [
|
|
609
|
-
/* @__PURE__ */
|
|
615
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ e(
|
|
610
616
|
"svg",
|
|
611
617
|
{
|
|
612
618
|
xmlns: "http://www.w3.org/2000/svg",
|
|
613
|
-
width: O(
|
|
614
|
-
height: O(
|
|
619
|
+
width: O(n),
|
|
620
|
+
height: O(n),
|
|
615
621
|
viewBox: "0 0 20 20",
|
|
616
622
|
fill: "none",
|
|
617
|
-
children: /* @__PURE__ */
|
|
623
|
+
children: /* @__PURE__ */ e(
|
|
618
624
|
"path",
|
|
619
625
|
{
|
|
620
626
|
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",
|
|
@@ -626,32 +632,32 @@ const O = (r) => {
|
|
|
626
632
|
)
|
|
627
633
|
}
|
|
628
634
|
) }),
|
|
629
|
-
/* @__PURE__ */
|
|
635
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ e(
|
|
630
636
|
"input",
|
|
631
637
|
{
|
|
632
638
|
className: "sa-calendar-input",
|
|
633
|
-
...
|
|
634
|
-
disabled:
|
|
635
|
-
value:
|
|
636
|
-
ref:
|
|
639
|
+
...i,
|
|
640
|
+
disabled: r,
|
|
641
|
+
value: i.value,
|
|
642
|
+
ref: h
|
|
637
643
|
}
|
|
638
644
|
) }),
|
|
639
|
-
|
|
645
|
+
y ? /* @__PURE__ */ e(
|
|
640
646
|
"button",
|
|
641
647
|
{
|
|
642
648
|
type: "button",
|
|
643
649
|
"aria-label": "Clear date",
|
|
644
650
|
className: "sa-calendar-input-clear",
|
|
645
|
-
onClick:
|
|
646
|
-
children: /* @__PURE__ */
|
|
651
|
+
onClick: M,
|
|
652
|
+
children: /* @__PURE__ */ e(
|
|
647
653
|
"svg",
|
|
648
654
|
{
|
|
649
655
|
xmlns: "http://www.w3.org/2000/svg",
|
|
650
|
-
width: O(
|
|
651
|
-
height: O(
|
|
656
|
+
width: O(n),
|
|
657
|
+
height: O(n),
|
|
652
658
|
viewBox: "0 0 20 20",
|
|
653
659
|
fill: "none",
|
|
654
|
-
children: /* @__PURE__ */
|
|
660
|
+
children: /* @__PURE__ */ e(
|
|
655
661
|
"path",
|
|
656
662
|
{
|
|
657
663
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -664,15 +670,15 @@ const O = (r) => {
|
|
|
664
670
|
}
|
|
665
671
|
)
|
|
666
672
|
}
|
|
667
|
-
) : /* @__PURE__ */
|
|
673
|
+
) : /* @__PURE__ */ e("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ e(
|
|
668
674
|
"svg",
|
|
669
675
|
{
|
|
670
676
|
xmlns: "http://www.w3.org/2000/svg",
|
|
671
|
-
width: O(
|
|
672
|
-
height: O(
|
|
677
|
+
width: O(n),
|
|
678
|
+
height: O(n),
|
|
673
679
|
viewBox: "0 0 20 20",
|
|
674
680
|
fill: "none",
|
|
675
|
-
children: /* @__PURE__ */
|
|
681
|
+
children: /* @__PURE__ */ e(
|
|
676
682
|
"path",
|
|
677
683
|
{
|
|
678
684
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -688,194 +694,195 @@ const O = (r) => {
|
|
|
688
694
|
}
|
|
689
695
|
);
|
|
690
696
|
}, un = ({
|
|
691
|
-
date:
|
|
692
|
-
setDate:
|
|
697
|
+
date: a,
|
|
698
|
+
setDate: n,
|
|
693
699
|
dateRange: t,
|
|
694
700
|
setDateRange: o,
|
|
695
701
|
onChange: l,
|
|
696
|
-
minDate:
|
|
697
|
-
maxDate:
|
|
698
|
-
input:
|
|
702
|
+
minDate: u,
|
|
703
|
+
maxDate: i,
|
|
704
|
+
input: h
|
|
699
705
|
}) => {
|
|
700
|
-
var
|
|
701
|
-
const [
|
|
702
|
-
let
|
|
703
|
-
const
|
|
704
|
-
for (let
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
) :
|
|
708
|
-
let
|
|
709
|
-
currentMonth:
|
|
710
|
-
date: new Date(
|
|
711
|
-
month:
|
|
712
|
-
number:
|
|
713
|
-
selected:
|
|
714
|
-
isToday:
|
|
715
|
-
year:
|
|
716
|
-
isDisabled:
|
|
706
|
+
var N, p, w;
|
|
707
|
+
const [g, r] = A(null);
|
|
708
|
+
let d = new Date(a.getFullYear(), a.getMonth(), 1), y = d.getDay(), M = [];
|
|
709
|
+
const k = a.getMonth(), $ = (/* @__PURE__ */ new Date()).toDateString(), m = !!(t.from && !t.to), f = m && g ? g : null;
|
|
710
|
+
for (let c = 0; c < 42; c++) {
|
|
711
|
+
c === 0 && y === 0 ? d.setDate(d.getDate() - 7) : c === 0 ? d.setDate(
|
|
712
|
+
d.getDate() + (c - y)
|
|
713
|
+
) : d.setDate(d.getDate() + 1);
|
|
714
|
+
let v = {
|
|
715
|
+
currentMonth: d.getMonth() === k,
|
|
716
|
+
date: new Date(d),
|
|
717
|
+
month: d.getMonth(),
|
|
718
|
+
number: d.getDate(),
|
|
719
|
+
selected: d.toDateString() === ((N = t.from) == null ? void 0 : N.toDateString()) || d.toDateString() === (((p = t.to) == null ? void 0 : p.toDateString()) || ((w = t.from) == null ? void 0 : w.toDateString())),
|
|
720
|
+
isToday: d.toDateString() === $,
|
|
721
|
+
year: d.getFullYear(),
|
|
722
|
+
isDisabled: u && d < u || i && d > i
|
|
717
723
|
};
|
|
718
|
-
|
|
724
|
+
M.push(v);
|
|
719
725
|
}
|
|
720
|
-
const
|
|
721
|
-
|
|
722
|
-
},
|
|
723
|
-
var
|
|
724
|
-
let
|
|
725
|
-
if (
|
|
726
|
-
|
|
726
|
+
const s = (c) => {
|
|
727
|
+
n(c);
|
|
728
|
+
}, x = (c) => {
|
|
729
|
+
var z;
|
|
730
|
+
let v = { ...t };
|
|
731
|
+
if (v.from && v.to)
|
|
732
|
+
v = { from: c, to: null };
|
|
727
733
|
else {
|
|
728
|
-
const S = ((
|
|
729
|
-
|
|
734
|
+
const S = ((z = v.from) == null ? void 0 : z.getTime()) || 0;
|
|
735
|
+
c.getTime() > S ? v = { from: v.from, to: c } : v = { from: c, to: v.from };
|
|
730
736
|
}
|
|
731
|
-
o(
|
|
737
|
+
o(v), l(v);
|
|
732
738
|
};
|
|
733
739
|
return /* @__PURE__ */ Y(
|
|
734
740
|
"div",
|
|
735
741
|
{
|
|
736
742
|
className: "sa-calendar-days-preivew",
|
|
737
|
-
onMouseLeave: () =>
|
|
743
|
+
onMouseLeave: () => r(null),
|
|
738
744
|
children: [
|
|
739
|
-
/* @__PURE__ */
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
const
|
|
742
|
-
if (!
|
|
745
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-days-name-preivew", children: an.map((c, v) => /* @__PURE__ */ e("p", { children: c }, v)) }),
|
|
746
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-days-number-preivew", children: M.map((c, v) => {
|
|
747
|
+
const z = t.from && t.to && c.date.getTime() > t.from.getTime() && c.date.getTime() < t.to.getTime(), S = (() => {
|
|
748
|
+
if (!f || !t.from)
|
|
743
749
|
return !1;
|
|
744
|
-
const
|
|
745
|
-
return
|
|
746
|
-
})(),
|
|
747
|
-
return /* @__PURE__ */
|
|
750
|
+
const F = c.date.getTime(), D = t.from.getTime(), E = f.getTime();
|
|
751
|
+
return E > D ? F > D && F < E : F < D && F > E;
|
|
752
|
+
})(), C = m && g && c.date.toDateString() === g.toDateString(), L = c.isDisabled, I = () => z || S ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "", T = () => L ? "var(--sa-color-gray-400, #b7b9be)" : z || S ? "var(--sa-color-gray-500, #8c8f97)" : "";
|
|
753
|
+
return /* @__PURE__ */ e(
|
|
748
754
|
"p",
|
|
749
755
|
{
|
|
750
|
-
className: `${
|
|
756
|
+
className: `${c.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${c.selected || C ? "sa-calendar-days-active" : ""} ${c.isToday && !c.selected ? "sa-calendar-days-today" : ""}`,
|
|
751
757
|
style: {
|
|
752
758
|
backgroundColor: I(),
|
|
753
|
-
pointerEvents:
|
|
754
|
-
cursor:
|
|
755
|
-
color:
|
|
756
|
-
opacity:
|
|
757
|
-
...
|
|
759
|
+
pointerEvents: L ? "none" : void 0,
|
|
760
|
+
cursor: L ? "not-allowed" : "pointer",
|
|
761
|
+
color: T(),
|
|
762
|
+
opacity: C && !c.selected ? 0.75 : 1,
|
|
763
|
+
...h ? {} : { width: "100%" }
|
|
758
764
|
},
|
|
759
765
|
onClick: () => {
|
|
760
|
-
|
|
766
|
+
L || (s(c.date), x(c.date));
|
|
761
767
|
},
|
|
762
768
|
onMouseEnter: () => {
|
|
763
|
-
|
|
769
|
+
L || r(c.date);
|
|
764
770
|
},
|
|
765
|
-
children:
|
|
771
|
+
children: c.number
|
|
766
772
|
},
|
|
767
|
-
|
|
773
|
+
v
|
|
768
774
|
);
|
|
769
775
|
}) })
|
|
770
776
|
]
|
|
771
777
|
}
|
|
772
778
|
);
|
|
773
779
|
}, pn = ({
|
|
774
|
-
date:
|
|
775
|
-
setDate:
|
|
780
|
+
date: a,
|
|
781
|
+
setDate: n,
|
|
776
782
|
filter: t,
|
|
777
783
|
setViews: o,
|
|
778
784
|
dateRange: l,
|
|
779
|
-
setDateRange:
|
|
780
|
-
onChange:
|
|
781
|
-
minDate:
|
|
782
|
-
maxDate:
|
|
783
|
-
input:
|
|
785
|
+
setDateRange: u,
|
|
786
|
+
onChange: i,
|
|
787
|
+
minDate: h,
|
|
788
|
+
maxDate: g,
|
|
789
|
+
input: r
|
|
784
790
|
}) => {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
791
|
+
var $;
|
|
792
|
+
const d = ($ = l.from) == null ? void 0 : $.getFullYear(), y = a.getFullYear(), M = (m) => {
|
|
793
|
+
t ? (k(m), n(m)) : (o("days"), n(m));
|
|
794
|
+
}, k = (m) => {
|
|
788
795
|
var s;
|
|
789
|
-
let
|
|
790
|
-
if (
|
|
791
|
-
|
|
796
|
+
let f = { ...l };
|
|
797
|
+
if (f.from && f.to)
|
|
798
|
+
f = { from: m, to: null };
|
|
792
799
|
else {
|
|
793
|
-
const x = ((s =
|
|
794
|
-
|
|
800
|
+
const x = ((s = f.from) == null ? void 0 : s.getTime()) || 0;
|
|
801
|
+
m.getTime() > x ? f = { from: f.from, to: m } : f = { from: m, to: f.from };
|
|
795
802
|
}
|
|
796
|
-
|
|
803
|
+
u(f), i(f);
|
|
797
804
|
};
|
|
798
|
-
return /* @__PURE__ */
|
|
799
|
-
var N,
|
|
800
|
-
const s = new Date(
|
|
801
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ e("div", { className: "sa-calendar-months-preview", children: W.map((m, f) => {
|
|
806
|
+
var N, p, w;
|
|
807
|
+
const s = l.from != null && new Date(y, f).getTime() > l.from.getTime() && new Date(y, f).getTime() < (((N = l.to) == null ? void 0 : N.getTime()) || l.from.getTime()), x = h && new Date(y, f) < h || g && new Date(y, f) > g;
|
|
808
|
+
return /* @__PURE__ */ e(
|
|
802
809
|
"p",
|
|
803
810
|
{
|
|
804
|
-
className:
|
|
811
|
+
className: d === y && (f === ((p = l.from) == null ? void 0 : p.getMonth()) || f === ((w = l.to) == null ? void 0 : w.getMonth())) ? "sa-calendar-months-active" : "",
|
|
805
812
|
style: {
|
|
806
813
|
backgroundColor: s ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
807
814
|
pointerEvents: x ? "none" : void 0,
|
|
808
815
|
cursor: x ? "not-allowed" : "pointer",
|
|
809
816
|
color: x ? "var(--sa-color-gray-400, #b7b9be)" : s ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
810
|
-
...
|
|
817
|
+
...r ? {} : { width: "100%" }
|
|
811
818
|
},
|
|
812
819
|
onClick: () => {
|
|
813
|
-
x ||
|
|
820
|
+
x || M(new Date(y, f));
|
|
814
821
|
},
|
|
815
|
-
children:
|
|
822
|
+
children: m.slice(0, 3)
|
|
816
823
|
},
|
|
817
|
-
|
|
824
|
+
f
|
|
818
825
|
);
|
|
819
826
|
}) });
|
|
820
|
-
}, q = (
|
|
821
|
-
const
|
|
822
|
-
return { start:
|
|
827
|
+
}, q = (a) => {
|
|
828
|
+
const n = Math.floor(a / 10) * 10, t = n + 10;
|
|
829
|
+
return { start: n, end: t };
|
|
823
830
|
}, hn = ({
|
|
824
|
-
date:
|
|
825
|
-
filter:
|
|
831
|
+
date: a,
|
|
832
|
+
filter: n,
|
|
826
833
|
setViews: t,
|
|
827
834
|
setDate: o,
|
|
828
835
|
dateRange: l,
|
|
829
|
-
setDateRange:
|
|
830
|
-
onChange:
|
|
831
|
-
minDate:
|
|
832
|
-
maxDate:
|
|
833
|
-
input:
|
|
836
|
+
setDateRange: u,
|
|
837
|
+
onChange: i,
|
|
838
|
+
minDate: h,
|
|
839
|
+
maxDate: g,
|
|
840
|
+
input: r
|
|
834
841
|
}) => {
|
|
835
|
-
var N;
|
|
836
|
-
let
|
|
837
|
-
const
|
|
838
|
-
for (let
|
|
839
|
-
const w = new Date(
|
|
840
|
-
|
|
841
|
-
year:
|
|
842
|
-
active:
|
|
843
|
-
highlight:
|
|
844
|
-
disabled:
|
|
842
|
+
var x, N;
|
|
843
|
+
let d = [];
|
|
844
|
+
const y = a.getFullYear(), { start: M, end: k } = q(y), $ = (x = l.from) == null ? void 0 : x.getFullYear(), m = (N = l.to) == null ? void 0 : N.getFullYear();
|
|
845
|
+
for (let p = M; p < k; p++) {
|
|
846
|
+
const w = new Date(p, 0), c = (!h || w >= h) && (!g || w <= g), v = $ != null && p === $ || m != null && p === m, z = l.from != null && l.to != null && w > l.from && w < l.to;
|
|
847
|
+
d.push({
|
|
848
|
+
year: p,
|
|
849
|
+
active: v && c,
|
|
850
|
+
highlight: z && c,
|
|
851
|
+
disabled: !c
|
|
845
852
|
});
|
|
846
853
|
}
|
|
847
|
-
const
|
|
848
|
-
|
|
849
|
-
},
|
|
850
|
-
var
|
|
854
|
+
const f = (p) => {
|
|
855
|
+
n ? (s(p), o(p)) : (o(p), t("months"));
|
|
856
|
+
}, s = (p) => {
|
|
857
|
+
var c;
|
|
851
858
|
let w = { ...l };
|
|
852
859
|
if (w.from && w.to)
|
|
853
|
-
w = { from:
|
|
860
|
+
w = { from: p, to: null };
|
|
854
861
|
else {
|
|
855
|
-
const
|
|
856
|
-
|
|
862
|
+
const v = ((c = w.from) == null ? void 0 : c.getTime()) || 0;
|
|
863
|
+
p.getTime() > v ? w = { from: w.from, to: p } : w = { from: p, to: w.from };
|
|
857
864
|
}
|
|
858
|
-
|
|
865
|
+
u(w), i(w);
|
|
859
866
|
};
|
|
860
|
-
return /* @__PURE__ */
|
|
867
|
+
return /* @__PURE__ */ e("div", { className: "sa-calendar-years-preview", children: d.map((p, w) => /* @__PURE__ */ e(
|
|
861
868
|
"p",
|
|
862
869
|
{
|
|
863
|
-
className: `${
|
|
870
|
+
className: `${p.active ? "sa-calendar-months-active" : ""} ${p.highlight ? "sa-calendar-months-highlight" : ""} ${p.disabled ? "sa-calendar-disabled" : ""}`,
|
|
864
871
|
onClick: () => {
|
|
865
|
-
|
|
872
|
+
p.disabled || f(new Date(p.year, 0));
|
|
866
873
|
},
|
|
867
874
|
style: {
|
|
868
|
-
backgroundColor:
|
|
869
|
-
color:
|
|
870
|
-
cursor:
|
|
871
|
-
pointerEvents:
|
|
872
|
-
...
|
|
875
|
+
backgroundColor: p.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
876
|
+
color: p.highlight ? "var(--sa-color-gray-500, #8c8f97)" : p.active ? "" : p.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
|
|
877
|
+
cursor: p.disabled ? "not-allowed" : "pointer",
|
|
878
|
+
pointerEvents: p.disbled ? "none" : "all",
|
|
879
|
+
...r ? {} : { width: "100%" }
|
|
873
880
|
},
|
|
874
|
-
children:
|
|
881
|
+
children: p.year
|
|
875
882
|
},
|
|
876
883
|
w
|
|
877
884
|
)) });
|
|
878
|
-
}, tn = ({ ...
|
|
885
|
+
}, tn = ({ ...a }) => /* @__PURE__ */ e(
|
|
879
886
|
"svg",
|
|
880
887
|
{
|
|
881
888
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -883,8 +890,8 @@ const O = (r) => {
|
|
|
883
890
|
height: "20",
|
|
884
891
|
viewBox: "0 0 20 20",
|
|
885
892
|
fill: "none",
|
|
886
|
-
...
|
|
887
|
-
children: /* @__PURE__ */
|
|
893
|
+
...a,
|
|
894
|
+
children: /* @__PURE__ */ e(
|
|
888
895
|
"path",
|
|
889
896
|
{
|
|
890
897
|
d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
|
|
@@ -895,7 +902,7 @@ const O = (r) => {
|
|
|
895
902
|
}
|
|
896
903
|
)
|
|
897
904
|
}
|
|
898
|
-
), sn = ({ ...
|
|
905
|
+
), sn = ({ ...a }) => /* @__PURE__ */ e(
|
|
899
906
|
"svg",
|
|
900
907
|
{
|
|
901
908
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -903,8 +910,8 @@ const O = (r) => {
|
|
|
903
910
|
height: "20",
|
|
904
911
|
viewBox: "0 0 20 20",
|
|
905
912
|
fill: "none",
|
|
906
|
-
...
|
|
907
|
-
children: /* @__PURE__ */
|
|
913
|
+
...a,
|
|
914
|
+
children: /* @__PURE__ */ e(
|
|
908
915
|
"path",
|
|
909
916
|
{
|
|
910
917
|
d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
|
|
@@ -916,172 +923,173 @@ const O = (r) => {
|
|
|
916
923
|
)
|
|
917
924
|
}
|
|
918
925
|
), gn = ({
|
|
919
|
-
setViews:
|
|
920
|
-
views:
|
|
926
|
+
setViews: a,
|
|
927
|
+
views: n,
|
|
921
928
|
filter: t,
|
|
922
929
|
date: o,
|
|
923
930
|
setDate: l
|
|
924
931
|
}) => {
|
|
925
|
-
const
|
|
926
|
-
t ||
|
|
927
|
-
},
|
|
928
|
-
if (
|
|
929
|
-
l((
|
|
932
|
+
const u = () => {
|
|
933
|
+
t || a((r) => r === "days" ? "months" : r === "months" ? "years" : "days");
|
|
934
|
+
}, i = () => {
|
|
935
|
+
if (n === "years") {
|
|
936
|
+
l((r) => new Date(r.getFullYear() + 10, 0));
|
|
930
937
|
return;
|
|
931
938
|
}
|
|
932
|
-
if (
|
|
933
|
-
l((
|
|
939
|
+
if (n === "months") {
|
|
940
|
+
l((r) => new Date(r.getFullYear() + 1, r.getMonth()));
|
|
934
941
|
return;
|
|
935
942
|
}
|
|
936
|
-
l((
|
|
937
|
-
},
|
|
938
|
-
if (
|
|
939
|
-
l((
|
|
943
|
+
l((r) => new Date(r.getFullYear(), r.getMonth() + 1));
|
|
944
|
+
}, h = () => {
|
|
945
|
+
if (n === "years") {
|
|
946
|
+
l((r) => new Date(r.getFullYear() - 10, 0));
|
|
940
947
|
return;
|
|
941
948
|
}
|
|
942
|
-
if (
|
|
943
|
-
l((
|
|
949
|
+
if (n === "months") {
|
|
950
|
+
l((r) => new Date(r.getFullYear() - 1, r.getMonth()));
|
|
944
951
|
return;
|
|
945
952
|
}
|
|
946
953
|
l(
|
|
947
|
-
(
|
|
948
|
-
|
|
949
|
-
|
|
954
|
+
(r) => new Date(
|
|
955
|
+
r.getMonth() === 0 ? r.getFullYear() - 1 : r.getFullYear(),
|
|
956
|
+
r.getMonth() === 0 ? 11 : r.getMonth() - 1
|
|
950
957
|
)
|
|
951
958
|
);
|
|
952
959
|
};
|
|
953
960
|
return /* @__PURE__ */ Y("div", { className: "sa-calendar-header", children: [
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
if (
|
|
961
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-header-title", onClick: u, children: (() => {
|
|
962
|
+
if (n === "days")
|
|
956
963
|
return `${W[o.getMonth()]} ${o.getFullYear()}`;
|
|
957
|
-
if (
|
|
964
|
+
if (n === "months")
|
|
958
965
|
return `${o.getFullYear()}`;
|
|
959
|
-
if (
|
|
966
|
+
if (n === "years")
|
|
960
967
|
return `${q(o.getFullYear()).start} ~ ${q(o.getFullYear()).end}`;
|
|
961
968
|
})() }),
|
|
962
969
|
/* @__PURE__ */ Y("div", { className: "sa-calendar-header-nav", children: [
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ e("button", { className: "sa-calendar-nav-btn", onClick: h, children: /* @__PURE__ */ e(tn, {}) }),
|
|
971
|
+
/* @__PURE__ */ e("button", { className: "sa-calendar-nav-btn", onClick: i, children: /* @__PURE__ */ e(sn, {}) })
|
|
965
972
|
] })
|
|
966
973
|
] });
|
|
967
974
|
};
|
|
968
|
-
function P(
|
|
969
|
-
const
|
|
970
|
-
return `${
|
|
975
|
+
function P(a) {
|
|
976
|
+
const n = new Date(a), t = n.getFullYear(), o = n.getMonth();
|
|
977
|
+
return `${n.getDate().toString().padStart(2, "0")} ${ln[o]} ${t}`;
|
|
971
978
|
}
|
|
972
979
|
const on = ({
|
|
973
|
-
label:
|
|
974
|
-
labelPosition:
|
|
980
|
+
label: a,
|
|
981
|
+
labelPosition: n = "outside-top",
|
|
975
982
|
required: t,
|
|
976
983
|
optional: o,
|
|
977
984
|
description: l,
|
|
978
|
-
helperText:
|
|
979
|
-
errorText:
|
|
980
|
-
fullWidth:
|
|
981
|
-
children:
|
|
985
|
+
helperText: u,
|
|
986
|
+
errorText: i,
|
|
987
|
+
fullWidth: h,
|
|
988
|
+
children: g
|
|
982
989
|
}) => {
|
|
983
|
-
const
|
|
990
|
+
const r = [
|
|
984
991
|
"sa-date-field",
|
|
985
|
-
|
|
986
|
-
].filter(Boolean).join(" "),
|
|
987
|
-
/* @__PURE__ */
|
|
988
|
-
o && /* @__PURE__ */
|
|
989
|
-
t && /* @__PURE__ */
|
|
990
|
-
] }) : null,
|
|
991
|
-
|
|
992
|
-
|
|
992
|
+
h ? "sa-date-field-fullwidth" : ""
|
|
993
|
+
].filter(Boolean).join(" "), d = a ? /* @__PURE__ */ Y("div", { className: "sa-date-field-label-row", children: [
|
|
994
|
+
/* @__PURE__ */ e("span", { className: "sa-date-field-label-text", children: a }),
|
|
995
|
+
o && /* @__PURE__ */ e("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
|
|
996
|
+
t && /* @__PURE__ */ e("span", { className: "sa-date-field-required", children: "*" })
|
|
997
|
+
] }) : null, y = /* @__PURE__ */ Y(en, { children: [
|
|
998
|
+
u && !i && /* @__PURE__ */ e("p", { className: "sa-date-field-helper", children: u }),
|
|
999
|
+
i && /* @__PURE__ */ e("p", { className: "sa-date-field-error-msg", children: i })
|
|
993
1000
|
] });
|
|
994
|
-
return
|
|
1001
|
+
return a ? n === "outside-left" ? /* @__PURE__ */ Y("div", { className: `${r} sa-date-field-left`, children: [
|
|
995
1002
|
/* @__PURE__ */ Y("div", { className: "sa-date-field-left-label", children: [
|
|
996
|
-
|
|
997
|
-
l && /* @__PURE__ */
|
|
1003
|
+
d,
|
|
1004
|
+
l && /* @__PURE__ */ e("p", { className: "sa-date-field-helper-top", children: l })
|
|
998
1005
|
] }),
|
|
999
1006
|
/* @__PURE__ */ Y("div", { className: "sa-date-field-input-wrap", children: [
|
|
1000
|
-
|
|
1001
|
-
|
|
1007
|
+
g,
|
|
1008
|
+
y
|
|
1002
1009
|
] })
|
|
1003
|
-
] }) : /* @__PURE__ */ Y("div", { className:
|
|
1004
|
-
|
|
1005
|
-
l && /* @__PURE__ */
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
] }) : /* @__PURE__ */ Y("div", { className:
|
|
1009
|
-
l && /* @__PURE__ */
|
|
1010
|
-
|
|
1011
|
-
|
|
1010
|
+
] }) : /* @__PURE__ */ Y("div", { className: r, children: [
|
|
1011
|
+
d,
|
|
1012
|
+
l && /* @__PURE__ */ e("p", { className: "sa-date-field-helper-top", children: l }),
|
|
1013
|
+
g,
|
|
1014
|
+
y
|
|
1015
|
+
] }) : /* @__PURE__ */ Y("div", { className: r, children: [
|
|
1016
|
+
l && /* @__PURE__ */ e("p", { className: "sa-date-field-helper-top", children: l }),
|
|
1017
|
+
g,
|
|
1018
|
+
y
|
|
1012
1019
|
] });
|
|
1013
|
-
}, X = "sa-calendar-styles", fn = (
|
|
1020
|
+
}, X = "sa-calendar-styles", fn = (a) => {
|
|
1014
1021
|
if (!document.getElementById(X)) {
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1022
|
+
const n = document.createElement("style");
|
|
1023
|
+
n.id = X, n.textContent = a, document.head.appendChild(n);
|
|
1017
1024
|
}
|
|
1018
1025
|
};
|
|
1019
|
-
fn(
|
|
1026
|
+
fn(R);
|
|
1020
1027
|
const bn = K(
|
|
1021
1028
|
({
|
|
1022
|
-
value:
|
|
1023
|
-
onChange:
|
|
1029
|
+
value: a,
|
|
1030
|
+
onChange: n,
|
|
1024
1031
|
filter: t,
|
|
1025
1032
|
input: o = !0,
|
|
1026
1033
|
disabled: l,
|
|
1027
|
-
minDate:
|
|
1028
|
-
maxDate:
|
|
1029
|
-
placeholder:
|
|
1030
|
-
size:
|
|
1031
|
-
variant:
|
|
1032
|
-
status:
|
|
1033
|
-
clearable:
|
|
1034
|
-
fullWidth:
|
|
1035
|
-
withPadding:
|
|
1036
|
-
label:
|
|
1037
|
-
labelPosition:
|
|
1038
|
-
required:
|
|
1039
|
-
optional:
|
|
1040
|
-
description:
|
|
1041
|
-
helperText:
|
|
1042
|
-
errorText:
|
|
1043
|
-
},
|
|
1044
|
-
const
|
|
1045
|
-
from: (
|
|
1046
|
-
to: (
|
|
1034
|
+
minDate: u,
|
|
1035
|
+
maxDate: i,
|
|
1036
|
+
placeholder: h,
|
|
1037
|
+
size: g,
|
|
1038
|
+
variant: r,
|
|
1039
|
+
status: d,
|
|
1040
|
+
clearable: y,
|
|
1041
|
+
fullWidth: M = !0,
|
|
1042
|
+
withPadding: k = !0,
|
|
1043
|
+
label: $,
|
|
1044
|
+
labelPosition: m,
|
|
1045
|
+
required: f,
|
|
1046
|
+
optional: s,
|
|
1047
|
+
description: x,
|
|
1048
|
+
helperText: N,
|
|
1049
|
+
errorText: p
|
|
1050
|
+
}, w) => {
|
|
1051
|
+
const c = p ? "error" : d, { ref: v, isComponentVisible: z, setIsComponentVisible: S } = rn(!1), C = J(null), [L, I] = A("days"), [T, F] = A(/* @__PURE__ */ new Date()), [D, E] = A({
|
|
1052
|
+
from: (a == null ? void 0 : a.from) ?? null,
|
|
1053
|
+
to: (a == null ? void 0 : a.to) ?? null
|
|
1047
1054
|
});
|
|
1048
1055
|
B(() => {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1056
|
+
if (a) {
|
|
1057
|
+
const b = a;
|
|
1058
|
+
b.from && F(b.from), E(b);
|
|
1059
|
+
} else
|
|
1060
|
+
F(/* @__PURE__ */ new Date()), E({ from: null, to: null });
|
|
1061
|
+
}, [a]), B(() => {
|
|
1054
1062
|
t && I(t);
|
|
1055
1063
|
}, [t]), B(() => {
|
|
1056
1064
|
t || I("days");
|
|
1057
|
-
}, [
|
|
1065
|
+
}, [z]), B(() => {
|
|
1058
1066
|
o || S(!0);
|
|
1059
1067
|
}, [o]);
|
|
1060
1068
|
const G = () => {
|
|
1061
|
-
var
|
|
1062
|
-
if (!
|
|
1069
|
+
var b, V;
|
|
1070
|
+
if (!a)
|
|
1063
1071
|
return "";
|
|
1064
1072
|
if (t) {
|
|
1065
|
-
if (
|
|
1066
|
-
return `${P(
|
|
1067
|
-
if (
|
|
1068
|
-
return `${W[
|
|
1069
|
-
if (
|
|
1070
|
-
return `${(
|
|
1073
|
+
if (L === "days")
|
|
1074
|
+
return `${P(D.from)} ~ ${P(D.to || D.from) || "-"}`;
|
|
1075
|
+
if (L === "months")
|
|
1076
|
+
return `${W[D.from.getMonth()]} ~ ${D.to ? W[D.to.getMonth()] : "-"}`;
|
|
1077
|
+
if (L === "years")
|
|
1078
|
+
return `${(b = D.from) == null ? void 0 : b.getFullYear()} ~ ${((V = D.to) == null ? void 0 : V.getFullYear()) || "-"}`;
|
|
1071
1079
|
} else
|
|
1072
|
-
return `${P(
|
|
1080
|
+
return `${P(D.from)} ~ ${P(D.to || D.from) || "-"}`;
|
|
1073
1081
|
}, j = () => {
|
|
1074
|
-
if (
|
|
1075
|
-
const
|
|
1076
|
-
window.innerWidth <
|
|
1082
|
+
if (C.current && v.current && o) {
|
|
1083
|
+
const b = v.current.getBoundingClientRect(), V = C.current.getBoundingClientRect();
|
|
1084
|
+
window.innerWidth < b.left + V.width ? C.current.style.left = `${b.left - V.width + b.width}px` : C.current.style.left = `${b.left}px`, b.top + V.height > window.innerHeight ? C.current.style.top = `${b.y - (b.height + V.height - 28)}px` : C.current.style.top = `${b.y + b.height}px`;
|
|
1077
1085
|
}
|
|
1078
1086
|
};
|
|
1079
1087
|
B(() => {
|
|
1080
|
-
|
|
1081
|
-
}, [
|
|
1082
|
-
const
|
|
1083
|
-
return
|
|
1084
|
-
|
|
1088
|
+
C.current && v.current && o && j();
|
|
1089
|
+
}, [C, v, z]), B(() => {
|
|
1090
|
+
const b = w == null ? void 0 : w.current;
|
|
1091
|
+
return b && b.addEventListener("scroll", j), window.addEventListener("scroll", j), () => {
|
|
1092
|
+
b && b.removeEventListener("scroll", j), window.removeEventListener("scroll", j);
|
|
1085
1093
|
};
|
|
1086
1094
|
}, []);
|
|
1087
1095
|
const U = /* @__PURE__ */ Y(
|
|
@@ -1089,9 +1097,9 @@ const bn = K(
|
|
|
1089
1097
|
{
|
|
1090
1098
|
className: "sa-calendar-wrapper",
|
|
1091
1099
|
style: { height: o ? "auto" : "100%" },
|
|
1092
|
-
ref: o ?
|
|
1100
|
+
ref: o ? v : null,
|
|
1093
1101
|
children: [
|
|
1094
|
-
o ? /* @__PURE__ */
|
|
1102
|
+
o ? /* @__PURE__ */ e(
|
|
1095
1103
|
cn,
|
|
1096
1104
|
{
|
|
1097
1105
|
value: G(),
|
|
@@ -1102,73 +1110,73 @@ const bn = K(
|
|
|
1102
1110
|
onChange: () => {
|
|
1103
1111
|
},
|
|
1104
1112
|
disabled: l,
|
|
1105
|
-
placeholder:
|
|
1106
|
-
size:
|
|
1107
|
-
variant:
|
|
1108
|
-
status:
|
|
1109
|
-
clearable:
|
|
1110
|
-
onClear: () =>
|
|
1113
|
+
placeholder: h,
|
|
1114
|
+
size: g,
|
|
1115
|
+
variant: r,
|
|
1116
|
+
status: c,
|
|
1117
|
+
clearable: y,
|
|
1118
|
+
onClear: () => n(void 0)
|
|
1111
1119
|
}
|
|
1112
1120
|
) : null,
|
|
1113
|
-
|
|
1121
|
+
z ? /* @__PURE__ */ Y(
|
|
1114
1122
|
"div",
|
|
1115
1123
|
{
|
|
1116
|
-
className: `sa-calendar sa-calendar-size-${
|
|
1124
|
+
className: `sa-calendar sa-calendar-size-${g || "md"} ${o ? "" : "sa-calendar-no-input"} ${k ? "" : "sa-calendar-no-padding"}`,
|
|
1117
1125
|
style: l ? { pointerEvents: "none" } : void 0,
|
|
1118
|
-
ref:
|
|
1126
|
+
ref: C,
|
|
1119
1127
|
children: [
|
|
1120
|
-
/* @__PURE__ */
|
|
1128
|
+
/* @__PURE__ */ e(
|
|
1121
1129
|
gn,
|
|
1122
1130
|
{
|
|
1123
1131
|
setViews: I,
|
|
1124
|
-
views:
|
|
1132
|
+
views: L,
|
|
1125
1133
|
filter: t,
|
|
1126
|
-
date:
|
|
1127
|
-
setDate:
|
|
1134
|
+
date: T,
|
|
1135
|
+
setDate: F
|
|
1128
1136
|
}
|
|
1129
1137
|
),
|
|
1130
|
-
/* @__PURE__ */
|
|
1138
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-body", children: L === "days" ? /* @__PURE__ */ e(
|
|
1131
1139
|
un,
|
|
1132
1140
|
{
|
|
1133
|
-
date:
|
|
1134
|
-
setDate:
|
|
1141
|
+
date: T,
|
|
1142
|
+
setDate: F,
|
|
1135
1143
|
setIsComponentVisible: S,
|
|
1136
|
-
dateRange:
|
|
1137
|
-
setDateRange:
|
|
1144
|
+
dateRange: D,
|
|
1145
|
+
setDateRange: E,
|
|
1138
1146
|
input: o,
|
|
1139
|
-
onChange:
|
|
1140
|
-
minDate:
|
|
1141
|
-
maxDate:
|
|
1147
|
+
onChange: n,
|
|
1148
|
+
minDate: u,
|
|
1149
|
+
maxDate: i
|
|
1142
1150
|
}
|
|
1143
|
-
) :
|
|
1151
|
+
) : L === "months" ? /* @__PURE__ */ e(
|
|
1144
1152
|
pn,
|
|
1145
1153
|
{
|
|
1146
|
-
date:
|
|
1147
|
-
setDate:
|
|
1154
|
+
date: T,
|
|
1155
|
+
setDate: F,
|
|
1148
1156
|
filter: t,
|
|
1149
1157
|
setViews: I,
|
|
1150
|
-
dateRange:
|
|
1151
|
-
setDateRange:
|
|
1158
|
+
dateRange: D,
|
|
1159
|
+
setDateRange: E,
|
|
1152
1160
|
setIsComponentVisible: S,
|
|
1153
1161
|
input: o,
|
|
1154
|
-
onChange:
|
|
1155
|
-
minDate:
|
|
1156
|
-
maxDate:
|
|
1162
|
+
onChange: n,
|
|
1163
|
+
minDate: u,
|
|
1164
|
+
maxDate: i
|
|
1157
1165
|
}
|
|
1158
|
-
) : /* @__PURE__ */
|
|
1166
|
+
) : /* @__PURE__ */ e(
|
|
1159
1167
|
hn,
|
|
1160
1168
|
{
|
|
1161
|
-
date:
|
|
1162
|
-
setDate:
|
|
1169
|
+
date: T,
|
|
1170
|
+
setDate: F,
|
|
1163
1171
|
filter: t,
|
|
1164
1172
|
setViews: I,
|
|
1165
|
-
dateRange:
|
|
1166
|
-
setDateRange:
|
|
1173
|
+
dateRange: D,
|
|
1174
|
+
setDateRange: E,
|
|
1167
1175
|
setIsComponentVisible: S,
|
|
1168
1176
|
input: o,
|
|
1169
|
-
onChange:
|
|
1170
|
-
minDate:
|
|
1171
|
-
maxDate:
|
|
1177
|
+
onChange: n,
|
|
1178
|
+
minDate: u,
|
|
1179
|
+
maxDate: i
|
|
1172
1180
|
}
|
|
1173
1181
|
) })
|
|
1174
1182
|
]
|
|
@@ -1177,63 +1185,63 @@ const bn = K(
|
|
|
1177
1185
|
]
|
|
1178
1186
|
}
|
|
1179
1187
|
);
|
|
1180
|
-
return /* @__PURE__ */
|
|
1188
|
+
return /* @__PURE__ */ e(
|
|
1181
1189
|
on,
|
|
1182
1190
|
{
|
|
1183
|
-
label:
|
|
1184
|
-
labelPosition:
|
|
1185
|
-
required:
|
|
1186
|
-
optional:
|
|
1187
|
-
description:
|
|
1188
|
-
helperText:
|
|
1189
|
-
errorText:
|
|
1190
|
-
fullWidth:
|
|
1191
|
+
label: $,
|
|
1192
|
+
labelPosition: m,
|
|
1193
|
+
required: f,
|
|
1194
|
+
optional: s,
|
|
1195
|
+
description: x,
|
|
1196
|
+
helperText: N,
|
|
1197
|
+
errorText: p,
|
|
1198
|
+
fullWidth: M,
|
|
1191
1199
|
children: U
|
|
1192
1200
|
}
|
|
1193
1201
|
);
|
|
1194
1202
|
}
|
|
1195
|
-
), _ = "sa-calendar-input-styles",
|
|
1203
|
+
), _ = "sa-calendar-input-styles", mn = (a) => {
|
|
1196
1204
|
if (!document.getElementById(_)) {
|
|
1197
|
-
const
|
|
1198
|
-
|
|
1205
|
+
const n = document.createElement("style");
|
|
1206
|
+
n.id = _, n.textContent = a, document.head.appendChild(n);
|
|
1199
1207
|
}
|
|
1200
1208
|
};
|
|
1201
|
-
|
|
1202
|
-
const H = (
|
|
1203
|
-
if (
|
|
1209
|
+
mn(R);
|
|
1210
|
+
const H = (a) => {
|
|
1211
|
+
if (a === "sm")
|
|
1204
1212
|
return 16;
|
|
1205
|
-
if (
|
|
1213
|
+
if (a === "md")
|
|
1206
1214
|
return 16;
|
|
1207
|
-
if (
|
|
1215
|
+
if (a === "lg")
|
|
1208
1216
|
return 20;
|
|
1209
|
-
},
|
|
1217
|
+
}, vn = (a) => {
|
|
1210
1218
|
const {
|
|
1211
|
-
size:
|
|
1219
|
+
size: n = "md",
|
|
1212
1220
|
status: t = "default",
|
|
1213
1221
|
variant: o = "outline",
|
|
1214
1222
|
clearable: l,
|
|
1215
|
-
onClear:
|
|
1216
|
-
...
|
|
1217
|
-
} =
|
|
1218
|
-
|
|
1219
|
-
},
|
|
1220
|
-
|
|
1223
|
+
onClear: u,
|
|
1224
|
+
...i
|
|
1225
|
+
} = a, h = J(null), g = () => {
|
|
1226
|
+
h.current && i.onClick && (h.current.focus(), i.onClick(""));
|
|
1227
|
+
}, r = t === "disable" || i.disabled, d = !!i.value, y = l && d && !r, M = (k) => {
|
|
1228
|
+
k.stopPropagation(), u == null || u();
|
|
1221
1229
|
};
|
|
1222
1230
|
return /* @__PURE__ */ Y(
|
|
1223
1231
|
"div",
|
|
1224
1232
|
{
|
|
1225
|
-
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${t} ${
|
|
1226
|
-
onClick:
|
|
1233
|
+
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${t} ${n} `,
|
|
1234
|
+
onClick: g,
|
|
1227
1235
|
children: [
|
|
1228
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ e(
|
|
1229
1237
|
"svg",
|
|
1230
1238
|
{
|
|
1231
1239
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1232
|
-
width: H(
|
|
1233
|
-
height: H(
|
|
1240
|
+
width: H(n),
|
|
1241
|
+
height: H(n),
|
|
1234
1242
|
viewBox: "0 0 20 20",
|
|
1235
1243
|
fill: "none",
|
|
1236
|
-
children: /* @__PURE__ */
|
|
1244
|
+
children: /* @__PURE__ */ e(
|
|
1237
1245
|
"path",
|
|
1238
1246
|
{
|
|
1239
1247
|
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",
|
|
@@ -1245,32 +1253,32 @@ const H = (r) => {
|
|
|
1245
1253
|
)
|
|
1246
1254
|
}
|
|
1247
1255
|
) }),
|
|
1248
|
-
/* @__PURE__ */
|
|
1256
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ e(
|
|
1249
1257
|
"input",
|
|
1250
1258
|
{
|
|
1251
1259
|
className: "sa-calendar-input",
|
|
1252
|
-
...
|
|
1253
|
-
disabled:
|
|
1254
|
-
value:
|
|
1255
|
-
ref:
|
|
1260
|
+
...i,
|
|
1261
|
+
disabled: r,
|
|
1262
|
+
value: i.value,
|
|
1263
|
+
ref: h
|
|
1256
1264
|
}
|
|
1257
1265
|
) }),
|
|
1258
|
-
|
|
1266
|
+
y ? /* @__PURE__ */ e(
|
|
1259
1267
|
"button",
|
|
1260
1268
|
{
|
|
1261
1269
|
type: "button",
|
|
1262
1270
|
"aria-label": "Clear date",
|
|
1263
1271
|
className: "sa-calendar-input-clear",
|
|
1264
|
-
onClick:
|
|
1265
|
-
children: /* @__PURE__ */
|
|
1272
|
+
onClick: M,
|
|
1273
|
+
children: /* @__PURE__ */ e(
|
|
1266
1274
|
"svg",
|
|
1267
1275
|
{
|
|
1268
1276
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1269
|
-
width: H(
|
|
1270
|
-
height: H(
|
|
1277
|
+
width: H(n),
|
|
1278
|
+
height: H(n),
|
|
1271
1279
|
viewBox: "0 0 20 20",
|
|
1272
1280
|
fill: "none",
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1281
|
+
children: /* @__PURE__ */ e(
|
|
1274
1282
|
"path",
|
|
1275
1283
|
{
|
|
1276
1284
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -1283,15 +1291,15 @@ const H = (r) => {
|
|
|
1283
1291
|
}
|
|
1284
1292
|
)
|
|
1285
1293
|
}
|
|
1286
|
-
) : /* @__PURE__ */
|
|
1294
|
+
) : /* @__PURE__ */ e("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ e(
|
|
1287
1295
|
"svg",
|
|
1288
1296
|
{
|
|
1289
1297
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1290
|
-
width: H(
|
|
1291
|
-
height: H(
|
|
1298
|
+
width: H(n),
|
|
1299
|
+
height: H(n),
|
|
1292
1300
|
viewBox: "0 0 20 20",
|
|
1293
1301
|
fill: "none",
|
|
1294
|
-
children: /* @__PURE__ */
|
|
1302
|
+
children: /* @__PURE__ */ e(
|
|
1295
1303
|
"path",
|
|
1296
1304
|
{
|
|
1297
1305
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -1307,46 +1315,47 @@ const H = (r) => {
|
|
|
1307
1315
|
}
|
|
1308
1316
|
);
|
|
1309
1317
|
}, yn = ({
|
|
1310
|
-
date:
|
|
1311
|
-
setDate:
|
|
1318
|
+
date: a,
|
|
1319
|
+
setDate: n,
|
|
1312
1320
|
previewDate: t,
|
|
1313
1321
|
setPreviewDate: o,
|
|
1314
1322
|
setIsComponentVisible: l,
|
|
1315
|
-
minDate:
|
|
1316
|
-
maxDate:
|
|
1317
|
-
input:
|
|
1318
|
-
onChange:
|
|
1323
|
+
minDate: u,
|
|
1324
|
+
maxDate: i,
|
|
1325
|
+
input: h,
|
|
1326
|
+
onChange: g,
|
|
1327
|
+
hasValue: r
|
|
1319
1328
|
}) => {
|
|
1320
|
-
let
|
|
1329
|
+
let d = new Date(
|
|
1321
1330
|
t.getFullYear(),
|
|
1322
1331
|
t.getMonth(),
|
|
1323
1332
|
1
|
|
1324
|
-
),
|
|
1325
|
-
const k =
|
|
1333
|
+
), y = d.getDay(), M = [];
|
|
1334
|
+
const k = a.toDateString(), $ = (/* @__PURE__ */ new Date()).toDateString(), m = t.getMonth();
|
|
1326
1335
|
for (let s = 0; s < 42; s++) {
|
|
1327
|
-
s === 0 &&
|
|
1328
|
-
|
|
1329
|
-
) :
|
|
1336
|
+
s === 0 && y === 0 ? d.setDate(d.getDate() - 7) : s === 0 ? d.setDate(
|
|
1337
|
+
d.getDate() + (s - y)
|
|
1338
|
+
) : d.setDate(d.getDate() + 1);
|
|
1330
1339
|
let x = {
|
|
1331
|
-
currentMonth:
|
|
1332
|
-
date: new Date(
|
|
1333
|
-
month:
|
|
1334
|
-
number:
|
|
1335
|
-
selected:
|
|
1336
|
-
isToday:
|
|
1337
|
-
year:
|
|
1338
|
-
isDisabled:
|
|
1340
|
+
currentMonth: d.getMonth() === m,
|
|
1341
|
+
date: new Date(d),
|
|
1342
|
+
month: d.getMonth(),
|
|
1343
|
+
number: d.getDate(),
|
|
1344
|
+
selected: r && d.toDateString() === k,
|
|
1345
|
+
isToday: d.toDateString() === $,
|
|
1346
|
+
year: d.getFullYear(),
|
|
1347
|
+
isDisabled: u && d < u || i && d > i
|
|
1339
1348
|
};
|
|
1340
|
-
|
|
1349
|
+
M.push(x);
|
|
1341
1350
|
}
|
|
1342
|
-
const
|
|
1343
|
-
(!
|
|
1351
|
+
const f = (s) => {
|
|
1352
|
+
(!u || s >= u) && (!i || s <= i) && (n(s), g(s), o(s), h && l(!1));
|
|
1344
1353
|
};
|
|
1345
1354
|
return /* @__PURE__ */ Y("div", { className: "sa-calendar-days-preivew", children: [
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-days-name-preivew", children: an.map((s, x) => /* @__PURE__ */ e("p", { children: s }, x)) }),
|
|
1356
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-days-number-preivew", children: M.map((s, x) => {
|
|
1348
1357
|
const N = s.isDisabled;
|
|
1349
|
-
return /* @__PURE__ */
|
|
1358
|
+
return /* @__PURE__ */ e(
|
|
1350
1359
|
"p",
|
|
1351
1360
|
{
|
|
1352
1361
|
className: `${s.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${s.selected ? "sa-calendar-days-active" : ""} ${s.isToday && !s.selected ? "sa-calendar-days-today" : ""}`,
|
|
@@ -1354,10 +1363,10 @@ const H = (r) => {
|
|
|
1354
1363
|
color: N ? "#ccc" : void 0,
|
|
1355
1364
|
pointerEvents: N ? "none" : void 0,
|
|
1356
1365
|
cursor: N ? "not-allowed" : "pointer",
|
|
1357
|
-
...
|
|
1366
|
+
...h ? {} : { width: "100%" }
|
|
1358
1367
|
},
|
|
1359
1368
|
onClick: () => {
|
|
1360
|
-
N ||
|
|
1369
|
+
N || f(s.date);
|
|
1361
1370
|
},
|
|
1362
1371
|
children: s.number
|
|
1363
1372
|
},
|
|
@@ -1366,65 +1375,71 @@ const H = (r) => {
|
|
|
1366
1375
|
}) })
|
|
1367
1376
|
] });
|
|
1368
1377
|
}, wn = ({
|
|
1369
|
-
date:
|
|
1370
|
-
setDate:
|
|
1378
|
+
date: a,
|
|
1379
|
+
setDate: n,
|
|
1371
1380
|
filter: t,
|
|
1372
1381
|
setViews: o,
|
|
1373
1382
|
onChange: l,
|
|
1374
|
-
previewDate:
|
|
1375
|
-
setPreviewDate:
|
|
1376
|
-
minDate:
|
|
1377
|
-
maxDate:
|
|
1378
|
-
input:
|
|
1383
|
+
previewDate: u,
|
|
1384
|
+
setPreviewDate: i,
|
|
1385
|
+
minDate: h,
|
|
1386
|
+
maxDate: g,
|
|
1387
|
+
input: r,
|
|
1388
|
+
hasValue: d
|
|
1379
1389
|
}) => {
|
|
1380
|
-
const
|
|
1381
|
-
(!
|
|
1390
|
+
const y = a.getMonth(), M = a.getFullYear(), k = u.getFullYear(), $ = (m) => {
|
|
1391
|
+
(!h || m >= h) && (!g || m <= g) && (t ? (l(m), n(m), i(m)) : (o("days"), i(m)));
|
|
1382
1392
|
};
|
|
1383
|
-
return /* @__PURE__ */
|
|
1384
|
-
const s =
|
|
1385
|
-
return /* @__PURE__ */
|
|
1393
|
+
return /* @__PURE__ */ e("div", { className: "sa-calendar-months-preview", children: W.map((m, f) => {
|
|
1394
|
+
const s = h && new Date(k, f, 1) < h || g && new Date(k, f + 1, 0) > g;
|
|
1395
|
+
return /* @__PURE__ */ e(
|
|
1386
1396
|
"p",
|
|
1387
1397
|
{
|
|
1388
|
-
className:
|
|
1398
|
+
className: d && f === y && k === M ? "sa-calendar-months-active" : "",
|
|
1389
1399
|
style: {
|
|
1390
1400
|
color: s ? "#ccc" : void 0,
|
|
1391
1401
|
pointerEvents: s ? "none" : void 0,
|
|
1392
1402
|
cursor: s ? "not-allowed" : "pointer",
|
|
1393
|
-
...
|
|
1403
|
+
...r ? {} : { width: "100%" }
|
|
1394
1404
|
},
|
|
1395
1405
|
onClick: () => {
|
|
1396
|
-
s ||
|
|
1406
|
+
s || $(new Date(k, f));
|
|
1397
1407
|
},
|
|
1398
|
-
children:
|
|
1408
|
+
children: m.slice(0, 3)
|
|
1399
1409
|
},
|
|
1400
|
-
|
|
1410
|
+
f
|
|
1401
1411
|
);
|
|
1402
1412
|
}) });
|
|
1403
|
-
}, Z = (
|
|
1404
|
-
const
|
|
1405
|
-
return { start:
|
|
1413
|
+
}, Z = (a) => {
|
|
1414
|
+
const n = Math.floor(a / 10) * 10, t = n + 10;
|
|
1415
|
+
return { start: n, end: t };
|
|
1406
1416
|
}, xn = ({
|
|
1407
|
-
date:
|
|
1408
|
-
filter:
|
|
1417
|
+
date: a,
|
|
1418
|
+
filter: n,
|
|
1409
1419
|
setViews: t,
|
|
1410
1420
|
setDate: o,
|
|
1411
1421
|
onChange: l,
|
|
1412
|
-
previewDate:
|
|
1413
|
-
setPreviewDate:
|
|
1414
|
-
minDate:
|
|
1415
|
-
maxDate:
|
|
1416
|
-
input:
|
|
1422
|
+
previewDate: u,
|
|
1423
|
+
setPreviewDate: i,
|
|
1424
|
+
minDate: h,
|
|
1425
|
+
maxDate: g,
|
|
1426
|
+
input: r,
|
|
1427
|
+
hasValue: d
|
|
1417
1428
|
}) => {
|
|
1418
|
-
let
|
|
1419
|
-
const
|
|
1420
|
-
for (let s = k; s <
|
|
1421
|
-
let x =
|
|
1422
|
-
|
|
1429
|
+
let y = [];
|
|
1430
|
+
const M = u.getFullYear(), { start: k, end: $ } = Z(M), m = a.getFullYear();
|
|
1431
|
+
for (let s = k; s < $; s++) {
|
|
1432
|
+
let x = h && new Date(s, 0, 1) < h || g && new Date(s, 11, 31) > g;
|
|
1433
|
+
y.push({
|
|
1434
|
+
year: s,
|
|
1435
|
+
active: !!d && s === m,
|
|
1436
|
+
isDisabled: x
|
|
1437
|
+
});
|
|
1423
1438
|
}
|
|
1424
|
-
const
|
|
1425
|
-
(!
|
|
1439
|
+
const f = (s) => {
|
|
1440
|
+
(!h || s >= h) && (!g || s <= g) && (n ? (l(s), o(s), i(s)) : (t("months"), i(s)));
|
|
1426
1441
|
};
|
|
1427
|
-
return /* @__PURE__ */
|
|
1442
|
+
return /* @__PURE__ */ e("div", { className: "sa-calendar-years-preview", children: y.map((s, x) => /* @__PURE__ */ e(
|
|
1428
1443
|
"p",
|
|
1429
1444
|
{
|
|
1430
1445
|
className: s.active ? "sa-calendar-months-active" : "",
|
|
@@ -1432,121 +1447,121 @@ const H = (r) => {
|
|
|
1432
1447
|
color: s.isDisabled ? "#ccc" : void 0,
|
|
1433
1448
|
pointerEvents: s.isDisabled ? "none" : void 0,
|
|
1434
1449
|
cursor: s.isDisabled ? "not-allowed" : "pointer",
|
|
1435
|
-
...
|
|
1450
|
+
...r ? {} : { width: "100%" }
|
|
1436
1451
|
},
|
|
1437
1452
|
onClick: () => {
|
|
1438
|
-
s.isDisabled ||
|
|
1453
|
+
s.isDisabled || f(new Date(s.year, 0));
|
|
1439
1454
|
},
|
|
1440
1455
|
children: s.year
|
|
1441
1456
|
},
|
|
1442
1457
|
x
|
|
1443
1458
|
)) });
|
|
1444
1459
|
}, kn = ({
|
|
1445
|
-
setViews:
|
|
1446
|
-
views:
|
|
1460
|
+
setViews: a,
|
|
1461
|
+
views: n,
|
|
1447
1462
|
filter: t,
|
|
1448
1463
|
previewDate: o,
|
|
1449
1464
|
setPreviewDate: l
|
|
1450
1465
|
}) => {
|
|
1451
|
-
const
|
|
1452
|
-
t ||
|
|
1453
|
-
},
|
|
1454
|
-
if (
|
|
1455
|
-
l((
|
|
1466
|
+
const u = () => {
|
|
1467
|
+
t || a((r) => r === "days" ? "months" : r === "months" ? "years" : "days");
|
|
1468
|
+
}, i = () => {
|
|
1469
|
+
if (n === "years") {
|
|
1470
|
+
l((r) => new Date(r.getFullYear() + 10, 0));
|
|
1456
1471
|
return;
|
|
1457
1472
|
}
|
|
1458
|
-
if (
|
|
1473
|
+
if (n === "months") {
|
|
1459
1474
|
l(
|
|
1460
|
-
(
|
|
1475
|
+
(r) => new Date(r.getFullYear() + 1, r.getMonth())
|
|
1461
1476
|
);
|
|
1462
1477
|
return;
|
|
1463
1478
|
}
|
|
1464
|
-
l((
|
|
1465
|
-
},
|
|
1466
|
-
if (
|
|
1467
|
-
l((
|
|
1479
|
+
l((r) => new Date(r.getFullYear(), r.getMonth() + 1));
|
|
1480
|
+
}, h = () => {
|
|
1481
|
+
if (n === "years") {
|
|
1482
|
+
l((r) => new Date(r.getFullYear() - 10, 0));
|
|
1468
1483
|
return;
|
|
1469
1484
|
}
|
|
1470
|
-
if (
|
|
1485
|
+
if (n === "months") {
|
|
1471
1486
|
l(
|
|
1472
|
-
(
|
|
1487
|
+
(r) => new Date(r.getFullYear() - 1, r.getMonth())
|
|
1473
1488
|
);
|
|
1474
1489
|
return;
|
|
1475
1490
|
}
|
|
1476
1491
|
l(
|
|
1477
|
-
(
|
|
1478
|
-
|
|
1479
|
-
|
|
1492
|
+
(r) => new Date(
|
|
1493
|
+
r.getMonth() === 0 ? r.getFullYear() - 1 : r.getFullYear(),
|
|
1494
|
+
r.getMonth() === 0 ? 11 : r.getMonth() - 1
|
|
1480
1495
|
)
|
|
1481
1496
|
);
|
|
1482
1497
|
};
|
|
1483
1498
|
return /* @__PURE__ */ Y("div", { className: "sa-calendar-header", children: [
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
if (
|
|
1499
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-header-title", onClick: u, children: (() => {
|
|
1500
|
+
if (n === "days")
|
|
1486
1501
|
return `${W[o.getMonth()]} ${o.getFullYear()}`;
|
|
1487
|
-
if (
|
|
1502
|
+
if (n === "months")
|
|
1488
1503
|
return `${o.getFullYear()}`;
|
|
1489
|
-
if (
|
|
1504
|
+
if (n === "years")
|
|
1490
1505
|
return `${Z(o.getFullYear()).start} ~ ${Z(o.getFullYear()).end}`;
|
|
1491
1506
|
})() }),
|
|
1492
1507
|
/* @__PURE__ */ Y("div", { className: "sa-calendar-header-nav", children: [
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1508
|
+
/* @__PURE__ */ e("button", { className: "sa-calendar-nav-btn", onClick: h, children: /* @__PURE__ */ e(tn, {}) }),
|
|
1509
|
+
/* @__PURE__ */ e("button", { className: "sa-calendar-nav-btn", onClick: i, children: /* @__PURE__ */ e(sn, {}) })
|
|
1495
1510
|
] })
|
|
1496
1511
|
] });
|
|
1497
|
-
}, nn = "sa-calendar-styles",
|
|
1512
|
+
}, nn = "sa-calendar-styles", Mn = (a) => {
|
|
1498
1513
|
if (!document.getElementById(nn)) {
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1514
|
+
const n = document.createElement("style");
|
|
1515
|
+
n.id = nn, n.textContent = a, document.head.appendChild(n);
|
|
1501
1516
|
}
|
|
1502
1517
|
};
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1518
|
+
Mn(R);
|
|
1519
|
+
const Cn = K(
|
|
1505
1520
|
({
|
|
1506
|
-
value:
|
|
1507
|
-
onChange:
|
|
1521
|
+
value: a,
|
|
1522
|
+
onChange: n,
|
|
1508
1523
|
filter: t,
|
|
1509
1524
|
input: o = !0,
|
|
1510
1525
|
disabled: l,
|
|
1511
|
-
minDate:
|
|
1512
|
-
maxDate:
|
|
1513
|
-
placeholder:
|
|
1514
|
-
size:
|
|
1515
|
-
variant:
|
|
1516
|
-
status:
|
|
1517
|
-
clearable:
|
|
1518
|
-
fullWidth:
|
|
1519
|
-
withPadding:
|
|
1520
|
-
label:
|
|
1521
|
-
labelPosition:
|
|
1522
|
-
required:
|
|
1523
|
-
optional:
|
|
1524
|
-
description:
|
|
1525
|
-
helperText:
|
|
1526
|
-
errorText:
|
|
1527
|
-
},
|
|
1528
|
-
const
|
|
1526
|
+
minDate: u,
|
|
1527
|
+
maxDate: i,
|
|
1528
|
+
placeholder: h,
|
|
1529
|
+
size: g,
|
|
1530
|
+
variant: r,
|
|
1531
|
+
status: d,
|
|
1532
|
+
clearable: y,
|
|
1533
|
+
fullWidth: M = !0,
|
|
1534
|
+
withPadding: k = !0,
|
|
1535
|
+
label: $,
|
|
1536
|
+
labelPosition: m,
|
|
1537
|
+
required: f,
|
|
1538
|
+
optional: s,
|
|
1539
|
+
description: x,
|
|
1540
|
+
helperText: N,
|
|
1541
|
+
errorText: p
|
|
1542
|
+
}, w) => {
|
|
1543
|
+
const c = p ? "error" : d, { ref: v, isComponentVisible: z, setIsComponentVisible: S } = rn(!1), C = J(null), [L, I] = A("days"), [T, F] = A(/* @__PURE__ */ new Date()), [D, E] = A(/* @__PURE__ */ new Date());
|
|
1529
1544
|
B(() => {
|
|
1530
|
-
|
|
1531
|
-
}, [
|
|
1545
|
+
a ? (F(a), E(a)) : (F(/* @__PURE__ */ new Date()), E(/* @__PURE__ */ new Date()));
|
|
1546
|
+
}, [a]), B(() => {
|
|
1532
1547
|
t && I(t);
|
|
1533
1548
|
}, [t]), B(() => {
|
|
1534
1549
|
t || I("days");
|
|
1535
|
-
}, [
|
|
1550
|
+
}, [z]), B(() => {
|
|
1536
1551
|
o || S(!0);
|
|
1537
1552
|
}, [o]);
|
|
1538
|
-
const G = () =>
|
|
1539
|
-
if (
|
|
1540
|
-
const
|
|
1541
|
-
window.innerWidth <
|
|
1553
|
+
const G = () => a ? t === "days" ? P(T) : t === "months" ? `${W[T.getMonth()]} ${T.getFullYear()}` : t === "years" ? T.getFullYear() : P(T) : "", j = () => {
|
|
1554
|
+
if (C.current && v.current && o) {
|
|
1555
|
+
const b = v.current.getBoundingClientRect(), V = C.current.getBoundingClientRect();
|
|
1556
|
+
window.innerWidth < b.left + V.width ? C.current.style.left = `${b.left - V.width + b.width}px` : C.current.style.left = `${b.left}px`, b.top + V.height > window.innerHeight ? C.current.style.top = `${b.y - (b.height + V.height - 28)}px` : C.current.style.top = `${b.y + b.height}px`;
|
|
1542
1557
|
}
|
|
1543
1558
|
};
|
|
1544
1559
|
B(() => {
|
|
1545
|
-
|
|
1546
|
-
}, [
|
|
1547
|
-
const
|
|
1548
|
-
return
|
|
1549
|
-
|
|
1560
|
+
C.current && v.current && o && j();
|
|
1561
|
+
}, [C, v, z]), B(() => {
|
|
1562
|
+
const b = w == null ? void 0 : w.current;
|
|
1563
|
+
return b && b.addEventListener("scroll", j), window.addEventListener("scroll", j), () => {
|
|
1564
|
+
b && b.removeEventListener("scroll", j), window.removeEventListener("scroll", j);
|
|
1550
1565
|
};
|
|
1551
1566
|
}, []);
|
|
1552
1567
|
const U = /* @__PURE__ */ Y(
|
|
@@ -1554,83 +1569,86 @@ const Mn = K(
|
|
|
1554
1569
|
{
|
|
1555
1570
|
className: "sa-calendar-wrapper",
|
|
1556
1571
|
style: { height: o ? "auto" : "100%" },
|
|
1557
|
-
ref: o ?
|
|
1572
|
+
ref: o ? v : null,
|
|
1558
1573
|
children: [
|
|
1559
|
-
o ? /* @__PURE__ */
|
|
1560
|
-
|
|
1574
|
+
o ? /* @__PURE__ */ e(
|
|
1575
|
+
vn,
|
|
1561
1576
|
{
|
|
1562
1577
|
value: G(),
|
|
1563
1578
|
onClick: () => S(!0),
|
|
1564
1579
|
onChange: () => {
|
|
1565
1580
|
},
|
|
1566
|
-
placeholder:
|
|
1581
|
+
placeholder: h,
|
|
1567
1582
|
disabled: l,
|
|
1568
|
-
size:
|
|
1569
|
-
variant:
|
|
1570
|
-
status:
|
|
1583
|
+
size: g,
|
|
1584
|
+
variant: r,
|
|
1585
|
+
status: c,
|
|
1571
1586
|
inputMode: "none",
|
|
1572
|
-
clearable:
|
|
1573
|
-
onClear: () =>
|
|
1587
|
+
clearable: y,
|
|
1588
|
+
onClear: () => n(void 0)
|
|
1574
1589
|
}
|
|
1575
1590
|
) : null,
|
|
1576
|
-
|
|
1591
|
+
z ? /* @__PURE__ */ Y(
|
|
1577
1592
|
"div",
|
|
1578
1593
|
{
|
|
1579
|
-
className: `sa-calendar sa-calendar-size-${
|
|
1594
|
+
className: `sa-calendar sa-calendar-size-${g || "md"} ${o ? "" : "sa-calendar-no-input"} ${k ? "" : "sa-calendar-no-padding"}`,
|
|
1580
1595
|
style: l ? { pointerEvents: "none" } : void 0,
|
|
1581
|
-
ref:
|
|
1596
|
+
ref: C,
|
|
1582
1597
|
children: [
|
|
1583
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ e(
|
|
1584
1599
|
kn,
|
|
1585
1600
|
{
|
|
1586
1601
|
setViews: I,
|
|
1587
|
-
views:
|
|
1602
|
+
views: L,
|
|
1588
1603
|
filter: t,
|
|
1589
|
-
previewDate:
|
|
1590
|
-
setPreviewDate:
|
|
1591
|
-
isComponentVisible:
|
|
1604
|
+
previewDate: D,
|
|
1605
|
+
setPreviewDate: E,
|
|
1606
|
+
isComponentVisible: z
|
|
1592
1607
|
}
|
|
1593
1608
|
),
|
|
1594
|
-
/* @__PURE__ */
|
|
1609
|
+
/* @__PURE__ */ e("div", { className: "sa-calendar-body", children: L === "days" ? /* @__PURE__ */ e(
|
|
1595
1610
|
yn,
|
|
1596
1611
|
{
|
|
1597
|
-
date:
|
|
1598
|
-
setDate:
|
|
1599
|
-
previewDate:
|
|
1600
|
-
setPreviewDate:
|
|
1612
|
+
date: T,
|
|
1613
|
+
setDate: F,
|
|
1614
|
+
previewDate: D,
|
|
1615
|
+
setPreviewDate: E,
|
|
1601
1616
|
setIsComponentVisible: S,
|
|
1602
1617
|
input: o,
|
|
1603
|
-
minDate:
|
|
1604
|
-
maxDate:
|
|
1605
|
-
onChange:
|
|
1618
|
+
minDate: u,
|
|
1619
|
+
maxDate: i,
|
|
1620
|
+
onChange: n,
|
|
1621
|
+
hasValue: a != null
|
|
1606
1622
|
}
|
|
1607
|
-
) :
|
|
1623
|
+
) : L === "months" ? /* @__PURE__ */ e(
|
|
1608
1624
|
wn,
|
|
1609
1625
|
{
|
|
1610
|
-
date:
|
|
1611
|
-
setDate:
|
|
1612
|
-
previewDate:
|
|
1613
|
-
setPreviewDate:
|
|
1626
|
+
date: T,
|
|
1627
|
+
setDate: F,
|
|
1628
|
+
previewDate: D,
|
|
1629
|
+
setPreviewDate: E,
|
|
1614
1630
|
filter: t,
|
|
1615
1631
|
setViews: I,
|
|
1616
|
-
onChange:
|
|
1617
|
-
minDate:
|
|
1618
|
-
maxDate:
|
|
1619
|
-
input: o
|
|
1632
|
+
onChange: n,
|
|
1633
|
+
minDate: u,
|
|
1634
|
+
maxDate: i,
|
|
1635
|
+
input: o,
|
|
1636
|
+
hasValue: a != null
|
|
1620
1637
|
}
|
|
1621
|
-
) : /* @__PURE__ */
|
|
1638
|
+
) : /* @__PURE__ */ e(
|
|
1622
1639
|
xn,
|
|
1623
1640
|
{
|
|
1624
|
-
date:
|
|
1625
|
-
setDate:
|
|
1626
|
-
previewDate:
|
|
1627
|
-
setPreviewDate:
|
|
1641
|
+
date: T,
|
|
1642
|
+
setDate: F,
|
|
1643
|
+
previewDate: D,
|
|
1644
|
+
setPreviewDate: E,
|
|
1628
1645
|
filter: t,
|
|
1629
1646
|
setViews: I,
|
|
1630
|
-
onChange:
|
|
1631
|
-
minDate:
|
|
1632
|
-
maxDate:
|
|
1633
|
-
input: o
|
|
1647
|
+
onChange: n,
|
|
1648
|
+
minDate: u,
|
|
1649
|
+
maxDate: i,
|
|
1650
|
+
input: o,
|
|
1651
|
+
hasValue: a != null
|
|
1634
1652
|
}
|
|
1635
1653
|
) })
|
|
1636
1654
|
]
|
|
@@ -1639,70 +1657,70 @@ const Mn = K(
|
|
|
1639
1657
|
]
|
|
1640
1658
|
}
|
|
1641
1659
|
);
|
|
1642
|
-
return /* @__PURE__ */
|
|
1660
|
+
return /* @__PURE__ */ e(
|
|
1643
1661
|
on,
|
|
1644
1662
|
{
|
|
1645
|
-
label:
|
|
1646
|
-
labelPosition:
|
|
1647
|
-
required:
|
|
1648
|
-
optional:
|
|
1649
|
-
description:
|
|
1650
|
-
helperText:
|
|
1651
|
-
errorText:
|
|
1652
|
-
fullWidth:
|
|
1663
|
+
label: $,
|
|
1664
|
+
labelPosition: m,
|
|
1665
|
+
required: f,
|
|
1666
|
+
optional: s,
|
|
1667
|
+
description: x,
|
|
1668
|
+
helperText: N,
|
|
1669
|
+
errorText: p,
|
|
1670
|
+
fullWidth: M,
|
|
1653
1671
|
children: U
|
|
1654
1672
|
}
|
|
1655
1673
|
);
|
|
1656
1674
|
}
|
|
1657
1675
|
), $n = K(
|
|
1658
1676
|
({
|
|
1659
|
-
value:
|
|
1660
|
-
onChange:
|
|
1677
|
+
value: a,
|
|
1678
|
+
onChange: n,
|
|
1661
1679
|
filter: t,
|
|
1662
1680
|
input: o = !0,
|
|
1663
1681
|
rangedDate: l,
|
|
1664
|
-
disabled:
|
|
1665
|
-
minDate:
|
|
1666
|
-
maxDate:
|
|
1667
|
-
placeholder:
|
|
1668
|
-
size:
|
|
1669
|
-
variant:
|
|
1670
|
-
status:
|
|
1671
|
-
clearable:
|
|
1672
|
-
fullWidth:
|
|
1673
|
-
withPadding:
|
|
1674
|
-
label:
|
|
1675
|
-
labelPosition:
|
|
1676
|
-
required:
|
|
1677
|
-
optional:
|
|
1678
|
-
description:
|
|
1679
|
-
helperText:
|
|
1680
|
-
errorText:
|
|
1681
|
-
},
|
|
1682
|
-
const
|
|
1683
|
-
onChange:
|
|
1684
|
-
value:
|
|
1682
|
+
disabled: u,
|
|
1683
|
+
minDate: i,
|
|
1684
|
+
maxDate: h,
|
|
1685
|
+
placeholder: g,
|
|
1686
|
+
size: r,
|
|
1687
|
+
variant: d,
|
|
1688
|
+
status: y,
|
|
1689
|
+
clearable: M,
|
|
1690
|
+
fullWidth: k,
|
|
1691
|
+
withPadding: $,
|
|
1692
|
+
label: m,
|
|
1693
|
+
labelPosition: f,
|
|
1694
|
+
required: s,
|
|
1695
|
+
optional: x,
|
|
1696
|
+
description: N,
|
|
1697
|
+
helperText: p,
|
|
1698
|
+
errorText: w
|
|
1699
|
+
}, c) => {
|
|
1700
|
+
const v = {
|
|
1701
|
+
onChange: n,
|
|
1702
|
+
value: a,
|
|
1685
1703
|
input: o,
|
|
1686
1704
|
filter: t,
|
|
1687
|
-
disabled:
|
|
1688
|
-
minDate:
|
|
1689
|
-
maxDate:
|
|
1690
|
-
placeholder:
|
|
1691
|
-
size:
|
|
1692
|
-
variant:
|
|
1693
|
-
status:
|
|
1694
|
-
clearable:
|
|
1695
|
-
fullWidth:
|
|
1696
|
-
withPadding:
|
|
1697
|
-
label:
|
|
1698
|
-
labelPosition:
|
|
1699
|
-
required:
|
|
1700
|
-
optional:
|
|
1701
|
-
description:
|
|
1702
|
-
helperText:
|
|
1703
|
-
errorText:
|
|
1705
|
+
disabled: u,
|
|
1706
|
+
minDate: i,
|
|
1707
|
+
maxDate: h,
|
|
1708
|
+
placeholder: g,
|
|
1709
|
+
size: r,
|
|
1710
|
+
variant: d,
|
|
1711
|
+
status: y,
|
|
1712
|
+
clearable: M,
|
|
1713
|
+
fullWidth: k,
|
|
1714
|
+
withPadding: $,
|
|
1715
|
+
label: m,
|
|
1716
|
+
labelPosition: f,
|
|
1717
|
+
required: s,
|
|
1718
|
+
optional: x,
|
|
1719
|
+
description: N,
|
|
1720
|
+
helperText: p,
|
|
1721
|
+
errorText: w
|
|
1704
1722
|
};
|
|
1705
|
-
return /* @__PURE__ */
|
|
1723
|
+
return /* @__PURE__ */ e(en, { children: l ? /* @__PURE__ */ e(bn, { ...v, ref: c }) : /* @__PURE__ */ e(Cn, { ...v, ref: c }) });
|
|
1706
1724
|
}
|
|
1707
1725
|
);
|
|
1708
1726
|
export {
|