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