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