@starasia/date 5.4.2 → 5.5.0

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