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