@starasia/date 5.0.3 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/date.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { jsxs as F, jsx as r, Fragment as _ } from "react/jsx-runtime";
2
- import { useState as z, useRef as P, useEffect as S, forwardRef as G } from "react";
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
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
  * {
@@ -147,6 +147,50 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
147
147
  gap: var(--sa-spacing-xs, 4px);
148
148
  }
149
149
 
150
+ .sa-calendar-header-title {
151
+ font-size: 15px;
152
+ font-weight: 600;
153
+ cursor: pointer;
154
+ color: var(--sa-date-text-primary);
155
+ flex: 1;
156
+ line-height: 1.3;
157
+ }
158
+
159
+ .sa-calendar-header-nav {
160
+ display: flex;
161
+ align-items: center;
162
+ gap: 2px;
163
+ flex-shrink: 0;
164
+ }
165
+
166
+ .sa-calendar-nav-btn {
167
+ display: inline-flex;
168
+ align-items: center;
169
+ justify-content: center;
170
+ width: 28px;
171
+ height: 28px;
172
+ border: 0;
173
+ padding: 0;
174
+ background: transparent;
175
+ border-radius: var(--sa-date-radius);
176
+ cursor: pointer;
177
+ color: var(--sa-date-brand);
178
+ transition: background-color 120ms ease;
179
+ }
180
+
181
+ .sa-calendar-nav-btn:hover {
182
+ background: var(--sa-date-brand-subtle);
183
+ }
184
+
185
+ .sa-calendar-nav-btn:active {
186
+ background: var(--sa-date-brand-secondary);
187
+ }
188
+
189
+ .sa-calendar-nav-btn:focus-visible {
190
+ outline: 2px solid var(--sa-date-brand);
191
+ outline-offset: 1px;
192
+ }
193
+
150
194
  .sa-calendar-days-name-preivew {
151
195
  display: flex;
152
196
  gap: var(--sa-spacing-sm, 8px);
@@ -270,13 +314,9 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
270
314
 
271
315
  .sa-calendar-input-outline {
272
316
  border-color: var(--sa-date-border-color);
273
- /* border-color: var(--sa-date-text-muted); */
274
317
  background-color: transparent;
275
318
  border-width: var(--sa-border, 1px);
276
319
  border-style: solid;
277
- /* height: var(--sa-h-10, 40px); */
278
- /* border-radius: var(--sa-date-radius); */
279
- /* padding-inline: var(--sa-spacing-3, 12px); */
280
320
  }
281
321
 
282
322
  .sa-calendar-input-container.sm {
@@ -298,6 +338,40 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
298
338
  padding-inline: var(--sa-spacing-3, 12px);
299
339
  }
300
340
 
341
+ /* filled variant — gray background, no visible border */
342
+ .sa-calendar-input-container.sa-calendar-input-filled {
343
+ background-color: var(--sa-date-accent-subtle, #f0f1f2);
344
+ border-color: transparent;
345
+ border-width: 1px;
346
+ border-style: solid;
347
+ }
348
+ .sa-calendar-input-container.sa-calendar-input-filled:has(input:focus) {
349
+ border-color: var(--sa-date-brand);
350
+ background-color: var(--sa-date-accent-subtle, #f0f1f2);
351
+ box-shadow: 0px 0px 0px 2px var(--sa-date-brand-subtle);
352
+ }
353
+
354
+ /* flushed variant — bottom border only */
355
+ .sa-calendar-input-container.sa-calendar-input-flushed {
356
+ background-color: transparent;
357
+ border-top: none;
358
+ border-left: none;
359
+ border-right: none;
360
+ border-bottom: 1px solid var(--sa-date-border-color);
361
+ border-radius: 0;
362
+ padding-inline: 0;
363
+ }
364
+ .sa-calendar-input-container.sa-calendar-input-flushed:has(input:focus) {
365
+ border-bottom-color: var(--sa-date-brand);
366
+ box-shadow: none;
367
+ }
368
+ .sa-calendar-input-container.sa-calendar-input-flushed.sa-calendar-input-container-error {
369
+ border-bottom-color: var(--sa-date-border-error) !important;
370
+ }
371
+ .sa-calendar-input-container.sa-calendar-input-flushed.sa-calendar-input-container-warning {
372
+ border-bottom-color: var(--sa-date-border-warning) !important;
373
+ }
374
+
301
375
  .sa-calendar-input-preview-container {
302
376
  width: 100%;
303
377
  position: relative;
@@ -358,7 +432,75 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
358
432
  outline: 2px solid var(--sa-date-brand);
359
433
  outline-offset: 1px;
360
434
  }
361
- `, ee = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], W = [
435
+
436
+ /* === CALENDAR PANEL SIZE VARIANTS === */
437
+ /* sa-calendar-size-md is the default — no override needed */
438
+
439
+ .sa-calendar.sa-calendar-size-sm {
440
+ padding: 16px 12px;
441
+ gap: 8px;
442
+ }
443
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-days-name-preivew {
444
+ gap: 4px;
445
+ }
446
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-days-name-preivew p {
447
+ font-size: var(--sa-font-size-sm, 12px);
448
+ }
449
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-days-number-preivew {
450
+ gap: 4px;
451
+ }
452
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-days-number-preivew p {
453
+ font-size: var(--sa-font-size-sm, 12px);
454
+ width: 28px;
455
+ height: 26px;
456
+ }
457
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-months-preview p,
458
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-years-preview p {
459
+ font-size: var(--sa-font-size-sm, 12px);
460
+ width: 76px;
461
+ height: 38px;
462
+ }
463
+
464
+ .sa-calendar.sa-calendar-size-lg {
465
+ padding: 28px 20px;
466
+ gap: 16px;
467
+ }
468
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-days-name-preivew {
469
+ gap: 10px;
470
+ }
471
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-days-name-preivew p {
472
+ font-size: 16px;
473
+ }
474
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-days-number-preivew {
475
+ gap: 10px;
476
+ }
477
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-days-number-preivew p {
478
+ font-size: 16px;
479
+ width: 40px;
480
+ height: 36px;
481
+ }
482
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-months-preview p,
483
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-years-preview p {
484
+ font-size: 16px;
485
+ width: 110px;
486
+ height: 54px;
487
+ }
488
+
489
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-header-title {
490
+ font-size: 13px;
491
+ }
492
+ .sa-calendar.sa-calendar-size-sm .sa-calendar-nav-btn {
493
+ width: 24px;
494
+ height: 24px;
495
+ }
496
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-header-title {
497
+ font-size: 16px;
498
+ }
499
+ .sa-calendar.sa-calendar-size-lg .sa-calendar-nav-btn {
500
+ width: 32px;
501
+ height: 32px;
502
+ }
503
+ `, en = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], A = [
362
504
  "January",
363
505
  "February",
364
506
  "March",
@@ -371,7 +513,7 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
371
513
  "October",
372
514
  "November",
373
515
  "December"
374
- ], se = [
516
+ ], on = [
375
517
  "Jan",
376
518
  "Feb",
377
519
  "Mar",
@@ -385,56 +527,56 @@ const J = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
385
527
  "Nov",
386
528
  "Dec"
387
529
  ];
388
- function ne(a) {
389
- const [n, t] = z(a), s = P(null), l = (h) => {
390
- s.current && !s.current.contains(h.target) && t(!1);
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);
391
533
  };
392
534
  return S(() => (document.addEventListener("click", l, !0), () => {
393
535
  document.removeEventListener("click", l, !0);
394
- }), []), { ref: s, isComponentVisible: n, setIsComponentVisible: t };
536
+ }), []), { ref: s, isComponentVisible: e, setIsComponentVisible: t };
395
537
  }
396
- const K = "sa-calendar-input-styles", oe = (a) => {
538
+ const K = "sa-calendar-input-styles", ln = (r) => {
397
539
  if (!document.getElementById(K)) {
398
- const n = document.createElement("style");
399
- n.id = K, n.textContent = a, document.head.appendChild(n);
540
+ const e = document.createElement("style");
541
+ e.id = K, e.textContent = r, document.head.appendChild(e);
400
542
  }
401
543
  };
402
- oe(J);
403
- const H = (a) => {
404
- if (a === "sm")
544
+ ln(J);
545
+ const W = (r) => {
546
+ if (r === "sm")
405
547
  return 16;
406
- if (a === "md")
548
+ if (r === "md")
407
549
  return 16;
408
- if (a === "lg")
550
+ if (r === "lg")
409
551
  return 20;
410
- }, le = (a) => {
552
+ }, dn = (r) => {
411
553
  const {
412
- size: n = "md",
554
+ size: e = "md",
413
555
  status: t = "default",
414
556
  variant: s = "outline",
415
557
  clearable: l,
416
- onClear: h,
417
- ...i
418
- } = a, g = P(null), f = () => {
419
- g.current && i.onClick && (g.current.focus(), i.onClick(""));
420
- }, e = t === "disable" || i.disabled, p = !!i.value, v = l && p && !e, x = (D) => {
421
- D.stopPropagation(), h == null || h();
558
+ onClear: c,
559
+ ...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();
422
564
  };
423
- return /* @__PURE__ */ F(
565
+ return /* @__PURE__ */ N(
424
566
  "div",
425
567
  {
426
- className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
568
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
427
569
  onClick: f,
428
570
  children: [
429
- /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
571
+ /* @__PURE__ */ a("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ a(
430
572
  "svg",
431
573
  {
432
574
  xmlns: "http://www.w3.org/2000/svg",
433
- width: H(n),
434
- height: H(n),
575
+ width: W(e),
576
+ height: W(e),
435
577
  viewBox: "0 0 20 20",
436
578
  fill: "none",
437
- children: /* @__PURE__ */ r(
579
+ children: /* @__PURE__ */ a(
438
580
  "path",
439
581
  {
440
582
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -446,32 +588,32 @@ const H = (a) => {
446
588
  )
447
589
  }
448
590
  ) }),
449
- /* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
591
+ /* @__PURE__ */ a("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ a(
450
592
  "input",
451
593
  {
452
594
  className: "sa-calendar-input",
453
- ...i,
454
- disabled: e,
455
- value: i.value,
595
+ ...d,
596
+ disabled: n,
597
+ value: d.value,
456
598
  ref: g
457
599
  }
458
600
  ) }),
459
- v ? /* @__PURE__ */ r(
601
+ y ? /* @__PURE__ */ a(
460
602
  "button",
461
603
  {
462
604
  type: "button",
463
605
  "aria-label": "Clear date",
464
606
  className: "sa-calendar-input-clear",
465
607
  onClick: x,
466
- children: /* @__PURE__ */ r(
608
+ children: /* @__PURE__ */ a(
467
609
  "svg",
468
610
  {
469
611
  xmlns: "http://www.w3.org/2000/svg",
470
- width: H(n),
471
- height: H(n),
612
+ width: W(e),
613
+ height: W(e),
472
614
  viewBox: "0 0 20 20",
473
615
  fill: "none",
474
- children: /* @__PURE__ */ r(
616
+ children: /* @__PURE__ */ a(
475
617
  "path",
476
618
  {
477
619
  d: "M5 5L15 15M15 5L5 15",
@@ -484,15 +626,15 @@ const H = (a) => {
484
626
  }
485
627
  )
486
628
  }
487
- ) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
629
+ ) : /* @__PURE__ */ a("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ a(
488
630
  "svg",
489
631
  {
490
632
  xmlns: "http://www.w3.org/2000/svg",
491
- width: H(n),
492
- height: H(n),
633
+ width: W(e),
634
+ height: W(e),
493
635
  viewBox: "0 0 20 20",
494
636
  fill: "none",
495
- children: /* @__PURE__ */ r(
637
+ children: /* @__PURE__ */ a(
496
638
  "path",
497
639
  {
498
640
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -507,194 +649,194 @@ const H = (a) => {
507
649
  ]
508
650
  }
509
651
  );
510
- }, ie = ({
511
- date: a,
512
- setDate: n,
652
+ }, cn = ({
653
+ date: r,
654
+ setDate: e,
513
655
  dateRange: t,
514
656
  setDateRange: s,
515
657
  onChange: l,
516
- minDate: h,
517
- maxDate: i,
658
+ minDate: c,
659
+ maxDate: d,
518
660
  input: g
519
661
  }) => {
520
- var Y, u, y;
521
- const [f, e] = z(null);
522
- let p = new Date(a.getFullYear(), a.getMonth(), 1), v = p.getDay(), x = [];
523
- const D = a.getMonth(), m = !!(t.from && !t.to), o = m && f ? f : null;
524
- for (let d = 0; d < 42; d++) {
525
- d === 0 && v === 0 ? p.setDate(p.getDate() - 7) : d === 0 ? p.setDate(
526
- p.getDate() + (d - v)
527
- ) : p.setDate(p.getDate() + 1);
528
- let w = {
529
- currentMonth: p.getMonth() === D,
530
- date: new Date(p),
531
- month: p.getMonth(),
532
- number: p.getDate(),
533
- selected: p.toDateString() === ((Y = t.from) == null ? void 0 : Y.toDateString()) || p.toDateString() === (((u = t.to) == null ? void 0 : u.toDateString()) || ((y = t.from) == null ? void 0 : y.toDateString())),
534
- year: p.getFullYear(),
535
- isDisabled: h && p < h || i && p > i
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);
670
+ 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
536
678
  };
537
- x.push(w);
679
+ x.push(b);
538
680
  }
539
- const c = (d) => {
540
- n(d);
541
- }, k = (d) => {
542
- var N;
543
- let w = { ...t };
544
- if (w.from && w.to)
545
- w = { from: d, to: null };
681
+ const i = (p) => {
682
+ e(p);
683
+ }, k = (p) => {
684
+ var $;
685
+ let b = { ...t };
686
+ if (b.from && b.to)
687
+ b = { from: p, to: null };
546
688
  else {
547
- const M = ((N = w.from) == null ? void 0 : N.getTime()) || 0;
548
- d.getTime() > M ? w = { from: w.from, to: d } : w = { from: d, to: w.from };
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 };
549
691
  }
550
- s(w), l(w);
692
+ s(b), l(b);
551
693
  };
552
- return /* @__PURE__ */ F(
694
+ return /* @__PURE__ */ N(
553
695
  "div",
554
696
  {
555
697
  className: "sa-calendar-days-preivew",
556
- onMouseLeave: () => e(null),
698
+ onMouseLeave: () => n(null),
557
699
  children: [
558
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((d, w) => /* @__PURE__ */ r("p", { children: d }, w)) }),
559
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: x.map((d, w) => {
560
- const N = t.from && t.to && d.date.getTime() > t.from.getTime() && d.date.getTime() < t.to.getTime(), M = (() => {
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 = (() => {
561
703
  if (!o || !t.from)
562
704
  return !1;
563
- const C = d.date.getTime(), L = t.from.getTime(), j = o.getTime();
564
- return j > L ? C > L && C < j : C < L && C > j;
565
- })(), T = m && f && d.date.toDateString() === f.toDateString(), $ = d.isDisabled, E = () => N || M ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "", I = () => $ ? "var(--sa-color-gray-400, #b7b9be)" : N || M ? "var(--sa-color-gray-500, #8c8f97)" : "";
566
- return /* @__PURE__ */ r(
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)" : "";
708
+ return /* @__PURE__ */ a(
567
709
  "p",
568
710
  {
569
- className: `${d.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${d.selected || T ? "sa-calendar-days-active" : ""}`,
711
+ className: `${p.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${p.selected || M ? "sa-calendar-days-active" : ""}`,
570
712
  style: {
571
- backgroundColor: E(),
572
- pointerEvents: $ ? "none" : void 0,
573
- cursor: $ ? "not-allowed" : "pointer",
574
- color: I(),
575
- opacity: T && !d.selected ? 0.75 : 1,
713
+ backgroundColor: I(),
714
+ pointerEvents: F ? "none" : void 0,
715
+ cursor: F ? "not-allowed" : "pointer",
716
+ color: E(),
717
+ opacity: M && !p.selected ? 0.75 : 1,
576
718
  ...g ? {} : { width: "100%" }
577
719
  },
578
720
  onClick: () => {
579
- $ || (c(d.date), k(d.date));
721
+ F || (i(p.date), k(p.date));
580
722
  },
581
723
  onMouseEnter: () => {
582
- $ || e(d.date);
724
+ F || n(p.date);
583
725
  },
584
- children: d.number
726
+ children: p.number
585
727
  },
586
- w
728
+ b
587
729
  );
588
730
  }) })
589
731
  ]
590
732
  }
591
733
  );
592
- }, de = ({
593
- date: a,
594
- setDate: n,
734
+ }, un = ({
735
+ date: r,
736
+ setDate: e,
595
737
  filter: t,
596
738
  setViews: s,
597
739
  dateRange: l,
598
- setDateRange: h,
599
- onChange: i,
740
+ setDateRange: c,
741
+ onChange: d,
600
742
  minDate: g,
601
743
  maxDate: f,
602
- input: e
744
+ input: n
603
745
  }) => {
604
- const p = l.from.getFullYear(), v = a.getFullYear(), x = (m) => {
605
- t ? (D(m), n(m)) : (s("days"), n(m));
746
+ const u = l.from.getFullYear(), y = r.getFullYear(), x = (m) => {
747
+ t ? (D(m), e(m)) : (s("days"), e(m));
606
748
  }, D = (m) => {
607
- var c;
749
+ var i;
608
750
  let o = { ...l };
609
751
  if (o.from && o.to)
610
752
  o = { from: m, to: null };
611
753
  else {
612
- const k = ((c = o.from) == null ? void 0 : c.getTime()) || 0;
754
+ const k = ((i = o.from) == null ? void 0 : i.getTime()) || 0;
613
755
  m.getTime() > k ? o = { from: o.from, to: m } : o = { from: m, to: o.from };
614
756
  }
615
- h(o), i(o);
757
+ c(o), d(o);
616
758
  };
617
- return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: W.map((m, o) => {
618
- var Y, u, y;
619
- const c = new Date(v, o).getTime() > l.from.getTime() && new Date(v, o).getTime() < (((Y = l.to) == null ? void 0 : Y.getTime()) || l.from.getTime()), k = g && new Date(v, o) < g || f && new Date(v, o) > f;
620
- return /* @__PURE__ */ r(
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;
762
+ return /* @__PURE__ */ a(
621
763
  "p",
622
764
  {
623
- className: p === v && (o === ((u = l.from) == null ? void 0 : u.getMonth()) || o === ((y = l.to) == null ? void 0 : y.getMonth())) ? "sa-calendar-months-active" : "",
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" : "",
624
766
  style: {
625
- backgroundColor: c ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
767
+ backgroundColor: i ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
626
768
  pointerEvents: k ? "none" : void 0,
627
769
  cursor: k ? "not-allowed" : "pointer",
628
- color: k ? "var(--sa-color-gray-400, #b7b9be)" : c ? "var(--sa-color-gray-500, #8c8f97)" : "",
629
- ...e ? {} : { width: "100%" }
770
+ color: k ? "var(--sa-color-gray-400, #b7b9be)" : i ? "var(--sa-color-gray-500, #8c8f97)" : "",
771
+ ...n ? {} : { width: "100%" }
630
772
  },
631
773
  onClick: () => {
632
- k || x(new Date(v, o));
774
+ k || x(new Date(y, o));
633
775
  },
634
776
  children: m.slice(0, 3)
635
777
  },
636
778
  o
637
779
  );
638
780
  }) });
639
- }, U = (a) => {
640
- const n = Math.floor(a / 10) * 10, t = n + 10;
641
- return { start: n, end: t };
642
- }, ce = ({
643
- date: a,
644
- filter: n,
781
+ }, q = (r) => {
782
+ const e = Math.floor(r / 10) * 10, t = e + 10;
783
+ return { start: e, end: t };
784
+ }, hn = ({
785
+ date: r,
786
+ filter: e,
645
787
  setViews: t,
646
788
  setDate: s,
647
789
  dateRange: l,
648
- setDateRange: h,
649
- onChange: i,
790
+ setDateRange: c,
791
+ onChange: d,
650
792
  minDate: g,
651
793
  maxDate: f,
652
- input: e
794
+ input: n
653
795
  }) => {
654
- var Y;
655
- let p = [];
656
- const v = a.getFullYear(), { start: x, end: D } = U(v), m = l.from.getFullYear(), o = (Y = l.to) == null ? void 0 : Y.getFullYear();
657
- for (let u = x; u < D; u++) {
658
- const y = new Date(u, 0), d = (!g || y >= g) && (!f || y <= f), w = u === m || u === o, N = y > l.from && y < l.to;
659
- p.push({
660
- year: u,
661
- active: w && d,
662
- highlight: N && d,
663
- disabled: !d
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
664
806
  });
665
807
  }
666
- const c = (u) => {
667
- n ? (k(u), s(u)) : (s(u), t("months"));
668
- }, k = (u) => {
669
- var d;
670
- let y = { ...l };
671
- if (y.from && y.to)
672
- y = { from: u, to: null };
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 };
673
815
  else {
674
- const w = ((d = y.from) == null ? void 0 : d.getTime()) || 0;
675
- u.getTime() > w ? y = { from: y.from, to: u } : y = { from: u, to: y.from };
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 };
676
818
  }
677
- h(y), i(y);
819
+ c(v), d(v);
678
820
  };
679
- return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: p.map((u, y) => /* @__PURE__ */ r(
821
+ return /* @__PURE__ */ a("div", { className: "sa-calendar-years-preview", children: u.map((h, v) => /* @__PURE__ */ a(
680
822
  "p",
681
823
  {
682
- className: `${u.active ? "sa-calendar-months-active" : ""} ${u.highlight ? "sa-calendar-months-highlight" : ""} ${u.disabled ? "sa-calendar-disabled" : ""}`,
824
+ className: `${h.active ? "sa-calendar-months-active" : ""} ${h.highlight ? "sa-calendar-months-highlight" : ""} ${h.disabled ? "sa-calendar-disabled" : ""}`,
683
825
  onClick: () => {
684
- u.disabled || c(new Date(u.year, 0));
826
+ h.disabled || i(new Date(h.year, 0));
685
827
  },
686
828
  style: {
687
- backgroundColor: u.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
688
- color: u.highlight ? "var(--sa-color-gray-500, #8c8f97)" : u.active ? "" : u.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
689
- cursor: u.disabled ? "not-allowed" : "pointer",
690
- pointerEvents: u.disbled ? "none" : "all",
691
- ...e ? {} : { width: "100%" }
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",
833
+ ...n ? {} : { width: "100%" }
692
834
  },
693
- children: u.year
835
+ children: h.year
694
836
  },
695
- y
837
+ v
696
838
  )) });
697
- }, ae = ({ ...a }) => /* @__PURE__ */ r(
839
+ }, rn = ({ ...r }) => /* @__PURE__ */ a(
698
840
  "svg",
699
841
  {
700
842
  xmlns: "http://www.w3.org/2000/svg",
@@ -702,8 +844,8 @@ const H = (a) => {
702
844
  height: "20",
703
845
  viewBox: "0 0 20 20",
704
846
  fill: "none",
705
- ...a,
706
- children: /* @__PURE__ */ r(
847
+ ...r,
848
+ children: /* @__PURE__ */ a(
707
849
  "path",
708
850
  {
709
851
  d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
@@ -714,7 +856,7 @@ const H = (a) => {
714
856
  }
715
857
  )
716
858
  }
717
- ), re = ({ ...a }) => /* @__PURE__ */ r(
859
+ ), tn = ({ ...r }) => /* @__PURE__ */ a(
718
860
  "svg",
719
861
  {
720
862
  xmlns: "http://www.w3.org/2000/svg",
@@ -722,8 +864,8 @@ const H = (a) => {
722
864
  height: "20",
723
865
  viewBox: "0 0 20 20",
724
866
  fill: "none",
725
- ...a,
726
- children: /* @__PURE__ */ r(
867
+ ...r,
868
+ children: /* @__PURE__ */ a(
727
869
  "path",
728
870
  {
729
871
  d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
@@ -734,254 +876,258 @@ const H = (a) => {
734
876
  }
735
877
  )
736
878
  }
737
- ), ue = ({
738
- setViews: a,
739
- views: n,
879
+ ), pn = ({
880
+ setViews: r,
881
+ views: e,
740
882
  filter: t,
741
883
  date: s,
742
884
  setDate: l
743
885
  }) => {
744
- const h = () => {
745
- t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
746
- }, i = () => {
747
- if (n === "years") {
748
- l((e) => new Date(e.getFullYear() + 10, 0));
886
+ const c = () => {
887
+ t || r((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
888
+ }, d = () => {
889
+ if (e === "years") {
890
+ l((n) => new Date(n.getFullYear() + 10, 0));
749
891
  return;
750
892
  }
751
- if (n === "months") {
752
- l((e) => new Date(e.getFullYear() + 1, e.getMonth()));
893
+ if (e === "months") {
894
+ l((n) => new Date(n.getFullYear() + 1, n.getMonth()));
753
895
  return;
754
896
  }
755
- l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
897
+ l((n) => new Date(n.getFullYear(), n.getMonth() + 1));
756
898
  }, g = () => {
757
- if (n === "years") {
758
- l((e) => new Date(e.getFullYear() - 10, 0));
899
+ if (e === "years") {
900
+ l((n) => new Date(n.getFullYear() - 10, 0));
759
901
  return;
760
902
  }
761
- if (n === "months") {
762
- l((e) => new Date(e.getFullYear() - 1, e.getMonth()));
903
+ if (e === "months") {
904
+ l((n) => new Date(n.getFullYear() - 1, n.getMonth()));
763
905
  return;
764
906
  }
765
907
  l(
766
- (e) => new Date(
767
- e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
768
- e.getMonth() === 0 ? 11 : e.getMonth() - 1
908
+ (n) => new Date(
909
+ n.getMonth() === 0 ? n.getFullYear() - 1 : n.getFullYear(),
910
+ n.getMonth() === 0 ? 11 : n.getMonth() - 1
769
911
  )
770
912
  );
771
913
  };
772
- return /* @__PURE__ */ F("div", { className: "sa-calendar-header", children: [
773
- /* @__PURE__ */ r(ae, { onClick: () => g() }),
774
- /* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: h, children: (() => {
775
- if (n === "days")
776
- return `${W[s.getMonth()]} ${s.getFullYear()}`;
777
- if (n === "months")
914
+ return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
915
+ /* @__PURE__ */ a("div", { className: "sa-calendar-header-title", onClick: c, children: (() => {
916
+ if (e === "days")
917
+ return `${A[s.getMonth()]} ${s.getFullYear()}`;
918
+ if (e === "months")
778
919
  return `${s.getFullYear()}`;
779
- if (n === "years")
780
- return `${U(s.getFullYear()).start} ~ ${U(s.getFullYear()).end}`;
920
+ if (e === "years")
921
+ return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
781
922
  })() }),
782
- /* @__PURE__ */ r(re, { onClick: () => i() })
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, {}) })
926
+ ] })
783
927
  ] });
784
928
  };
785
- function A(a) {
786
- const n = new Date(a), t = n.getFullYear(), s = n.getMonth();
787
- return `${n.getDate().toString().padStart(2, "0")} ${se[s]} ${t}`;
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}`;
788
932
  }
789
- const te = ({
790
- label: a,
791
- labelPosition: n = "outside-top",
933
+ const sn = ({
934
+ label: r,
935
+ labelPosition: e = "outside-top",
792
936
  required: t,
793
937
  optional: s,
794
938
  description: l,
795
- helperText: h,
796
- errorText: i,
939
+ helperText: c,
940
+ errorText: d,
797
941
  fullWidth: g,
798
942
  children: f
799
943
  }) => {
800
- const e = [
944
+ const n = [
801
945
  "sa-date-field",
802
946
  g ? "sa-date-field-fullwidth" : ""
803
- ].filter(Boolean).join(" "), p = a ? /* @__PURE__ */ F("div", { className: "sa-date-field-label-row", children: [
804
- /* @__PURE__ */ r("span", { className: "sa-date-field-label-text", children: a }),
805
- s && /* @__PURE__ */ r("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
806
- t && /* @__PURE__ */ r("span", { className: "sa-date-field-required", children: "*" })
807
- ] }) : null, v = /* @__PURE__ */ F(_, { children: [
808
- h && !i && /* @__PURE__ */ r("p", { className: "sa-date-field-helper", children: h }),
809
- i && /* @__PURE__ */ r("p", { className: "sa-date-field-error-msg", children: i })
947
+ ].filter(Boolean).join(" "), u = r ? /* @__PURE__ */ N("div", { className: "sa-date-field-label-row", children: [
948
+ /* @__PURE__ */ a("span", { className: "sa-date-field-label-text", children: r }),
949
+ s && /* @__PURE__ */ a("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
950
+ t && /* @__PURE__ */ a("span", { className: "sa-date-field-required", children: "*" })
951
+ ] }) : null, y = /* @__PURE__ */ N(nn, { children: [
952
+ c && !d && /* @__PURE__ */ a("p", { className: "sa-date-field-helper", children: c }),
953
+ d && /* @__PURE__ */ a("p", { className: "sa-date-field-error-msg", children: d })
810
954
  ] });
811
- return a ? n === "outside-left" ? /* @__PURE__ */ F("div", { className: `${e} sa-date-field-left`, children: [
812
- /* @__PURE__ */ F("div", { className: "sa-date-field-left-label", children: [
813
- p,
814
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l })
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,
958
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l })
815
959
  ] }),
816
- /* @__PURE__ */ F("div", { className: "sa-date-field-input-wrap", children: [
960
+ /* @__PURE__ */ N("div", { className: "sa-date-field-input-wrap", children: [
817
961
  f,
818
- v
962
+ y
819
963
  ] })
820
- ] }) : /* @__PURE__ */ F("div", { className: e, children: [
821
- p,
822
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
964
+ ] }) : /* @__PURE__ */ N("div", { className: n, children: [
965
+ u,
966
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l }),
823
967
  f,
824
- v
825
- ] }) : /* @__PURE__ */ F("div", { className: e, children: [
826
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
968
+ y
969
+ ] }) : /* @__PURE__ */ N("div", { className: n, children: [
970
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l }),
827
971
  f,
828
- v
972
+ y
829
973
  ] });
830
- }, Q = "sa-calendar-styles", he = (a) => {
974
+ }, Q = "sa-calendar-styles", gn = (r) => {
831
975
  if (!document.getElementById(Q)) {
832
- const n = document.createElement("style");
833
- n.id = Q, n.textContent = a, document.head.appendChild(n);
976
+ const e = document.createElement("style");
977
+ e.id = Q, e.textContent = r, document.head.appendChild(e);
834
978
  }
835
979
  };
836
- he(J);
837
- const pe = G(
980
+ gn(J);
981
+ const fn = Z(
838
982
  ({
839
- value: a,
840
- onChange: n,
983
+ value: r,
984
+ onChange: e,
841
985
  filter: t,
842
986
  input: s = !0,
843
987
  disabled: l,
844
- minDate: h,
845
- maxDate: i,
988
+ minDate: c,
989
+ maxDate: d,
846
990
  placeholder: g,
847
991
  size: f,
848
- status: e,
849
- clearable: p,
850
- fullWidth: v = !0,
851
- label: x,
852
- labelPosition: D,
853
- required: m,
854
- optional: o,
855
- description: c,
856
- helperText: k,
857
- errorText: Y
858
- }, u) => {
859
- const y = Y ? "error" : e, { ref: d, isComponentVisible: w, setIsComponentVisible: N } = ne(!1), M = P(null), [T, $] = z("days"), [E, I] = z(/* @__PURE__ */ new Date()), [C, L] = z({
860
- from: (a == null ? void 0 : a.from) || /* @__PURE__ */ new Date(),
861
- to: (a == null ? void 0 : a.to) || /* @__PURE__ */ new Date()
992
+ 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({
1005
+ from: (r == null ? void 0 : r.from) || /* @__PURE__ */ new Date(),
1006
+ to: (r == null ? void 0 : r.to) || /* @__PURE__ */ new Date()
862
1007
  });
863
1008
  S(() => {
864
- a ? (I(a.from), L(a)) : (I(/* @__PURE__ */ new Date()), L({
1009
+ r ? (Y(r.from), z(r)) : (Y(/* @__PURE__ */ new Date()), z({
865
1010
  from: /* @__PURE__ */ new Date(),
866
1011
  to: /* @__PURE__ */ new Date()
867
1012
  }));
868
- }, [a]), S(() => {
869
- t && $(t);
1013
+ }, [r]), S(() => {
1014
+ t && I(t);
870
1015
  }, [t]), S(() => {
871
- t || $("days");
872
- }, [w]), S(() => {
873
- s || N(!0);
1016
+ t || I("days");
1017
+ }, [$]), S(() => {
1018
+ s || T(!0);
874
1019
  }, [s]);
875
- const j = () => {
876
- var b, B;
877
- if (!a)
1020
+ const R = () => {
1021
+ var w, B;
1022
+ if (!r)
878
1023
  return "";
879
1024
  if (t) {
880
- if (T === "days")
881
- return `${A(C.from)} ~ ${A(C.to || C.from) || "-"}`;
882
- if (T === "months")
883
- return `${W[C.from.getMonth()]} ~ ${C.to ? W[C.to.getMonth()] : "-"}`;
884
- if (T === "years")
885
- return `${(b = C.from) == null ? void 0 : b.getFullYear()} ~ ${((B = C.to) == null ? void 0 : B.getFullYear()) || "-"}`;
1025
+ if (F === "days")
1026
+ return `${O(C.from)} ~ ${O(C.to || C.from) || "-"}`;
1027
+ if (F === "months")
1028
+ return `${A[C.from.getMonth()]} ~ ${C.to ? A[C.to.getMonth()] : "-"}`;
1029
+ if (F === "years")
1030
+ return `${(w = C.from) == null ? void 0 : w.getFullYear()} ~ ${((B = C.to) == null ? void 0 : B.getFullYear()) || "-"}`;
886
1031
  } else
887
- return `${A(C.from)} ~ ${A(C.to || C.from) || "-"}`;
1032
+ return `${O(C.from)} ~ ${O(C.to || C.from) || "-"}`;
888
1033
  }, V = () => {
889
- if (M.current && d.current && s) {
890
- const b = d.current.getBoundingClientRect(), B = M.current.getBoundingClientRect();
891
- window.innerWidth < b.left + B.width ? M.current.style.left = `${b.left - B.width + b.width}px` : M.current.style.left = `${b.left}px`, b.top + B.height > window.innerHeight ? M.current.style.top = `${b.y - (b.height + B.height - 28)}px` : M.current.style.top = `${b.y + b.height}px`;
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`;
892
1037
  }
893
1038
  };
894
1039
  S(() => {
895
- M.current && d.current && s && V();
896
- }, [M, d, w]), S(() => {
897
- const b = u == null ? void 0 : u.current;
898
- return b && b.addEventListener("scroll", V), window.addEventListener("scroll", V), () => {
899
- b && b.removeEventListener("scroll", V), window.removeEventListener("scroll", V);
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);
900
1045
  };
901
1046
  }, []);
902
- const R = /* @__PURE__ */ F(
1047
+ const U = /* @__PURE__ */ N(
903
1048
  "div",
904
1049
  {
905
1050
  className: "sa-calendar-wrapper",
906
1051
  style: { height: s ? "auto" : "100%" },
907
- ref: s ? d : null,
1052
+ ref: s ? b : null,
908
1053
  children: [
909
- s ? /* @__PURE__ */ r(
910
- le,
1054
+ s ? /* @__PURE__ */ a(
1055
+ dn,
911
1056
  {
912
- value: j(),
1057
+ value: R(),
913
1058
  inputMode: "none",
914
1059
  onClick: () => {
915
- N(!0);
1060
+ T(!0);
916
1061
  },
917
1062
  onChange: () => {
918
1063
  },
919
1064
  disabled: l,
920
1065
  placeholder: g,
921
1066
  size: f,
922
- status: y,
923
- clearable: p,
924
- onClear: () => n(void 0)
1067
+ variant: n,
1068
+ status: p,
1069
+ clearable: y,
1070
+ onClear: () => e(void 0)
925
1071
  }
926
1072
  ) : null,
927
- w ? /* @__PURE__ */ F(
1073
+ $ ? /* @__PURE__ */ N(
928
1074
  "div",
929
1075
  {
930
- className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
1076
+ className: `sa-calendar sa-calendar-size-${f || "md"} ${s ? "" : "sa-calendar-no-input"}`,
931
1077
  ref: M,
932
1078
  children: [
933
- /* @__PURE__ */ r(
934
- ue,
1079
+ /* @__PURE__ */ a(
1080
+ pn,
935
1081
  {
936
- setViews: $,
937
- views: T,
1082
+ setViews: I,
1083
+ views: F,
938
1084
  filter: t,
939
1085
  date: E,
940
- setDate: I
1086
+ setDate: Y
941
1087
  }
942
1088
  ),
943
- /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: T === "days" ? /* @__PURE__ */ r(
944
- ie,
1089
+ /* @__PURE__ */ a("div", { className: "sa-calendar-body", children: F === "days" ? /* @__PURE__ */ a(
1090
+ cn,
945
1091
  {
946
1092
  date: E,
947
- setDate: I,
948
- setIsComponentVisible: N,
1093
+ setDate: Y,
1094
+ setIsComponentVisible: T,
949
1095
  dateRange: C,
950
- setDateRange: L,
1096
+ setDateRange: z,
951
1097
  input: s,
952
- onChange: n,
953
- minDate: h,
954
- maxDate: i
1098
+ onChange: e,
1099
+ minDate: c,
1100
+ maxDate: d
955
1101
  }
956
- ) : T === "months" ? /* @__PURE__ */ r(
957
- de,
1102
+ ) : F === "months" ? /* @__PURE__ */ a(
1103
+ un,
958
1104
  {
959
1105
  date: E,
960
- setDate: I,
1106
+ setDate: Y,
961
1107
  filter: t,
962
- setViews: $,
1108
+ setViews: I,
963
1109
  dateRange: C,
964
- setDateRange: L,
965
- setIsComponentVisible: N,
1110
+ setDateRange: z,
1111
+ setIsComponentVisible: T,
966
1112
  input: s,
967
- onChange: n,
968
- minDate: h,
969
- maxDate: i
1113
+ onChange: e,
1114
+ minDate: c,
1115
+ maxDate: d
970
1116
  }
971
- ) : /* @__PURE__ */ r(
972
- ce,
1117
+ ) : /* @__PURE__ */ a(
1118
+ hn,
973
1119
  {
974
1120
  date: E,
975
- setDate: I,
1121
+ setDate: Y,
976
1122
  filter: t,
977
- setViews: $,
1123
+ setViews: I,
978
1124
  dateRange: C,
979
- setDateRange: L,
980
- setIsComponentVisible: N,
1125
+ setDateRange: z,
1126
+ setIsComponentVisible: T,
981
1127
  input: s,
982
- onChange: n,
983
- minDate: h,
984
- maxDate: i
1128
+ onChange: e,
1129
+ minDate: c,
1130
+ maxDate: d
985
1131
  }
986
1132
  ) })
987
1133
  ]
@@ -990,63 +1136,63 @@ const pe = G(
990
1136
  ]
991
1137
  }
992
1138
  );
993
- return /* @__PURE__ */ r(
994
- te,
1139
+ return /* @__PURE__ */ a(
1140
+ sn,
995
1141
  {
996
- label: x,
997
- labelPosition: D,
998
- required: m,
999
- optional: o,
1000
- description: c,
1001
- helperText: k,
1002
- errorText: Y,
1003
- fullWidth: v,
1004
- children: R
1142
+ label: D,
1143
+ labelPosition: m,
1144
+ required: o,
1145
+ optional: i,
1146
+ description: k,
1147
+ helperText: L,
1148
+ errorText: h,
1149
+ fullWidth: x,
1150
+ children: U
1005
1151
  }
1006
1152
  );
1007
1153
  }
1008
- ), X = "sa-calendar-input-styles", ge = (a) => {
1154
+ ), X = "sa-calendar-input-styles", bn = (r) => {
1009
1155
  if (!document.getElementById(X)) {
1010
- const n = document.createElement("style");
1011
- n.id = X, n.textContent = a, document.head.appendChild(n);
1156
+ const e = document.createElement("style");
1157
+ e.id = X, e.textContent = r, document.head.appendChild(e);
1012
1158
  }
1013
1159
  };
1014
- ge(J);
1015
- const O = (a) => {
1016
- if (a === "sm")
1160
+ bn(J);
1161
+ const H = (r) => {
1162
+ if (r === "sm")
1017
1163
  return 16;
1018
- if (a === "md")
1164
+ if (r === "md")
1019
1165
  return 16;
1020
- if (a === "lg")
1166
+ if (r === "lg")
1021
1167
  return 20;
1022
- }, fe = (a) => {
1168
+ }, mn = (r) => {
1023
1169
  const {
1024
- size: n = "md",
1170
+ size: e = "md",
1025
1171
  status: t = "default",
1026
1172
  variant: s = "outline",
1027
1173
  clearable: l,
1028
- onClear: h,
1029
- ...i
1030
- } = a, g = P(null), f = () => {
1031
- g.current && i.onClick && (g.current.focus(), i.onClick(""));
1032
- }, e = t === "disable" || i.disabled, p = !!i.value, v = l && p && !e, x = (D) => {
1033
- D.stopPropagation(), h == null || h();
1174
+ onClear: c,
1175
+ ...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();
1034
1180
  };
1035
- return /* @__PURE__ */ F(
1181
+ return /* @__PURE__ */ N(
1036
1182
  "div",
1037
1183
  {
1038
- className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
1184
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
1039
1185
  onClick: f,
1040
1186
  children: [
1041
- /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
1187
+ /* @__PURE__ */ a("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ a(
1042
1188
  "svg",
1043
1189
  {
1044
1190
  xmlns: "http://www.w3.org/2000/svg",
1045
- width: O(n),
1046
- height: O(n),
1191
+ width: H(e),
1192
+ height: H(e),
1047
1193
  viewBox: "0 0 20 20",
1048
1194
  fill: "none",
1049
- children: /* @__PURE__ */ r(
1195
+ children: /* @__PURE__ */ a(
1050
1196
  "path",
1051
1197
  {
1052
1198
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -1058,32 +1204,32 @@ const O = (a) => {
1058
1204
  )
1059
1205
  }
1060
1206
  ) }),
1061
- /* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
1207
+ /* @__PURE__ */ a("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ a(
1062
1208
  "input",
1063
1209
  {
1064
1210
  className: "sa-calendar-input",
1065
- ...i,
1066
- disabled: e,
1067
- value: i.value,
1211
+ ...d,
1212
+ disabled: n,
1213
+ value: d.value,
1068
1214
  ref: g
1069
1215
  }
1070
1216
  ) }),
1071
- v ? /* @__PURE__ */ r(
1217
+ y ? /* @__PURE__ */ a(
1072
1218
  "button",
1073
1219
  {
1074
1220
  type: "button",
1075
1221
  "aria-label": "Clear date",
1076
1222
  className: "sa-calendar-input-clear",
1077
1223
  onClick: x,
1078
- children: /* @__PURE__ */ r(
1224
+ children: /* @__PURE__ */ a(
1079
1225
  "svg",
1080
1226
  {
1081
1227
  xmlns: "http://www.w3.org/2000/svg",
1082
- width: O(n),
1083
- height: O(n),
1228
+ width: H(e),
1229
+ height: H(e),
1084
1230
  viewBox: "0 0 20 20",
1085
1231
  fill: "none",
1086
- children: /* @__PURE__ */ r(
1232
+ children: /* @__PURE__ */ a(
1087
1233
  "path",
1088
1234
  {
1089
1235
  d: "M5 5L15 15M15 5L5 15",
@@ -1096,15 +1242,15 @@ const O = (a) => {
1096
1242
  }
1097
1243
  )
1098
1244
  }
1099
- ) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
1245
+ ) : /* @__PURE__ */ a("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ a(
1100
1246
  "svg",
1101
1247
  {
1102
1248
  xmlns: "http://www.w3.org/2000/svg",
1103
- width: O(n),
1104
- height: O(n),
1249
+ width: H(e),
1250
+ height: H(e),
1105
1251
  viewBox: "0 0 20 20",
1106
1252
  fill: "none",
1107
- children: /* @__PURE__ */ r(
1253
+ children: /* @__PURE__ */ a(
1108
1254
  "path",
1109
1255
  {
1110
1256
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1119,46 +1265,46 @@ const O = (a) => {
1119
1265
  ]
1120
1266
  }
1121
1267
  );
1122
- }, me = ({
1123
- date: a,
1124
- setDate: n,
1268
+ }, vn = ({
1269
+ date: r,
1270
+ setDate: e,
1125
1271
  previewDate: t,
1126
1272
  setPreviewDate: s,
1127
1273
  setIsComponentVisible: l,
1128
- minDate: h,
1129
- maxDate: i,
1274
+ minDate: c,
1275
+ maxDate: d,
1130
1276
  input: g,
1131
1277
  onChange: f
1132
1278
  }) => {
1133
- let e = new Date(
1279
+ let n = new Date(
1134
1280
  t.getFullYear(),
1135
1281
  t.getMonth(),
1136
1282
  1
1137
- ), p = e.getDay(), v = [];
1138
- const x = a.toDateString(), D = t.getMonth();
1283
+ ), u = n.getDay(), y = [];
1284
+ const x = r.toDateString(), D = t.getMonth();
1139
1285
  for (let o = 0; o < 42; o++) {
1140
- o === 0 && p === 0 ? e.setDate(e.getDate() - 7) : o === 0 ? e.setDate(
1141
- e.getDate() + (o - p)
1142
- ) : e.setDate(e.getDate() + 1);
1143
- let c = {
1144
- currentMonth: e.getMonth() === D,
1145
- date: new Date(e),
1146
- month: e.getMonth(),
1147
- number: e.getDate(),
1148
- selected: e.toDateString() === x,
1149
- year: e.getFullYear(),
1150
- isDisabled: h && e < h || i && e > i
1286
+ o === 0 && u === 0 ? n.setDate(n.getDate() - 7) : o === 0 ? n.setDate(
1287
+ n.getDate() + (o - u)
1288
+ ) : n.setDate(n.getDate() + 1);
1289
+ let i = {
1290
+ currentMonth: n.getMonth() === D,
1291
+ date: new Date(n),
1292
+ month: n.getMonth(),
1293
+ number: n.getDate(),
1294
+ selected: n.toDateString() === x,
1295
+ year: n.getFullYear(),
1296
+ isDisabled: c && n < c || d && n > d
1151
1297
  };
1152
- v.push(c);
1298
+ y.push(i);
1153
1299
  }
1154
1300
  const m = (o) => {
1155
- (!h || o >= h) && (!i || o <= i) && (n(o), f(o), s(o), g && l(!1));
1301
+ (!c || o >= c) && (!d || o <= d) && (e(o), f(o), s(o), g && l(!1));
1156
1302
  };
1157
- return /* @__PURE__ */ F("div", { className: "sa-calendar-days-preivew", children: [
1158
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((o, c) => /* @__PURE__ */ r("p", { children: o }, c)) }),
1159
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: v.map((o, c) => {
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) => {
1160
1306
  const k = o.isDisabled;
1161
- return /* @__PURE__ */ r(
1307
+ return /* @__PURE__ */ a(
1162
1308
  "p",
1163
1309
  {
1164
1310
  className: `${o.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${o.selected ? "sa-calendar-days-active" : ""}`,
@@ -1173,269 +1319,273 @@ const O = (a) => {
1173
1319
  },
1174
1320
  children: o.number
1175
1321
  },
1176
- c
1322
+ i
1177
1323
  );
1178
1324
  }) })
1179
1325
  ] });
1180
- }, ve = ({
1181
- date: a,
1182
- setDate: n,
1326
+ }, yn = ({
1327
+ date: r,
1328
+ setDate: e,
1183
1329
  filter: t,
1184
1330
  setViews: s,
1185
1331
  onChange: l,
1186
- previewDate: h,
1187
- setPreviewDate: i,
1332
+ previewDate: c,
1333
+ setPreviewDate: d,
1188
1334
  minDate: g,
1189
1335
  maxDate: f,
1190
- input: e
1336
+ input: n
1191
1337
  }) => {
1192
- const p = a.getMonth(), v = a.getFullYear(), x = h.getFullYear(), D = (m) => {
1193
- (!g || m >= g) && (!f || m <= f) && (t ? (l(m), n(m), i(m)) : (s("days"), i(m)));
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)));
1194
1340
  };
1195
- return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: W.map((m, o) => {
1196
- const c = g && new Date(x, o, 1) < g || f && new Date(x, o + 1, 0) > f;
1197
- return /* @__PURE__ */ r(
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;
1343
+ return /* @__PURE__ */ a(
1198
1344
  "p",
1199
1345
  {
1200
- className: o === p && x === v ? "sa-calendar-months-active" : "",
1346
+ className: o === u && x === y ? "sa-calendar-months-active" : "",
1201
1347
  style: {
1202
- color: c ? "#ccc" : void 0,
1203
- pointerEvents: c ? "none" : void 0,
1204
- cursor: c ? "not-allowed" : "pointer",
1205
- ...e ? {} : { width: "100%" }
1348
+ color: i ? "#ccc" : void 0,
1349
+ pointerEvents: i ? "none" : void 0,
1350
+ cursor: i ? "not-allowed" : "pointer",
1351
+ ...n ? {} : { width: "100%" }
1206
1352
  },
1207
1353
  onClick: () => {
1208
- c || D(new Date(x, o));
1354
+ i || D(new Date(x, o));
1209
1355
  },
1210
1356
  children: m.slice(0, 3)
1211
1357
  },
1212
1358
  o
1213
1359
  );
1214
1360
  }) });
1215
- }, q = (a) => {
1216
- const n = Math.floor(a / 10) * 10, t = n + 10;
1217
- return { start: n, end: t };
1218
- }, be = ({
1219
- date: a,
1220
- filter: n,
1361
+ }, G = (r) => {
1362
+ const e = Math.floor(r / 10) * 10, t = e + 10;
1363
+ return { start: e, end: t };
1364
+ }, wn = ({
1365
+ date: r,
1366
+ filter: e,
1221
1367
  setViews: t,
1222
1368
  setDate: s,
1223
1369
  onChange: l,
1224
- previewDate: h,
1225
- setPreviewDate: i,
1370
+ previewDate: c,
1371
+ setPreviewDate: d,
1226
1372
  minDate: g,
1227
1373
  maxDate: f,
1228
- input: e
1374
+ input: n
1229
1375
  }) => {
1230
- let p = [];
1231
- const v = h.getFullYear(), { start: x, end: D } = q(v), m = a.getFullYear();
1232
- for (let c = x; c < D; c++) {
1233
- let k = g && new Date(c, 0, 1) < g || f && new Date(c, 11, 31) > f;
1234
- p.push({ year: c, active: c === m, isDisabled: k });
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 });
1235
1381
  }
1236
- const o = (c) => {
1237
- (!g || c >= g) && (!f || c <= f) && (n ? (l(c), s(c), i(c)) : (t("months"), i(c)));
1382
+ const o = (i) => {
1383
+ (!g || i >= g) && (!f || i <= f) && (e ? (l(i), s(i), d(i)) : (t("months"), d(i)));
1238
1384
  };
1239
- return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: p.map((c, k) => /* @__PURE__ */ r(
1385
+ return /* @__PURE__ */ a("div", { className: "sa-calendar-years-preview", children: u.map((i, k) => /* @__PURE__ */ a(
1240
1386
  "p",
1241
1387
  {
1242
- className: c.active ? "sa-calendar-months-active" : "",
1388
+ className: i.active ? "sa-calendar-months-active" : "",
1243
1389
  style: {
1244
- color: c.isDisabled ? "#ccc" : void 0,
1245
- pointerEvents: c.isDisabled ? "none" : void 0,
1246
- cursor: c.isDisabled ? "not-allowed" : "pointer",
1247
- ...e ? {} : { width: "100%" }
1390
+ color: i.isDisabled ? "#ccc" : void 0,
1391
+ pointerEvents: i.isDisabled ? "none" : void 0,
1392
+ cursor: i.isDisabled ? "not-allowed" : "pointer",
1393
+ ...n ? {} : { width: "100%" }
1248
1394
  },
1249
1395
  onClick: () => {
1250
- c.isDisabled || o(new Date(c.year, 0));
1396
+ i.isDisabled || o(new Date(i.year, 0));
1251
1397
  },
1252
- children: c.year
1398
+ children: i.year
1253
1399
  },
1254
1400
  k
1255
1401
  )) });
1256
- }, ye = ({
1257
- setViews: a,
1258
- views: n,
1402
+ }, xn = ({
1403
+ setViews: r,
1404
+ views: e,
1259
1405
  filter: t,
1260
1406
  previewDate: s,
1261
1407
  setPreviewDate: l
1262
1408
  }) => {
1263
- const h = () => {
1264
- t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
1265
- }, i = () => {
1266
- if (n === "years") {
1267
- l((e) => new Date(e.getFullYear() + 10, 0));
1409
+ const c = () => {
1410
+ t || r((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
1411
+ }, d = () => {
1412
+ if (e === "years") {
1413
+ l((n) => new Date(n.getFullYear() + 10, 0));
1268
1414
  return;
1269
1415
  }
1270
- if (n === "months") {
1416
+ if (e === "months") {
1271
1417
  l(
1272
- (e) => new Date(e.getFullYear() + 1, e.getMonth())
1418
+ (n) => new Date(n.getFullYear() + 1, n.getMonth())
1273
1419
  );
1274
1420
  return;
1275
1421
  }
1276
- l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
1422
+ l((n) => new Date(n.getFullYear(), n.getMonth() + 1));
1277
1423
  }, g = () => {
1278
- if (n === "years") {
1279
- l((e) => new Date(e.getFullYear() - 10, 0));
1424
+ if (e === "years") {
1425
+ l((n) => new Date(n.getFullYear() - 10, 0));
1280
1426
  return;
1281
1427
  }
1282
- if (n === "months") {
1428
+ if (e === "months") {
1283
1429
  l(
1284
- (e) => new Date(e.getFullYear() - 1, e.getMonth())
1430
+ (n) => new Date(n.getFullYear() - 1, n.getMonth())
1285
1431
  );
1286
1432
  return;
1287
1433
  }
1288
1434
  l(
1289
- (e) => new Date(
1290
- e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
1291
- e.getMonth() === 0 ? 11 : e.getMonth() - 1
1435
+ (n) => new Date(
1436
+ n.getMonth() === 0 ? n.getFullYear() - 1 : n.getFullYear(),
1437
+ n.getMonth() === 0 ? 11 : n.getMonth() - 1
1292
1438
  )
1293
1439
  );
1294
1440
  };
1295
- return /* @__PURE__ */ F("div", { className: "sa-calendar-header", children: [
1296
- /* @__PURE__ */ r(ae, { onClick: () => g() }),
1297
- /* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: h, children: (() => {
1298
- if (n === "days")
1299
- return `${W[s.getMonth()]} ${s.getFullYear()}`;
1300
- if (n === "months")
1441
+ return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
1442
+ /* @__PURE__ */ a("div", { className: "sa-calendar-header-title", onClick: c, children: (() => {
1443
+ if (e === "days")
1444
+ return `${A[s.getMonth()]} ${s.getFullYear()}`;
1445
+ if (e === "months")
1301
1446
  return `${s.getFullYear()}`;
1302
- if (n === "years")
1303
- return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
1447
+ if (e === "years")
1448
+ return `${G(s.getFullYear()).start} ~ ${G(s.getFullYear()).end}`;
1304
1449
  })() }),
1305
- /* @__PURE__ */ r(re, { onClick: () => i() })
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, {}) })
1453
+ ] })
1306
1454
  ] });
1307
- }, Z = "sa-calendar-styles", we = (a) => {
1308
- if (!document.getElementById(Z)) {
1309
- const n = document.createElement("style");
1310
- n.id = Z, n.textContent = a, document.head.appendChild(n);
1455
+ }, _ = "sa-calendar-styles", kn = (r) => {
1456
+ if (!document.getElementById(_)) {
1457
+ const e = document.createElement("style");
1458
+ e.id = _, e.textContent = r, document.head.appendChild(e);
1311
1459
  }
1312
1460
  };
1313
- we(J);
1314
- const xe = G(
1461
+ kn(J);
1462
+ const Mn = Z(
1315
1463
  ({
1316
- value: a,
1317
- onChange: n,
1464
+ value: r,
1465
+ onChange: e,
1318
1466
  filter: t,
1319
1467
  input: s = !0,
1320
1468
  disabled: l,
1321
- minDate: h,
1322
- maxDate: i,
1469
+ minDate: c,
1470
+ maxDate: d,
1323
1471
  placeholder: g,
1324
1472
  size: f,
1325
- status: e,
1326
- clearable: p,
1327
- fullWidth: v = !0,
1328
- label: x,
1329
- labelPosition: D,
1330
- required: m,
1331
- optional: o,
1332
- description: c,
1333
- helperText: k,
1334
- errorText: Y
1335
- }, u) => {
1336
- const y = Y ? "error" : e, { ref: d, isComponentVisible: w, setIsComponentVisible: N } = ne(!1), M = P(null), [T, $] = z("days"), [E, I] = z(/* @__PURE__ */ new Date()), [C, L] = z(/* @__PURE__ */ new Date());
1473
+ 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());
1337
1486
  S(() => {
1338
- a ? (I(a), L(a)) : (I(/* @__PURE__ */ new Date()), L(/* @__PURE__ */ new Date()));
1339
- }, [a]), S(() => {
1340
- t && $(t);
1487
+ r ? (Y(r), z(r)) : (Y(/* @__PURE__ */ new Date()), z(/* @__PURE__ */ new Date()));
1488
+ }, [r]), S(() => {
1489
+ t && I(t);
1341
1490
  }, [t]), S(() => {
1342
- t || $("days");
1343
- }, [w]), S(() => {
1344
- s || N(!0);
1491
+ t || I("days");
1492
+ }, [$]), S(() => {
1493
+ s || T(!0);
1345
1494
  }, [s]);
1346
- const j = () => a ? t === "days" ? A(E) : t === "months" ? `${W[E.getMonth()]} ${E.getFullYear()}` : t === "years" ? E.getFullYear() : A(E) : "", V = () => {
1347
- if (M.current && d.current && s) {
1348
- const b = d.current.getBoundingClientRect(), B = M.current.getBoundingClientRect();
1349
- window.innerWidth < b.left + B.width ? M.current.style.left = `${b.left - B.width + b.width}px` : M.current.style.left = `${b.left}px`, b.top + B.height > window.innerHeight ? M.current.style.top = `${b.y - (b.height + B.height - 28)}px` : M.current.style.top = `${b.y + b.height}px`;
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`;
1350
1499
  }
1351
1500
  };
1352
1501
  S(() => {
1353
- M.current && d.current && s && V();
1354
- }, [M, d, w]), S(() => {
1355
- const b = u == null ? void 0 : u.current;
1356
- return b && b.addEventListener("scroll", V), window.addEventListener("scroll", V), () => {
1357
- b && b.removeEventListener("scroll", V), window.removeEventListener("scroll", V);
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);
1358
1507
  };
1359
1508
  }, []);
1360
- const R = /* @__PURE__ */ F(
1509
+ const U = /* @__PURE__ */ N(
1361
1510
  "div",
1362
1511
  {
1363
1512
  className: "sa-calendar-wrapper",
1364
1513
  style: { height: s ? "auto" : "100%" },
1365
- ref: s ? d : null,
1514
+ ref: s ? b : null,
1366
1515
  children: [
1367
- s ? /* @__PURE__ */ r(
1368
- fe,
1516
+ s ? /* @__PURE__ */ a(
1517
+ mn,
1369
1518
  {
1370
- value: j(),
1371
- onClick: () => N(!0),
1519
+ value: R(),
1520
+ onClick: () => T(!0),
1372
1521
  onChange: () => {
1373
1522
  },
1374
1523
  placeholder: g,
1375
1524
  disabled: l,
1376
1525
  size: f,
1377
- status: y,
1526
+ variant: n,
1527
+ status: p,
1378
1528
  inputMode: "none",
1379
- clearable: p,
1380
- onClear: () => n(void 0)
1529
+ clearable: y,
1530
+ onClear: () => e(void 0)
1381
1531
  }
1382
1532
  ) : null,
1383
- w ? /* @__PURE__ */ F(
1533
+ $ ? /* @__PURE__ */ N(
1384
1534
  "div",
1385
1535
  {
1386
- className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
1536
+ className: `sa-calendar sa-calendar-size-${f || "md"} ${s ? "" : "sa-calendar-no-input"}`,
1387
1537
  ref: M,
1388
1538
  children: [
1389
- /* @__PURE__ */ r(
1390
- ye,
1539
+ /* @__PURE__ */ a(
1540
+ xn,
1391
1541
  {
1392
- setViews: $,
1393
- views: T,
1542
+ setViews: I,
1543
+ views: F,
1394
1544
  filter: t,
1395
1545
  previewDate: C,
1396
- setPreviewDate: L,
1397
- isComponentVisible: w
1546
+ setPreviewDate: z,
1547
+ isComponentVisible: $
1398
1548
  }
1399
1549
  ),
1400
- /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: T === "days" ? /* @__PURE__ */ r(
1401
- me,
1550
+ /* @__PURE__ */ a("div", { className: "sa-calendar-body", children: F === "days" ? /* @__PURE__ */ a(
1551
+ vn,
1402
1552
  {
1403
1553
  date: E,
1404
- setDate: I,
1554
+ setDate: Y,
1405
1555
  previewDate: C,
1406
- setPreviewDate: L,
1407
- setIsComponentVisible: N,
1556
+ setPreviewDate: z,
1557
+ setIsComponentVisible: T,
1408
1558
  input: s,
1409
- minDate: h,
1410
- maxDate: i,
1411
- onChange: n
1559
+ minDate: c,
1560
+ maxDate: d,
1561
+ onChange: e
1412
1562
  }
1413
- ) : T === "months" ? /* @__PURE__ */ r(
1414
- ve,
1563
+ ) : F === "months" ? /* @__PURE__ */ a(
1564
+ yn,
1415
1565
  {
1416
1566
  date: E,
1417
- setDate: I,
1567
+ setDate: Y,
1418
1568
  previewDate: C,
1419
- setPreviewDate: L,
1569
+ setPreviewDate: z,
1420
1570
  filter: t,
1421
- setViews: $,
1422
- onChange: n,
1423
- minDate: h,
1424
- maxDate: i,
1571
+ setViews: I,
1572
+ onChange: e,
1573
+ minDate: c,
1574
+ maxDate: d,
1425
1575
  input: s
1426
1576
  }
1427
- ) : /* @__PURE__ */ r(
1428
- be,
1577
+ ) : /* @__PURE__ */ a(
1578
+ wn,
1429
1579
  {
1430
1580
  date: E,
1431
- setDate: I,
1581
+ setDate: Y,
1432
1582
  previewDate: C,
1433
- setPreviewDate: L,
1583
+ setPreviewDate: z,
1434
1584
  filter: t,
1435
- setViews: $,
1436
- onChange: n,
1437
- minDate: h,
1438
- maxDate: i,
1585
+ setViews: I,
1586
+ onChange: e,
1587
+ minDate: c,
1588
+ maxDate: d,
1439
1589
  input: s
1440
1590
  }
1441
1591
  ) })
@@ -1445,68 +1595,70 @@ const xe = G(
1445
1595
  ]
1446
1596
  }
1447
1597
  );
1448
- return /* @__PURE__ */ r(
1449
- te,
1598
+ return /* @__PURE__ */ a(
1599
+ sn,
1450
1600
  {
1451
- label: x,
1452
- labelPosition: D,
1453
- required: m,
1454
- optional: o,
1455
- description: c,
1456
- helperText: k,
1457
- errorText: Y,
1458
- fullWidth: v,
1459
- children: R
1601
+ label: D,
1602
+ labelPosition: m,
1603
+ required: o,
1604
+ optional: i,
1605
+ description: k,
1606
+ helperText: L,
1607
+ errorText: h,
1608
+ fullWidth: x,
1609
+ children: U
1460
1610
  }
1461
1611
  );
1462
1612
  }
1463
- ), Ce = G(
1613
+ ), Nn = Z(
1464
1614
  ({
1465
- value: a,
1466
- onChange: n,
1615
+ value: r,
1616
+ onChange: e,
1467
1617
  filter: t,
1468
1618
  input: s = !0,
1469
1619
  rangedDate: l,
1470
- disabled: h,
1471
- minDate: i,
1620
+ disabled: c,
1621
+ minDate: d,
1472
1622
  maxDate: g,
1473
1623
  placeholder: f,
1474
- size: e,
1475
- status: p,
1476
- clearable: v,
1477
- fullWidth: x,
1478
- label: D,
1479
- labelPosition: m,
1480
- required: o,
1481
- optional: c,
1482
- description: k,
1483
- helperText: Y,
1484
- errorText: u
1485
- }, y) => {
1486
- const d = {
1487
- onChange: n,
1488
- value: a,
1624
+ 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) => {
1637
+ const b = {
1638
+ onChange: e,
1639
+ value: r,
1489
1640
  input: s,
1490
1641
  filter: t,
1491
- disabled: h,
1492
- minDate: i,
1642
+ disabled: c,
1643
+ minDate: d,
1493
1644
  maxDate: g,
1494
1645
  placeholder: f,
1495
- size: e,
1496
- status: p,
1497
- clearable: v,
1498
- fullWidth: x,
1499
- label: D,
1500
- labelPosition: m,
1501
- required: o,
1502
- optional: c,
1503
- description: k,
1504
- helperText: Y,
1505
- errorText: u
1646
+ 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
1506
1658
  };
1507
- return /* @__PURE__ */ r(_, { children: l ? /* @__PURE__ */ r(pe, { ...d, ref: y }) : /* @__PURE__ */ r(xe, { ...d, ref: y }) });
1659
+ return /* @__PURE__ */ a(nn, { children: l ? /* @__PURE__ */ a(fn, { ...b, ref: p }) : /* @__PURE__ */ a(Mn, { ...b, ref: p }) });
1508
1660
  }
1509
1661
  );
1510
1662
  export {
1511
- Ce as StarasiaDate
1663
+ Nn as StarasiaDate
1512
1664
  };