@starasia/date 5.0.2 → 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,6 +1,6 @@
1
- import { jsxs as N, jsx as r, Fragment as _ } from "react/jsx-runtime";
2
- import { useState as z, useRef as A, useEffect as $, forwardRef as G } from "react";
3
- const P = `@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 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");
4
4
 
5
5
  * {
6
6
  margin: 0;
@@ -147,6 +147,50 @@ const P = `@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 P = `@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 P = `@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 P = `@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"], j = [
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 P = `@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 P = `@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 = A(null), l = (p) => {
390
- s.current && !s.current.contains(p.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
- return $(() => (document.addEventListener("click", l, !0), () => {
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(P);
403
- const W = (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: p,
558
+ onClear: c,
417
559
  ...d
418
- } = a, g = A(null), i = () => {
560
+ } = r, g = P(null), f = () => {
419
561
  g.current && d.onClick && (g.current.focus(), d.onClick(""));
420
- }, e = t === "disable" || d.disabled, w = !!d.value, v = l && w && !e, k = (M) => {
421
- M.stopPropagation(), p == null || p();
562
+ }, n = t === "disable" || d.disabled, u = !!d.value, y = l && u && !n, x = (D) => {
563
+ D.stopPropagation(), c == null || c();
422
564
  };
423
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} `,
427
- onClick: i,
568
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
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: W(n),
434
- height: W(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 W = (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
595
  ...d,
454
- disabled: e,
596
+ disabled: n,
455
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
- onClick: k,
466
- children: /* @__PURE__ */ r(
607
+ onClick: x,
608
+ children: /* @__PURE__ */ a(
467
609
  "svg",
468
610
  {
469
611
  xmlns: "http://www.w3.org/2000/svg",
470
- width: W(n),
471
- height: W(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 W = (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: W(n),
492
- height: W(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,178 +649,194 @@ const W = (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: p,
658
+ minDate: c,
517
659
  maxDate: d,
518
660
  input: g
519
661
  }) => {
520
- var f, o, c;
521
- let i = new Date(a.getFullYear(), a.getMonth(), 1), e = i.getDay(), w = [];
522
- const v = a.getMonth();
523
- for (let u = 0; u < 42; u++) {
524
- u === 0 && e === 0 ? i.setDate(i.getDate() - 7) : u === 0 ? i.setDate(
525
- i.getDate() + (u - e)
526
- ) : i.setDate(i.getDate() + 1);
527
- let y = {
528
- currentMonth: i.getMonth() === v,
529
- date: new Date(i),
530
- month: i.getMonth(),
531
- number: i.getDate(),
532
- selected: i.toDateString() === ((f = t.from) == null ? void 0 : f.toDateString()) || i.toDateString() === (((o = t.to) == null ? void 0 : o.toDateString()) || ((c = t.from) == null ? void 0 : c.toDateString())),
533
- year: i.getFullYear(),
534
- isDisabled: p && i < p || d && i > d
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
535
678
  };
536
- w.push(y);
679
+ x.push(b);
537
680
  }
538
- const k = (u) => {
539
- n(u);
540
- }, M = (u) => {
541
- var h;
542
- let y = { ...t };
543
- if (y.from && y.to)
544
- y = { from: u, 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 };
545
688
  else {
546
- const m = ((h = y.from) == null ? void 0 : h.getTime()) || 0;
547
- u.getTime() > m ? y = { from: y.from, to: u } : y = { from: u, to: y.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 };
548
691
  }
549
- s(y), l(y);
692
+ s(b), l(b);
550
693
  };
551
- return /* @__PURE__ */ N("div", { className: "sa-calendar-days-preivew", children: [
552
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((u, y) => /* @__PURE__ */ r("p", { children: u }, y)) }),
553
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: w.map((u, y) => {
554
- var x;
555
- const h = u.date.getTime() > t.from.getTime() && u.date.getTime() < (((x = t.to) == null ? void 0 : x.getTime()) || t.from.getTime()), m = u.isDisabled;
556
- return /* @__PURE__ */ r(
557
- "p",
558
- {
559
- className: `${u.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${u.selected ? "sa-calendar-days-active" : ""}`,
560
- style: {
561
- backgroundColor: h ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
562
- pointerEvents: m ? "none" : void 0,
563
- cursor: m ? "not-allowed" : "pointer",
564
- color: m ? "var(--sa-color-gray-400, #b7b9be)" : h ? "var(--sa-color-gray-500, #8c8f97)" : "",
565
- ...g ? {} : { width: "100%" }
566
- },
567
- onClick: () => {
568
- m || (k(u.date), M(u.date));
569
- },
570
- children: u.number
571
- },
572
- y
573
- );
574
- }) })
575
- ] });
576
- }, de = ({
577
- date: a,
578
- setDate: n,
694
+ return /* @__PURE__ */ N(
695
+ "div",
696
+ {
697
+ className: "sa-calendar-days-preivew",
698
+ onMouseLeave: () => n(null),
699
+ 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)
704
+ 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)" : "";
708
+ return /* @__PURE__ */ a(
709
+ "p",
710
+ {
711
+ className: `${p.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${p.selected || M ? "sa-calendar-days-active" : ""}`,
712
+ style: {
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,
718
+ ...g ? {} : { width: "100%" }
719
+ },
720
+ onClick: () => {
721
+ F || (i(p.date), k(p.date));
722
+ },
723
+ onMouseEnter: () => {
724
+ F || n(p.date);
725
+ },
726
+ children: p.number
727
+ },
728
+ b
729
+ );
730
+ }) })
731
+ ]
732
+ }
733
+ );
734
+ }, un = ({
735
+ date: r,
736
+ setDate: e,
579
737
  filter: t,
580
738
  setViews: s,
581
739
  dateRange: l,
582
- setDateRange: p,
740
+ setDateRange: c,
583
741
  onChange: d,
584
742
  minDate: g,
585
- maxDate: i,
586
- input: e
743
+ maxDate: f,
744
+ input: n
587
745
  }) => {
588
- const w = l.from.getFullYear(), v = a.getFullYear(), k = (f) => {
589
- t ? (M(f), n(f)) : (s("days"), n(f));
590
- }, M = (f) => {
591
- var c;
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;
592
750
  let o = { ...l };
593
751
  if (o.from && o.to)
594
- o = { from: f, to: null };
752
+ o = { from: m, to: null };
595
753
  else {
596
- const u = ((c = o.from) == null ? void 0 : c.getTime()) || 0;
597
- f.getTime() > u ? o = { from: o.from, to: f } : o = { from: f, to: o.from };
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 };
598
756
  }
599
- p(o), d(o);
757
+ c(o), d(o);
600
758
  };
601
- return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: j.map((f, o) => {
602
- var y, h, m;
603
- 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()), u = g && new Date(v, o) < g || i && new Date(v, o) > i;
604
- 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(
605
763
  "p",
606
764
  {
607
- className: w === v && (o === ((h = l.from) == null ? void 0 : h.getMonth()) || o === ((m = l.to) == null ? void 0 : m.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" : "",
608
766
  style: {
609
- backgroundColor: c ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
610
- pointerEvents: u ? "none" : void 0,
611
- cursor: u ? "not-allowed" : "pointer",
612
- color: u ? "var(--sa-color-gray-400, #b7b9be)" : c ? "var(--sa-color-gray-500, #8c8f97)" : "",
613
- ...e ? {} : { width: "100%" }
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)" : "",
771
+ ...n ? {} : { width: "100%" }
614
772
  },
615
773
  onClick: () => {
616
- u || k(new Date(v, o));
774
+ k || x(new Date(y, o));
617
775
  },
618
- children: f.slice(0, 3)
776
+ children: m.slice(0, 3)
619
777
  },
620
778
  o
621
779
  );
622
780
  }) });
623
- }, U = (a) => {
624
- const n = Math.floor(a / 10) * 10, t = n + 10;
625
- return { start: n, end: t };
626
- }, ce = ({
627
- date: a,
628
- 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,
629
787
  setViews: t,
630
788
  setDate: s,
631
789
  dateRange: l,
632
- setDateRange: p,
790
+ setDateRange: c,
633
791
  onChange: d,
634
792
  minDate: g,
635
- maxDate: i,
636
- input: e
793
+ maxDate: f,
794
+ input: n
637
795
  }) => {
638
- var y;
639
- let w = [];
640
- const v = a.getFullYear(), { start: k, end: M } = U(v), f = l.from.getFullYear(), o = (y = l.to) == null ? void 0 : y.getFullYear();
641
- for (let h = k; h < M; h++) {
642
- const m = new Date(h, 0), x = (!g || m >= g) && (!i || m <= i), F = h === f || h === o, L = m > l.from && m < l.to;
643
- w.push({
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({
644
802
  year: h,
645
- active: F && x,
646
- highlight: L && x,
647
- disabled: !x
803
+ active: b && p,
804
+ highlight: $ && p,
805
+ disabled: !p
648
806
  });
649
807
  }
650
- const c = (h) => {
651
- n ? (u(h), s(h)) : (s(h), t("months"));
652
- }, u = (h) => {
653
- var x;
654
- let m = { ...l };
655
- if (m.from && m.to)
656
- m = { from: h, 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 };
657
815
  else {
658
- const F = ((x = m.from) == null ? void 0 : x.getTime()) || 0;
659
- h.getTime() > F ? m = { from: m.from, to: h } : m = { from: h, to: m.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 };
660
818
  }
661
- p(m), d(m);
819
+ c(v), d(v);
662
820
  };
663
- return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((h, m) => /* @__PURE__ */ r(
821
+ return /* @__PURE__ */ a("div", { className: "sa-calendar-years-preview", children: u.map((h, v) => /* @__PURE__ */ a(
664
822
  "p",
665
823
  {
666
824
  className: `${h.active ? "sa-calendar-months-active" : ""} ${h.highlight ? "sa-calendar-months-highlight" : ""} ${h.disabled ? "sa-calendar-disabled" : ""}`,
667
825
  onClick: () => {
668
- h.disabled || c(new Date(h.year, 0));
826
+ h.disabled || i(new Date(h.year, 0));
669
827
  },
670
828
  style: {
671
829
  backgroundColor: h.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
672
830
  color: h.highlight ? "var(--sa-color-gray-500, #8c8f97)" : h.active ? "" : h.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
673
831
  cursor: h.disabled ? "not-allowed" : "pointer",
674
832
  pointerEvents: h.disbled ? "none" : "all",
675
- ...e ? {} : { width: "100%" }
833
+ ...n ? {} : { width: "100%" }
676
834
  },
677
835
  children: h.year
678
836
  },
679
- m
837
+ v
680
838
  )) });
681
- }, ae = ({ ...a }) => /* @__PURE__ */ r(
839
+ }, rn = ({ ...r }) => /* @__PURE__ */ a(
682
840
  "svg",
683
841
  {
684
842
  xmlns: "http://www.w3.org/2000/svg",
@@ -686,8 +844,8 @@ const W = (a) => {
686
844
  height: "20",
687
845
  viewBox: "0 0 20 20",
688
846
  fill: "none",
689
- ...a,
690
- children: /* @__PURE__ */ r(
847
+ ...r,
848
+ children: /* @__PURE__ */ a(
691
849
  "path",
692
850
  {
693
851
  d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
@@ -698,7 +856,7 @@ const W = (a) => {
698
856
  }
699
857
  )
700
858
  }
701
- ), re = ({ ...a }) => /* @__PURE__ */ r(
859
+ ), tn = ({ ...r }) => /* @__PURE__ */ a(
702
860
  "svg",
703
861
  {
704
862
  xmlns: "http://www.w3.org/2000/svg",
@@ -706,8 +864,8 @@ const W = (a) => {
706
864
  height: "20",
707
865
  viewBox: "0 0 20 20",
708
866
  fill: "none",
709
- ...a,
710
- children: /* @__PURE__ */ r(
867
+ ...r,
868
+ children: /* @__PURE__ */ a(
711
869
  "path",
712
870
  {
713
871
  d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
@@ -718,253 +876,257 @@ const W = (a) => {
718
876
  }
719
877
  )
720
878
  }
721
- ), ue = ({
722
- setViews: a,
723
- views: n,
879
+ ), pn = ({
880
+ setViews: r,
881
+ views: e,
724
882
  filter: t,
725
883
  date: s,
726
884
  setDate: l
727
885
  }) => {
728
- const p = () => {
729
- t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
886
+ const c = () => {
887
+ t || r((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
730
888
  }, d = () => {
731
- if (n === "years") {
732
- l((e) => new Date(e.getFullYear() + 10, 0));
889
+ if (e === "years") {
890
+ l((n) => new Date(n.getFullYear() + 10, 0));
733
891
  return;
734
892
  }
735
- if (n === "months") {
736
- l((e) => new Date(e.getFullYear() + 1, e.getMonth()));
893
+ if (e === "months") {
894
+ l((n) => new Date(n.getFullYear() + 1, n.getMonth()));
737
895
  return;
738
896
  }
739
- l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
897
+ l((n) => new Date(n.getFullYear(), n.getMonth() + 1));
740
898
  }, g = () => {
741
- if (n === "years") {
742
- l((e) => new Date(e.getFullYear() - 10, 0));
899
+ if (e === "years") {
900
+ l((n) => new Date(n.getFullYear() - 10, 0));
743
901
  return;
744
902
  }
745
- if (n === "months") {
746
- l((e) => new Date(e.getFullYear() - 1, e.getMonth()));
903
+ if (e === "months") {
904
+ l((n) => new Date(n.getFullYear() - 1, n.getMonth()));
747
905
  return;
748
906
  }
749
907
  l(
750
- (e) => new Date(
751
- e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
752
- 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
753
911
  )
754
912
  );
755
913
  };
756
914
  return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
757
- /* @__PURE__ */ r(ae, { onClick: () => g() }),
758
- /* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: p, children: (() => {
759
- if (n === "days")
760
- return `${j[s.getMonth()]} ${s.getFullYear()}`;
761
- if (n === "months")
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")
762
919
  return `${s.getFullYear()}`;
763
- if (n === "years")
764
- return `${U(s.getFullYear()).start} ~ ${U(s.getFullYear()).end}`;
920
+ if (e === "years")
921
+ return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
765
922
  })() }),
766
- /* @__PURE__ */ r(re, { onClick: () => d() })
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
+ ] })
767
927
  ] });
768
928
  };
769
- function H(a) {
770
- const n = new Date(a), t = n.getFullYear(), s = n.getMonth();
771
- 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}`;
772
932
  }
773
- const te = ({
774
- label: a,
775
- labelPosition: n = "outside-top",
933
+ const sn = ({
934
+ label: r,
935
+ labelPosition: e = "outside-top",
776
936
  required: t,
777
937
  optional: s,
778
938
  description: l,
779
- helperText: p,
939
+ helperText: c,
780
940
  errorText: d,
781
941
  fullWidth: g,
782
- children: i
942
+ children: f
783
943
  }) => {
784
- const e = [
944
+ const n = [
785
945
  "sa-date-field",
786
946
  g ? "sa-date-field-fullwidth" : ""
787
- ].filter(Boolean).join(" "), w = a ? /* @__PURE__ */ N("div", { className: "sa-date-field-label-row", children: [
788
- /* @__PURE__ */ r("span", { className: "sa-date-field-label-text", children: a }),
789
- s && /* @__PURE__ */ r("span", { className: "sa-date-field-optional-badge", children: "Optional" }),
790
- t && /* @__PURE__ */ r("span", { className: "sa-date-field-required", children: "*" })
791
- ] }) : null, v = /* @__PURE__ */ N(_, { children: [
792
- p && !d && /* @__PURE__ */ r("p", { className: "sa-date-field-helper", children: p }),
793
- d && /* @__PURE__ */ r("p", { className: "sa-date-field-error-msg", children: d })
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 })
794
954
  ] });
795
- return a ? n === "outside-left" ? /* @__PURE__ */ N("div", { className: `${e} sa-date-field-left`, children: [
955
+ return r ? e === "outside-left" ? /* @__PURE__ */ N("div", { className: `${n} sa-date-field-left`, children: [
796
956
  /* @__PURE__ */ N("div", { className: "sa-date-field-left-label", children: [
797
- w,
798
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l })
957
+ u,
958
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l })
799
959
  ] }),
800
960
  /* @__PURE__ */ N("div", { className: "sa-date-field-input-wrap", children: [
801
- i,
802
- v
961
+ f,
962
+ y
803
963
  ] })
804
- ] }) : /* @__PURE__ */ N("div", { className: e, children: [
805
- w,
806
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
807
- i,
808
- v
809
- ] }) : /* @__PURE__ */ N("div", { className: e, children: [
810
- l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
811
- i,
812
- v
964
+ ] }) : /* @__PURE__ */ N("div", { className: n, children: [
965
+ u,
966
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l }),
967
+ f,
968
+ y
969
+ ] }) : /* @__PURE__ */ N("div", { className: n, children: [
970
+ l && /* @__PURE__ */ a("p", { className: "sa-date-field-helper-top", children: l }),
971
+ f,
972
+ y
813
973
  ] });
814
- }, Q = "sa-calendar-styles", he = (a) => {
974
+ }, Q = "sa-calendar-styles", gn = (r) => {
815
975
  if (!document.getElementById(Q)) {
816
- const n = document.createElement("style");
817
- 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);
818
978
  }
819
979
  };
820
- he(P);
821
- const pe = G(
980
+ gn(J);
981
+ const fn = Z(
822
982
  ({
823
- value: a,
824
- onChange: n,
983
+ value: r,
984
+ onChange: e,
825
985
  filter: t,
826
986
  input: s = !0,
827
987
  disabled: l,
828
- minDate: p,
988
+ minDate: c,
829
989
  maxDate: d,
830
990
  placeholder: g,
831
- size: i,
832
- status: e,
833
- clearable: w,
834
- fullWidth: v = !0,
835
- label: k,
836
- labelPosition: M,
837
- required: f,
838
- optional: o,
839
- description: c,
840
- helperText: u,
841
- errorText: y
842
- }, h) => {
843
- const m = y ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = z("days"), [Y, E] = z(/* @__PURE__ */ new Date()), [D, I] = z({
844
- from: (a == null ? void 0 : a.from) || /* @__PURE__ */ new Date(),
845
- to: (a == null ? void 0 : a.to) || /* @__PURE__ */ new Date()
991
+ size: f,
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()
846
1007
  });
847
- $(() => {
848
- a ? (E(a.from), I(a)) : (E(/* @__PURE__ */ new Date()), I({
1008
+ S(() => {
1009
+ r ? (Y(r.from), z(r)) : (Y(/* @__PURE__ */ new Date()), z({
849
1010
  from: /* @__PURE__ */ new Date(),
850
1011
  to: /* @__PURE__ */ new Date()
851
1012
  }));
852
- }, [a]), $(() => {
853
- t && S(t);
854
- }, [t]), $(() => {
855
- t || S("days");
856
- }, [F]), $(() => {
857
- s || L(!0);
1013
+ }, [r]), S(() => {
1014
+ t && I(t);
1015
+ }, [t]), S(() => {
1016
+ t || I("days");
1017
+ }, [$]), S(() => {
1018
+ s || T(!0);
858
1019
  }, [s]);
859
- const J = () => {
860
- var b, T;
861
- if (!a)
1020
+ const R = () => {
1021
+ var w, B;
1022
+ if (!r)
862
1023
  return "";
863
1024
  if (t) {
864
- if (V === "days")
865
- return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
866
- if (V === "months")
867
- return `${j[D.from.getMonth()]} ~ ${D.to ? j[D.to.getMonth()] : "-"}`;
868
- if (V === "years")
869
- return `${(b = D.from) == null ? void 0 : b.getFullYear()} ~ ${((T = D.to) == null ? void 0 : T.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()) || "-"}`;
870
1031
  } else
871
- return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
872
- }, B = () => {
873
- if (C.current && x.current && s) {
874
- const b = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
875
- window.innerWidth < b.left + T.width ? C.current.style.left = `${b.left - T.width + b.width}px` : C.current.style.left = `${b.left}px`, b.top + T.height > window.innerHeight ? C.current.style.top = `${b.y - (b.height + T.height - 28)}px` : C.current.style.top = `${b.y + b.height}px`;
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`;
876
1037
  }
877
1038
  };
878
- $(() => {
879
- C.current && x.current && s && B();
880
- }, [C, x, F]), $(() => {
881
- const b = h == null ? void 0 : h.current;
882
- return b && b.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
883
- b && b.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
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);
884
1045
  };
885
1046
  }, []);
886
- const R = /* @__PURE__ */ N(
1047
+ const U = /* @__PURE__ */ N(
887
1048
  "div",
888
1049
  {
889
1050
  className: "sa-calendar-wrapper",
890
1051
  style: { height: s ? "auto" : "100%" },
891
- ref: s ? x : null,
1052
+ ref: s ? b : null,
892
1053
  children: [
893
- s ? /* @__PURE__ */ r(
894
- le,
1054
+ s ? /* @__PURE__ */ a(
1055
+ dn,
895
1056
  {
896
- value: J(),
1057
+ value: R(),
897
1058
  inputMode: "none",
898
1059
  onClick: () => {
899
- L(!0);
1060
+ T(!0);
900
1061
  },
901
1062
  onChange: () => {
902
1063
  },
903
1064
  disabled: l,
904
1065
  placeholder: g,
905
- size: i,
906
- status: m,
907
- clearable: w,
908
- onClear: () => n(void 0)
1066
+ size: f,
1067
+ variant: n,
1068
+ status: p,
1069
+ clearable: y,
1070
+ onClear: () => e(void 0)
909
1071
  }
910
1072
  ) : null,
911
- F ? /* @__PURE__ */ N(
1073
+ $ ? /* @__PURE__ */ N(
912
1074
  "div",
913
1075
  {
914
- className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
915
- ref: C,
1076
+ className: `sa-calendar sa-calendar-size-${f || "md"} ${s ? "" : "sa-calendar-no-input"}`,
1077
+ ref: M,
916
1078
  children: [
917
- /* @__PURE__ */ r(
918
- ue,
1079
+ /* @__PURE__ */ a(
1080
+ pn,
919
1081
  {
920
- setViews: S,
921
- views: V,
1082
+ setViews: I,
1083
+ views: F,
922
1084
  filter: t,
923
- date: Y,
924
- setDate: E
1085
+ date: E,
1086
+ setDate: Y
925
1087
  }
926
1088
  ),
927
- /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
928
- ie,
1089
+ /* @__PURE__ */ a("div", { className: "sa-calendar-body", children: F === "days" ? /* @__PURE__ */ a(
1090
+ cn,
929
1091
  {
930
- date: Y,
931
- setDate: E,
932
- setIsComponentVisible: L,
933
- dateRange: D,
934
- setDateRange: I,
1092
+ date: E,
1093
+ setDate: Y,
1094
+ setIsComponentVisible: T,
1095
+ dateRange: C,
1096
+ setDateRange: z,
935
1097
  input: s,
936
- onChange: n,
937
- minDate: p,
1098
+ onChange: e,
1099
+ minDate: c,
938
1100
  maxDate: d
939
1101
  }
940
- ) : V === "months" ? /* @__PURE__ */ r(
941
- de,
1102
+ ) : F === "months" ? /* @__PURE__ */ a(
1103
+ un,
942
1104
  {
943
- date: Y,
944
- setDate: E,
1105
+ date: E,
1106
+ setDate: Y,
945
1107
  filter: t,
946
- setViews: S,
947
- dateRange: D,
948
- setDateRange: I,
949
- setIsComponentVisible: L,
1108
+ setViews: I,
1109
+ dateRange: C,
1110
+ setDateRange: z,
1111
+ setIsComponentVisible: T,
950
1112
  input: s,
951
- onChange: n,
952
- minDate: p,
1113
+ onChange: e,
1114
+ minDate: c,
953
1115
  maxDate: d
954
1116
  }
955
- ) : /* @__PURE__ */ r(
956
- ce,
1117
+ ) : /* @__PURE__ */ a(
1118
+ hn,
957
1119
  {
958
- date: Y,
959
- setDate: E,
1120
+ date: E,
1121
+ setDate: Y,
960
1122
  filter: t,
961
- setViews: S,
962
- dateRange: D,
963
- setDateRange: I,
964
- setIsComponentVisible: L,
1123
+ setViews: I,
1124
+ dateRange: C,
1125
+ setDateRange: z,
1126
+ setIsComponentVisible: T,
965
1127
  input: s,
966
- onChange: n,
967
- minDate: p,
1128
+ onChange: e,
1129
+ minDate: c,
968
1130
  maxDate: d
969
1131
  }
970
1132
  ) })
@@ -974,63 +1136,63 @@ const pe = G(
974
1136
  ]
975
1137
  }
976
1138
  );
977
- return /* @__PURE__ */ r(
978
- te,
1139
+ return /* @__PURE__ */ a(
1140
+ sn,
979
1141
  {
980
- label: k,
981
- labelPosition: M,
982
- required: f,
983
- optional: o,
984
- description: c,
985
- helperText: u,
986
- errorText: y,
987
- fullWidth: v,
988
- 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
989
1151
  }
990
1152
  );
991
1153
  }
992
- ), X = "sa-calendar-input-styles", ge = (a) => {
1154
+ ), X = "sa-calendar-input-styles", bn = (r) => {
993
1155
  if (!document.getElementById(X)) {
994
- const n = document.createElement("style");
995
- 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);
996
1158
  }
997
1159
  };
998
- ge(P);
999
- const O = (a) => {
1000
- if (a === "sm")
1160
+ bn(J);
1161
+ const H = (r) => {
1162
+ if (r === "sm")
1001
1163
  return 16;
1002
- if (a === "md")
1164
+ if (r === "md")
1003
1165
  return 16;
1004
- if (a === "lg")
1166
+ if (r === "lg")
1005
1167
  return 20;
1006
- }, fe = (a) => {
1168
+ }, mn = (r) => {
1007
1169
  const {
1008
- size: n = "md",
1170
+ size: e = "md",
1009
1171
  status: t = "default",
1010
1172
  variant: s = "outline",
1011
1173
  clearable: l,
1012
- onClear: p,
1174
+ onClear: c,
1013
1175
  ...d
1014
- } = a, g = A(null), i = () => {
1176
+ } = r, g = P(null), f = () => {
1015
1177
  g.current && d.onClick && (g.current.focus(), d.onClick(""));
1016
- }, e = t === "disable" || d.disabled, w = !!d.value, v = l && w && !e, k = (M) => {
1017
- M.stopPropagation(), p == null || p();
1178
+ }, n = t === "disable" || d.disabled, u = !!d.value, y = l && u && !n, x = (D) => {
1179
+ D.stopPropagation(), c == null || c();
1018
1180
  };
1019
1181
  return /* @__PURE__ */ N(
1020
1182
  "div",
1021
1183
  {
1022
- className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
1023
- onClick: i,
1184
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
1185
+ onClick: f,
1024
1186
  children: [
1025
- /* @__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(
1026
1188
  "svg",
1027
1189
  {
1028
1190
  xmlns: "http://www.w3.org/2000/svg",
1029
- width: O(n),
1030
- height: O(n),
1191
+ width: H(e),
1192
+ height: H(e),
1031
1193
  viewBox: "0 0 20 20",
1032
1194
  fill: "none",
1033
- children: /* @__PURE__ */ r(
1195
+ children: /* @__PURE__ */ a(
1034
1196
  "path",
1035
1197
  {
1036
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",
@@ -1042,32 +1204,32 @@ const O = (a) => {
1042
1204
  )
1043
1205
  }
1044
1206
  ) }),
1045
- /* @__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(
1046
1208
  "input",
1047
1209
  {
1048
1210
  className: "sa-calendar-input",
1049
1211
  ...d,
1050
- disabled: e,
1212
+ disabled: n,
1051
1213
  value: d.value,
1052
1214
  ref: g
1053
1215
  }
1054
1216
  ) }),
1055
- v ? /* @__PURE__ */ r(
1217
+ y ? /* @__PURE__ */ a(
1056
1218
  "button",
1057
1219
  {
1058
1220
  type: "button",
1059
1221
  "aria-label": "Clear date",
1060
1222
  className: "sa-calendar-input-clear",
1061
- onClick: k,
1062
- children: /* @__PURE__ */ r(
1223
+ onClick: x,
1224
+ children: /* @__PURE__ */ a(
1063
1225
  "svg",
1064
1226
  {
1065
1227
  xmlns: "http://www.w3.org/2000/svg",
1066
- width: O(n),
1067
- height: O(n),
1228
+ width: H(e),
1229
+ height: H(e),
1068
1230
  viewBox: "0 0 20 20",
1069
1231
  fill: "none",
1070
- children: /* @__PURE__ */ r(
1232
+ children: /* @__PURE__ */ a(
1071
1233
  "path",
1072
1234
  {
1073
1235
  d: "M5 5L15 15M15 5L5 15",
@@ -1080,15 +1242,15 @@ const O = (a) => {
1080
1242
  }
1081
1243
  )
1082
1244
  }
1083
- ) : /* @__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(
1084
1246
  "svg",
1085
1247
  {
1086
1248
  xmlns: "http://www.w3.org/2000/svg",
1087
- width: O(n),
1088
- height: O(n),
1249
+ width: H(e),
1250
+ height: H(e),
1089
1251
  viewBox: "0 0 20 20",
1090
1252
  fill: "none",
1091
- children: /* @__PURE__ */ r(
1253
+ children: /* @__PURE__ */ a(
1092
1254
  "path",
1093
1255
  {
1094
1256
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1103,322 +1265,326 @@ const O = (a) => {
1103
1265
  ]
1104
1266
  }
1105
1267
  );
1106
- }, me = ({
1107
- date: a,
1108
- setDate: n,
1268
+ }, vn = ({
1269
+ date: r,
1270
+ setDate: e,
1109
1271
  previewDate: t,
1110
1272
  setPreviewDate: s,
1111
1273
  setIsComponentVisible: l,
1112
- minDate: p,
1274
+ minDate: c,
1113
1275
  maxDate: d,
1114
1276
  input: g,
1115
- onChange: i
1277
+ onChange: f
1116
1278
  }) => {
1117
- let e = new Date(
1279
+ let n = new Date(
1118
1280
  t.getFullYear(),
1119
1281
  t.getMonth(),
1120
1282
  1
1121
- ), w = e.getDay(), v = [];
1122
- const k = a.toDateString(), M = t.getMonth();
1283
+ ), u = n.getDay(), y = [];
1284
+ const x = r.toDateString(), D = t.getMonth();
1123
1285
  for (let o = 0; o < 42; o++) {
1124
- o === 0 && w === 0 ? e.setDate(e.getDate() - 7) : o === 0 ? e.setDate(
1125
- e.getDate() + (o - w)
1126
- ) : e.setDate(e.getDate() + 1);
1127
- let c = {
1128
- currentMonth: e.getMonth() === M,
1129
- date: new Date(e),
1130
- month: e.getMonth(),
1131
- number: e.getDate(),
1132
- selected: e.toDateString() === k,
1133
- year: e.getFullYear(),
1134
- isDisabled: p && e < p || d && e > d
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
1135
1297
  };
1136
- v.push(c);
1298
+ y.push(i);
1137
1299
  }
1138
- const f = (o) => {
1139
- (!p || o >= p) && (!d || o <= d) && (n(o), i(o), s(o), g && l(!1));
1300
+ const m = (o) => {
1301
+ (!c || o >= c) && (!d || o <= d) && (e(o), f(o), s(o), g && l(!1));
1140
1302
  };
1141
1303
  return /* @__PURE__ */ N("div", { className: "sa-calendar-days-preivew", children: [
1142
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((o, c) => /* @__PURE__ */ r("p", { children: o }, c)) }),
1143
- /* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: v.map((o, c) => {
1144
- const u = o.isDisabled;
1145
- return /* @__PURE__ */ r(
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;
1307
+ return /* @__PURE__ */ a(
1146
1308
  "p",
1147
1309
  {
1148
1310
  className: `${o.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${o.selected ? "sa-calendar-days-active" : ""}`,
1149
1311
  style: {
1150
- color: u ? "#ccc" : void 0,
1151
- pointerEvents: u ? "none" : void 0,
1152
- cursor: u ? "not-allowed" : "pointer",
1312
+ color: k ? "#ccc" : void 0,
1313
+ pointerEvents: k ? "none" : void 0,
1314
+ cursor: k ? "not-allowed" : "pointer",
1153
1315
  ...g ? {} : { width: "100%" }
1154
1316
  },
1155
1317
  onClick: () => {
1156
- u || f(o.date);
1318
+ k || m(o.date);
1157
1319
  },
1158
1320
  children: o.number
1159
1321
  },
1160
- c
1322
+ i
1161
1323
  );
1162
1324
  }) })
1163
1325
  ] });
1164
- }, be = ({
1165
- date: a,
1166
- setDate: n,
1326
+ }, yn = ({
1327
+ date: r,
1328
+ setDate: e,
1167
1329
  filter: t,
1168
1330
  setViews: s,
1169
1331
  onChange: l,
1170
- previewDate: p,
1332
+ previewDate: c,
1171
1333
  setPreviewDate: d,
1172
1334
  minDate: g,
1173
- maxDate: i,
1174
- input: e
1335
+ maxDate: f,
1336
+ input: n
1175
1337
  }) => {
1176
- const w = a.getMonth(), v = a.getFullYear(), k = p.getFullYear(), M = (f) => {
1177
- (!g || f >= g) && (!i || f <= i) && (t ? (l(f), n(f), d(f)) : (s("days"), d(f)));
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)));
1178
1340
  };
1179
- return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: j.map((f, o) => {
1180
- const c = g && new Date(k, o, 1) < g || i && new Date(k, o + 1, 0) > i;
1181
- 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(
1182
1344
  "p",
1183
1345
  {
1184
- className: o === w && k === v ? "sa-calendar-months-active" : "",
1346
+ className: o === u && x === y ? "sa-calendar-months-active" : "",
1185
1347
  style: {
1186
- color: c ? "#ccc" : void 0,
1187
- pointerEvents: c ? "none" : void 0,
1188
- cursor: c ? "not-allowed" : "pointer",
1189
- ...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%" }
1190
1352
  },
1191
1353
  onClick: () => {
1192
- c || M(new Date(k, o));
1354
+ i || D(new Date(x, o));
1193
1355
  },
1194
- children: f.slice(0, 3)
1356
+ children: m.slice(0, 3)
1195
1357
  },
1196
1358
  o
1197
1359
  );
1198
1360
  }) });
1199
- }, q = (a) => {
1200
- const n = Math.floor(a / 10) * 10, t = n + 10;
1201
- return { start: n, end: t };
1202
- }, ve = ({
1203
- date: a,
1204
- 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,
1205
1367
  setViews: t,
1206
1368
  setDate: s,
1207
1369
  onChange: l,
1208
- previewDate: p,
1370
+ previewDate: c,
1209
1371
  setPreviewDate: d,
1210
1372
  minDate: g,
1211
- maxDate: i,
1212
- input: e
1373
+ maxDate: f,
1374
+ input: n
1213
1375
  }) => {
1214
- let w = [];
1215
- const v = p.getFullYear(), { start: k, end: M } = q(v), f = a.getFullYear();
1216
- for (let c = k; c < M; c++) {
1217
- let u = g && new Date(c, 0, 1) < g || i && new Date(c, 11, 31) > i;
1218
- w.push({ year: c, active: c === f, isDisabled: u });
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 });
1219
1381
  }
1220
- const o = (c) => {
1221
- (!g || c >= g) && (!i || c <= i) && (n ? (l(c), s(c), d(c)) : (t("months"), d(c)));
1382
+ const o = (i) => {
1383
+ (!g || i >= g) && (!f || i <= f) && (e ? (l(i), s(i), d(i)) : (t("months"), d(i)));
1222
1384
  };
1223
- return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((c, u) => /* @__PURE__ */ r(
1385
+ return /* @__PURE__ */ a("div", { className: "sa-calendar-years-preview", children: u.map((i, k) => /* @__PURE__ */ a(
1224
1386
  "p",
1225
1387
  {
1226
- className: c.active ? "sa-calendar-months-active" : "",
1388
+ className: i.active ? "sa-calendar-months-active" : "",
1227
1389
  style: {
1228
- color: c.isDisabled ? "#ccc" : void 0,
1229
- pointerEvents: c.isDisabled ? "none" : void 0,
1230
- cursor: c.isDisabled ? "not-allowed" : "pointer",
1231
- ...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%" }
1232
1394
  },
1233
1395
  onClick: () => {
1234
- c.isDisabled || o(new Date(c.year, 0));
1396
+ i.isDisabled || o(new Date(i.year, 0));
1235
1397
  },
1236
- children: c.year
1398
+ children: i.year
1237
1399
  },
1238
- u
1400
+ k
1239
1401
  )) });
1240
- }, ye = ({
1241
- setViews: a,
1242
- views: n,
1402
+ }, xn = ({
1403
+ setViews: r,
1404
+ views: e,
1243
1405
  filter: t,
1244
1406
  previewDate: s,
1245
1407
  setPreviewDate: l
1246
1408
  }) => {
1247
- const p = () => {
1248
- t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
1409
+ const c = () => {
1410
+ t || r((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
1249
1411
  }, d = () => {
1250
- if (n === "years") {
1251
- l((e) => new Date(e.getFullYear() + 10, 0));
1412
+ if (e === "years") {
1413
+ l((n) => new Date(n.getFullYear() + 10, 0));
1252
1414
  return;
1253
1415
  }
1254
- if (n === "months") {
1416
+ if (e === "months") {
1255
1417
  l(
1256
- (e) => new Date(e.getFullYear() + 1, e.getMonth())
1418
+ (n) => new Date(n.getFullYear() + 1, n.getMonth())
1257
1419
  );
1258
1420
  return;
1259
1421
  }
1260
- l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
1422
+ l((n) => new Date(n.getFullYear(), n.getMonth() + 1));
1261
1423
  }, g = () => {
1262
- if (n === "years") {
1263
- l((e) => new Date(e.getFullYear() - 10, 0));
1424
+ if (e === "years") {
1425
+ l((n) => new Date(n.getFullYear() - 10, 0));
1264
1426
  return;
1265
1427
  }
1266
- if (n === "months") {
1428
+ if (e === "months") {
1267
1429
  l(
1268
- (e) => new Date(e.getFullYear() - 1, e.getMonth())
1430
+ (n) => new Date(n.getFullYear() - 1, n.getMonth())
1269
1431
  );
1270
1432
  return;
1271
1433
  }
1272
1434
  l(
1273
- (e) => new Date(
1274
- e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
1275
- 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
1276
1438
  )
1277
1439
  );
1278
1440
  };
1279
1441
  return /* @__PURE__ */ N("div", { className: "sa-calendar-header", children: [
1280
- /* @__PURE__ */ r(ae, { onClick: () => g() }),
1281
- /* @__PURE__ */ r("div", { style: { cursor: "pointer" }, onClick: p, children: (() => {
1282
- if (n === "days")
1283
- return `${j[s.getMonth()]} ${s.getFullYear()}`;
1284
- if (n === "months")
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")
1285
1446
  return `${s.getFullYear()}`;
1286
- if (n === "years")
1287
- return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
1447
+ if (e === "years")
1448
+ return `${G(s.getFullYear()).start} ~ ${G(s.getFullYear()).end}`;
1288
1449
  })() }),
1289
- /* @__PURE__ */ r(re, { onClick: () => d() })
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
+ ] })
1290
1454
  ] });
1291
- }, Z = "sa-calendar-styles", we = (a) => {
1292
- if (!document.getElementById(Z)) {
1293
- const n = document.createElement("style");
1294
- 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);
1295
1459
  }
1296
1460
  };
1297
- we(P);
1298
- const xe = G(
1461
+ kn(J);
1462
+ const Mn = Z(
1299
1463
  ({
1300
- value: a,
1301
- onChange: n,
1464
+ value: r,
1465
+ onChange: e,
1302
1466
  filter: t,
1303
1467
  input: s = !0,
1304
1468
  disabled: l,
1305
- minDate: p,
1469
+ minDate: c,
1306
1470
  maxDate: d,
1307
1471
  placeholder: g,
1308
- size: i,
1309
- status: e,
1310
- clearable: w,
1311
- fullWidth: v = !0,
1312
- label: k,
1313
- labelPosition: M,
1314
- required: f,
1315
- optional: o,
1316
- description: c,
1317
- helperText: u,
1318
- errorText: y
1319
- }, h) => {
1320
- const m = y ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = z("days"), [Y, E] = z(/* @__PURE__ */ new Date()), [D, I] = z(/* @__PURE__ */ new Date());
1321
- $(() => {
1322
- a ? (E(a), I(a)) : (E(/* @__PURE__ */ new Date()), I(/* @__PURE__ */ new Date()));
1323
- }, [a]), $(() => {
1324
- t && S(t);
1325
- }, [t]), $(() => {
1326
- t || S("days");
1327
- }, [F]), $(() => {
1328
- s || L(!0);
1472
+ size: f,
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());
1486
+ S(() => {
1487
+ r ? (Y(r), z(r)) : (Y(/* @__PURE__ */ new Date()), z(/* @__PURE__ */ new Date()));
1488
+ }, [r]), S(() => {
1489
+ t && I(t);
1490
+ }, [t]), S(() => {
1491
+ t || I("days");
1492
+ }, [$]), S(() => {
1493
+ s || T(!0);
1329
1494
  }, [s]);
1330
- const J = () => a ? t === "days" ? H(Y) : t === "months" ? `${j[Y.getMonth()]} ${Y.getFullYear()}` : t === "years" ? Y.getFullYear() : H(Y) : "", B = () => {
1331
- if (C.current && x.current && s) {
1332
- const b = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
1333
- window.innerWidth < b.left + T.width ? C.current.style.left = `${b.left - T.width + b.width}px` : C.current.style.left = `${b.left}px`, b.top + T.height > window.innerHeight ? C.current.style.top = `${b.y - (b.height + T.height - 28)}px` : C.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`;
1334
1499
  }
1335
1500
  };
1336
- $(() => {
1337
- C.current && x.current && s && B();
1338
- }, [C, x, F]), $(() => {
1339
- const b = h == null ? void 0 : h.current;
1340
- return b && b.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
1341
- b && b.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
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);
1342
1507
  };
1343
1508
  }, []);
1344
- const R = /* @__PURE__ */ N(
1509
+ const U = /* @__PURE__ */ N(
1345
1510
  "div",
1346
1511
  {
1347
1512
  className: "sa-calendar-wrapper",
1348
1513
  style: { height: s ? "auto" : "100%" },
1349
- ref: s ? x : null,
1514
+ ref: s ? b : null,
1350
1515
  children: [
1351
- s ? /* @__PURE__ */ r(
1352
- fe,
1516
+ s ? /* @__PURE__ */ a(
1517
+ mn,
1353
1518
  {
1354
- value: J(),
1355
- onClick: () => L(!0),
1519
+ value: R(),
1520
+ onClick: () => T(!0),
1356
1521
  onChange: () => {
1357
1522
  },
1358
1523
  placeholder: g,
1359
1524
  disabled: l,
1360
- size: i,
1361
- status: m,
1525
+ size: f,
1526
+ variant: n,
1527
+ status: p,
1362
1528
  inputMode: "none",
1363
- clearable: w,
1364
- onClear: () => n(void 0)
1529
+ clearable: y,
1530
+ onClear: () => e(void 0)
1365
1531
  }
1366
1532
  ) : null,
1367
- F ? /* @__PURE__ */ N(
1533
+ $ ? /* @__PURE__ */ N(
1368
1534
  "div",
1369
1535
  {
1370
- className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
1371
- ref: C,
1536
+ className: `sa-calendar sa-calendar-size-${f || "md"} ${s ? "" : "sa-calendar-no-input"}`,
1537
+ ref: M,
1372
1538
  children: [
1373
- /* @__PURE__ */ r(
1374
- ye,
1539
+ /* @__PURE__ */ a(
1540
+ xn,
1375
1541
  {
1376
- setViews: S,
1377
- views: V,
1542
+ setViews: I,
1543
+ views: F,
1378
1544
  filter: t,
1379
- previewDate: D,
1380
- setPreviewDate: I,
1381
- isComponentVisible: F
1545
+ previewDate: C,
1546
+ setPreviewDate: z,
1547
+ isComponentVisible: $
1382
1548
  }
1383
1549
  ),
1384
- /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
1385
- me,
1550
+ /* @__PURE__ */ a("div", { className: "sa-calendar-body", children: F === "days" ? /* @__PURE__ */ a(
1551
+ vn,
1386
1552
  {
1387
- date: Y,
1388
- setDate: E,
1389
- previewDate: D,
1390
- setPreviewDate: I,
1391
- setIsComponentVisible: L,
1553
+ date: E,
1554
+ setDate: Y,
1555
+ previewDate: C,
1556
+ setPreviewDate: z,
1557
+ setIsComponentVisible: T,
1392
1558
  input: s,
1393
- minDate: p,
1559
+ minDate: c,
1394
1560
  maxDate: d,
1395
- onChange: n
1561
+ onChange: e
1396
1562
  }
1397
- ) : V === "months" ? /* @__PURE__ */ r(
1398
- be,
1563
+ ) : F === "months" ? /* @__PURE__ */ a(
1564
+ yn,
1399
1565
  {
1400
- date: Y,
1401
- setDate: E,
1402
- previewDate: D,
1403
- setPreviewDate: I,
1566
+ date: E,
1567
+ setDate: Y,
1568
+ previewDate: C,
1569
+ setPreviewDate: z,
1404
1570
  filter: t,
1405
- setViews: S,
1406
- onChange: n,
1407
- minDate: p,
1571
+ setViews: I,
1572
+ onChange: e,
1573
+ minDate: c,
1408
1574
  maxDate: d,
1409
1575
  input: s
1410
1576
  }
1411
- ) : /* @__PURE__ */ r(
1412
- ve,
1577
+ ) : /* @__PURE__ */ a(
1578
+ wn,
1413
1579
  {
1414
- date: Y,
1415
- setDate: E,
1416
- previewDate: D,
1417
- setPreviewDate: I,
1580
+ date: E,
1581
+ setDate: Y,
1582
+ previewDate: C,
1583
+ setPreviewDate: z,
1418
1584
  filter: t,
1419
- setViews: S,
1420
- onChange: n,
1421
- minDate: p,
1585
+ setViews: I,
1586
+ onChange: e,
1587
+ minDate: c,
1422
1588
  maxDate: d,
1423
1589
  input: s
1424
1590
  }
@@ -1429,68 +1595,70 @@ const xe = G(
1429
1595
  ]
1430
1596
  }
1431
1597
  );
1432
- return /* @__PURE__ */ r(
1433
- te,
1598
+ return /* @__PURE__ */ a(
1599
+ sn,
1434
1600
  {
1435
- label: k,
1436
- labelPosition: M,
1437
- required: f,
1438
- optional: o,
1439
- description: c,
1440
- helperText: u,
1441
- errorText: y,
1442
- fullWidth: v,
1443
- 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
1444
1610
  }
1445
1611
  );
1446
1612
  }
1447
- ), Ce = G(
1613
+ ), Nn = Z(
1448
1614
  ({
1449
- value: a,
1450
- onChange: n,
1615
+ value: r,
1616
+ onChange: e,
1451
1617
  filter: t,
1452
1618
  input: s = !0,
1453
1619
  rangedDate: l,
1454
- disabled: p,
1620
+ disabled: c,
1455
1621
  minDate: d,
1456
1622
  maxDate: g,
1457
- placeholder: i,
1458
- size: e,
1459
- status: w,
1460
- clearable: v,
1461
- fullWidth: k,
1462
- label: M,
1463
- labelPosition: f,
1464
- required: o,
1465
- optional: c,
1466
- description: u,
1467
- helperText: y,
1468
- errorText: h
1469
- }, m) => {
1470
- const x = {
1471
- onChange: n,
1472
- value: a,
1623
+ placeholder: f,
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,
1473
1640
  input: s,
1474
1641
  filter: t,
1475
- disabled: p,
1642
+ disabled: c,
1476
1643
  minDate: d,
1477
1644
  maxDate: g,
1478
- placeholder: i,
1479
- size: e,
1480
- status: w,
1481
- clearable: v,
1482
- fullWidth: k,
1483
- label: M,
1484
- labelPosition: f,
1485
- required: o,
1486
- optional: c,
1487
- description: u,
1488
- helperText: y,
1489
- errorText: h
1645
+ placeholder: f,
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
1490
1658
  };
1491
- return /* @__PURE__ */ r(_, { children: l ? /* @__PURE__ */ r(pe, { ...x, ref: m }) : /* @__PURE__ */ r(xe, { ...x, ref: m }) });
1659
+ return /* @__PURE__ */ a(nn, { children: l ? /* @__PURE__ */ a(fn, { ...b, ref: p }) : /* @__PURE__ */ a(Mn, { ...b, ref: p }) });
1492
1660
  }
1493
1661
  );
1494
1662
  export {
1495
- Ce as StarasiaDate
1663
+ Nn as StarasiaDate
1496
1664
  };