@starasia/date 5.1.1 → 5.2.1

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