@starasia/date 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/date.es.js +920 -821
- package/dist/date.umd.js +9 -3
- package/dist/interfaces.d.ts +9 -0
- package/dist/utils/functions.d.ts +26 -0
- package/package.json +1 -1
package/dist/date.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as z, jsx as s, Fragment as yn } from "react/jsx-runtime";
|
|
2
|
+
import wn, { useState as G, useRef as _, useEffect as P, forwardRef as xn, useMemo as tn } from "react";
|
|
3
|
+
const gn = `@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;
|
|
@@ -33,6 +33,12 @@ const un = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
|
|
|
33
33
|
position: relative;
|
|
34
34
|
width: 100%;
|
|
35
35
|
}
|
|
36
|
+
/* Custom trigger: hug the trigger so the fixed calendar anchors to the actual
|
|
37
|
+
element (not a full-width container) — fixes right-edge flip misalignment. */
|
|
38
|
+
.sa-calendar-wrapper-custom {
|
|
39
|
+
width: max-content;
|
|
40
|
+
max-width: 100%;
|
|
41
|
+
}
|
|
36
42
|
|
|
37
43
|
/* === DATE FIELD WRAPPER === */
|
|
38
44
|
.sa-date-field {
|
|
@@ -590,7 +596,7 @@ const un = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
|
|
|
590
596
|
width: 32px;
|
|
591
597
|
height: 32px;
|
|
592
598
|
}
|
|
593
|
-
`,
|
|
599
|
+
`, Vn = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Q = [
|
|
594
600
|
"January",
|
|
595
601
|
"February",
|
|
596
602
|
"March",
|
|
@@ -603,7 +609,7 @@ const un = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
|
|
|
603
609
|
"October",
|
|
604
610
|
"November",
|
|
605
611
|
"December"
|
|
606
|
-
],
|
|
612
|
+
], jn = [
|
|
607
613
|
"Jan",
|
|
608
614
|
"Feb",
|
|
609
615
|
"Mar",
|
|
@@ -617,22 +623,22 @@ const un = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
|
|
|
617
623
|
"Nov",
|
|
618
624
|
"Dec"
|
|
619
625
|
];
|
|
620
|
-
function
|
|
621
|
-
const [e,
|
|
622
|
-
o.current && !o.current.contains(d.target) &&
|
|
626
|
+
function En(n) {
|
|
627
|
+
const [e, a] = G(n), o = _(null), r = (d) => {
|
|
628
|
+
o.current && !o.current.contains(d.target) && a(!1);
|
|
623
629
|
};
|
|
624
|
-
return
|
|
625
|
-
document.removeEventListener("click",
|
|
626
|
-
}), []), { ref: o, isComponentVisible: e, setIsComponentVisible:
|
|
630
|
+
return P(() => (document.addEventListener("click", r, !0), () => {
|
|
631
|
+
document.removeEventListener("click", r, !0);
|
|
632
|
+
}), []), { ref: o, isComponentVisible: e, setIsComponentVisible: a };
|
|
627
633
|
}
|
|
628
|
-
const
|
|
629
|
-
if (!(typeof document > "u") && !document.getElementById(
|
|
634
|
+
const Ln = "sa-calendar-input-styles", An = (n) => {
|
|
635
|
+
if (!(typeof document > "u") && !document.getElementById(Ln)) {
|
|
630
636
|
const e = document.createElement("style");
|
|
631
|
-
e.id =
|
|
637
|
+
e.id = Ln, e.textContent = n, document.head.appendChild(e);
|
|
632
638
|
}
|
|
633
639
|
};
|
|
634
|
-
|
|
635
|
-
const
|
|
640
|
+
An(gn);
|
|
641
|
+
const rn = (n) => {
|
|
636
642
|
if (n === "xs")
|
|
637
643
|
return 14;
|
|
638
644
|
if (n === "sm")
|
|
@@ -641,34 +647,34 @@ const an = (n) => {
|
|
|
641
647
|
return 16;
|
|
642
648
|
if (n === "lg")
|
|
643
649
|
return 20;
|
|
644
|
-
},
|
|
650
|
+
}, Hn = (n) => {
|
|
645
651
|
const {
|
|
646
652
|
size: e = "sm",
|
|
647
|
-
status:
|
|
653
|
+
status: a = "default",
|
|
648
654
|
variant: o = "outline",
|
|
649
|
-
clearable:
|
|
655
|
+
clearable: r,
|
|
650
656
|
onClear: d,
|
|
651
|
-
...
|
|
652
|
-
} = n,
|
|
653
|
-
|
|
654
|
-
},
|
|
655
|
-
|
|
657
|
+
...i
|
|
658
|
+
} = n, p = _(null), h = () => {
|
|
659
|
+
p.current && i.onClick && (p.current.focus(), i.onClick(""));
|
|
660
|
+
}, l = a === "disable" || i.disabled, c = !!i.value, w = r && c && !l, M = (E) => {
|
|
661
|
+
E.stopPropagation(), d == null || d();
|
|
656
662
|
};
|
|
657
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ z(
|
|
658
664
|
"div",
|
|
659
665
|
{
|
|
660
|
-
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${
|
|
666
|
+
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${a} ${e} `,
|
|
661
667
|
onClick: h,
|
|
662
668
|
children: [
|
|
663
|
-
/* @__PURE__ */
|
|
669
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ s(
|
|
664
670
|
"svg",
|
|
665
671
|
{
|
|
666
672
|
xmlns: "http://www.w3.org/2000/svg",
|
|
667
|
-
width:
|
|
668
|
-
height:
|
|
673
|
+
width: rn(e),
|
|
674
|
+
height: rn(e),
|
|
669
675
|
viewBox: "0 0 20 20",
|
|
670
676
|
fill: "none",
|
|
671
|
-
children: /* @__PURE__ */
|
|
677
|
+
children: /* @__PURE__ */ s(
|
|
672
678
|
"path",
|
|
673
679
|
{
|
|
674
680
|
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",
|
|
@@ -680,32 +686,32 @@ const an = (n) => {
|
|
|
680
686
|
)
|
|
681
687
|
}
|
|
682
688
|
) }),
|
|
683
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ s(
|
|
684
690
|
"input",
|
|
685
691
|
{
|
|
686
692
|
className: "sa-calendar-input",
|
|
687
|
-
...
|
|
688
|
-
disabled:
|
|
689
|
-
value:
|
|
690
|
-
ref:
|
|
693
|
+
...i,
|
|
694
|
+
disabled: l,
|
|
695
|
+
value: i.value,
|
|
696
|
+
ref: p
|
|
691
697
|
}
|
|
692
698
|
) }),
|
|
693
|
-
|
|
699
|
+
w ? /* @__PURE__ */ s(
|
|
694
700
|
"button",
|
|
695
701
|
{
|
|
696
702
|
type: "button",
|
|
697
703
|
"aria-label": "Clear date",
|
|
698
704
|
className: "sa-calendar-input-clear",
|
|
699
|
-
onClick:
|
|
700
|
-
children: /* @__PURE__ */
|
|
705
|
+
onClick: M,
|
|
706
|
+
children: /* @__PURE__ */ s(
|
|
701
707
|
"svg",
|
|
702
708
|
{
|
|
703
709
|
xmlns: "http://www.w3.org/2000/svg",
|
|
704
|
-
width:
|
|
705
|
-
height:
|
|
710
|
+
width: rn(e),
|
|
711
|
+
height: rn(e),
|
|
706
712
|
viewBox: "0 0 20 20",
|
|
707
713
|
fill: "none",
|
|
708
|
-
children: /* @__PURE__ */
|
|
714
|
+
children: /* @__PURE__ */ s(
|
|
709
715
|
"path",
|
|
710
716
|
{
|
|
711
717
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -718,15 +724,15 @@ const an = (n) => {
|
|
|
718
724
|
}
|
|
719
725
|
)
|
|
720
726
|
}
|
|
721
|
-
) : /* @__PURE__ */
|
|
727
|
+
) : /* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ s(
|
|
722
728
|
"svg",
|
|
723
729
|
{
|
|
724
730
|
xmlns: "http://www.w3.org/2000/svg",
|
|
725
|
-
width:
|
|
726
|
-
height:
|
|
731
|
+
width: rn(e),
|
|
732
|
+
height: rn(e),
|
|
727
733
|
viewBox: "0 0 20 20",
|
|
728
734
|
fill: "none",
|
|
729
|
-
children: /* @__PURE__ */
|
|
735
|
+
children: /* @__PURE__ */ s(
|
|
730
736
|
"path",
|
|
731
737
|
{
|
|
732
738
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -741,199 +747,199 @@ const an = (n) => {
|
|
|
741
747
|
]
|
|
742
748
|
}
|
|
743
749
|
);
|
|
744
|
-
},
|
|
750
|
+
}, Wn = ({
|
|
745
751
|
date: n,
|
|
746
752
|
setDate: e,
|
|
747
|
-
dateRange:
|
|
753
|
+
dateRange: a,
|
|
748
754
|
setDateRange: o,
|
|
749
|
-
onChange:
|
|
755
|
+
onChange: r,
|
|
750
756
|
minDate: d,
|
|
751
|
-
maxDate:
|
|
752
|
-
input:
|
|
757
|
+
maxDate: i,
|
|
758
|
+
input: p
|
|
753
759
|
}) => {
|
|
754
|
-
var T,
|
|
755
|
-
const [h,
|
|
756
|
-
let c = new Date(n.getFullYear(), n.getMonth(), 1),
|
|
757
|
-
const
|
|
758
|
-
for (let
|
|
759
|
-
|
|
760
|
-
c.getDate() + (
|
|
760
|
+
var T, y, k;
|
|
761
|
+
const [h, l] = G(null);
|
|
762
|
+
let c = new Date(n.getFullYear(), n.getMonth(), 1), w = c.getDay(), M = [];
|
|
763
|
+
const E = n.getMonth(), x = (/* @__PURE__ */ new Date()).toDateString(), b = !!(a.from && !a.to), g = b && h ? h : null;
|
|
764
|
+
for (let v = 0; v < 42; v++) {
|
|
765
|
+
v === 0 && w === 0 ? c.setDate(c.getDate() - 7) : v === 0 ? c.setDate(
|
|
766
|
+
c.getDate() + (v - w)
|
|
761
767
|
) : c.setDate(c.getDate() + 1);
|
|
762
|
-
let
|
|
763
|
-
currentMonth: c.getMonth() ===
|
|
768
|
+
let N = {
|
|
769
|
+
currentMonth: c.getMonth() === E,
|
|
764
770
|
date: new Date(c),
|
|
765
771
|
month: c.getMonth(),
|
|
766
772
|
number: c.getDate(),
|
|
767
|
-
selected: c.toDateString() === ((T =
|
|
768
|
-
isToday: c.toDateString() ===
|
|
773
|
+
selected: c.toDateString() === ((T = a.from) == null ? void 0 : T.toDateString()) || c.toDateString() === (((y = a.to) == null ? void 0 : y.toDateString()) || ((k = a.from) == null ? void 0 : k.toDateString())),
|
|
774
|
+
isToday: c.toDateString() === x,
|
|
769
775
|
year: c.getFullYear(),
|
|
770
|
-
isDisabled: d && c < d ||
|
|
776
|
+
isDisabled: d && c < d || i && c > i
|
|
771
777
|
};
|
|
772
|
-
|
|
778
|
+
M.push(N);
|
|
773
779
|
}
|
|
774
|
-
const
|
|
775
|
-
e(
|
|
776
|
-
},
|
|
777
|
-
let
|
|
778
|
-
if (
|
|
779
|
-
|
|
780
|
-
else if (!
|
|
781
|
-
|
|
780
|
+
const u = (v) => {
|
|
781
|
+
e(v);
|
|
782
|
+
}, C = (v) => {
|
|
783
|
+
let N = { ...a };
|
|
784
|
+
if (N.from && N.to)
|
|
785
|
+
N = { from: v, to: null };
|
|
786
|
+
else if (!N.from)
|
|
787
|
+
N = { from: v, to: null };
|
|
782
788
|
else {
|
|
783
|
-
const
|
|
784
|
-
|
|
789
|
+
const K = N.from.getTime();
|
|
790
|
+
v.getTime() > K ? N = { from: N.from, to: v } : N = { from: v, to: N.from };
|
|
785
791
|
}
|
|
786
|
-
o(
|
|
792
|
+
o(N), r(N);
|
|
787
793
|
};
|
|
788
|
-
return /* @__PURE__ */
|
|
794
|
+
return /* @__PURE__ */ z(
|
|
789
795
|
"div",
|
|
790
796
|
{
|
|
791
797
|
className: "sa-calendar-days-preivew",
|
|
792
|
-
onMouseLeave: () =>
|
|
798
|
+
onMouseLeave: () => l(null),
|
|
793
799
|
children: [
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
const
|
|
797
|
-
if (!g || !
|
|
800
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-days-name-preivew", children: Vn.map((v, N) => /* @__PURE__ */ s("p", { children: v }, N)) }),
|
|
801
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-days-number-preivew", children: M.map((v, N) => {
|
|
802
|
+
const K = a.from && a.to && v.date.getTime() > a.from.getTime() && v.date.getTime() < a.to.getTime(), j = (() => {
|
|
803
|
+
if (!g || !a.from)
|
|
798
804
|
return !1;
|
|
799
|
-
const
|
|
800
|
-
return
|
|
801
|
-
})(),
|
|
802
|
-
return /* @__PURE__ */
|
|
805
|
+
const Y = v.date.getTime(), L = a.from.getTime(), S = g.getTime();
|
|
806
|
+
return S > L ? Y > L && Y < S : Y < L && Y > S;
|
|
807
|
+
})(), B = b && h && v.date.toDateString() === h.toDateString(), F = v.isDisabled, $ = () => K || j ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "", m = () => F ? "var(--sa-color-gray-400, #b7b9be)" : K || j ? "var(--sa-color-gray-500, #8c8f97)" : "";
|
|
808
|
+
return /* @__PURE__ */ s(
|
|
803
809
|
"p",
|
|
804
810
|
{
|
|
805
|
-
className: `${
|
|
811
|
+
className: `${v.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${v.selected || B ? "sa-calendar-days-active" : ""} ${v.isToday && !v.selected ? "sa-calendar-days-today" : ""}`,
|
|
806
812
|
style: {
|
|
807
|
-
backgroundColor:
|
|
808
|
-
pointerEvents:
|
|
809
|
-
cursor:
|
|
810
|
-
color:
|
|
811
|
-
opacity:
|
|
812
|
-
...
|
|
813
|
+
backgroundColor: $(),
|
|
814
|
+
pointerEvents: F ? "none" : void 0,
|
|
815
|
+
cursor: F ? "not-allowed" : "pointer",
|
|
816
|
+
color: m(),
|
|
817
|
+
opacity: B && !v.selected ? 0.75 : 1,
|
|
818
|
+
...p ? {} : { width: "100%" }
|
|
813
819
|
},
|
|
814
820
|
onClick: () => {
|
|
815
|
-
|
|
821
|
+
F || (u(v.date), C(v.date));
|
|
816
822
|
},
|
|
817
823
|
onMouseEnter: () => {
|
|
818
|
-
|
|
824
|
+
F || l(v.date);
|
|
819
825
|
},
|
|
820
|
-
children:
|
|
826
|
+
children: v.number
|
|
821
827
|
},
|
|
822
|
-
|
|
828
|
+
N
|
|
823
829
|
);
|
|
824
830
|
}) })
|
|
825
831
|
]
|
|
826
832
|
}
|
|
827
833
|
);
|
|
828
|
-
},
|
|
834
|
+
}, Jn = ({
|
|
829
835
|
date: n,
|
|
830
836
|
setDate: e,
|
|
831
|
-
filter:
|
|
837
|
+
filter: a,
|
|
832
838
|
setViews: o,
|
|
833
|
-
dateRange:
|
|
839
|
+
dateRange: r,
|
|
834
840
|
setDateRange: d,
|
|
835
|
-
onChange:
|
|
836
|
-
minDate:
|
|
841
|
+
onChange: i,
|
|
842
|
+
minDate: p,
|
|
837
843
|
maxDate: h,
|
|
838
|
-
input:
|
|
844
|
+
input: l
|
|
839
845
|
}) => {
|
|
840
|
-
var
|
|
841
|
-
const c = (
|
|
842
|
-
|
|
843
|
-
},
|
|
844
|
-
let g = { ...
|
|
846
|
+
var x;
|
|
847
|
+
const c = (x = r.from) == null ? void 0 : x.getFullYear(), w = n.getFullYear(), M = (b) => {
|
|
848
|
+
a ? (E(b), e(b)) : (o("days"), e(b));
|
|
849
|
+
}, E = (b) => {
|
|
850
|
+
let g = { ...r };
|
|
845
851
|
if (g.from && g.to)
|
|
846
852
|
g = { from: b, to: null };
|
|
847
853
|
else if (!g.from)
|
|
848
854
|
g = { from: b, to: null };
|
|
849
855
|
else {
|
|
850
|
-
const
|
|
851
|
-
b.getTime() >
|
|
856
|
+
const u = g.from.getTime();
|
|
857
|
+
b.getTime() > u ? g = { from: g.from, to: b } : g = { from: b, to: g.from };
|
|
852
858
|
}
|
|
853
|
-
d(g),
|
|
859
|
+
d(g), i(g);
|
|
854
860
|
};
|
|
855
|
-
return /* @__PURE__ */
|
|
856
|
-
var T,
|
|
857
|
-
const
|
|
858
|
-
return /* @__PURE__ */
|
|
861
|
+
return /* @__PURE__ */ s("div", { className: "sa-calendar-months-preview", children: Q.map((b, g) => {
|
|
862
|
+
var T, y, k;
|
|
863
|
+
const u = r.from != null && new Date(w, g).getTime() > r.from.getTime() && new Date(w, g).getTime() < (((T = r.to) == null ? void 0 : T.getTime()) || r.from.getTime()), C = p && new Date(w, g) < p || h && new Date(w, g) > h;
|
|
864
|
+
return /* @__PURE__ */ s(
|
|
859
865
|
"p",
|
|
860
866
|
{
|
|
861
|
-
className: c ===
|
|
867
|
+
className: c === w && (g === ((y = r.from) == null ? void 0 : y.getMonth()) || g === ((k = r.to) == null ? void 0 : k.getMonth())) ? "sa-calendar-months-active" : "",
|
|
862
868
|
style: {
|
|
863
|
-
backgroundColor:
|
|
864
|
-
pointerEvents:
|
|
865
|
-
cursor:
|
|
866
|
-
color:
|
|
867
|
-
...
|
|
869
|
+
backgroundColor: u ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
870
|
+
pointerEvents: C ? "none" : void 0,
|
|
871
|
+
cursor: C ? "not-allowed" : "pointer",
|
|
872
|
+
color: C ? "var(--sa-color-gray-400, #b7b9be)" : u ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
873
|
+
...l ? {} : { width: "100%" }
|
|
868
874
|
},
|
|
869
875
|
onClick: () => {
|
|
870
|
-
|
|
876
|
+
C || M(new Date(w, g));
|
|
871
877
|
},
|
|
872
878
|
children: b.slice(0, 3)
|
|
873
879
|
},
|
|
874
880
|
g
|
|
875
881
|
);
|
|
876
882
|
}) });
|
|
877
|
-
},
|
|
878
|
-
const e = Math.floor(n / 10) * 10,
|
|
879
|
-
return { start: e, end:
|
|
880
|
-
},
|
|
883
|
+
}, Cn = (n) => {
|
|
884
|
+
const e = Math.floor(n / 10) * 10, a = e + 10;
|
|
885
|
+
return { start: e, end: a };
|
|
886
|
+
}, Kn = ({
|
|
881
887
|
date: n,
|
|
882
888
|
filter: e,
|
|
883
|
-
setViews:
|
|
889
|
+
setViews: a,
|
|
884
890
|
setDate: o,
|
|
885
|
-
dateRange:
|
|
891
|
+
dateRange: r,
|
|
886
892
|
setDateRange: d,
|
|
887
|
-
onChange:
|
|
888
|
-
minDate:
|
|
893
|
+
onChange: i,
|
|
894
|
+
minDate: p,
|
|
889
895
|
maxDate: h,
|
|
890
|
-
input:
|
|
896
|
+
input: l
|
|
891
897
|
}) => {
|
|
892
|
-
var
|
|
898
|
+
var C, T;
|
|
893
899
|
let c = [];
|
|
894
|
-
const
|
|
895
|
-
for (let
|
|
896
|
-
const
|
|
900
|
+
const w = n.getFullYear(), { start: M, end: E } = Cn(w), x = (C = r.from) == null ? void 0 : C.getFullYear(), b = (T = r.to) == null ? void 0 : T.getFullYear();
|
|
901
|
+
for (let y = M; y < E; y++) {
|
|
902
|
+
const k = new Date(y, 0), v = (!p || k >= p) && (!h || k <= h), N = x != null && y === x || b != null && y === b, K = r.from != null && r.to != null && k > r.from && k < r.to;
|
|
897
903
|
c.push({
|
|
898
|
-
year:
|
|
899
|
-
active:
|
|
900
|
-
highlight:
|
|
901
|
-
disabled: !
|
|
904
|
+
year: y,
|
|
905
|
+
active: N && v,
|
|
906
|
+
highlight: K && v,
|
|
907
|
+
disabled: !v
|
|
902
908
|
});
|
|
903
909
|
}
|
|
904
|
-
const g = (
|
|
905
|
-
e ? (
|
|
906
|
-
},
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
909
|
-
|
|
910
|
-
else if (!
|
|
911
|
-
|
|
910
|
+
const g = (y) => {
|
|
911
|
+
e ? (u(y), o(y)) : (o(y), a("months"));
|
|
912
|
+
}, u = (y) => {
|
|
913
|
+
let k = { ...r };
|
|
914
|
+
if (k.from && k.to)
|
|
915
|
+
k = { from: y, to: null };
|
|
916
|
+
else if (!k.from)
|
|
917
|
+
k = { from: y, to: null };
|
|
912
918
|
else {
|
|
913
|
-
const
|
|
914
|
-
|
|
919
|
+
const v = k.from.getTime();
|
|
920
|
+
y.getTime() > v ? k = { from: k.from, to: y } : k = { from: y, to: k.from };
|
|
915
921
|
}
|
|
916
|
-
d(
|
|
922
|
+
d(k), i(k);
|
|
917
923
|
};
|
|
918
|
-
return /* @__PURE__ */
|
|
924
|
+
return /* @__PURE__ */ s("div", { className: "sa-calendar-years-preview", children: c.map((y, k) => /* @__PURE__ */ s(
|
|
919
925
|
"p",
|
|
920
926
|
{
|
|
921
|
-
className: `${
|
|
927
|
+
className: `${y.active ? "sa-calendar-months-active" : ""} ${y.highlight ? "sa-calendar-months-highlight" : ""} ${y.disabled ? "sa-calendar-disabled" : ""}`,
|
|
922
928
|
onClick: () => {
|
|
923
|
-
|
|
929
|
+
y.disabled || g(new Date(y.year, 0));
|
|
924
930
|
},
|
|
925
931
|
style: {
|
|
926
|
-
backgroundColor:
|
|
927
|
-
color:
|
|
928
|
-
cursor:
|
|
929
|
-
pointerEvents:
|
|
930
|
-
...
|
|
932
|
+
backgroundColor: y.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
933
|
+
color: y.highlight ? "var(--sa-color-gray-500, #8c8f97)" : y.active ? "" : y.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
|
|
934
|
+
cursor: y.disabled ? "not-allowed" : "pointer",
|
|
935
|
+
pointerEvents: y.disbled ? "none" : "all",
|
|
936
|
+
...l ? {} : { width: "100%" }
|
|
931
937
|
},
|
|
932
|
-
children:
|
|
938
|
+
children: y.year
|
|
933
939
|
},
|
|
934
|
-
|
|
940
|
+
k
|
|
935
941
|
)) });
|
|
936
|
-
},
|
|
942
|
+
}, Pn = ({ ...n }) => /* @__PURE__ */ s(
|
|
937
943
|
"svg",
|
|
938
944
|
{
|
|
939
945
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -942,7 +948,7 @@ const an = (n) => {
|
|
|
942
948
|
viewBox: "0 0 20 20",
|
|
943
949
|
fill: "none",
|
|
944
950
|
...n,
|
|
945
|
-
children: /* @__PURE__ */
|
|
951
|
+
children: /* @__PURE__ */ s(
|
|
946
952
|
"path",
|
|
947
953
|
{
|
|
948
954
|
d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
|
|
@@ -953,7 +959,7 @@ const an = (n) => {
|
|
|
953
959
|
}
|
|
954
960
|
)
|
|
955
961
|
}
|
|
956
|
-
),
|
|
962
|
+
), Rn = ({ ...n }) => /* @__PURE__ */ s(
|
|
957
963
|
"svg",
|
|
958
964
|
{
|
|
959
965
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -962,7 +968,7 @@ const an = (n) => {
|
|
|
962
968
|
viewBox: "0 0 20 20",
|
|
963
969
|
fill: "none",
|
|
964
970
|
...n,
|
|
965
|
-
children: /* @__PURE__ */
|
|
971
|
+
children: /* @__PURE__ */ s(
|
|
966
972
|
"path",
|
|
967
973
|
{
|
|
968
974
|
d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
|
|
@@ -973,285 +979,357 @@ const an = (n) => {
|
|
|
973
979
|
}
|
|
974
980
|
)
|
|
975
981
|
}
|
|
976
|
-
),
|
|
982
|
+
), qn = ({
|
|
977
983
|
setViews: n,
|
|
978
984
|
views: e,
|
|
979
|
-
filter:
|
|
985
|
+
filter: a,
|
|
980
986
|
date: o,
|
|
981
|
-
setDate:
|
|
987
|
+
setDate: r
|
|
982
988
|
}) => {
|
|
983
989
|
const d = () => {
|
|
984
|
-
|
|
985
|
-
},
|
|
990
|
+
a || n((l) => l === "days" ? "months" : l === "months" ? "years" : "days");
|
|
991
|
+
}, i = () => {
|
|
986
992
|
if (e === "years") {
|
|
987
|
-
|
|
993
|
+
r((l) => new Date(l.getFullYear() + 10, 0));
|
|
988
994
|
return;
|
|
989
995
|
}
|
|
990
996
|
if (e === "months") {
|
|
991
|
-
|
|
997
|
+
r((l) => new Date(l.getFullYear() + 1, l.getMonth()));
|
|
992
998
|
return;
|
|
993
999
|
}
|
|
994
|
-
|
|
995
|
-
},
|
|
1000
|
+
r((l) => new Date(l.getFullYear(), l.getMonth() + 1));
|
|
1001
|
+
}, p = () => {
|
|
996
1002
|
if (e === "years") {
|
|
997
|
-
|
|
1003
|
+
r((l) => new Date(l.getFullYear() - 10, 0));
|
|
998
1004
|
return;
|
|
999
1005
|
}
|
|
1000
1006
|
if (e === "months") {
|
|
1001
|
-
|
|
1007
|
+
r((l) => new Date(l.getFullYear() - 1, l.getMonth()));
|
|
1002
1008
|
return;
|
|
1003
1009
|
}
|
|
1004
|
-
|
|
1005
|
-
(
|
|
1006
|
-
|
|
1007
|
-
|
|
1010
|
+
r(
|
|
1011
|
+
(l) => new Date(
|
|
1012
|
+
l.getMonth() === 0 ? l.getFullYear() - 1 : l.getFullYear(),
|
|
1013
|
+
l.getMonth() === 0 ? 11 : l.getMonth() - 1
|
|
1008
1014
|
)
|
|
1009
1015
|
);
|
|
1010
1016
|
};
|
|
1011
|
-
return /* @__PURE__ */
|
|
1012
|
-
/* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ z("div", { className: "sa-calendar-header", children: [
|
|
1018
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-header-title", onClick: d, children: (() => {
|
|
1013
1019
|
if (e === "days")
|
|
1014
|
-
return `${
|
|
1020
|
+
return `${Q[o.getMonth()]} ${o.getFullYear()}`;
|
|
1015
1021
|
if (e === "months")
|
|
1016
1022
|
return `${o.getFullYear()}`;
|
|
1017
1023
|
if (e === "years")
|
|
1018
|
-
return `${
|
|
1024
|
+
return `${Cn(o.getFullYear()).start} ~ ${Cn(o.getFullYear()).end}`;
|
|
1019
1025
|
})() }),
|
|
1020
|
-
/* @__PURE__ */
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1026
|
+
/* @__PURE__ */ z("div", { className: "sa-calendar-header-nav", children: [
|
|
1027
|
+
/* @__PURE__ */ s("button", { className: "sa-calendar-nav-btn", onClick: p, children: /* @__PURE__ */ s(Pn, {}) }),
|
|
1028
|
+
/* @__PURE__ */ s("button", { className: "sa-calendar-nav-btn", onClick: i, children: /* @__PURE__ */ s(Rn, {}) })
|
|
1023
1029
|
] })
|
|
1024
1030
|
] });
|
|
1025
1031
|
};
|
|
1026
|
-
function
|
|
1027
|
-
const e = new Date(n),
|
|
1028
|
-
return `${e.getDate().toString().padStart(2, "0")} ${
|
|
1032
|
+
function on(n) {
|
|
1033
|
+
const e = new Date(n), a = e.getFullYear(), o = e.getMonth();
|
|
1034
|
+
return `${e.getDate().toString().padStart(2, "0")} ${jn[o]} ${a}`;
|
|
1035
|
+
}
|
|
1036
|
+
const Fn = (() => {
|
|
1037
|
+
const n = {};
|
|
1038
|
+
return Q.forEach((e, a) => {
|
|
1039
|
+
n[e.toLowerCase()] = a, n[e.slice(0, 3).toLowerCase()] = a;
|
|
1040
|
+
}), n;
|
|
1041
|
+
})(), kn = (n) => n < 100 ? 2e3 + n : n;
|
|
1042
|
+
function $n(n, e) {
|
|
1043
|
+
const a = String(n.getDate()).padStart(2, "0"), o = String(n.getMonth() + 1).padStart(2, "0"), r = n.getFullYear();
|
|
1044
|
+
return e === "years" ? `${r}` : e === "months" ? `${o}/${r}` : `${a}/${o}/${r}`;
|
|
1045
|
+
}
|
|
1046
|
+
function Un(n, e) {
|
|
1047
|
+
const a = n.from ? $n(n.from, e) : "", o = n.to ? $n(n.to, e) : "";
|
|
1048
|
+
return a ? o ? `${a} ~ ${o}` : a : "";
|
|
1049
|
+
}
|
|
1050
|
+
function bn(n, e) {
|
|
1051
|
+
const a = n.trim().toLowerCase().split(/[\s/.\-,]+/).filter(Boolean);
|
|
1052
|
+
if (!a.length)
|
|
1053
|
+
return null;
|
|
1054
|
+
let o = null;
|
|
1055
|
+
const r = [];
|
|
1056
|
+
for (const c of a)
|
|
1057
|
+
c in Fn ? o = Fn[c] : /^\d+$/.test(c) && r.push(parseInt(c, 10));
|
|
1058
|
+
if (e === "years") {
|
|
1059
|
+
const c = r[0];
|
|
1060
|
+
return c == null ? null : new Date(kn(c), 0, 1);
|
|
1061
|
+
}
|
|
1062
|
+
if (e === "months") {
|
|
1063
|
+
const c = o ?? r[0] - 1, w = o != null ? r[0] : r[1];
|
|
1064
|
+
return c == null || isNaN(c) || c < 0 || c > 11 || w == null ? null : new Date(kn(w), c, 1);
|
|
1065
|
+
}
|
|
1066
|
+
let d, i, p;
|
|
1067
|
+
if (o != null ? (d = r[0], p = r[1], i = o) : (d = r[0], i = r[1] != null ? r[1] - 1 : void 0, p = r[2]), d == null || i == null || p == null)
|
|
1068
|
+
return null;
|
|
1069
|
+
const h = kn(p), l = new Date(h, i, d);
|
|
1070
|
+
return l.getFullYear() !== h || l.getMonth() !== i || l.getDate() !== d ? null : l;
|
|
1071
|
+
}
|
|
1072
|
+
function Gn(n, e) {
|
|
1073
|
+
const a = n.indexOf("~");
|
|
1074
|
+
if (a === -1) {
|
|
1075
|
+
const d = bn(n, e);
|
|
1076
|
+
return d ? { from: d, to: null } : null;
|
|
1077
|
+
}
|
|
1078
|
+
const o = bn(n.slice(0, a), e);
|
|
1079
|
+
if (!o)
|
|
1080
|
+
return null;
|
|
1081
|
+
const r = bn(n.slice(a + 1), e);
|
|
1082
|
+
return { from: o, to: r ?? null };
|
|
1083
|
+
}
|
|
1084
|
+
function Dn(n, e, a) {
|
|
1085
|
+
const o = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime(), r = o(n);
|
|
1086
|
+
return !(e && r < o(e) || a && r > o(a));
|
|
1029
1087
|
}
|
|
1030
|
-
const
|
|
1088
|
+
const Yn = ({
|
|
1031
1089
|
label: n,
|
|
1032
1090
|
labelPosition: e = "outside-top",
|
|
1033
|
-
required:
|
|
1091
|
+
required: a,
|
|
1034
1092
|
optional: o,
|
|
1035
|
-
description:
|
|
1093
|
+
description: r,
|
|
1036
1094
|
helperText: d,
|
|
1037
|
-
errorText:
|
|
1038
|
-
fullWidth:
|
|
1095
|
+
errorText: i,
|
|
1096
|
+
fullWidth: p,
|
|
1039
1097
|
size: h = "sm",
|
|
1040
|
-
children:
|
|
1098
|
+
children: l
|
|
1041
1099
|
}) => {
|
|
1042
1100
|
const c = [
|
|
1043
1101
|
"sa-date-field",
|
|
1044
1102
|
`sa-date-field-size-${h}`,
|
|
1045
|
-
|
|
1046
|
-
].filter(Boolean).join(" "),
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
o && /* @__PURE__ */
|
|
1049
|
-
|
|
1050
|
-
] }) : null,
|
|
1051
|
-
d && !
|
|
1052
|
-
|
|
1103
|
+
p ? "sa-date-field-fullwidth" : ""
|
|
1104
|
+
].filter(Boolean).join(" "), w = n ? /* @__PURE__ */ z("div", { className: "sa-date-field-label-row", children: [
|
|
1105
|
+
/* @__PURE__ */ s("span", { className: "sa-date-field-label-text", children: n }),
|
|
1106
|
+
o && /* @__PURE__ */ s("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
|
|
1107
|
+
a && /* @__PURE__ */ s("span", { className: "sa-date-field-required", children: "*" })
|
|
1108
|
+
] }) : null, M = /* @__PURE__ */ z(yn, { children: [
|
|
1109
|
+
d && !i && /* @__PURE__ */ s("p", { className: "sa-date-field-helper", children: d }),
|
|
1110
|
+
i && /* @__PURE__ */ s("p", { className: "sa-date-field-error-msg", children: i })
|
|
1053
1111
|
] });
|
|
1054
|
-
return n ? e === "outside-left" ? /* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
|
|
1057
|
-
|
|
1112
|
+
return n ? e === "outside-left" ? /* @__PURE__ */ z("div", { className: `${c} sa-date-field-left`, children: [
|
|
1113
|
+
/* @__PURE__ */ z("div", { className: "sa-date-field-left-label", children: [
|
|
1114
|
+
w,
|
|
1115
|
+
r && /* @__PURE__ */ s("p", { className: "sa-date-field-helper-top", children: r })
|
|
1058
1116
|
] }),
|
|
1059
|
-
/* @__PURE__ */
|
|
1060
|
-
|
|
1061
|
-
|
|
1117
|
+
/* @__PURE__ */ z("div", { className: "sa-date-field-input-wrap", children: [
|
|
1118
|
+
l,
|
|
1119
|
+
M
|
|
1062
1120
|
] })
|
|
1063
|
-
] }) : /* @__PURE__ */
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
] }) : /* @__PURE__ */
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1121
|
+
] }) : /* @__PURE__ */ z("div", { className: c, children: [
|
|
1122
|
+
w,
|
|
1123
|
+
r && /* @__PURE__ */ s("p", { className: "sa-date-field-helper-top", children: r }),
|
|
1124
|
+
l,
|
|
1125
|
+
M
|
|
1126
|
+
] }) : /* @__PURE__ */ z("div", { className: c, children: [
|
|
1127
|
+
r && /* @__PURE__ */ s("p", { className: "sa-date-field-helper-top", children: r }),
|
|
1128
|
+
l,
|
|
1129
|
+
M
|
|
1072
1130
|
] });
|
|
1073
|
-
},
|
|
1074
|
-
if (!(typeof document > "u") && !document.getElementById(
|
|
1131
|
+
}, Sn = "sa-calendar-styles", Zn = (n) => {
|
|
1132
|
+
if (!(typeof document > "u") && !document.getElementById(Sn)) {
|
|
1075
1133
|
const e = document.createElement("style");
|
|
1076
|
-
e.id =
|
|
1134
|
+
e.id = Sn, e.textContent = n, document.head.appendChild(e);
|
|
1077
1135
|
}
|
|
1078
1136
|
};
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1137
|
+
Zn(gn);
|
|
1138
|
+
const _n = xn(
|
|
1081
1139
|
({
|
|
1082
1140
|
value: n,
|
|
1083
1141
|
onChange: e,
|
|
1084
|
-
filter:
|
|
1142
|
+
filter: a,
|
|
1085
1143
|
input: o = !0,
|
|
1086
|
-
disabled:
|
|
1144
|
+
disabled: r,
|
|
1087
1145
|
minDate: d,
|
|
1088
|
-
maxDate:
|
|
1089
|
-
placeholder:
|
|
1146
|
+
maxDate: i,
|
|
1147
|
+
placeholder: p,
|
|
1090
1148
|
size: h = "sm",
|
|
1091
|
-
variant:
|
|
1149
|
+
variant: l,
|
|
1092
1150
|
status: c,
|
|
1093
|
-
clearable:
|
|
1094
|
-
fullWidth:
|
|
1095
|
-
withPadding:
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1151
|
+
clearable: w,
|
|
1152
|
+
fullWidth: M = !0,
|
|
1153
|
+
withPadding: E = !0,
|
|
1154
|
+
editable: x = !1,
|
|
1155
|
+
trigger: b,
|
|
1156
|
+
renderTrigger: g,
|
|
1157
|
+
label: u,
|
|
1158
|
+
labelPosition: C,
|
|
1159
|
+
required: T,
|
|
1160
|
+
optional: y,
|
|
1161
|
+
description: k,
|
|
1162
|
+
helperText: v,
|
|
1163
|
+
errorText: N
|
|
1164
|
+
}, K) => {
|
|
1165
|
+
const j = N ? "error" : c, { ref: B, isComponentVisible: F, setIsComponentVisible: $ } = En(!1), m = _(null), [Y, L] = G("days"), [S, I] = G(/* @__PURE__ */ new Date()), A = typeof g == "function" || b != null, O = !o && !A, W = !O, [D, J] = G({
|
|
1107
1166
|
from: (n == null ? void 0 : n.from) ?? null,
|
|
1108
1167
|
to: (n == null ? void 0 : n.to) ?? null
|
|
1109
|
-
});
|
|
1110
|
-
|
|
1168
|
+
}), [q, U] = G(null);
|
|
1169
|
+
P(() => {
|
|
1111
1170
|
if (n) {
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1171
|
+
const t = n;
|
|
1172
|
+
t.from && I(t.from), J(t);
|
|
1114
1173
|
} else
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1174
|
+
I(/* @__PURE__ */ new Date()), J({ from: null, to: null });
|
|
1175
|
+
U(null);
|
|
1176
|
+
}, [n]), P(() => {
|
|
1177
|
+
a && L(a);
|
|
1178
|
+
}, [a]), P(() => {
|
|
1179
|
+
a || L("days");
|
|
1180
|
+
}, [F]), P(() => {
|
|
1181
|
+
O && $(!0);
|
|
1182
|
+
}, [O]);
|
|
1183
|
+
const X = () => {
|
|
1184
|
+
var t, f;
|
|
1125
1185
|
if (!n)
|
|
1126
1186
|
return "";
|
|
1127
|
-
if (
|
|
1128
|
-
if (
|
|
1129
|
-
return `${
|
|
1130
|
-
if (
|
|
1131
|
-
return `${
|
|
1132
|
-
if (
|
|
1133
|
-
return `${(
|
|
1187
|
+
if (a) {
|
|
1188
|
+
if (Y === "days")
|
|
1189
|
+
return `${on(D.from)} ~ ${on(D.to || D.from) || "-"}`;
|
|
1190
|
+
if (Y === "months")
|
|
1191
|
+
return `${Q[D.from.getMonth()]} ~ ${D.to ? Q[D.to.getMonth()] : "-"}`;
|
|
1192
|
+
if (Y === "years")
|
|
1193
|
+
return `${(t = D.from) == null ? void 0 : t.getFullYear()} ~ ${((f = D.to) == null ? void 0 : f.getFullYear()) || "-"}`;
|
|
1134
1194
|
} else
|
|
1135
|
-
return `${
|
|
1136
|
-
},
|
|
1137
|
-
if (
|
|
1138
|
-
const
|
|
1139
|
-
window.innerWidth <
|
|
1195
|
+
return `${on(D.from)} ~ ${on(D.to || D.from) || "-"}`;
|
|
1196
|
+
}, R = () => {
|
|
1197
|
+
if (m.current && B.current && W) {
|
|
1198
|
+
const t = B.current.getBoundingClientRect(), f = m.current.getBoundingClientRect();
|
|
1199
|
+
window.innerWidth < t.left + f.width ? m.current.style.left = `${t.left - f.width + t.width}px` : m.current.style.left = `${t.left}px`, t.top + f.height > window.innerHeight ? m.current.style.top = `${t.y - (t.height + f.height - 28)}px` : m.current.style.top = `${t.y + t.height}px`;
|
|
1140
1200
|
}
|
|
1141
1201
|
};
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
}, [
|
|
1145
|
-
window.removeEventListener("scroll",
|
|
1202
|
+
P(() => {
|
|
1203
|
+
m.current && B.current && W && R();
|
|
1204
|
+
}, [m, B, F]), P(() => (window.addEventListener("scroll", R, !0), window.addEventListener("resize", R), () => {
|
|
1205
|
+
window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R);
|
|
1146
1206
|
}), []);
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1207
|
+
const ln = () => $(!0), dn = () => $(!1), nn = () => $((t) => !t), cn = () => {
|
|
1208
|
+
x && U(Un(D, a));
|
|
1209
|
+
}, en = () => {
|
|
1210
|
+
if (q === null)
|
|
1211
|
+
return;
|
|
1212
|
+
const t = q.trim();
|
|
1213
|
+
if (!t) {
|
|
1214
|
+
e(void 0), U(null);
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const f = Gn(t, a), V = f && Dn(f.from, d, i) && (!f.to || Dn(f.to, d, i));
|
|
1218
|
+
f && V && (e(f), J(f), I(f.from)), U(null);
|
|
1219
|
+
}, un = (t) => {
|
|
1220
|
+
t.key === "Enter" ? (en(), $(!1)) : t.key === "Escape" && (U(null), $(!1));
|
|
1221
|
+
}, pn = {
|
|
1222
|
+
isOpen: F,
|
|
1223
|
+
open: ln,
|
|
1224
|
+
close: dn,
|
|
1225
|
+
toggle: nn,
|
|
1152
1226
|
value: n,
|
|
1153
|
-
formattedValue: String(
|
|
1227
|
+
formattedValue: String(X() ?? ""),
|
|
1154
1228
|
clear: () => e(void 0),
|
|
1155
|
-
disabled:
|
|
1156
|
-
placeholder:
|
|
1157
|
-
},
|
|
1229
|
+
disabled: r,
|
|
1230
|
+
placeholder: p
|
|
1231
|
+
}, hn = /* @__PURE__ */ z(
|
|
1158
1232
|
"div",
|
|
1159
1233
|
{
|
|
1160
|
-
className: "sa-calendar-wrapper"
|
|
1161
|
-
style: { height:
|
|
1162
|
-
ref:
|
|
1234
|
+
className: `sa-calendar-wrapper${A ? " sa-calendar-wrapper-custom" : ""}`,
|
|
1235
|
+
style: { height: O ? "100%" : "auto" },
|
|
1236
|
+
ref: W ? B : null,
|
|
1163
1237
|
children: [
|
|
1164
|
-
|
|
1165
|
-
if (typeof
|
|
1166
|
-
return
|
|
1167
|
-
if (
|
|
1168
|
-
const
|
|
1169
|
-
return
|
|
1170
|
-
onClick: (
|
|
1171
|
-
var
|
|
1172
|
-
(
|
|
1238
|
+
A ? (() => {
|
|
1239
|
+
if (typeof g == "function")
|
|
1240
|
+
return g(pn);
|
|
1241
|
+
if (wn.isValidElement(b)) {
|
|
1242
|
+
const t = b;
|
|
1243
|
+
return wn.cloneElement(t, {
|
|
1244
|
+
onClick: (f) => {
|
|
1245
|
+
var V, an;
|
|
1246
|
+
(an = (V = t.props) == null ? void 0 : V.onClick) == null || an.call(V, f), r || nn();
|
|
1173
1247
|
}
|
|
1174
1248
|
});
|
|
1175
1249
|
}
|
|
1176
|
-
return
|
|
1177
|
-
})() : o ? /* @__PURE__ */
|
|
1178
|
-
|
|
1250
|
+
return b;
|
|
1251
|
+
})() : o ? /* @__PURE__ */ s(
|
|
1252
|
+
Hn,
|
|
1179
1253
|
{
|
|
1180
|
-
value:
|
|
1181
|
-
inputMode: "none",
|
|
1254
|
+
value: x && q !== null ? q : X(),
|
|
1255
|
+
inputMode: x ? "text" : "none",
|
|
1256
|
+
readOnly: !x,
|
|
1182
1257
|
onClick: () => {
|
|
1183
1258
|
$(!0);
|
|
1184
1259
|
},
|
|
1185
|
-
onChange: () => {
|
|
1260
|
+
onChange: x ? (t) => U(t.target.value) : () => {
|
|
1186
1261
|
},
|
|
1187
|
-
|
|
1188
|
-
|
|
1262
|
+
onFocus: x ? cn : void 0,
|
|
1263
|
+
onBlur: x ? en : void 0,
|
|
1264
|
+
onKeyDown: x ? un : void 0,
|
|
1265
|
+
disabled: r,
|
|
1266
|
+
placeholder: p,
|
|
1189
1267
|
size: h,
|
|
1190
|
-
variant:
|
|
1191
|
-
status:
|
|
1192
|
-
clearable:
|
|
1268
|
+
variant: l,
|
|
1269
|
+
status: j,
|
|
1270
|
+
clearable: w,
|
|
1193
1271
|
onClear: () => e(void 0)
|
|
1194
1272
|
}
|
|
1195
1273
|
) : null,
|
|
1196
|
-
|
|
1274
|
+
F ? /* @__PURE__ */ z(
|
|
1197
1275
|
"div",
|
|
1198
1276
|
{
|
|
1199
|
-
className: `sa-calendar sa-calendar-size-${h || "sm"} ${
|
|
1200
|
-
style:
|
|
1201
|
-
ref:
|
|
1277
|
+
className: `sa-calendar sa-calendar-size-${h || "sm"} ${O ? "sa-calendar-no-input" : ""} ${E ? "" : "sa-calendar-no-padding"}`,
|
|
1278
|
+
style: r ? { pointerEvents: "none" } : void 0,
|
|
1279
|
+
ref: m,
|
|
1202
1280
|
children: [
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
|
|
1281
|
+
/* @__PURE__ */ s(
|
|
1282
|
+
qn,
|
|
1205
1283
|
{
|
|
1206
|
-
setViews:
|
|
1207
|
-
views:
|
|
1208
|
-
filter:
|
|
1209
|
-
date:
|
|
1210
|
-
setDate:
|
|
1284
|
+
setViews: L,
|
|
1285
|
+
views: Y,
|
|
1286
|
+
filter: a,
|
|
1287
|
+
date: S,
|
|
1288
|
+
setDate: I
|
|
1211
1289
|
}
|
|
1212
1290
|
),
|
|
1213
|
-
/* @__PURE__ */
|
|
1214
|
-
|
|
1291
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-body", children: Y === "days" ? /* @__PURE__ */ s(
|
|
1292
|
+
Wn,
|
|
1215
1293
|
{
|
|
1216
|
-
date:
|
|
1217
|
-
setDate:
|
|
1294
|
+
date: S,
|
|
1295
|
+
setDate: I,
|
|
1218
1296
|
setIsComponentVisible: $,
|
|
1219
|
-
dateRange:
|
|
1220
|
-
setDateRange:
|
|
1297
|
+
dateRange: D,
|
|
1298
|
+
setDateRange: J,
|
|
1221
1299
|
input: o,
|
|
1222
1300
|
onChange: e,
|
|
1223
1301
|
minDate: d,
|
|
1224
|
-
maxDate:
|
|
1302
|
+
maxDate: i
|
|
1225
1303
|
}
|
|
1226
|
-
) :
|
|
1227
|
-
|
|
1304
|
+
) : Y === "months" ? /* @__PURE__ */ s(
|
|
1305
|
+
Jn,
|
|
1228
1306
|
{
|
|
1229
|
-
date:
|
|
1230
|
-
setDate:
|
|
1231
|
-
filter:
|
|
1232
|
-
setViews:
|
|
1233
|
-
dateRange:
|
|
1234
|
-
setDateRange:
|
|
1307
|
+
date: S,
|
|
1308
|
+
setDate: I,
|
|
1309
|
+
filter: a,
|
|
1310
|
+
setViews: L,
|
|
1311
|
+
dateRange: D,
|
|
1312
|
+
setDateRange: J,
|
|
1235
1313
|
setIsComponentVisible: $,
|
|
1236
1314
|
input: o,
|
|
1237
1315
|
onChange: e,
|
|
1238
1316
|
minDate: d,
|
|
1239
|
-
maxDate:
|
|
1317
|
+
maxDate: i
|
|
1240
1318
|
}
|
|
1241
|
-
) : /* @__PURE__ */
|
|
1242
|
-
|
|
1319
|
+
) : /* @__PURE__ */ s(
|
|
1320
|
+
Kn,
|
|
1243
1321
|
{
|
|
1244
|
-
date:
|
|
1245
|
-
setDate:
|
|
1246
|
-
filter:
|
|
1247
|
-
setViews:
|
|
1248
|
-
dateRange:
|
|
1249
|
-
setDateRange:
|
|
1322
|
+
date: S,
|
|
1323
|
+
setDate: I,
|
|
1324
|
+
filter: a,
|
|
1325
|
+
setViews: L,
|
|
1326
|
+
dateRange: D,
|
|
1327
|
+
setDateRange: J,
|
|
1250
1328
|
setIsComponentVisible: $,
|
|
1251
1329
|
input: o,
|
|
1252
1330
|
onChange: e,
|
|
1253
1331
|
minDate: d,
|
|
1254
|
-
maxDate:
|
|
1332
|
+
maxDate: i
|
|
1255
1333
|
}
|
|
1256
1334
|
) })
|
|
1257
1335
|
]
|
|
@@ -1260,30 +1338,30 @@ const Wn = mn(
|
|
|
1260
1338
|
]
|
|
1261
1339
|
}
|
|
1262
1340
|
);
|
|
1263
|
-
return /* @__PURE__ */
|
|
1264
|
-
|
|
1341
|
+
return /* @__PURE__ */ s(
|
|
1342
|
+
Yn,
|
|
1265
1343
|
{
|
|
1266
|
-
label:
|
|
1267
|
-
labelPosition:
|
|
1268
|
-
required:
|
|
1269
|
-
optional:
|
|
1270
|
-
description:
|
|
1271
|
-
helperText:
|
|
1272
|
-
errorText:
|
|
1273
|
-
fullWidth:
|
|
1344
|
+
label: u,
|
|
1345
|
+
labelPosition: C,
|
|
1346
|
+
required: T,
|
|
1347
|
+
optional: y,
|
|
1348
|
+
description: k,
|
|
1349
|
+
helperText: v,
|
|
1350
|
+
errorText: N,
|
|
1351
|
+
fullWidth: M,
|
|
1274
1352
|
size: h,
|
|
1275
|
-
children:
|
|
1353
|
+
children: hn
|
|
1276
1354
|
}
|
|
1277
1355
|
);
|
|
1278
1356
|
}
|
|
1279
|
-
),
|
|
1280
|
-
if (!(typeof document > "u") && !document.getElementById(
|
|
1357
|
+
), In = "sa-calendar-input-styles", Qn = (n) => {
|
|
1358
|
+
if (!(typeof document > "u") && !document.getElementById(In)) {
|
|
1281
1359
|
const e = document.createElement("style");
|
|
1282
|
-
e.id =
|
|
1360
|
+
e.id = In, e.textContent = n, document.head.appendChild(e);
|
|
1283
1361
|
}
|
|
1284
1362
|
};
|
|
1285
|
-
|
|
1286
|
-
const
|
|
1363
|
+
Qn(gn);
|
|
1364
|
+
const sn = (n) => {
|
|
1287
1365
|
if (n === "xs")
|
|
1288
1366
|
return 14;
|
|
1289
1367
|
if (n === "sm")
|
|
@@ -1292,34 +1370,34 @@ const tn = (n) => {
|
|
|
1292
1370
|
return 16;
|
|
1293
1371
|
if (n === "lg")
|
|
1294
1372
|
return 20;
|
|
1295
|
-
},
|
|
1373
|
+
}, Xn = (n) => {
|
|
1296
1374
|
const {
|
|
1297
1375
|
size: e = "sm",
|
|
1298
|
-
status:
|
|
1376
|
+
status: a = "default",
|
|
1299
1377
|
variant: o = "outline",
|
|
1300
|
-
clearable:
|
|
1378
|
+
clearable: r,
|
|
1301
1379
|
onClear: d,
|
|
1302
|
-
...
|
|
1303
|
-
} = n,
|
|
1304
|
-
|
|
1305
|
-
},
|
|
1306
|
-
|
|
1380
|
+
...i
|
|
1381
|
+
} = n, p = _(null), h = () => {
|
|
1382
|
+
p.current && i.onClick && (p.current.focus(), i.onClick(""));
|
|
1383
|
+
}, l = a === "disable" || i.disabled, c = !!i.value, w = r && c && !l, M = (E) => {
|
|
1384
|
+
E.stopPropagation(), d == null || d();
|
|
1307
1385
|
};
|
|
1308
|
-
return /* @__PURE__ */
|
|
1386
|
+
return /* @__PURE__ */ z(
|
|
1309
1387
|
"div",
|
|
1310
1388
|
{
|
|
1311
|
-
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${
|
|
1389
|
+
className: `sa-calendar-input-container sa-calendar-input-${o} sa-calendar-input-container-${a} ${e} `,
|
|
1312
1390
|
onClick: h,
|
|
1313
1391
|
children: [
|
|
1314
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ s(
|
|
1315
1393
|
"svg",
|
|
1316
1394
|
{
|
|
1317
1395
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1318
|
-
width:
|
|
1319
|
-
height:
|
|
1396
|
+
width: sn(e),
|
|
1397
|
+
height: sn(e),
|
|
1320
1398
|
viewBox: "0 0 20 20",
|
|
1321
1399
|
fill: "none",
|
|
1322
|
-
children: /* @__PURE__ */
|
|
1400
|
+
children: /* @__PURE__ */ s(
|
|
1323
1401
|
"path",
|
|
1324
1402
|
{
|
|
1325
1403
|
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",
|
|
@@ -1331,32 +1409,32 @@ const tn = (n) => {
|
|
|
1331
1409
|
)
|
|
1332
1410
|
}
|
|
1333
1411
|
) }),
|
|
1334
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ s(
|
|
1335
1413
|
"input",
|
|
1336
1414
|
{
|
|
1337
1415
|
className: "sa-calendar-input",
|
|
1338
|
-
...
|
|
1339
|
-
disabled:
|
|
1340
|
-
value:
|
|
1341
|
-
ref:
|
|
1416
|
+
...i,
|
|
1417
|
+
disabled: l,
|
|
1418
|
+
value: i.value,
|
|
1419
|
+
ref: p
|
|
1342
1420
|
}
|
|
1343
1421
|
) }),
|
|
1344
|
-
|
|
1422
|
+
w ? /* @__PURE__ */ s(
|
|
1345
1423
|
"button",
|
|
1346
1424
|
{
|
|
1347
1425
|
type: "button",
|
|
1348
1426
|
"aria-label": "Clear date",
|
|
1349
1427
|
className: "sa-calendar-input-clear",
|
|
1350
|
-
onClick:
|
|
1351
|
-
children: /* @__PURE__ */
|
|
1428
|
+
onClick: M,
|
|
1429
|
+
children: /* @__PURE__ */ s(
|
|
1352
1430
|
"svg",
|
|
1353
1431
|
{
|
|
1354
1432
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1355
|
-
width:
|
|
1356
|
-
height:
|
|
1433
|
+
width: sn(e),
|
|
1434
|
+
height: sn(e),
|
|
1357
1435
|
viewBox: "0 0 20 20",
|
|
1358
1436
|
fill: "none",
|
|
1359
|
-
children: /* @__PURE__ */
|
|
1437
|
+
children: /* @__PURE__ */ s(
|
|
1360
1438
|
"path",
|
|
1361
1439
|
{
|
|
1362
1440
|
d: "M5 5L15 15M15 5L5 15",
|
|
@@ -1369,15 +1447,15 @@ const tn = (n) => {
|
|
|
1369
1447
|
}
|
|
1370
1448
|
)
|
|
1371
1449
|
}
|
|
1372
|
-
) : /* @__PURE__ */
|
|
1450
|
+
) : /* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ s(
|
|
1373
1451
|
"svg",
|
|
1374
1452
|
{
|
|
1375
1453
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1376
|
-
width:
|
|
1377
|
-
height:
|
|
1454
|
+
width: sn(e),
|
|
1455
|
+
height: sn(e),
|
|
1378
1456
|
viewBox: "0 0 20 20",
|
|
1379
1457
|
fill: "none",
|
|
1380
|
-
children: /* @__PURE__ */
|
|
1458
|
+
children: /* @__PURE__ */ s(
|
|
1381
1459
|
"path",
|
|
1382
1460
|
{
|
|
1383
1461
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -1392,361 +1470,380 @@ const tn = (n) => {
|
|
|
1392
1470
|
]
|
|
1393
1471
|
}
|
|
1394
1472
|
);
|
|
1395
|
-
},
|
|
1473
|
+
}, ne = ({
|
|
1396
1474
|
date: n,
|
|
1397
1475
|
setDate: e,
|
|
1398
|
-
previewDate:
|
|
1476
|
+
previewDate: a,
|
|
1399
1477
|
setPreviewDate: o,
|
|
1400
|
-
setIsComponentVisible:
|
|
1478
|
+
setIsComponentVisible: r,
|
|
1401
1479
|
minDate: d,
|
|
1402
|
-
maxDate:
|
|
1403
|
-
input:
|
|
1480
|
+
maxDate: i,
|
|
1481
|
+
input: p,
|
|
1404
1482
|
onChange: h,
|
|
1405
|
-
hasValue:
|
|
1483
|
+
hasValue: l
|
|
1406
1484
|
}) => {
|
|
1407
1485
|
let c = new Date(
|
|
1408
|
-
|
|
1409
|
-
|
|
1486
|
+
a.getFullYear(),
|
|
1487
|
+
a.getMonth(),
|
|
1410
1488
|
1
|
|
1411
|
-
),
|
|
1412
|
-
const
|
|
1413
|
-
for (let
|
|
1414
|
-
|
|
1415
|
-
c.getDate() + (
|
|
1489
|
+
), w = c.getDay(), M = [];
|
|
1490
|
+
const E = n.toDateString(), x = (/* @__PURE__ */ new Date()).toDateString(), b = a.getMonth();
|
|
1491
|
+
for (let u = 0; u < 42; u++) {
|
|
1492
|
+
u === 0 && w === 0 ? c.setDate(c.getDate() - 7) : u === 0 ? c.setDate(
|
|
1493
|
+
c.getDate() + (u - w)
|
|
1416
1494
|
) : c.setDate(c.getDate() + 1);
|
|
1417
|
-
let
|
|
1495
|
+
let C = {
|
|
1418
1496
|
currentMonth: c.getMonth() === b,
|
|
1419
1497
|
date: new Date(c),
|
|
1420
1498
|
month: c.getMonth(),
|
|
1421
1499
|
number: c.getDate(),
|
|
1422
|
-
selected:
|
|
1423
|
-
isToday: c.toDateString() ===
|
|
1500
|
+
selected: l && c.toDateString() === E,
|
|
1501
|
+
isToday: c.toDateString() === x,
|
|
1424
1502
|
year: c.getFullYear(),
|
|
1425
|
-
isDisabled: d && c < d ||
|
|
1503
|
+
isDisabled: d && c < d || i && c > i
|
|
1426
1504
|
};
|
|
1427
|
-
|
|
1505
|
+
M.push(C);
|
|
1428
1506
|
}
|
|
1429
|
-
const g = (
|
|
1430
|
-
(!d ||
|
|
1507
|
+
const g = (u) => {
|
|
1508
|
+
(!d || u >= d) && (!i || u <= i) && (e(u), h(u), o(u), p && r(!1));
|
|
1431
1509
|
};
|
|
1432
|
-
return /* @__PURE__ */
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
/* @__PURE__ */
|
|
1435
|
-
const T =
|
|
1436
|
-
return /* @__PURE__ */
|
|
1510
|
+
return /* @__PURE__ */ z("div", { className: "sa-calendar-days-preivew", children: [
|
|
1511
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-days-name-preivew", children: Vn.map((u, C) => /* @__PURE__ */ s("p", { children: u }, C)) }),
|
|
1512
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-days-number-preivew", children: M.map((u, C) => {
|
|
1513
|
+
const T = u.isDisabled;
|
|
1514
|
+
return /* @__PURE__ */ s(
|
|
1437
1515
|
"p",
|
|
1438
1516
|
{
|
|
1439
|
-
className: `${
|
|
1517
|
+
className: `${u.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${u.selected ? "sa-calendar-days-active" : ""} ${u.isToday && !u.selected ? "sa-calendar-days-today" : ""}`,
|
|
1440
1518
|
style: {
|
|
1441
1519
|
color: T ? "#ccc" : void 0,
|
|
1442
1520
|
pointerEvents: T ? "none" : void 0,
|
|
1443
1521
|
cursor: T ? "not-allowed" : "pointer",
|
|
1444
|
-
...
|
|
1522
|
+
...p ? {} : { width: "100%" }
|
|
1445
1523
|
},
|
|
1446
1524
|
onClick: () => {
|
|
1447
|
-
T || g(
|
|
1525
|
+
T || g(u.date);
|
|
1448
1526
|
},
|
|
1449
|
-
children:
|
|
1527
|
+
children: u.number
|
|
1450
1528
|
},
|
|
1451
|
-
|
|
1529
|
+
C
|
|
1452
1530
|
);
|
|
1453
1531
|
}) })
|
|
1454
1532
|
] });
|
|
1455
|
-
},
|
|
1533
|
+
}, ee = ({
|
|
1456
1534
|
date: n,
|
|
1457
1535
|
setDate: e,
|
|
1458
|
-
filter:
|
|
1536
|
+
filter: a,
|
|
1459
1537
|
setViews: o,
|
|
1460
|
-
onChange:
|
|
1538
|
+
onChange: r,
|
|
1461
1539
|
previewDate: d,
|
|
1462
|
-
setPreviewDate:
|
|
1463
|
-
minDate:
|
|
1540
|
+
setPreviewDate: i,
|
|
1541
|
+
minDate: p,
|
|
1464
1542
|
maxDate: h,
|
|
1465
|
-
input:
|
|
1543
|
+
input: l,
|
|
1466
1544
|
hasValue: c
|
|
1467
1545
|
}) => {
|
|
1468
|
-
const
|
|
1469
|
-
(!
|
|
1546
|
+
const w = n.getMonth(), M = n.getFullYear(), E = d.getFullYear(), x = (b) => {
|
|
1547
|
+
(!p || b >= p) && (!h || b <= h) && (a ? (r(b), e(b), i(b)) : (o("days"), i(b)));
|
|
1470
1548
|
};
|
|
1471
|
-
return /* @__PURE__ */
|
|
1472
|
-
const
|
|
1473
|
-
return /* @__PURE__ */
|
|
1549
|
+
return /* @__PURE__ */ s("div", { className: "sa-calendar-months-preview", children: Q.map((b, g) => {
|
|
1550
|
+
const u = p && new Date(E, g, 1) < p || h && new Date(E, g + 1, 0) > h;
|
|
1551
|
+
return /* @__PURE__ */ s(
|
|
1474
1552
|
"p",
|
|
1475
1553
|
{
|
|
1476
|
-
className: c && g ===
|
|
1554
|
+
className: c && g === w && E === M ? "sa-calendar-months-active" : "",
|
|
1477
1555
|
style: {
|
|
1478
|
-
color:
|
|
1479
|
-
pointerEvents:
|
|
1480
|
-
cursor:
|
|
1481
|
-
...
|
|
1556
|
+
color: u ? "#ccc" : void 0,
|
|
1557
|
+
pointerEvents: u ? "none" : void 0,
|
|
1558
|
+
cursor: u ? "not-allowed" : "pointer",
|
|
1559
|
+
...l ? {} : { width: "100%" }
|
|
1482
1560
|
},
|
|
1483
1561
|
onClick: () => {
|
|
1484
|
-
|
|
1562
|
+
u || x(new Date(E, g));
|
|
1485
1563
|
},
|
|
1486
1564
|
children: b.slice(0, 3)
|
|
1487
1565
|
},
|
|
1488
1566
|
g
|
|
1489
1567
|
);
|
|
1490
1568
|
}) });
|
|
1491
|
-
},
|
|
1492
|
-
const e = Math.floor(n / 10) * 10,
|
|
1493
|
-
return { start: e, end:
|
|
1494
|
-
},
|
|
1569
|
+
}, zn = (n) => {
|
|
1570
|
+
const e = Math.floor(n / 10) * 10, a = e + 10;
|
|
1571
|
+
return { start: e, end: a };
|
|
1572
|
+
}, ae = ({
|
|
1495
1573
|
date: n,
|
|
1496
1574
|
filter: e,
|
|
1497
|
-
setViews:
|
|
1575
|
+
setViews: a,
|
|
1498
1576
|
setDate: o,
|
|
1499
|
-
onChange:
|
|
1577
|
+
onChange: r,
|
|
1500
1578
|
previewDate: d,
|
|
1501
|
-
setPreviewDate:
|
|
1502
|
-
minDate:
|
|
1579
|
+
setPreviewDate: i,
|
|
1580
|
+
minDate: p,
|
|
1503
1581
|
maxDate: h,
|
|
1504
|
-
input:
|
|
1582
|
+
input: l,
|
|
1505
1583
|
hasValue: c
|
|
1506
1584
|
}) => {
|
|
1507
|
-
let
|
|
1508
|
-
const
|
|
1509
|
-
for (let
|
|
1510
|
-
let
|
|
1511
|
-
|
|
1512
|
-
year:
|
|
1513
|
-
active: !!c &&
|
|
1514
|
-
isDisabled:
|
|
1585
|
+
let w = [];
|
|
1586
|
+
const M = d.getFullYear(), { start: E, end: x } = zn(M), b = n.getFullYear();
|
|
1587
|
+
for (let u = E; u < x; u++) {
|
|
1588
|
+
let C = p && new Date(u, 0, 1) < p || h && new Date(u, 11, 31) > h;
|
|
1589
|
+
w.push({
|
|
1590
|
+
year: u,
|
|
1591
|
+
active: !!c && u === b,
|
|
1592
|
+
isDisabled: C
|
|
1515
1593
|
});
|
|
1516
1594
|
}
|
|
1517
|
-
const g = (
|
|
1518
|
-
(!
|
|
1595
|
+
const g = (u) => {
|
|
1596
|
+
(!p || u >= p) && (!h || u <= h) && (e ? (r(u), o(u), i(u)) : (a("months"), i(u)));
|
|
1519
1597
|
};
|
|
1520
|
-
return /* @__PURE__ */
|
|
1598
|
+
return /* @__PURE__ */ s("div", { className: "sa-calendar-years-preview", children: w.map((u, C) => /* @__PURE__ */ s(
|
|
1521
1599
|
"p",
|
|
1522
1600
|
{
|
|
1523
|
-
className:
|
|
1601
|
+
className: u.active ? "sa-calendar-months-active" : "",
|
|
1524
1602
|
style: {
|
|
1525
|
-
color:
|
|
1526
|
-
pointerEvents:
|
|
1527
|
-
cursor:
|
|
1528
|
-
...
|
|
1603
|
+
color: u.isDisabled ? "#ccc" : void 0,
|
|
1604
|
+
pointerEvents: u.isDisabled ? "none" : void 0,
|
|
1605
|
+
cursor: u.isDisabled ? "not-allowed" : "pointer",
|
|
1606
|
+
...l ? {} : { width: "100%" }
|
|
1529
1607
|
},
|
|
1530
1608
|
onClick: () => {
|
|
1531
|
-
|
|
1609
|
+
u.isDisabled || g(new Date(u.year, 0));
|
|
1532
1610
|
},
|
|
1533
|
-
children:
|
|
1611
|
+
children: u.year
|
|
1534
1612
|
},
|
|
1535
|
-
|
|
1613
|
+
C
|
|
1536
1614
|
)) });
|
|
1537
|
-
},
|
|
1615
|
+
}, te = ({
|
|
1538
1616
|
setViews: n,
|
|
1539
1617
|
views: e,
|
|
1540
|
-
filter:
|
|
1618
|
+
filter: a,
|
|
1541
1619
|
previewDate: o,
|
|
1542
|
-
setPreviewDate:
|
|
1620
|
+
setPreviewDate: r
|
|
1543
1621
|
}) => {
|
|
1544
1622
|
const d = () => {
|
|
1545
|
-
|
|
1546
|
-
},
|
|
1623
|
+
a || n((l) => l === "days" ? "months" : l === "months" ? "years" : "days");
|
|
1624
|
+
}, i = () => {
|
|
1547
1625
|
if (e === "years") {
|
|
1548
|
-
|
|
1626
|
+
r((l) => new Date(l.getFullYear() + 10, 0));
|
|
1549
1627
|
return;
|
|
1550
1628
|
}
|
|
1551
1629
|
if (e === "months") {
|
|
1552
|
-
|
|
1553
|
-
(
|
|
1630
|
+
r(
|
|
1631
|
+
(l) => new Date(l.getFullYear() + 1, l.getMonth())
|
|
1554
1632
|
);
|
|
1555
1633
|
return;
|
|
1556
1634
|
}
|
|
1557
|
-
|
|
1558
|
-
},
|
|
1635
|
+
r((l) => new Date(l.getFullYear(), l.getMonth() + 1));
|
|
1636
|
+
}, p = () => {
|
|
1559
1637
|
if (e === "years") {
|
|
1560
|
-
|
|
1638
|
+
r((l) => new Date(l.getFullYear() - 10, 0));
|
|
1561
1639
|
return;
|
|
1562
1640
|
}
|
|
1563
1641
|
if (e === "months") {
|
|
1564
|
-
|
|
1565
|
-
(
|
|
1642
|
+
r(
|
|
1643
|
+
(l) => new Date(l.getFullYear() - 1, l.getMonth())
|
|
1566
1644
|
);
|
|
1567
1645
|
return;
|
|
1568
1646
|
}
|
|
1569
|
-
|
|
1570
|
-
(
|
|
1571
|
-
|
|
1572
|
-
|
|
1647
|
+
r(
|
|
1648
|
+
(l) => new Date(
|
|
1649
|
+
l.getMonth() === 0 ? l.getFullYear() - 1 : l.getFullYear(),
|
|
1650
|
+
l.getMonth() === 0 ? 11 : l.getMonth() - 1
|
|
1573
1651
|
)
|
|
1574
1652
|
);
|
|
1575
1653
|
};
|
|
1576
|
-
return /* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1654
|
+
return /* @__PURE__ */ z("div", { className: "sa-calendar-header", children: [
|
|
1655
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-header-title", onClick: d, children: (() => {
|
|
1578
1656
|
if (e === "days")
|
|
1579
|
-
return `${
|
|
1657
|
+
return `${Q[o.getMonth()]} ${o.getFullYear()}`;
|
|
1580
1658
|
if (e === "months")
|
|
1581
1659
|
return `${o.getFullYear()}`;
|
|
1582
1660
|
if (e === "years")
|
|
1583
|
-
return `${
|
|
1661
|
+
return `${zn(o.getFullYear()).start} ~ ${zn(o.getFullYear()).end}`;
|
|
1584
1662
|
})() }),
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1587
|
-
/* @__PURE__ */
|
|
1663
|
+
/* @__PURE__ */ z("div", { className: "sa-calendar-header-nav", children: [
|
|
1664
|
+
/* @__PURE__ */ s("button", { className: "sa-calendar-nav-btn", onClick: p, children: /* @__PURE__ */ s(Pn, {}) }),
|
|
1665
|
+
/* @__PURE__ */ s("button", { className: "sa-calendar-nav-btn", onClick: i, children: /* @__PURE__ */ s(Rn, {}) })
|
|
1588
1666
|
] })
|
|
1589
1667
|
] });
|
|
1590
|
-
},
|
|
1591
|
-
if (!(typeof document > "u") && !document.getElementById(
|
|
1668
|
+
}, Tn = "sa-calendar-styles", re = (n) => {
|
|
1669
|
+
if (!(typeof document > "u") && !document.getElementById(Tn)) {
|
|
1592
1670
|
const e = document.createElement("style");
|
|
1593
|
-
e.id =
|
|
1671
|
+
e.id = Tn, e.textContent = n, document.head.appendChild(e);
|
|
1594
1672
|
}
|
|
1595
1673
|
};
|
|
1596
|
-
|
|
1597
|
-
const
|
|
1674
|
+
re(gn);
|
|
1675
|
+
const se = xn(
|
|
1598
1676
|
({
|
|
1599
1677
|
value: n,
|
|
1600
1678
|
onChange: e,
|
|
1601
|
-
filter:
|
|
1679
|
+
filter: a,
|
|
1602
1680
|
input: o = !0,
|
|
1603
|
-
disabled:
|
|
1681
|
+
disabled: r,
|
|
1604
1682
|
minDate: d,
|
|
1605
|
-
maxDate:
|
|
1606
|
-
placeholder:
|
|
1683
|
+
maxDate: i,
|
|
1684
|
+
placeholder: p,
|
|
1607
1685
|
size: h = "sm",
|
|
1608
|
-
variant:
|
|
1686
|
+
variant: l,
|
|
1609
1687
|
status: c,
|
|
1610
|
-
clearable:
|
|
1611
|
-
fullWidth:
|
|
1612
|
-
withPadding:
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
j(()
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1688
|
+
clearable: w,
|
|
1689
|
+
fullWidth: M = !0,
|
|
1690
|
+
withPadding: E = !0,
|
|
1691
|
+
editable: x = !1,
|
|
1692
|
+
trigger: b,
|
|
1693
|
+
renderTrigger: g,
|
|
1694
|
+
label: u,
|
|
1695
|
+
labelPosition: C,
|
|
1696
|
+
required: T,
|
|
1697
|
+
optional: y,
|
|
1698
|
+
description: k,
|
|
1699
|
+
helperText: v,
|
|
1700
|
+
errorText: N
|
|
1701
|
+
}, K) => {
|
|
1702
|
+
const j = N ? "error" : c, { ref: B, isComponentVisible: F, setIsComponentVisible: $ } = En(!1), m = _(null), [Y, L] = G("days"), [S, I] = G(/* @__PURE__ */ new Date()), [A, O] = G(/* @__PURE__ */ new Date()), [W, D] = G(null), J = typeof g == "function" || b != null, q = !o && !J, U = !q;
|
|
1703
|
+
P(() => {
|
|
1704
|
+
n ? (I(n), O(n)) : (I(/* @__PURE__ */ new Date()), O(/* @__PURE__ */ new Date())), D(null);
|
|
1705
|
+
}, [n]), P(() => {
|
|
1706
|
+
a && L(a);
|
|
1707
|
+
}, [a]), P(() => {
|
|
1708
|
+
a || L("days");
|
|
1709
|
+
}, [F]), P(() => {
|
|
1710
|
+
q && $(!0);
|
|
1711
|
+
}, [q]);
|
|
1712
|
+
const X = () => n ? a === "days" ? on(S) : a === "months" ? `${Q[S.getMonth()]} ${S.getFullYear()}` : a === "years" ? S.getFullYear() : on(S) : "", R = () => {
|
|
1713
|
+
if (m.current && B.current && U) {
|
|
1714
|
+
const t = B.current.getBoundingClientRect(), f = m.current.getBoundingClientRect();
|
|
1715
|
+
window.innerWidth < t.left + f.width ? m.current.style.left = `${t.left - f.width + t.width}px` : m.current.style.left = `${t.left}px`, t.top + f.height > window.innerHeight ? m.current.style.top = `${t.y - (t.height + f.height - 28)}px` : m.current.style.top = `${t.y + t.height}px`;
|
|
1637
1716
|
}
|
|
1638
1717
|
};
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
}, [
|
|
1642
|
-
window.removeEventListener("scroll",
|
|
1718
|
+
P(() => {
|
|
1719
|
+
m.current && B.current && U && R();
|
|
1720
|
+
}, [m, B, F]), P(() => (window.addEventListener("scroll", R, !0), window.addEventListener("resize", R), () => {
|
|
1721
|
+
window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R);
|
|
1643
1722
|
}), []);
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1723
|
+
const ln = () => $(!0), dn = () => $(!1), nn = () => $((t) => !t), cn = () => {
|
|
1724
|
+
x && D(n ? $n(n, a) : "");
|
|
1725
|
+
}, en = () => {
|
|
1726
|
+
if (W === null)
|
|
1727
|
+
return;
|
|
1728
|
+
const t = W.trim();
|
|
1729
|
+
if (!t) {
|
|
1730
|
+
e(void 0), D(null);
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
const f = bn(t, a);
|
|
1734
|
+
f && Dn(f, d, i) && (e(f), I(f), O(f)), D(null);
|
|
1735
|
+
}, un = (t) => {
|
|
1736
|
+
t.key === "Enter" ? (en(), $(!1)) : t.key === "Escape" && (D(null), $(!1));
|
|
1737
|
+
}, pn = {
|
|
1738
|
+
isOpen: F,
|
|
1739
|
+
open: ln,
|
|
1740
|
+
close: dn,
|
|
1741
|
+
toggle: nn,
|
|
1649
1742
|
value: n,
|
|
1650
|
-
formattedValue: String(
|
|
1743
|
+
formattedValue: String(X() ?? ""),
|
|
1651
1744
|
clear: () => e(void 0),
|
|
1652
|
-
disabled:
|
|
1653
|
-
placeholder:
|
|
1654
|
-
},
|
|
1745
|
+
disabled: r,
|
|
1746
|
+
placeholder: p
|
|
1747
|
+
}, hn = /* @__PURE__ */ z(
|
|
1655
1748
|
"div",
|
|
1656
1749
|
{
|
|
1657
|
-
className: "sa-calendar-wrapper"
|
|
1658
|
-
style: { height:
|
|
1659
|
-
ref:
|
|
1750
|
+
className: `sa-calendar-wrapper${J ? " sa-calendar-wrapper-custom" : ""}`,
|
|
1751
|
+
style: { height: q ? "100%" : "auto" },
|
|
1752
|
+
ref: U ? B : null,
|
|
1660
1753
|
children: [
|
|
1661
|
-
|
|
1662
|
-
if (typeof
|
|
1663
|
-
return
|
|
1664
|
-
if (
|
|
1665
|
-
const
|
|
1666
|
-
return
|
|
1667
|
-
onClick: (
|
|
1668
|
-
var
|
|
1669
|
-
(
|
|
1754
|
+
J ? (() => {
|
|
1755
|
+
if (typeof g == "function")
|
|
1756
|
+
return g(pn);
|
|
1757
|
+
if (wn.isValidElement(b)) {
|
|
1758
|
+
const t = b;
|
|
1759
|
+
return wn.cloneElement(t, {
|
|
1760
|
+
onClick: (f) => {
|
|
1761
|
+
var V, an;
|
|
1762
|
+
(an = (V = t.props) == null ? void 0 : V.onClick) == null || an.call(V, f), r || nn();
|
|
1670
1763
|
}
|
|
1671
1764
|
});
|
|
1672
1765
|
}
|
|
1673
|
-
return
|
|
1674
|
-
})() : o ? /* @__PURE__ */
|
|
1675
|
-
|
|
1766
|
+
return b;
|
|
1767
|
+
})() : o ? /* @__PURE__ */ s(
|
|
1768
|
+
Xn,
|
|
1676
1769
|
{
|
|
1677
|
-
value:
|
|
1770
|
+
value: x && W !== null ? W : X(),
|
|
1678
1771
|
onClick: () => $(!0),
|
|
1679
|
-
onChange: () => {
|
|
1772
|
+
onChange: x ? (t) => D(t.target.value) : () => {
|
|
1680
1773
|
},
|
|
1681
|
-
|
|
1682
|
-
|
|
1774
|
+
onFocus: x ? cn : void 0,
|
|
1775
|
+
onBlur: x ? en : void 0,
|
|
1776
|
+
onKeyDown: x ? un : void 0,
|
|
1777
|
+
placeholder: p,
|
|
1778
|
+
disabled: r,
|
|
1683
1779
|
size: h,
|
|
1684
|
-
variant:
|
|
1685
|
-
status:
|
|
1686
|
-
inputMode: "none",
|
|
1687
|
-
|
|
1780
|
+
variant: l,
|
|
1781
|
+
status: j,
|
|
1782
|
+
inputMode: x ? "text" : "none",
|
|
1783
|
+
readOnly: !x,
|
|
1784
|
+
clearable: w,
|
|
1688
1785
|
onClear: () => e(void 0)
|
|
1689
1786
|
}
|
|
1690
1787
|
) : null,
|
|
1691
|
-
|
|
1788
|
+
F ? /* @__PURE__ */ z(
|
|
1692
1789
|
"div",
|
|
1693
1790
|
{
|
|
1694
|
-
className: `sa-calendar sa-calendar-size-${h || "sm"} ${
|
|
1695
|
-
style:
|
|
1696
|
-
ref:
|
|
1791
|
+
className: `sa-calendar sa-calendar-size-${h || "sm"} ${q ? "sa-calendar-no-input" : ""} ${E ? "" : "sa-calendar-no-padding"}`,
|
|
1792
|
+
style: r ? { pointerEvents: "none" } : void 0,
|
|
1793
|
+
ref: m,
|
|
1697
1794
|
children: [
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
|
|
1795
|
+
/* @__PURE__ */ s(
|
|
1796
|
+
te,
|
|
1700
1797
|
{
|
|
1701
|
-
setViews:
|
|
1702
|
-
views:
|
|
1703
|
-
filter:
|
|
1704
|
-
previewDate:
|
|
1705
|
-
setPreviewDate:
|
|
1706
|
-
isComponentVisible:
|
|
1798
|
+
setViews: L,
|
|
1799
|
+
views: Y,
|
|
1800
|
+
filter: a,
|
|
1801
|
+
previewDate: A,
|
|
1802
|
+
setPreviewDate: O,
|
|
1803
|
+
isComponentVisible: F
|
|
1707
1804
|
}
|
|
1708
1805
|
),
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
-
|
|
1806
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-body", children: Y === "days" ? /* @__PURE__ */ s(
|
|
1807
|
+
ne,
|
|
1711
1808
|
{
|
|
1712
|
-
date:
|
|
1713
|
-
setDate:
|
|
1714
|
-
previewDate:
|
|
1715
|
-
setPreviewDate:
|
|
1809
|
+
date: S,
|
|
1810
|
+
setDate: I,
|
|
1811
|
+
previewDate: A,
|
|
1812
|
+
setPreviewDate: O,
|
|
1716
1813
|
setIsComponentVisible: $,
|
|
1717
1814
|
input: o,
|
|
1718
1815
|
minDate: d,
|
|
1719
|
-
maxDate:
|
|
1816
|
+
maxDate: i,
|
|
1720
1817
|
onChange: e,
|
|
1721
1818
|
hasValue: n != null
|
|
1722
1819
|
}
|
|
1723
|
-
) :
|
|
1724
|
-
|
|
1820
|
+
) : Y === "months" ? /* @__PURE__ */ s(
|
|
1821
|
+
ee,
|
|
1725
1822
|
{
|
|
1726
|
-
date:
|
|
1727
|
-
setDate:
|
|
1728
|
-
previewDate:
|
|
1729
|
-
setPreviewDate:
|
|
1730
|
-
filter:
|
|
1731
|
-
setViews:
|
|
1823
|
+
date: S,
|
|
1824
|
+
setDate: I,
|
|
1825
|
+
previewDate: A,
|
|
1826
|
+
setPreviewDate: O,
|
|
1827
|
+
filter: a,
|
|
1828
|
+
setViews: L,
|
|
1732
1829
|
onChange: e,
|
|
1733
1830
|
minDate: d,
|
|
1734
|
-
maxDate:
|
|
1831
|
+
maxDate: i,
|
|
1735
1832
|
input: o,
|
|
1736
1833
|
hasValue: n != null
|
|
1737
1834
|
}
|
|
1738
|
-
) : /* @__PURE__ */
|
|
1739
|
-
|
|
1835
|
+
) : /* @__PURE__ */ s(
|
|
1836
|
+
ae,
|
|
1740
1837
|
{
|
|
1741
|
-
date:
|
|
1742
|
-
setDate:
|
|
1743
|
-
previewDate:
|
|
1744
|
-
setPreviewDate:
|
|
1745
|
-
filter:
|
|
1746
|
-
setViews:
|
|
1838
|
+
date: S,
|
|
1839
|
+
setDate: I,
|
|
1840
|
+
previewDate: A,
|
|
1841
|
+
setPreviewDate: O,
|
|
1842
|
+
filter: a,
|
|
1843
|
+
setViews: L,
|
|
1747
1844
|
onChange: e,
|
|
1748
1845
|
minDate: d,
|
|
1749
|
-
maxDate:
|
|
1846
|
+
maxDate: i,
|
|
1750
1847
|
input: o,
|
|
1751
1848
|
hasValue: n != null
|
|
1752
1849
|
}
|
|
@@ -1757,77 +1854,79 @@ const Qn = mn(
|
|
|
1757
1854
|
]
|
|
1758
1855
|
}
|
|
1759
1856
|
);
|
|
1760
|
-
return /* @__PURE__ */
|
|
1761
|
-
|
|
1857
|
+
return /* @__PURE__ */ s(
|
|
1858
|
+
Yn,
|
|
1762
1859
|
{
|
|
1763
|
-
label:
|
|
1764
|
-
labelPosition:
|
|
1765
|
-
required:
|
|
1766
|
-
optional:
|
|
1767
|
-
description:
|
|
1768
|
-
helperText:
|
|
1769
|
-
errorText:
|
|
1770
|
-
fullWidth:
|
|
1860
|
+
label: u,
|
|
1861
|
+
labelPosition: C,
|
|
1862
|
+
required: T,
|
|
1863
|
+
optional: y,
|
|
1864
|
+
description: k,
|
|
1865
|
+
helperText: v,
|
|
1866
|
+
errorText: N,
|
|
1867
|
+
fullWidth: M,
|
|
1771
1868
|
size: h,
|
|
1772
|
-
children:
|
|
1869
|
+
children: hn
|
|
1773
1870
|
}
|
|
1774
1871
|
);
|
|
1775
1872
|
}
|
|
1776
|
-
),
|
|
1873
|
+
), ge = xn(
|
|
1777
1874
|
({
|
|
1778
1875
|
value: n,
|
|
1779
1876
|
onChange: e,
|
|
1780
|
-
filter:
|
|
1877
|
+
filter: a,
|
|
1781
1878
|
input: o = !0,
|
|
1782
|
-
rangedDate:
|
|
1879
|
+
rangedDate: r,
|
|
1783
1880
|
disabled: d,
|
|
1784
|
-
minDate:
|
|
1785
|
-
maxDate:
|
|
1881
|
+
minDate: i,
|
|
1882
|
+
maxDate: p,
|
|
1786
1883
|
placeholder: h,
|
|
1787
|
-
size:
|
|
1884
|
+
size: l,
|
|
1788
1885
|
variant: c,
|
|
1789
|
-
status:
|
|
1790
|
-
clearable:
|
|
1791
|
-
fullWidth:
|
|
1792
|
-
withPadding:
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1886
|
+
status: w,
|
|
1887
|
+
clearable: M,
|
|
1888
|
+
fullWidth: E,
|
|
1889
|
+
withPadding: x,
|
|
1890
|
+
editable: b,
|
|
1891
|
+
trigger: g,
|
|
1892
|
+
renderTrigger: u,
|
|
1893
|
+
label: C,
|
|
1894
|
+
labelPosition: T,
|
|
1895
|
+
required: y,
|
|
1896
|
+
optional: k,
|
|
1897
|
+
description: v,
|
|
1898
|
+
helperText: N,
|
|
1899
|
+
errorText: K
|
|
1900
|
+
}, j) => {
|
|
1901
|
+
const B = {
|
|
1804
1902
|
onChange: e,
|
|
1805
1903
|
value: n,
|
|
1806
1904
|
input: o,
|
|
1807
|
-
filter:
|
|
1905
|
+
filter: a,
|
|
1808
1906
|
disabled: d,
|
|
1809
|
-
minDate:
|
|
1810
|
-
maxDate:
|
|
1907
|
+
minDate: i,
|
|
1908
|
+
maxDate: p,
|
|
1811
1909
|
placeholder: h,
|
|
1812
|
-
size:
|
|
1910
|
+
size: l,
|
|
1813
1911
|
variant: c,
|
|
1814
|
-
status:
|
|
1815
|
-
clearable:
|
|
1816
|
-
fullWidth:
|
|
1817
|
-
withPadding:
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1912
|
+
status: w,
|
|
1913
|
+
clearable: M,
|
|
1914
|
+
fullWidth: E,
|
|
1915
|
+
withPadding: x,
|
|
1916
|
+
editable: b,
|
|
1917
|
+
trigger: g,
|
|
1918
|
+
renderTrigger: u,
|
|
1919
|
+
label: C,
|
|
1920
|
+
labelPosition: T,
|
|
1921
|
+
required: y,
|
|
1922
|
+
optional: k,
|
|
1923
|
+
description: v,
|
|
1924
|
+
helperText: N,
|
|
1925
|
+
errorText: K
|
|
1827
1926
|
};
|
|
1828
|
-
return /* @__PURE__ */
|
|
1927
|
+
return /* @__PURE__ */ s(yn, { children: r ? /* @__PURE__ */ s(_n, { ...B, ref: j }) : /* @__PURE__ */ s(se, { ...B, ref: j }) });
|
|
1829
1928
|
}
|
|
1830
|
-
),
|
|
1929
|
+
), oe = `/* StarasiaTime — popover columns. Reuses --sa-date-* tokens (defined in
|
|
1831
1930
|
date.module.css, injected alongside this sheet) and the .sa-calendar /
|
|
1832
1931
|
.sa-calendar-input-* shells for the box + masked input. */
|
|
1833
1932
|
|
|
@@ -1958,46 +2057,46 @@ const Qn = mn(
|
|
|
1958
2057
|
.sa-time-input-wrap {
|
|
1959
2058
|
width: 100%;
|
|
1960
2059
|
}
|
|
1961
|
-
`,
|
|
2060
|
+
`, Nn = (n, e, a) => Math.min(a, Math.max(e, n)), H = (n) => String(n).padStart(2, "0"), Mn = (n) => {
|
|
1962
2061
|
if (!n)
|
|
1963
2062
|
return null;
|
|
1964
2063
|
const e = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(n.trim());
|
|
1965
2064
|
if (!e)
|
|
1966
2065
|
return null;
|
|
1967
|
-
const
|
|
1968
|
-
return
|
|
1969
|
-
},
|
|
1970
|
-
const o =
|
|
2066
|
+
const a = Number(e[1]), o = Number(e[2]), r = e[3] != null ? Number(e[3]) : 0;
|
|
2067
|
+
return a > 23 || o > 59 || r > 59 ? null : { h: a, m: o, s: r };
|
|
2068
|
+
}, le = (n, e) => e ? `${H(n.h)}:${H(n.m)}:${H(n.s)}` : `${H(n.h)}:${H(n.m)}`, Z = (n) => n.h * 60 + n.m, ie = (n, e, a) => {
|
|
2069
|
+
const o = a ? `:${H(n.s)}` : "";
|
|
1971
2070
|
if (e === "12h") {
|
|
1972
|
-
const
|
|
1973
|
-
return `${
|
|
2071
|
+
const r = n.h >= 12 ? "PM" : "AM", d = n.h % 12 === 0 ? 12 : n.h % 12;
|
|
2072
|
+
return `${H(d)}:${H(n.m)}${o} ${r}`;
|
|
1974
2073
|
}
|
|
1975
|
-
return `${
|
|
1976
|
-
},
|
|
1977
|
-
const o = n.toLowerCase(),
|
|
2074
|
+
return `${H(n.h)}:${H(n.m)}${o}`;
|
|
2075
|
+
}, de = (n, e, a) => {
|
|
2076
|
+
const o = n.toLowerCase(), r = /p/.test(o) ? "pm" : /a/.test(o) ? "am" : null, d = o.replace(/[^\d]/g, "");
|
|
1978
2077
|
if (!d)
|
|
1979
2078
|
return null;
|
|
1980
|
-
let
|
|
2079
|
+
let i = 0, p = 0, h = 0;
|
|
1981
2080
|
if (n.includes(":")) {
|
|
1982
|
-
const
|
|
1983
|
-
|
|
2081
|
+
const l = n.split(":").map((c) => c.replace(/[^\d]/g, ""));
|
|
2082
|
+
i = Number(l[0] || 0), p = Number(l[1] || 0), h = a ? Number(l[2] || 0) : 0;
|
|
1984
2083
|
} else
|
|
1985
|
-
d.length <= 2 ?
|
|
1986
|
-
return
|
|
1987
|
-
},
|
|
1988
|
-
const
|
|
2084
|
+
d.length <= 2 ? i = Number(d) : d.length <= 4 ? (i = Number(d.slice(0, d.length - 2)), p = Number(d.slice(-2))) : (i = Number(d.slice(0, d.length - 4)), p = Number(d.slice(-4, -2)), h = a ? Number(d.slice(-2)) : 0);
|
|
2085
|
+
return r && (r === "pm" && i < 12 && (i += 12), r === "am" && i === 12 && (i = 0)), i > 23 || p > 59 || h > 59 ? null : { h: Nn(i, 0, 23), m: Nn(p, 0, 59), s: Nn(h, 0, 59) };
|
|
2086
|
+
}, mn = (n, e = 1) => {
|
|
2087
|
+
const a = [];
|
|
1989
2088
|
for (let o = 0; o < n; o += e)
|
|
1990
|
-
|
|
1991
|
-
return
|
|
1992
|
-
},
|
|
2089
|
+
a.push(o);
|
|
2090
|
+
return a;
|
|
2091
|
+
}, On = (n, e) => {
|
|
1993
2092
|
if (typeof document > "u" || document.getElementById(n))
|
|
1994
2093
|
return;
|
|
1995
|
-
const
|
|
1996
|
-
|
|
2094
|
+
const a = document.createElement("style");
|
|
2095
|
+
a.id = n, a.textContent = e, document.head.appendChild(a);
|
|
1997
2096
|
};
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
const
|
|
2097
|
+
On("sa-calendar-styles", gn);
|
|
2098
|
+
On("sa-time-styles", oe);
|
|
2099
|
+
const ce = (n) => n === "xs" ? 14 : n === "lg" ? 20 : 16, Bn = ({ s: n }) => /* @__PURE__ */ s("svg", { width: n, height: n, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ s(
|
|
2001
2100
|
"path",
|
|
2002
2101
|
{
|
|
2003
2102
|
d: "M10 5v5l3 2M17.5 10a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Z",
|
|
@@ -2006,7 +2105,7 @@ const te = (n) => n === "xs" ? 14 : n === "lg" ? 20 : 16, Yn = ({ s: n }) => /*
|
|
|
2006
2105
|
strokeLinecap: "round",
|
|
2007
2106
|
strokeLinejoin: "round"
|
|
2008
2107
|
}
|
|
2009
|
-
) }),
|
|
2108
|
+
) }), ue = ({ s: n }) => /* @__PURE__ */ s("svg", { width: n, height: n, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ s(
|
|
2010
2109
|
"path",
|
|
2011
2110
|
{
|
|
2012
2111
|
d: "M5 5l10 10M15 5L5 15",
|
|
@@ -2014,235 +2113,235 @@ const te = (n) => n === "xs" ? 14 : n === "lg" ? 20 : 16, Yn = ({ s: n }) => /*
|
|
|
2014
2113
|
strokeWidth: "1.5",
|
|
2015
2114
|
strokeLinecap: "round"
|
|
2016
2115
|
}
|
|
2017
|
-
) }),
|
|
2018
|
-
const
|
|
2019
|
-
return
|
|
2020
|
-
var
|
|
2021
|
-
(
|
|
2022
|
-
}, [
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
const
|
|
2026
|
-
return /* @__PURE__ */
|
|
2116
|
+
) }), vn = ({ label: n, options: e, active: a, onPick: o }) => {
|
|
2117
|
+
const r = _(null), d = _(null);
|
|
2118
|
+
return P(() => {
|
|
2119
|
+
var i;
|
|
2120
|
+
(i = d.current) == null || i.scrollIntoView({ block: "nearest" });
|
|
2121
|
+
}, [a]), /* @__PURE__ */ z("div", { className: "sa-time-col", children: [
|
|
2122
|
+
/* @__PURE__ */ s("div", { className: "sa-time-col-head", children: n }),
|
|
2123
|
+
/* @__PURE__ */ s("div", { className: "sa-time-col-list", ref: r, children: e.map((i) => {
|
|
2124
|
+
const p = i.value === a;
|
|
2125
|
+
return /* @__PURE__ */ s(
|
|
2027
2126
|
"button",
|
|
2028
2127
|
{
|
|
2029
2128
|
type: "button",
|
|
2030
|
-
ref:
|
|
2031
|
-
disabled:
|
|
2032
|
-
className: `sa-time-opt${
|
|
2033
|
-
onClick: () => o(
|
|
2034
|
-
children:
|
|
2129
|
+
ref: p ? d : null,
|
|
2130
|
+
disabled: i.disabled,
|
|
2131
|
+
className: `sa-time-opt${p ? " sa-time-opt-active" : ""}`,
|
|
2132
|
+
onClick: () => o(i.value),
|
|
2133
|
+
children: i.label
|
|
2035
2134
|
},
|
|
2036
|
-
|
|
2135
|
+
i.value
|
|
2037
2136
|
);
|
|
2038
2137
|
}) })
|
|
2039
2138
|
] });
|
|
2040
|
-
},
|
|
2139
|
+
}, pe = xn(
|
|
2041
2140
|
({
|
|
2042
2141
|
value: n,
|
|
2043
2142
|
onChange: e,
|
|
2044
|
-
format:
|
|
2143
|
+
format: a = "24h",
|
|
2045
2144
|
withSeconds: o = !1,
|
|
2046
|
-
step:
|
|
2145
|
+
step: r = 1,
|
|
2047
2146
|
minTime: d,
|
|
2048
|
-
maxTime:
|
|
2049
|
-
input:
|
|
2147
|
+
maxTime: i,
|
|
2148
|
+
input: p = !0,
|
|
2050
2149
|
placeholder: h = "--:--",
|
|
2051
|
-
disabled:
|
|
2150
|
+
disabled: l,
|
|
2052
2151
|
clearable: c,
|
|
2053
|
-
size:
|
|
2054
|
-
variant:
|
|
2055
|
-
status:
|
|
2056
|
-
fullWidth:
|
|
2152
|
+
size: w = "sm",
|
|
2153
|
+
variant: M = "outline",
|
|
2154
|
+
status: E,
|
|
2155
|
+
fullWidth: x = !0,
|
|
2057
2156
|
withPadding: b = !0,
|
|
2058
2157
|
label: g,
|
|
2059
|
-
labelPosition:
|
|
2060
|
-
required:
|
|
2158
|
+
labelPosition: u,
|
|
2159
|
+
required: C,
|
|
2061
2160
|
optional: T,
|
|
2062
|
-
description:
|
|
2063
|
-
helperText:
|
|
2064
|
-
errorText:
|
|
2065
|
-
},
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
}, [
|
|
2070
|
-
const
|
|
2071
|
-
if (
|
|
2161
|
+
description: y,
|
|
2162
|
+
helperText: k,
|
|
2163
|
+
errorText: v
|
|
2164
|
+
}, N) => {
|
|
2165
|
+
const K = v ? "error" : E, { ref: j, isComponentVisible: B, setIsComponentVisible: F } = En(!1), $ = _(null), m = tn(() => Mn(n), [n]), Y = tn(() => Mn(d), [d]), L = tn(() => Mn(i), [i]), [S, I] = G(null);
|
|
2166
|
+
P(() => {
|
|
2167
|
+
p || F(!0);
|
|
2168
|
+
}, [p]);
|
|
2169
|
+
const A = () => {
|
|
2170
|
+
if (!$.current || !j.current || !p)
|
|
2072
2171
|
return;
|
|
2073
|
-
const
|
|
2074
|
-
|
|
2172
|
+
const t = j.current.getBoundingClientRect(), f = $.current.getBoundingClientRect();
|
|
2173
|
+
$.current.style.left = window.innerWidth < t.left + f.width ? `${t.left - f.width + t.width}px` : `${t.left}px`, $.current.style.top = t.top + f.height > window.innerHeight ? `${t.y - (t.height + f.height - 28)}px` : `${t.y + t.height}px`;
|
|
2075
2174
|
};
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
}, [
|
|
2079
|
-
window.removeEventListener("scroll",
|
|
2175
|
+
P(() => {
|
|
2176
|
+
A();
|
|
2177
|
+
}, [B]), P(() => (window.addEventListener("scroll", A, !0), window.addEventListener("resize", A), () => {
|
|
2178
|
+
window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A);
|
|
2080
2179
|
}), []);
|
|
2081
|
-
const
|
|
2082
|
-
const
|
|
2083
|
-
return !(
|
|
2084
|
-
},
|
|
2085
|
-
e(
|
|
2086
|
-
},
|
|
2087
|
-
|
|
2088
|
-
},
|
|
2089
|
-
if (
|
|
2180
|
+
const O = (t) => {
|
|
2181
|
+
const f = Z(t);
|
|
2182
|
+
return !(Y && f < Z(Y) || L && f > Z(L));
|
|
2183
|
+
}, W = (t) => {
|
|
2184
|
+
e(le(t, o)), I(null);
|
|
2185
|
+
}, D = (t) => {
|
|
2186
|
+
W({ ...m ?? { h: 0, m: 0, s: 0 }, ...t });
|
|
2187
|
+
}, J = () => {
|
|
2188
|
+
if (S == null)
|
|
2090
2189
|
return;
|
|
2091
|
-
if (
|
|
2092
|
-
e(null),
|
|
2190
|
+
if (S.trim() === "") {
|
|
2191
|
+
e(null), I(null);
|
|
2093
2192
|
return;
|
|
2094
2193
|
}
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
},
|
|
2098
|
-
const
|
|
2194
|
+
const t = de(S, a, o);
|
|
2195
|
+
t && O(t) ? W(t) : I(null);
|
|
2196
|
+
}, q = m ? ie(m, a, o) : "", U = S ?? q, X = c && !!m && !l, R = m && m.h >= 12 ? "PM" : "AM", ln = tn(() => a === "12h" ? mn(12).map((t) => {
|
|
2197
|
+
const f = t === 0 ? 12 : t, V = R === "PM" ? f % 12 + 12 : f % 12;
|
|
2099
2198
|
return {
|
|
2100
|
-
value:
|
|
2101
|
-
label:
|
|
2102
|
-
disabled:
|
|
2199
|
+
value: f,
|
|
2200
|
+
label: H(f),
|
|
2201
|
+
disabled: Y && V * 60 + 59 < Z(Y) || L && V * 60 > Z(L) || !1
|
|
2103
2202
|
};
|
|
2104
|
-
}) :
|
|
2105
|
-
value:
|
|
2106
|
-
label:
|
|
2107
|
-
disabled:
|
|
2108
|
-
})), [
|
|
2109
|
-
const
|
|
2110
|
-
return
|
|
2111
|
-
value:
|
|
2112
|
-
label:
|
|
2113
|
-
disabled:
|
|
2203
|
+
}) : mn(24).map((t) => ({
|
|
2204
|
+
value: t,
|
|
2205
|
+
label: H(t),
|
|
2206
|
+
disabled: Y && t * 60 + 59 < Z(Y) || L && t * 60 > Z(L) || !1
|
|
2207
|
+
})), [a, R, Y, L]), dn = tn(() => {
|
|
2208
|
+
const t = (m == null ? void 0 : m.h) ?? 0;
|
|
2209
|
+
return mn(60, r).map((f) => ({
|
|
2210
|
+
value: f,
|
|
2211
|
+
label: H(f),
|
|
2212
|
+
disabled: Y && t * 60 + f < Z(Y) || L && t * 60 + f > Z(L) || !1
|
|
2114
2213
|
}));
|
|
2115
|
-
}, [
|
|
2116
|
-
() =>
|
|
2214
|
+
}, [r, m == null ? void 0 : m.h, Y, L]), nn = tn(
|
|
2215
|
+
() => mn(60).map((t) => ({ value: t, label: H(t) })),
|
|
2117
2216
|
[]
|
|
2118
|
-
),
|
|
2119
|
-
if (
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2217
|
+
), cn = m == null ? null : a === "12h" ? m.h % 12 === 0 ? 12 : m.h % 12 : m.h, en = (t) => {
|
|
2218
|
+
if (a === "12h") {
|
|
2219
|
+
const f = R === "PM" ? t % 12 + 12 : t % 12;
|
|
2220
|
+
D({ h: f });
|
|
2122
2221
|
} else
|
|
2123
|
-
|
|
2124
|
-
},
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2127
|
-
},
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
},
|
|
2222
|
+
D({ h: t });
|
|
2223
|
+
}, un = (t) => {
|
|
2224
|
+
const f = m ?? { h: 0, m: 0, s: 0 }, V = f.h % 12 === 0 ? 12 : f.h % 12, an = t === "PM" ? V % 12 + 12 : V % 12;
|
|
2225
|
+
W({ ...f, h: an });
|
|
2226
|
+
}, pn = () => {
|
|
2227
|
+
const t = /* @__PURE__ */ new Date(), f = Math.floor(t.getMinutes() / r) * r;
|
|
2228
|
+
W({ h: t.getHours(), m: f, s: o ? t.getSeconds() : 0 });
|
|
2229
|
+
}, fn = ce(w), hn = /* @__PURE__ */ z(
|
|
2131
2230
|
"div",
|
|
2132
2231
|
{
|
|
2133
2232
|
className: "sa-calendar-wrapper",
|
|
2134
|
-
style: { height:
|
|
2135
|
-
ref:
|
|
2233
|
+
style: { height: p ? "auto" : "100%" },
|
|
2234
|
+
ref: p ? j : null,
|
|
2136
2235
|
children: [
|
|
2137
|
-
|
|
2236
|
+
p ? /* @__PURE__ */ z(
|
|
2138
2237
|
"div",
|
|
2139
2238
|
{
|
|
2140
|
-
className: `sa-calendar-input-container sa-calendar-input-${
|
|
2141
|
-
onClick: () => !
|
|
2239
|
+
className: `sa-calendar-input-container sa-calendar-input-${M} sa-calendar-input-container-${K || "default"} ${w}`,
|
|
2240
|
+
onClick: () => !l && F(!0),
|
|
2142
2241
|
children: [
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ s(Bn, { s: fn }) }),
|
|
2243
|
+
/* @__PURE__ */ s("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ s(
|
|
2145
2244
|
"input",
|
|
2146
2245
|
{
|
|
2147
2246
|
className: "sa-calendar-input",
|
|
2148
|
-
value:
|
|
2247
|
+
value: U,
|
|
2149
2248
|
placeholder: h,
|
|
2150
|
-
disabled:
|
|
2151
|
-
onChange: (
|
|
2152
|
-
onFocus: () =>
|
|
2153
|
-
onBlur:
|
|
2154
|
-
onKeyDown: (
|
|
2155
|
-
|
|
2249
|
+
disabled: l,
|
|
2250
|
+
onChange: (t) => I(t.target.value),
|
|
2251
|
+
onFocus: () => F(!0),
|
|
2252
|
+
onBlur: J,
|
|
2253
|
+
onKeyDown: (t) => {
|
|
2254
|
+
t.key === "Enter" && (J(), F(!1)), t.key === "Escape" && (I(null), F(!1));
|
|
2156
2255
|
}
|
|
2157
2256
|
}
|
|
2158
2257
|
) }),
|
|
2159
|
-
|
|
2258
|
+
X ? /* @__PURE__ */ s(
|
|
2160
2259
|
"button",
|
|
2161
2260
|
{
|
|
2162
2261
|
type: "button",
|
|
2163
2262
|
"aria-label": "Clear time",
|
|
2164
2263
|
className: "sa-calendar-input-clear",
|
|
2165
|
-
onClick: (
|
|
2166
|
-
|
|
2264
|
+
onClick: (t) => {
|
|
2265
|
+
t.stopPropagation(), e(null), I(null);
|
|
2167
2266
|
},
|
|
2168
|
-
children: /* @__PURE__ */
|
|
2267
|
+
children: /* @__PURE__ */ s(ue, { s: fn })
|
|
2169
2268
|
}
|
|
2170
|
-
) : /* @__PURE__ */
|
|
2269
|
+
) : /* @__PURE__ */ s("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ s(Bn, { s: fn }) })
|
|
2171
2270
|
]
|
|
2172
2271
|
}
|
|
2173
2272
|
) : null,
|
|
2174
|
-
|
|
2273
|
+
B ? /* @__PURE__ */ z(
|
|
2175
2274
|
"div",
|
|
2176
2275
|
{
|
|
2177
|
-
ref:
|
|
2178
|
-
className: `sa-calendar sa-calendar-size-${
|
|
2179
|
-
style:
|
|
2276
|
+
ref: $,
|
|
2277
|
+
className: `sa-calendar sa-calendar-size-${w} ${p ? "" : "sa-calendar-no-input"} ${b ? "" : "sa-calendar-no-padding"}`,
|
|
2278
|
+
style: l ? { pointerEvents: "none" } : void 0,
|
|
2180
2279
|
children: [
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
|
|
2280
|
+
/* @__PURE__ */ z("div", { className: "sa-time-columns", children: [
|
|
2281
|
+
/* @__PURE__ */ s(
|
|
2282
|
+
vn,
|
|
2184
2283
|
{
|
|
2185
2284
|
label: "Jam",
|
|
2186
2285
|
options: ln,
|
|
2187
|
-
active:
|
|
2188
|
-
onPick:
|
|
2286
|
+
active: cn,
|
|
2287
|
+
onPick: en
|
|
2189
2288
|
}
|
|
2190
2289
|
),
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
|
|
2290
|
+
/* @__PURE__ */ s("div", { className: "sa-time-divider" }),
|
|
2291
|
+
/* @__PURE__ */ s(
|
|
2292
|
+
vn,
|
|
2194
2293
|
{
|
|
2195
2294
|
label: "Menit",
|
|
2196
|
-
options:
|
|
2197
|
-
active: (
|
|
2198
|
-
onPick: (
|
|
2295
|
+
options: dn,
|
|
2296
|
+
active: (m == null ? void 0 : m.m) ?? null,
|
|
2297
|
+
onPick: (t) => D({ m: t })
|
|
2199
2298
|
}
|
|
2200
2299
|
),
|
|
2201
|
-
o && /* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
|
|
2300
|
+
o && /* @__PURE__ */ z(yn, { children: [
|
|
2301
|
+
/* @__PURE__ */ s("div", { className: "sa-time-divider" }),
|
|
2302
|
+
/* @__PURE__ */ s(
|
|
2303
|
+
vn,
|
|
2205
2304
|
{
|
|
2206
2305
|
label: "Detik",
|
|
2207
|
-
options:
|
|
2208
|
-
active: (
|
|
2209
|
-
onPick: (
|
|
2306
|
+
options: nn,
|
|
2307
|
+
active: (m == null ? void 0 : m.s) ?? null,
|
|
2308
|
+
onPick: (t) => D({ s: t })
|
|
2210
2309
|
}
|
|
2211
2310
|
)
|
|
2212
2311
|
] }),
|
|
2213
|
-
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
|
|
2312
|
+
a === "12h" && /* @__PURE__ */ z(yn, { children: [
|
|
2313
|
+
/* @__PURE__ */ s("div", { className: "sa-time-divider" }),
|
|
2314
|
+
/* @__PURE__ */ s(
|
|
2315
|
+
vn,
|
|
2217
2316
|
{
|
|
2218
2317
|
label: "",
|
|
2219
2318
|
options: [
|
|
2220
2319
|
{ value: 0, label: "AM" },
|
|
2221
2320
|
{ value: 1, label: "PM" }
|
|
2222
2321
|
],
|
|
2223
|
-
active:
|
|
2224
|
-
onPick: (
|
|
2322
|
+
active: m == null ? null : R === "PM" ? 1 : 0,
|
|
2323
|
+
onPick: (t) => un(t === 1 ? "PM" : "AM")
|
|
2225
2324
|
}
|
|
2226
2325
|
)
|
|
2227
2326
|
] })
|
|
2228
2327
|
] }),
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ z("div", { className: "sa-time-footer", children: [
|
|
2329
|
+
/* @__PURE__ */ s(
|
|
2231
2330
|
"button",
|
|
2232
2331
|
{
|
|
2233
2332
|
type: "button",
|
|
2234
2333
|
className: "sa-time-footer-btn",
|
|
2235
|
-
onClick:
|
|
2334
|
+
onClick: pn,
|
|
2236
2335
|
children: "Sekarang"
|
|
2237
2336
|
}
|
|
2238
2337
|
),
|
|
2239
|
-
/* @__PURE__ */
|
|
2338
|
+
/* @__PURE__ */ s(
|
|
2240
2339
|
"button",
|
|
2241
2340
|
{
|
|
2242
2341
|
type: "button",
|
|
2243
2342
|
className: "sa-time-footer-btn sa-time-footer-btn-muted",
|
|
2244
2343
|
onClick: () => {
|
|
2245
|
-
e(null),
|
|
2344
|
+
e(null), I(null);
|
|
2246
2345
|
},
|
|
2247
2346
|
children: "Hapus"
|
|
2248
2347
|
}
|
|
@@ -2254,25 +2353,25 @@ const te = (n) => n === "xs" ? 14 : n === "lg" ? 20 : 16, Yn = ({ s: n }) => /*
|
|
|
2254
2353
|
]
|
|
2255
2354
|
}
|
|
2256
2355
|
);
|
|
2257
|
-
return /* @__PURE__ */
|
|
2258
|
-
|
|
2356
|
+
return /* @__PURE__ */ s(
|
|
2357
|
+
Yn,
|
|
2259
2358
|
{
|
|
2260
2359
|
label: g,
|
|
2261
|
-
labelPosition:
|
|
2262
|
-
required:
|
|
2360
|
+
labelPosition: u,
|
|
2361
|
+
required: C,
|
|
2263
2362
|
optional: T,
|
|
2264
|
-
description:
|
|
2265
|
-
helperText:
|
|
2266
|
-
errorText:
|
|
2267
|
-
fullWidth:
|
|
2268
|
-
size:
|
|
2269
|
-
children:
|
|
2363
|
+
description: y,
|
|
2364
|
+
helperText: k,
|
|
2365
|
+
errorText: v,
|
|
2366
|
+
fullWidth: x,
|
|
2367
|
+
size: w,
|
|
2368
|
+
children: hn
|
|
2270
2369
|
}
|
|
2271
2370
|
);
|
|
2272
2371
|
}
|
|
2273
2372
|
);
|
|
2274
|
-
|
|
2373
|
+
pe.displayName = "StarasiaTime";
|
|
2275
2374
|
export {
|
|
2276
|
-
|
|
2277
|
-
|
|
2375
|
+
ge as StarasiaDate,
|
|
2376
|
+
pe as StarasiaTime
|
|
2278
2377
|
};
|