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