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