@starasia/date 4.0.0 → 5.0.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 F, jsx as t, Fragment as q } from "react/jsx-runtime";
2
- import { useState as N, useRef as B, useEffect as D, forwardRef as W } from "react";
3
- const V = `@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 r, Fragment as _ } from "react/jsx-runtime";
2
+ import { useState as j, 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");
4
4
 
5
5
  * {
6
6
  margin: 0;
@@ -29,11 +29,87 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
29
29
  }
30
30
  .sa-calendar-wrapper {
31
31
  position: relative;
32
+ width: 100%;
33
+ }
34
+
35
+ /* === DATE FIELD WRAPPER === */
36
+ .sa-date-field {
37
+ display: flex;
38
+ flex-direction: column;
39
+ gap: 6px;
32
40
  width: max-content;
41
+ font-family: "Poppins", sans-serif;
33
42
  }
34
- .sa-calendar-wrapper-fullwidth {
43
+ .sa-date-field-fullwidth {
35
44
  width: 100%;
36
45
  }
46
+ .sa-date-field-left {
47
+ flex-direction: row;
48
+ align-items: flex-start;
49
+ gap: 16px;
50
+ }
51
+ .sa-date-field-left-label {
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: 4px;
55
+ flex: 0 0 auto;
56
+ width: 35%;
57
+ padding-top: 8px;
58
+ }
59
+ .sa-date-field-input-wrap {
60
+ display: flex;
61
+ flex-direction: column;
62
+ gap: 6px;
63
+ flex: 1;
64
+ min-width: 0;
65
+ }
66
+ .sa-date-field-label-row {
67
+ display: flex;
68
+ align-items: center;
69
+ gap: 6px;
70
+ flex-wrap: wrap;
71
+ }
72
+ .sa-date-field-label-text {
73
+ font-size: 14px;
74
+ font-weight: 500;
75
+ color: var(--sa-date-text-primary);
76
+ line-height: 1.3;
77
+ }
78
+ .sa-date-field-required {
79
+ font-size: 14px;
80
+ font-weight: 500;
81
+ color: var(--sa-date-border-error);
82
+ line-height: 1;
83
+ }
84
+ .sa-date-field-optional-badge {
85
+ display: inline-flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ padding: 0 6px;
89
+ border: 0.8px solid var(--sa-date-border-color);
90
+ border-radius: 4px;
91
+ background-color: transparent;
92
+ font-size: 10px;
93
+ font-weight: 500;
94
+ color: var(--sa-date-text-subtle);
95
+ line-height: 18px;
96
+ text-transform: lowercase;
97
+ }
98
+ .sa-date-field-helper-top,
99
+ .sa-date-field-helper {
100
+ font-size: 12px;
101
+ font-weight: 400;
102
+ color: var(--sa-date-text-subtle);
103
+ line-height: 1.4;
104
+ margin: 0;
105
+ }
106
+ .sa-date-field-error-msg {
107
+ font-size: 12px;
108
+ font-weight: 400;
109
+ color: var(--sa-date-border-error);
110
+ line-height: 1.4;
111
+ margin: 0;
112
+ }
37
113
 
38
114
  .sa-calendar {
39
115
  border-radius: var(--sa-date-radius);
@@ -282,7 +358,7 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
282
358
  outline: 2px solid var(--sa-date-brand);
283
359
  outline-offset: 1px;
284
360
  }
285
- `, P = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], L = [
361
+ `, ee = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], z = [
286
362
  "January",
287
363
  "February",
288
364
  "March",
@@ -295,7 +371,7 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
295
371
  "October",
296
372
  "November",
297
373
  "December"
298
- ], K = [
374
+ ], se = [
299
375
  "Jan",
300
376
  "Feb",
301
377
  "Mar",
@@ -309,56 +385,56 @@ const V = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
309
385
  "Nov",
310
386
  "Dec"
311
387
  ];
312
- function R(a) {
313
- const [e, o] = N(a), l = B(null), c = (g) => {
314
- l.current && !l.current.contains(g.target) && o(!1);
388
+ function ne(a) {
389
+ const [n, t] = j(a), s = A(null), l = (p) => {
390
+ s.current && !s.current.contains(p.target) && t(!1);
315
391
  };
316
- return D(() => (document.addEventListener("click", c, !0), () => {
317
- document.removeEventListener("click", c, !0);
318
- }), []), { ref: l, isComponentVisible: e, setIsComponentVisible: o };
392
+ return $(() => (document.addEventListener("click", l, !0), () => {
393
+ document.removeEventListener("click", l, !0);
394
+ }), []), { ref: s, isComponentVisible: n, setIsComponentVisible: t };
319
395
  }
320
- const O = "sa-calendar-input-styles", Q = (a) => {
321
- if (!document.getElementById(O)) {
322
- const e = document.createElement("style");
323
- e.id = O, e.textContent = a, document.head.appendChild(e);
396
+ const K = "sa-calendar-input-styles", oe = (a) => {
397
+ if (!document.getElementById(K)) {
398
+ const n = document.createElement("style");
399
+ n.id = K, n.textContent = a, document.head.appendChild(n);
324
400
  }
325
401
  };
326
- Q(V);
327
- const E = (a) => {
402
+ oe(P);
403
+ const W = (a) => {
328
404
  if (a === "sm")
329
405
  return 16;
330
406
  if (a === "md")
331
407
  return 16;
332
408
  if (a === "lg")
333
409
  return 20;
334
- }, X = (a) => {
410
+ }, le = (a) => {
335
411
  const {
336
- size: e = "md",
337
- status: o = "default",
338
- variant: l = "outline",
339
- clearable: c,
340
- onClear: g,
341
- ...h
342
- } = a, f = B(null), u = () => {
343
- f.current && h.onClick && (f.current.focus(), h.onClick(""));
344
- }, n = o === "disable" || h.disabled, M = !!h.value, k = c && M && !n, x = (b) => {
345
- b.stopPropagation(), g == null || g();
412
+ size: n = "md",
413
+ status: t = "default",
414
+ variant: s = "outline",
415
+ clearable: l,
416
+ onClear: p,
417
+ ...d
418
+ } = a, g = A(null), i = () => {
419
+ g.current && d.onClick && (g.current.focus(), d.onClick(""));
420
+ }, e = t === "disable" || d.disabled, w = !!d.value, y = l && w && !e, k = (M) => {
421
+ M.stopPropagation(), p == null || p();
346
422
  };
347
- return /* @__PURE__ */ F(
423
+ return /* @__PURE__ */ N(
348
424
  "div",
349
425
  {
350
- className: `sa-calendar-input-container sa-calendar-input-${l} sa-calendar-input-container-${o} ${e} `,
351
- onClick: u,
426
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
427
+ onClick: i,
352
428
  children: [
353
- /* @__PURE__ */ t("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ t(
429
+ /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
354
430
  "svg",
355
431
  {
356
432
  xmlns: "http://www.w3.org/2000/svg",
357
- width: E(e),
358
- height: E(e),
433
+ width: W(n),
434
+ height: W(n),
359
435
  viewBox: "0 0 20 20",
360
436
  fill: "none",
361
- children: /* @__PURE__ */ t(
437
+ children: /* @__PURE__ */ r(
362
438
  "path",
363
439
  {
364
440
  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",
@@ -370,32 +446,32 @@ const E = (a) => {
370
446
  )
371
447
  }
372
448
  ) }),
373
- /* @__PURE__ */ t("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ t(
449
+ /* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
374
450
  "input",
375
451
  {
376
452
  className: "sa-calendar-input",
377
- ...h,
378
- disabled: n,
379
- value: h.value,
380
- ref: f
453
+ ...d,
454
+ disabled: e,
455
+ value: d.value,
456
+ ref: g
381
457
  }
382
458
  ) }),
383
- k ? /* @__PURE__ */ t(
459
+ y ? /* @__PURE__ */ r(
384
460
  "button",
385
461
  {
386
462
  type: "button",
387
463
  "aria-label": "Clear date",
388
464
  className: "sa-calendar-input-clear",
389
- onClick: x,
390
- children: /* @__PURE__ */ t(
465
+ onClick: k,
466
+ children: /* @__PURE__ */ r(
391
467
  "svg",
392
468
  {
393
469
  xmlns: "http://www.w3.org/2000/svg",
394
- width: E(e),
395
- height: E(e),
470
+ width: W(n),
471
+ height: W(n),
396
472
  viewBox: "0 0 20 20",
397
473
  fill: "none",
398
- children: /* @__PURE__ */ t(
474
+ children: /* @__PURE__ */ r(
399
475
  "path",
400
476
  {
401
477
  d: "M5 5L15 15M15 5L5 15",
@@ -408,15 +484,15 @@ const E = (a) => {
408
484
  }
409
485
  )
410
486
  }
411
- ) : /* @__PURE__ */ t("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ t(
487
+ ) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
412
488
  "svg",
413
489
  {
414
490
  xmlns: "http://www.w3.org/2000/svg",
415
- width: E(e),
416
- height: E(e),
491
+ width: W(n),
492
+ height: W(n),
417
493
  viewBox: "0 0 20 20",
418
494
  fill: "none",
419
- children: /* @__PURE__ */ t(
495
+ children: /* @__PURE__ */ r(
420
496
  "path",
421
497
  {
422
498
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -431,178 +507,178 @@ const E = (a) => {
431
507
  ]
432
508
  }
433
509
  );
434
- }, Z = ({
510
+ }, ie = ({
435
511
  date: a,
436
- setDate: e,
437
- dateRange: o,
438
- setDateRange: l,
439
- onChange: c,
440
- minDate: g,
441
- maxDate: h,
442
- input: f
512
+ setDate: n,
513
+ dateRange: t,
514
+ setDateRange: s,
515
+ onChange: l,
516
+ minDate: p,
517
+ maxDate: d,
518
+ input: g
443
519
  }) => {
444
- var y, s, r;
445
- let u = new Date(a.getFullYear(), a.getMonth(), 1), n = u.getDay(), M = [];
446
- const k = a.getMonth();
447
- for (let i = 0; i < 42; i++) {
448
- i === 0 && n === 0 ? u.setDate(u.getDate() - 7) : i === 0 ? u.setDate(
449
- u.getDate() + (i - n)
450
- ) : u.setDate(u.getDate() + 1);
451
- let m = {
452
- currentMonth: u.getMonth() === k,
453
- date: new Date(u),
454
- month: u.getMonth(),
455
- number: u.getDate(),
456
- selected: u.toDateString() === ((y = o.from) == null ? void 0 : y.toDateString()) || u.toDateString() === (((s = o.to) == null ? void 0 : s.toDateString()) || ((r = o.from) == null ? void 0 : r.toDateString())),
457
- year: u.getFullYear(),
458
- isDisabled: g && u < g || h && u > h
520
+ var f, o, c;
521
+ let i = new Date(a.getFullYear(), a.getMonth(), 1), e = i.getDay(), w = [];
522
+ const y = a.getMonth();
523
+ for (let h = 0; h < 42; h++) {
524
+ h === 0 && e === 0 ? i.setDate(i.getDate() - 7) : h === 0 ? i.setDate(
525
+ i.getDate() + (h - e)
526
+ ) : i.setDate(i.getDate() + 1);
527
+ let b = {
528
+ currentMonth: i.getMonth() === y,
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
459
535
  };
460
- M.push(m);
536
+ w.push(b);
461
537
  }
462
- const x = (i) => {
463
- e(i);
464
- }, b = (i) => {
465
- var d;
466
- let m = { ...o };
467
- if (m.from && m.to)
468
- m = { from: i, to: null };
538
+ const k = (h) => {
539
+ n(h);
540
+ }, M = (h) => {
541
+ var u;
542
+ let b = { ...t };
543
+ if (b.from && b.to)
544
+ b = { from: h, to: null };
469
545
  else {
470
- const p = ((d = m.from) == null ? void 0 : d.getTime()) || 0;
471
- i.getTime() > p ? m = { from: m.from, to: i } : m = { from: i, to: m.from };
546
+ const m = ((u = b.from) == null ? void 0 : u.getTime()) || 0;
547
+ h.getTime() > m ? b = { from: b.from, to: h } : b = { from: h, to: b.from };
472
548
  }
473
- l(m), c(m);
549
+ s(b), l(b);
474
550
  };
475
- return /* @__PURE__ */ F("div", { className: "sa-calendar-days-preivew", children: [
476
- /* @__PURE__ */ t("div", { className: "sa-calendar-days-name-preivew", children: P.map((i, m) => /* @__PURE__ */ t("p", { children: i }, m)) }),
477
- /* @__PURE__ */ t("div", { className: "sa-calendar-days-number-preivew", children: M.map((i, m) => {
478
- var w;
479
- const d = i.date.getTime() > o.from.getTime() && i.date.getTime() < (((w = o.to) == null ? void 0 : w.getTime()) || o.from.getTime()), p = i.isDisabled;
480
- return /* @__PURE__ */ t(
551
+ return /* @__PURE__ */ N("div", { className: "sa-calendar-days-preivew", children: [
552
+ /* @__PURE__ */ r("div", { className: "sa-calendar-days-name-preivew", children: ee.map((h, b) => /* @__PURE__ */ r("p", { children: h }, b)) }),
553
+ /* @__PURE__ */ r("div", { className: "sa-calendar-days-number-preivew", children: w.map((h, b) => {
554
+ var x;
555
+ const u = h.date.getTime() > t.from.getTime() && h.date.getTime() < (((x = t.to) == null ? void 0 : x.getTime()) || t.from.getTime()), m = h.isDisabled;
556
+ return /* @__PURE__ */ r(
481
557
  "p",
482
558
  {
483
- className: `${i.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${i.selected ? "sa-calendar-days-active" : ""}`,
559
+ className: `${h.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${h.selected ? "sa-calendar-days-active" : ""}`,
484
560
  style: {
485
- backgroundColor: d ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
486
- pointerEvents: p ? "none" : void 0,
487
- cursor: p ? "not-allowed" : "pointer",
488
- color: p ? "var(--sa-color-gray-400, #b7b9be)" : d ? "var(--sa-color-gray-500, #8c8f97)" : "",
489
- ...f ? {} : { width: "100%" }
561
+ backgroundColor: u ? "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)" : u ? "var(--sa-color-gray-500, #8c8f97)" : "",
565
+ ...g ? {} : { width: "100%" }
490
566
  },
491
567
  onClick: () => {
492
- p || (x(i.date), b(i.date));
568
+ m || (k(h.date), M(h.date));
493
569
  },
494
- children: i.number
570
+ children: h.number
495
571
  },
496
- m
572
+ b
497
573
  );
498
574
  }) })
499
575
  ] });
500
- }, _ = ({
576
+ }, de = ({
501
577
  date: a,
502
- setDate: e,
503
- filter: o,
504
- setViews: l,
505
- dateRange: c,
506
- setDateRange: g,
507
- onChange: h,
508
- minDate: f,
509
- maxDate: u,
510
- input: n
578
+ setDate: n,
579
+ filter: t,
580
+ setViews: s,
581
+ dateRange: l,
582
+ setDateRange: p,
583
+ onChange: d,
584
+ minDate: g,
585
+ maxDate: i,
586
+ input: e
511
587
  }) => {
512
- const M = c.from.getFullYear(), k = a.getFullYear(), x = (y) => {
513
- o ? (b(y), e(y)) : (l("days"), e(y));
514
- }, b = (y) => {
515
- var r;
516
- let s = { ...c };
517
- if (s.from && s.to)
518
- s = { from: y, to: null };
588
+ const w = l.from.getFullYear(), y = a.getFullYear(), k = (f) => {
589
+ t ? (M(f), n(f)) : (s("days"), n(f));
590
+ }, M = (f) => {
591
+ var c;
592
+ let o = { ...l };
593
+ if (o.from && o.to)
594
+ o = { from: f, to: null };
519
595
  else {
520
- const i = ((r = s.from) == null ? void 0 : r.getTime()) || 0;
521
- y.getTime() > i ? s = { from: s.from, to: y } : s = { from: y, to: s.from };
596
+ const h = ((c = o.from) == null ? void 0 : c.getTime()) || 0;
597
+ f.getTime() > h ? o = { from: o.from, to: f } : o = { from: f, to: o.from };
522
598
  }
523
- g(s), h(s);
599
+ p(o), d(o);
524
600
  };
525
- return /* @__PURE__ */ t("div", { className: "sa-calendar-months-preview", children: L.map((y, s) => {
526
- var m, d, p;
527
- const r = new Date(k, s).getTime() > c.from.getTime() && new Date(k, s).getTime() < (((m = c.to) == null ? void 0 : m.getTime()) || c.from.getTime()), i = f && new Date(k, s) < f || u && new Date(k, s) > u;
528
- return /* @__PURE__ */ t(
601
+ return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: z.map((f, o) => {
602
+ var b, u, m;
603
+ const c = new Date(y, o).getTime() > l.from.getTime() && new Date(y, o).getTime() < (((b = l.to) == null ? void 0 : b.getTime()) || l.from.getTime()), h = g && new Date(y, o) < g || i && new Date(y, o) > i;
604
+ return /* @__PURE__ */ r(
529
605
  "p",
530
606
  {
531
- className: M === k && (s === ((d = c.from) == null ? void 0 : d.getMonth()) || s === ((p = c.to) == null ? void 0 : p.getMonth())) ? "sa-calendar-months-active" : "",
607
+ className: w === y && (o === ((u = l.from) == null ? void 0 : u.getMonth()) || o === ((m = l.to) == null ? void 0 : m.getMonth())) ? "sa-calendar-months-active" : "",
532
608
  style: {
533
- backgroundColor: r ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
534
- pointerEvents: i ? "none" : void 0,
535
- cursor: i ? "not-allowed" : "pointer",
536
- color: i ? "var(--sa-color-gray-400, #b7b9be)" : r ? "var(--sa-color-gray-500, #8c8f97)" : "",
537
- ...n ? {} : { width: "100%" }
609
+ backgroundColor: c ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
610
+ pointerEvents: h ? "none" : void 0,
611
+ cursor: h ? "not-allowed" : "pointer",
612
+ color: h ? "var(--sa-color-gray-400, #b7b9be)" : c ? "var(--sa-color-gray-500, #8c8f97)" : "",
613
+ ...e ? {} : { width: "100%" }
538
614
  },
539
615
  onClick: () => {
540
- i || x(new Date(k, s));
616
+ h || k(new Date(y, o));
541
617
  },
542
- children: y.slice(0, 3)
618
+ children: f.slice(0, 3)
543
619
  },
544
- s
620
+ o
545
621
  );
546
622
  }) });
547
- }, j = (a) => {
548
- const e = Math.floor(a / 10) * 10, o = e + 10;
549
- return { start: e, end: o };
550
- }, ee = ({
623
+ }, U = (a) => {
624
+ const n = Math.floor(a / 10) * 10, t = n + 10;
625
+ return { start: n, end: t };
626
+ }, ce = ({
551
627
  date: a,
552
- filter: e,
553
- setViews: o,
554
- setDate: l,
555
- dateRange: c,
556
- setDateRange: g,
557
- onChange: h,
558
- minDate: f,
559
- maxDate: u,
560
- input: n
628
+ filter: n,
629
+ setViews: t,
630
+ setDate: s,
631
+ dateRange: l,
632
+ setDateRange: p,
633
+ onChange: d,
634
+ minDate: g,
635
+ maxDate: i,
636
+ input: e
561
637
  }) => {
562
- var m;
563
- let M = [];
564
- const k = a.getFullYear(), { start: x, end: b } = j(k), y = c.from.getFullYear(), s = (m = c.to) == null ? void 0 : m.getFullYear();
565
- for (let d = x; d < b; d++) {
566
- const p = new Date(d, 0), w = (!f || p >= f) && (!u || p <= u), C = d === y || d === s, T = p > c.from && p < c.to;
567
- M.push({
568
- year: d,
569
- active: C && w,
570
- highlight: T && w,
571
- disabled: !w
638
+ var b;
639
+ let w = [];
640
+ const y = a.getFullYear(), { start: k, end: M } = U(y), f = l.from.getFullYear(), o = (b = l.to) == null ? void 0 : b.getFullYear();
641
+ for (let u = k; u < M; u++) {
642
+ const m = new Date(u, 0), x = (!g || m >= g) && (!i || m <= i), F = u === f || u === o, L = m > l.from && m < l.to;
643
+ w.push({
644
+ year: u,
645
+ active: F && x,
646
+ highlight: L && x,
647
+ disabled: !x
572
648
  });
573
649
  }
574
- const r = (d) => {
575
- e ? (i(d), l(d)) : (l(d), o("months"));
576
- }, i = (d) => {
577
- var w;
578
- let p = { ...c };
579
- if (p.from && p.to)
580
- p = { from: d, to: null };
650
+ const c = (u) => {
651
+ n ? (h(u), s(u)) : (s(u), t("months"));
652
+ }, h = (u) => {
653
+ var x;
654
+ let m = { ...l };
655
+ if (m.from && m.to)
656
+ m = { from: u, to: null };
581
657
  else {
582
- const C = ((w = p.from) == null ? void 0 : w.getTime()) || 0;
583
- d.getTime() > C ? p = { from: p.from, to: d } : p = { from: d, to: p.from };
658
+ const F = ((x = m.from) == null ? void 0 : x.getTime()) || 0;
659
+ u.getTime() > F ? m = { from: m.from, to: u } : m = { from: u, to: m.from };
584
660
  }
585
- g(p), h(p);
661
+ p(m), d(m);
586
662
  };
587
- return /* @__PURE__ */ t("div", { className: "sa-calendar-years-preview", children: M.map((d, p) => /* @__PURE__ */ t(
663
+ return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((u, m) => /* @__PURE__ */ r(
588
664
  "p",
589
665
  {
590
- className: `${d.active ? "sa-calendar-months-active" : ""} ${d.highlight ? "sa-calendar-months-highlight" : ""} ${d.disabled ? "sa-calendar-disabled" : ""}`,
666
+ className: `${u.active ? "sa-calendar-months-active" : ""} ${u.highlight ? "sa-calendar-months-highlight" : ""} ${u.disabled ? "sa-calendar-disabled" : ""}`,
591
667
  onClick: () => {
592
- d.disabled || r(new Date(d.year, 0));
668
+ u.disabled || c(new Date(u.year, 0));
593
669
  },
594
670
  style: {
595
- backgroundColor: d.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
596
- color: d.highlight ? "var(--sa-color-gray-500, #8c8f97)" : d.active ? "" : d.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
597
- cursor: d.disabled ? "not-allowed" : "pointer",
598
- pointerEvents: d.disbled ? "none" : "all",
599
- ...n ? {} : { width: "100%" }
671
+ backgroundColor: u.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
672
+ color: u.highlight ? "var(--sa-color-gray-500, #8c8f97)" : u.active ? "" : u.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
673
+ cursor: u.disabled ? "not-allowed" : "pointer",
674
+ pointerEvents: u.disbled ? "none" : "all",
675
+ ...e ? {} : { width: "100%" }
600
676
  },
601
- children: d.year
677
+ children: u.year
602
678
  },
603
- p
679
+ m
604
680
  )) });
605
- }, U = ({ ...a }) => /* @__PURE__ */ t(
681
+ }, ae = ({ ...a }) => /* @__PURE__ */ r(
606
682
  "svg",
607
683
  {
608
684
  xmlns: "http://www.w3.org/2000/svg",
@@ -611,7 +687,7 @@ const E = (a) => {
611
687
  viewBox: "0 0 20 20",
612
688
  fill: "none",
613
689
  ...a,
614
- children: /* @__PURE__ */ t(
690
+ children: /* @__PURE__ */ r(
615
691
  "path",
616
692
  {
617
693
  d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
@@ -622,7 +698,7 @@ const E = (a) => {
622
698
  }
623
699
  )
624
700
  }
625
- ), G = ({ ...a }) => /* @__PURE__ */ t(
701
+ ), re = ({ ...a }) => /* @__PURE__ */ r(
626
702
  "svg",
627
703
  {
628
704
  xmlns: "http://www.w3.org/2000/svg",
@@ -631,7 +707,7 @@ const E = (a) => {
631
707
  viewBox: "0 0 20 20",
632
708
  fill: "none",
633
709
  ...a,
634
- children: /* @__PURE__ */ t(
710
+ children: /* @__PURE__ */ r(
635
711
  "path",
636
712
  {
637
713
  d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
@@ -642,205 +718,254 @@ const E = (a) => {
642
718
  }
643
719
  )
644
720
  }
645
- ), ne = ({
721
+ ), he = ({
646
722
  setViews: a,
647
- views: e,
648
- filter: o,
649
- date: l,
650
- setDate: c
723
+ views: n,
724
+ filter: t,
725
+ date: s,
726
+ setDate: l
651
727
  }) => {
652
- const g = () => {
653
- o || a((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
654
- }, h = () => {
655
- if (e === "years") {
656
- c((n) => new Date(n.getFullYear() + 10, 0));
728
+ const p = () => {
729
+ t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
730
+ }, d = () => {
731
+ if (n === "years") {
732
+ l((e) => new Date(e.getFullYear() + 10, 0));
657
733
  return;
658
734
  }
659
- if (e === "months") {
660
- c((n) => new Date(n.getFullYear() + 1, n.getMonth()));
735
+ if (n === "months") {
736
+ l((e) => new Date(e.getFullYear() + 1, e.getMonth()));
661
737
  return;
662
738
  }
663
- c((n) => new Date(n.getFullYear(), n.getMonth() + 1));
664
- }, f = () => {
665
- if (e === "years") {
666
- c((n) => new Date(n.getFullYear() - 10, 0));
739
+ l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
740
+ }, g = () => {
741
+ if (n === "years") {
742
+ l((e) => new Date(e.getFullYear() - 10, 0));
667
743
  return;
668
744
  }
669
- if (e === "months") {
670
- c((n) => new Date(n.getFullYear() - 1, n.getMonth()));
745
+ if (n === "months") {
746
+ l((e) => new Date(e.getFullYear() - 1, e.getMonth()));
671
747
  return;
672
748
  }
673
- c(
674
- (n) => new Date(
675
- n.getMonth() === 0 ? n.getFullYear() - 1 : n.getFullYear(),
676
- n.getMonth() === 0 ? 11 : n.getMonth() - 1
749
+ l(
750
+ (e) => new Date(
751
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
752
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
677
753
  )
678
754
  );
679
755
  };
680
- return /* @__PURE__ */ F("div", { className: "sa-calendar-header", children: [
681
- /* @__PURE__ */ t(U, { onClick: () => f() }),
682
- /* @__PURE__ */ t("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
683
- if (e === "days")
684
- return `${L[l.getMonth()]} ${l.getFullYear()}`;
685
- if (e === "months")
686
- return `${l.getFullYear()}`;
687
- if (e === "years")
688
- return `${j(l.getFullYear()).start} ~ ${j(l.getFullYear()).end}`;
756
+ 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 `${z[s.getMonth()]} ${s.getFullYear()}`;
761
+ if (n === "months")
762
+ return `${s.getFullYear()}`;
763
+ if (n === "years")
764
+ return `${U(s.getFullYear()).start} ~ ${U(s.getFullYear()).end}`;
689
765
  })() }),
690
- /* @__PURE__ */ t(G, { onClick: () => h() })
766
+ /* @__PURE__ */ r(re, { onClick: () => d() })
691
767
  ] });
692
768
  };
693
- function S(a) {
694
- const e = new Date(a), o = e.getFullYear(), l = e.getMonth();
695
- return `${e.getDate().toString().padStart(2, "0")} ${K[l]} ${o}`;
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}`;
696
772
  }
697
- const H = "sa-calendar-styles", ae = (a) => {
698
- if (!document.getElementById(H)) {
699
- const e = document.createElement("style");
700
- e.id = H, e.textContent = a, document.head.appendChild(e);
773
+ const te = ({
774
+ label: a,
775
+ labelPosition: n = "outside-top",
776
+ required: t,
777
+ optional: s,
778
+ description: l,
779
+ helperText: p,
780
+ errorText: d,
781
+ fullWidth: g,
782
+ children: i
783
+ }) => {
784
+ const e = [
785
+ "sa-date-field",
786
+ 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, y = /* @__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 })
794
+ ] });
795
+ return a ? n === "outside-left" ? /* @__PURE__ */ N("div", { className: `${e} sa-date-field-left`, children: [
796
+ /* @__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 })
799
+ ] }),
800
+ /* @__PURE__ */ N("div", { className: "sa-date-field-input-wrap", children: [
801
+ i,
802
+ y
803
+ ] })
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
+ y
809
+ ] }) : /* @__PURE__ */ N("div", { className: e, children: [
810
+ l && /* @__PURE__ */ r("p", { className: "sa-date-field-helper-top", children: l }),
811
+ i,
812
+ y
813
+ ] });
814
+ }, Q = "sa-calendar-styles", ue = (a) => {
815
+ if (!document.getElementById(Q)) {
816
+ const n = document.createElement("style");
817
+ n.id = Q, n.textContent = a, document.head.appendChild(n);
701
818
  }
702
819
  };
703
- ae(V);
704
- const re = W(
820
+ ue(P);
821
+ const pe = G(
705
822
  ({
706
823
  value: a,
707
- onChange: e,
708
- filter: o,
709
- input: l = !0,
710
- disabled: c,
711
- minDate: g,
712
- maxDate: h,
713
- placeholder: f,
714
- size: u,
715
- status: n,
716
- clearable: M,
717
- fullWidth: k = !1
718
- }, x) => {
719
- const { ref: b, isComponentVisible: y, setIsComponentVisible: s } = R(!1), r = B(null), [i, m] = N("days"), [d, p] = N(/* @__PURE__ */ new Date()), [w, C] = N({
824
+ onChange: n,
825
+ filter: t,
826
+ input: s = !0,
827
+ disabled: l,
828
+ minDate: p,
829
+ maxDate: d,
830
+ placeholder: g,
831
+ size: i,
832
+ status: e,
833
+ clearable: w,
834
+ fullWidth: y = !0,
835
+ label: k,
836
+ labelPosition: M,
837
+ required: f,
838
+ optional: o,
839
+ description: c,
840
+ helperText: h,
841
+ errorText: b
842
+ }, u) => {
843
+ const m = b ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = j("days"), [Y, E] = j(/* @__PURE__ */ new Date()), [D, I] = j({
720
844
  from: (a == null ? void 0 : a.from) || /* @__PURE__ */ new Date(),
721
845
  to: (a == null ? void 0 : a.to) || /* @__PURE__ */ new Date()
722
846
  });
723
- D(() => {
724
- a ? (p(a.from), C(a)) : (p(/* @__PURE__ */ new Date()), C({
847
+ $(() => {
848
+ a ? (E(a.from), I(a)) : (E(/* @__PURE__ */ new Date()), I({
725
849
  from: /* @__PURE__ */ new Date(),
726
850
  to: /* @__PURE__ */ new Date()
727
851
  }));
728
- }, [a]), D(() => {
729
- o && m(o);
730
- }, [o]), D(() => {
731
- o || m("days");
732
- }, [y]), D(() => {
733
- l || s(!0);
734
- }, [l]);
735
- const T = () => {
736
- var v, $;
852
+ }, [a]), $(() => {
853
+ t && S(t);
854
+ }, [t]), $(() => {
855
+ t || S("days");
856
+ }, [F]), $(() => {
857
+ s || L(!0);
858
+ }, [s]);
859
+ const J = () => {
860
+ var v, T;
737
861
  if (!a)
738
862
  return "";
739
- if (o) {
740
- if (i === "days")
741
- return `${S(w.from)} ~ ${S(w.to || w.from) || "-"}`;
742
- if (i === "months")
743
- return `${L[w.from.getMonth()]} ~ ${w.to ? L[w.to.getMonth()] : "-"}`;
744
- if (i === "years")
745
- return `${(v = w.from) == null ? void 0 : v.getFullYear()} ~ ${(($ = w.to) == null ? void 0 : $.getFullYear()) || "-"}`;
863
+ if (t) {
864
+ if (V === "days")
865
+ return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
866
+ if (V === "months")
867
+ return `${z[D.from.getMonth()]} ~ ${D.to ? z[D.to.getMonth()] : "-"}`;
868
+ if (V === "years")
869
+ return `${(v = D.from) == null ? void 0 : v.getFullYear()} ~ ${((T = D.to) == null ? void 0 : T.getFullYear()) || "-"}`;
746
870
  } else
747
- return `${S(w.from)} ~ ${S(w.to || w.from) || "-"}`;
748
- }, Y = () => {
749
- if (r.current && b.current && l) {
750
- const v = b.current.getBoundingClientRect(), $ = r.current.getBoundingClientRect();
751
- window.innerWidth < v.left + $.width ? r.current.style.left = `${v.left - $.width + v.width}px` : r.current.style.left = `${v.left}px`, v.top + $.height > window.innerHeight ? r.current.style.top = `${v.y - (v.height + $.height - 28)}px` : r.current.style.top = `${v.y + v.height}px`;
871
+ return `${H(D.from)} ~ ${H(D.to || D.from) || "-"}`;
872
+ }, B = () => {
873
+ if (C.current && x.current && s) {
874
+ const v = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
875
+ window.innerWidth < v.left + T.width ? C.current.style.left = `${v.left - T.width + v.width}px` : C.current.style.left = `${v.left}px`, v.top + T.height > window.innerHeight ? C.current.style.top = `${v.y - (v.height + T.height - 28)}px` : C.current.style.top = `${v.y + v.height}px`;
752
876
  }
753
877
  };
754
- return D(() => {
755
- r.current && b.current && l && Y();
756
- }, [r, b, y]), D(() => {
757
- const v = x == null ? void 0 : x.current;
758
- return v && v.addEventListener("scroll", Y), window.addEventListener("scroll", Y), () => {
759
- v && v.removeEventListener("scroll", Y), window.removeEventListener("scroll", Y);
878
+ $(() => {
879
+ C.current && x.current && s && B();
880
+ }, [C, x, F]), $(() => {
881
+ const v = u == null ? void 0 : u.current;
882
+ return v && v.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
883
+ v && v.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
760
884
  };
761
- }, []), /* @__PURE__ */ F(
885
+ }, []);
886
+ const R = /* @__PURE__ */ N(
762
887
  "div",
763
888
  {
764
- className: `sa-calendar-wrapper${k ? " sa-calendar-wrapper-fullwidth" : ""}`,
765
- style: { height: l ? "auto" : "100%" },
766
- ref: l ? b : null,
889
+ className: "sa-calendar-wrapper",
890
+ style: { height: s ? "auto" : "100%" },
891
+ ref: s ? x : null,
767
892
  children: [
768
- l ? /* @__PURE__ */ t(
769
- X,
893
+ s ? /* @__PURE__ */ r(
894
+ le,
770
895
  {
771
- value: T(),
896
+ value: J(),
772
897
  inputMode: "none",
773
898
  onClick: () => {
774
- s(!0);
899
+ L(!0);
775
900
  },
776
901
  onChange: () => {
777
902
  },
778
- disabled: c,
779
- placeholder: f,
780
- size: u,
781
- status: n,
782
- clearable: M,
783
- onClear: () => e(void 0)
903
+ disabled: l,
904
+ placeholder: g,
905
+ size: i,
906
+ status: m,
907
+ clearable: w,
908
+ onClear: () => n(void 0)
784
909
  }
785
910
  ) : null,
786
- y ? /* @__PURE__ */ F(
911
+ F ? /* @__PURE__ */ N(
787
912
  "div",
788
913
  {
789
- className: `sa-calendar ${l ? "" : "sa-calendar-no-input"}`,
790
- ref: r,
914
+ className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
915
+ ref: C,
791
916
  children: [
792
- /* @__PURE__ */ t(
793
- ne,
917
+ /* @__PURE__ */ r(
918
+ he,
794
919
  {
795
- setViews: m,
796
- views: i,
797
- filter: o,
798
- date: d,
799
- setDate: p
920
+ setViews: S,
921
+ views: V,
922
+ filter: t,
923
+ date: Y,
924
+ setDate: E
800
925
  }
801
926
  ),
802
- /* @__PURE__ */ t("div", { className: "sa-calendar-body", children: i === "days" ? /* @__PURE__ */ t(
803
- Z,
927
+ /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
928
+ ie,
804
929
  {
805
- date: d,
806
- setDate: p,
807
- setIsComponentVisible: s,
808
- dateRange: w,
809
- setDateRange: C,
810
- input: l,
811
- onChange: e,
812
- minDate: g,
813
- maxDate: h
930
+ date: Y,
931
+ setDate: E,
932
+ setIsComponentVisible: L,
933
+ dateRange: D,
934
+ setDateRange: I,
935
+ input: s,
936
+ onChange: n,
937
+ minDate: p,
938
+ maxDate: d
814
939
  }
815
- ) : i === "months" ? /* @__PURE__ */ t(
816
- _,
940
+ ) : V === "months" ? /* @__PURE__ */ r(
941
+ de,
817
942
  {
818
- date: d,
819
- setDate: p,
820
- filter: o,
821
- setViews: m,
822
- dateRange: w,
823
- setDateRange: C,
824
- setIsComponentVisible: s,
825
- input: l,
826
- onChange: e,
827
- minDate: g,
828
- maxDate: h
943
+ date: Y,
944
+ setDate: E,
945
+ filter: t,
946
+ setViews: S,
947
+ dateRange: D,
948
+ setDateRange: I,
949
+ setIsComponentVisible: L,
950
+ input: s,
951
+ onChange: n,
952
+ minDate: p,
953
+ maxDate: d
829
954
  }
830
- ) : /* @__PURE__ */ t(
831
- ee,
955
+ ) : /* @__PURE__ */ r(
956
+ ce,
832
957
  {
833
- date: d,
834
- setDate: p,
835
- filter: o,
836
- setViews: m,
837
- dateRange: w,
838
- setDateRange: C,
839
- setIsComponentVisible: s,
840
- input: l,
841
- onChange: e,
842
- minDate: g,
843
- maxDate: h
958
+ date: Y,
959
+ setDate: E,
960
+ filter: t,
961
+ setViews: S,
962
+ dateRange: D,
963
+ setDateRange: I,
964
+ setIsComponentVisible: L,
965
+ input: s,
966
+ onChange: n,
967
+ minDate: p,
968
+ maxDate: d
844
969
  }
845
970
  ) })
846
971
  ]
@@ -849,49 +974,63 @@ const re = W(
849
974
  ]
850
975
  }
851
976
  );
977
+ return /* @__PURE__ */ r(
978
+ te,
979
+ {
980
+ label: k,
981
+ labelPosition: M,
982
+ required: f,
983
+ optional: o,
984
+ description: c,
985
+ helperText: h,
986
+ errorText: b,
987
+ fullWidth: y,
988
+ children: R
989
+ }
990
+ );
852
991
  }
853
- ), A = "sa-calendar-input-styles", te = (a) => {
854
- if (!document.getElementById(A)) {
855
- const e = document.createElement("style");
856
- e.id = A, e.textContent = a, document.head.appendChild(e);
992
+ ), X = "sa-calendar-input-styles", ge = (a) => {
993
+ if (!document.getElementById(X)) {
994
+ const n = document.createElement("style");
995
+ n.id = X, n.textContent = a, document.head.appendChild(n);
857
996
  }
858
997
  };
859
- te(V);
860
- const I = (a) => {
998
+ ge(P);
999
+ const O = (a) => {
861
1000
  if (a === "sm")
862
1001
  return 16;
863
1002
  if (a === "md")
864
1003
  return 16;
865
1004
  if (a === "lg")
866
1005
  return 20;
867
- }, se = (a) => {
1006
+ }, fe = (a) => {
868
1007
  const {
869
- size: e = "md",
870
- status: o = "default",
871
- variant: l = "outline",
872
- clearable: c,
873
- onClear: g,
874
- ...h
875
- } = a, f = B(null), u = () => {
876
- f.current && h.onClick && (f.current.focus(), h.onClick(""));
877
- }, n = o === "disable" || h.disabled, M = !!h.value, k = c && M && !n, x = (b) => {
878
- b.stopPropagation(), g == null || g();
1008
+ size: n = "md",
1009
+ status: t = "default",
1010
+ variant: s = "outline",
1011
+ clearable: l,
1012
+ onClear: p,
1013
+ ...d
1014
+ } = a, g = A(null), i = () => {
1015
+ g.current && d.onClick && (g.current.focus(), d.onClick(""));
1016
+ }, e = t === "disable" || d.disabled, w = !!d.value, y = l && w && !e, k = (M) => {
1017
+ M.stopPropagation(), p == null || p();
879
1018
  };
880
- return /* @__PURE__ */ F(
1019
+ return /* @__PURE__ */ N(
881
1020
  "div",
882
1021
  {
883
- className: `sa-calendar-input-container sa-calendar-input-${l} sa-calendar-input-container-${o} ${e} `,
884
- onClick: u,
1022
+ className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${n} `,
1023
+ onClick: i,
885
1024
  children: [
886
- /* @__PURE__ */ t("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ t(
1025
+ /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ r(
887
1026
  "svg",
888
1027
  {
889
1028
  xmlns: "http://www.w3.org/2000/svg",
890
- width: I(e),
891
- height: I(e),
1029
+ width: O(n),
1030
+ height: O(n),
892
1031
  viewBox: "0 0 20 20",
893
1032
  fill: "none",
894
- children: /* @__PURE__ */ t(
1033
+ children: /* @__PURE__ */ r(
895
1034
  "path",
896
1035
  {
897
1036
  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",
@@ -903,32 +1042,32 @@ const I = (a) => {
903
1042
  )
904
1043
  }
905
1044
  ) }),
906
- /* @__PURE__ */ t("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ t(
1045
+ /* @__PURE__ */ r("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ r(
907
1046
  "input",
908
1047
  {
909
1048
  className: "sa-calendar-input",
910
- ...h,
911
- disabled: n,
912
- value: h.value,
913
- ref: f
1049
+ ...d,
1050
+ disabled: e,
1051
+ value: d.value,
1052
+ ref: g
914
1053
  }
915
1054
  ) }),
916
- k ? /* @__PURE__ */ t(
1055
+ y ? /* @__PURE__ */ r(
917
1056
  "button",
918
1057
  {
919
1058
  type: "button",
920
1059
  "aria-label": "Clear date",
921
1060
  className: "sa-calendar-input-clear",
922
- onClick: x,
923
- children: /* @__PURE__ */ t(
1061
+ onClick: k,
1062
+ children: /* @__PURE__ */ r(
924
1063
  "svg",
925
1064
  {
926
1065
  xmlns: "http://www.w3.org/2000/svg",
927
- width: I(e),
928
- height: I(e),
1066
+ width: O(n),
1067
+ height: O(n),
929
1068
  viewBox: "0 0 20 20",
930
1069
  fill: "none",
931
- children: /* @__PURE__ */ t(
1070
+ children: /* @__PURE__ */ r(
932
1071
  "path",
933
1072
  {
934
1073
  d: "M5 5L15 15M15 5L5 15",
@@ -941,15 +1080,15 @@ const I = (a) => {
941
1080
  }
942
1081
  )
943
1082
  }
944
- ) : /* @__PURE__ */ t("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ t(
1083
+ ) : /* @__PURE__ */ r("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ r(
945
1084
  "svg",
946
1085
  {
947
1086
  xmlns: "http://www.w3.org/2000/svg",
948
- width: I(e),
949
- height: I(e),
1087
+ width: O(n),
1088
+ height: O(n),
950
1089
  viewBox: "0 0 20 20",
951
1090
  fill: "none",
952
- children: /* @__PURE__ */ t(
1091
+ children: /* @__PURE__ */ r(
953
1092
  "path",
954
1093
  {
955
1094
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -964,316 +1103,324 @@ const I = (a) => {
964
1103
  ]
965
1104
  }
966
1105
  );
967
- }, oe = ({
1106
+ }, me = ({
968
1107
  date: a,
969
- setDate: e,
970
- previewDate: o,
971
- setPreviewDate: l,
972
- setIsComponentVisible: c,
973
- minDate: g,
974
- maxDate: h,
975
- input: f,
976
- onChange: u
1108
+ setDate: n,
1109
+ previewDate: t,
1110
+ setPreviewDate: s,
1111
+ setIsComponentVisible: l,
1112
+ minDate: p,
1113
+ maxDate: d,
1114
+ input: g,
1115
+ onChange: i
977
1116
  }) => {
978
- let n = new Date(
979
- o.getFullYear(),
980
- o.getMonth(),
1117
+ let e = new Date(
1118
+ t.getFullYear(),
1119
+ t.getMonth(),
981
1120
  1
982
- ), M = n.getDay(), k = [];
983
- const x = a.toDateString(), b = o.getMonth();
984
- for (let s = 0; s < 42; s++) {
985
- s === 0 && M === 0 ? n.setDate(n.getDate() - 7) : s === 0 ? n.setDate(
986
- n.getDate() + (s - M)
987
- ) : n.setDate(n.getDate() + 1);
988
- let r = {
989
- currentMonth: n.getMonth() === b,
990
- date: new Date(n),
991
- month: n.getMonth(),
992
- number: n.getDate(),
993
- selected: n.toDateString() === x,
994
- year: n.getFullYear(),
995
- isDisabled: g && n < g || h && n > h
1121
+ ), w = e.getDay(), y = [];
1122
+ const k = a.toDateString(), M = t.getMonth();
1123
+ 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
996
1135
  };
997
- k.push(r);
1136
+ y.push(c);
998
1137
  }
999
- const y = (s) => {
1000
- (!g || s >= g) && (!h || s <= h) && (e(s), u(s), l(s), f && c(!1));
1138
+ const f = (o) => {
1139
+ (!p || o >= p) && (!d || o <= d) && (n(o), i(o), s(o), g && l(!1));
1001
1140
  };
1002
- return /* @__PURE__ */ F("div", { className: "sa-calendar-days-preivew", children: [
1003
- /* @__PURE__ */ t("div", { className: "sa-calendar-days-name-preivew", children: P.map((s, r) => /* @__PURE__ */ t("p", { children: s }, r)) }),
1004
- /* @__PURE__ */ t("div", { className: "sa-calendar-days-number-preivew", children: k.map((s, r) => {
1005
- const i = s.isDisabled;
1006
- return /* @__PURE__ */ t(
1141
+ 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: y.map((o, c) => {
1144
+ const h = o.isDisabled;
1145
+ return /* @__PURE__ */ r(
1007
1146
  "p",
1008
1147
  {
1009
- className: `${s.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${s.selected ? "sa-calendar-days-active" : ""}`,
1148
+ className: `${o.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${o.selected ? "sa-calendar-days-active" : ""}`,
1010
1149
  style: {
1011
- color: i ? "#ccc" : void 0,
1012
- pointerEvents: i ? "none" : void 0,
1013
- cursor: i ? "not-allowed" : "pointer",
1014
- ...f ? {} : { width: "100%" }
1150
+ color: h ? "#ccc" : void 0,
1151
+ pointerEvents: h ? "none" : void 0,
1152
+ cursor: h ? "not-allowed" : "pointer",
1153
+ ...g ? {} : { width: "100%" }
1015
1154
  },
1016
1155
  onClick: () => {
1017
- i || y(s.date);
1156
+ h || f(o.date);
1018
1157
  },
1019
- children: s.number
1158
+ children: o.number
1020
1159
  },
1021
- r
1160
+ c
1022
1161
  );
1023
1162
  }) })
1024
1163
  ] });
1025
- }, le = ({
1164
+ }, ve = ({
1026
1165
  date: a,
1027
- setDate: e,
1028
- filter: o,
1029
- setViews: l,
1030
- onChange: c,
1031
- previewDate: g,
1032
- setPreviewDate: h,
1033
- minDate: f,
1034
- maxDate: u,
1035
- input: n
1166
+ setDate: n,
1167
+ filter: t,
1168
+ setViews: s,
1169
+ onChange: l,
1170
+ previewDate: p,
1171
+ setPreviewDate: d,
1172
+ minDate: g,
1173
+ maxDate: i,
1174
+ input: e
1036
1175
  }) => {
1037
- const M = a.getMonth(), k = a.getFullYear(), x = g.getFullYear(), b = (y) => {
1038
- (!f || y >= f) && (!u || y <= u) && (o ? (c(y), e(y), h(y)) : (l("days"), h(y)));
1176
+ const w = a.getMonth(), y = 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)));
1039
1178
  };
1040
- return /* @__PURE__ */ t("div", { className: "sa-calendar-months-preview", children: L.map((y, s) => {
1041
- const r = f && new Date(x, s, 1) < f || u && new Date(x, s + 1, 0) > u;
1042
- return /* @__PURE__ */ t(
1179
+ return /* @__PURE__ */ r("div", { className: "sa-calendar-months-preview", children: z.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(
1043
1182
  "p",
1044
1183
  {
1045
- className: s === M && x === k ? "sa-calendar-months-active" : "",
1184
+ className: o === w && k === y ? "sa-calendar-months-active" : "",
1046
1185
  style: {
1047
- color: r ? "#ccc" : void 0,
1048
- pointerEvents: r ? "none" : void 0,
1049
- cursor: r ? "not-allowed" : "pointer",
1050
- ...n ? {} : { width: "100%" }
1186
+ color: c ? "#ccc" : void 0,
1187
+ pointerEvents: c ? "none" : void 0,
1188
+ cursor: c ? "not-allowed" : "pointer",
1189
+ ...e ? {} : { width: "100%" }
1051
1190
  },
1052
1191
  onClick: () => {
1053
- r || b(new Date(x, s));
1192
+ c || M(new Date(k, o));
1054
1193
  },
1055
- children: y.slice(0, 3)
1194
+ children: f.slice(0, 3)
1056
1195
  },
1057
- s
1196
+ o
1058
1197
  );
1059
1198
  }) });
1060
- }, z = (a) => {
1061
- const e = Math.floor(a / 10) * 10, o = e + 10;
1062
- return { start: e, end: o };
1063
- }, ie = ({
1199
+ }, q = (a) => {
1200
+ const n = Math.floor(a / 10) * 10, t = n + 10;
1201
+ return { start: n, end: t };
1202
+ }, ye = ({
1064
1203
  date: a,
1065
- filter: e,
1066
- setViews: o,
1067
- setDate: l,
1068
- onChange: c,
1069
- previewDate: g,
1070
- setPreviewDate: h,
1071
- minDate: f,
1072
- maxDate: u,
1073
- input: n
1204
+ filter: n,
1205
+ setViews: t,
1206
+ setDate: s,
1207
+ onChange: l,
1208
+ previewDate: p,
1209
+ setPreviewDate: d,
1210
+ minDate: g,
1211
+ maxDate: i,
1212
+ input: e
1074
1213
  }) => {
1075
- let M = [];
1076
- const k = g.getFullYear(), { start: x, end: b } = z(k), y = a.getFullYear();
1077
- for (let r = x; r < b; r++) {
1078
- let i = f && new Date(r, 0, 1) < f || u && new Date(r, 11, 31) > u;
1079
- M.push({ year: r, active: r === y, isDisabled: i });
1214
+ let w = [];
1215
+ const y = p.getFullYear(), { start: k, end: M } = q(y), f = a.getFullYear();
1216
+ for (let c = k; c < M; c++) {
1217
+ let h = g && new Date(c, 0, 1) < g || i && new Date(c, 11, 31) > i;
1218
+ w.push({ year: c, active: c === f, isDisabled: h });
1080
1219
  }
1081
- const s = (r) => {
1082
- (!f || r >= f) && (!u || r <= u) && (e ? (c(r), l(r), h(r)) : (o("months"), h(r)));
1220
+ const o = (c) => {
1221
+ (!g || c >= g) && (!i || c <= i) && (n ? (l(c), s(c), d(c)) : (t("months"), d(c)));
1083
1222
  };
1084
- return /* @__PURE__ */ t("div", { className: "sa-calendar-years-preview", children: M.map((r, i) => /* @__PURE__ */ t(
1223
+ return /* @__PURE__ */ r("div", { className: "sa-calendar-years-preview", children: w.map((c, h) => /* @__PURE__ */ r(
1085
1224
  "p",
1086
1225
  {
1087
- className: r.active ? "sa-calendar-months-active" : "",
1226
+ className: c.active ? "sa-calendar-months-active" : "",
1088
1227
  style: {
1089
- color: r.isDisabled ? "#ccc" : void 0,
1090
- pointerEvents: r.isDisabled ? "none" : void 0,
1091
- cursor: r.isDisabled ? "not-allowed" : "pointer",
1092
- ...n ? {} : { width: "100%" }
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%" }
1093
1232
  },
1094
1233
  onClick: () => {
1095
- r.isDisabled || s(new Date(r.year, 0));
1234
+ c.isDisabled || o(new Date(c.year, 0));
1096
1235
  },
1097
- children: r.year
1236
+ children: c.year
1098
1237
  },
1099
- i
1238
+ h
1100
1239
  )) });
1101
- }, de = ({
1240
+ }, be = ({
1102
1241
  setViews: a,
1103
- views: e,
1104
- filter: o,
1105
- previewDate: l,
1106
- setPreviewDate: c
1242
+ views: n,
1243
+ filter: t,
1244
+ previewDate: s,
1245
+ setPreviewDate: l
1107
1246
  }) => {
1108
- const g = () => {
1109
- o || a((n) => n === "days" ? "months" : n === "months" ? "years" : "days");
1110
- }, h = () => {
1111
- if (e === "years") {
1112
- c((n) => new Date(n.getFullYear() + 10, 0));
1247
+ const p = () => {
1248
+ t || a((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
1249
+ }, d = () => {
1250
+ if (n === "years") {
1251
+ l((e) => new Date(e.getFullYear() + 10, 0));
1113
1252
  return;
1114
1253
  }
1115
- if (e === "months") {
1116
- c(
1117
- (n) => new Date(n.getFullYear() + 1, n.getMonth())
1254
+ if (n === "months") {
1255
+ l(
1256
+ (e) => new Date(e.getFullYear() + 1, e.getMonth())
1118
1257
  );
1119
1258
  return;
1120
1259
  }
1121
- c((n) => new Date(n.getFullYear(), n.getMonth() + 1));
1122
- }, f = () => {
1123
- if (e === "years") {
1124
- c((n) => new Date(n.getFullYear() - 10, 0));
1260
+ l((e) => new Date(e.getFullYear(), e.getMonth() + 1));
1261
+ }, g = () => {
1262
+ if (n === "years") {
1263
+ l((e) => new Date(e.getFullYear() - 10, 0));
1125
1264
  return;
1126
1265
  }
1127
- if (e === "months") {
1128
- c(
1129
- (n) => new Date(n.getFullYear() - 1, n.getMonth())
1266
+ if (n === "months") {
1267
+ l(
1268
+ (e) => new Date(e.getFullYear() - 1, e.getMonth())
1130
1269
  );
1131
1270
  return;
1132
1271
  }
1133
- c(
1134
- (n) => new Date(
1135
- n.getMonth() === 0 ? n.getFullYear() - 1 : n.getFullYear(),
1136
- n.getMonth() === 0 ? 11 : n.getMonth() - 1
1272
+ l(
1273
+ (e) => new Date(
1274
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
1275
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
1137
1276
  )
1138
1277
  );
1139
1278
  };
1140
- return /* @__PURE__ */ F("div", { className: "sa-calendar-header", children: [
1141
- /* @__PURE__ */ t(U, { onClick: () => f() }),
1142
- /* @__PURE__ */ t("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
1143
- if (e === "days")
1144
- return `${L[l.getMonth()]} ${l.getFullYear()}`;
1145
- if (e === "months")
1146
- return `${l.getFullYear()}`;
1147
- if (e === "years")
1148
- return `${z(l.getFullYear()).start} ~ ${z(l.getFullYear()).end}`;
1279
+ 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 `${z[s.getMonth()]} ${s.getFullYear()}`;
1284
+ if (n === "months")
1285
+ return `${s.getFullYear()}`;
1286
+ if (n === "years")
1287
+ return `${q(s.getFullYear()).start} ~ ${q(s.getFullYear()).end}`;
1149
1288
  })() }),
1150
- /* @__PURE__ */ t(G, { onClick: () => h() })
1289
+ /* @__PURE__ */ r(re, { onClick: () => d() })
1151
1290
  ] });
1152
- }, J = "sa-calendar-styles", ce = (a) => {
1153
- if (!document.getElementById(J)) {
1154
- const e = document.createElement("style");
1155
- e.id = J, e.textContent = a, document.head.appendChild(e);
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);
1156
1295
  }
1157
1296
  };
1158
- ce(V);
1159
- const ue = W(
1297
+ we(P);
1298
+ const xe = G(
1160
1299
  ({
1161
1300
  value: a,
1162
- onChange: e,
1163
- filter: o,
1164
- input: l = !0,
1165
- disabled: c,
1166
- minDate: g,
1167
- maxDate: h,
1168
- placeholder: f,
1169
- size: u,
1170
- status: n,
1171
- clearable: M,
1172
- fullWidth: k = !1
1173
- }, x) => {
1174
- const { ref: b, isComponentVisible: y, setIsComponentVisible: s } = R(!1), r = B(null), [i, m] = N("days"), [d, p] = N(/* @__PURE__ */ new Date()), [w, C] = N(/* @__PURE__ */ new Date());
1175
- D(() => {
1176
- a ? (p(a), C(a)) : (p(/* @__PURE__ */ new Date()), C(/* @__PURE__ */ new Date()));
1177
- }, [a]), D(() => {
1178
- o && m(o);
1179
- }, [o]), D(() => {
1180
- o || m("days");
1181
- }, [y]), D(() => {
1182
- l || s(!0);
1183
- }, [l]);
1184
- const T = () => a ? o === "days" ? S(d) : o === "months" ? `${L[d.getMonth()]} ${d.getFullYear()}` : o === "years" ? d.getFullYear() : S(d) : "", Y = () => {
1185
- if (r.current && b.current && l) {
1186
- const v = b.current.getBoundingClientRect(), $ = r.current.getBoundingClientRect();
1187
- window.innerWidth < v.left + $.width ? r.current.style.left = `${v.left - $.width + v.width}px` : r.current.style.left = `${v.left}px`, v.top + $.height > window.innerHeight ? r.current.style.top = `${v.y - (v.height + $.height - 28)}px` : r.current.style.top = `${v.y + v.height}px`;
1301
+ onChange: n,
1302
+ filter: t,
1303
+ input: s = !0,
1304
+ disabled: l,
1305
+ minDate: p,
1306
+ maxDate: d,
1307
+ placeholder: g,
1308
+ size: i,
1309
+ status: e,
1310
+ clearable: w,
1311
+ fullWidth: y = !0,
1312
+ label: k,
1313
+ labelPosition: M,
1314
+ required: f,
1315
+ optional: o,
1316
+ description: c,
1317
+ helperText: h,
1318
+ errorText: b
1319
+ }, u) => {
1320
+ const m = b ? "error" : e, { ref: x, isComponentVisible: F, setIsComponentVisible: L } = ne(!1), C = A(null), [V, S] = j("days"), [Y, E] = j(/* @__PURE__ */ new Date()), [D, I] = j(/* @__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);
1329
+ }, [s]);
1330
+ const J = () => a ? t === "days" ? H(Y) : t === "months" ? `${z[Y.getMonth()]} ${Y.getFullYear()}` : t === "years" ? Y.getFullYear() : H(Y) : "", B = () => {
1331
+ if (C.current && x.current && s) {
1332
+ const v = x.current.getBoundingClientRect(), T = C.current.getBoundingClientRect();
1333
+ window.innerWidth < v.left + T.width ? C.current.style.left = `${v.left - T.width + v.width}px` : C.current.style.left = `${v.left}px`, v.top + T.height > window.innerHeight ? C.current.style.top = `${v.y - (v.height + T.height - 28)}px` : C.current.style.top = `${v.y + v.height}px`;
1188
1334
  }
1189
1335
  };
1190
- return D(() => {
1191
- r.current && b.current && l && Y();
1192
- }, [r, b, y]), D(() => {
1193
- const v = x == null ? void 0 : x.current;
1194
- return v && v.addEventListener("scroll", Y), window.addEventListener("scroll", Y), () => {
1195
- v && v.removeEventListener("scroll", Y), window.removeEventListener("scroll", Y);
1336
+ $(() => {
1337
+ C.current && x.current && s && B();
1338
+ }, [C, x, F]), $(() => {
1339
+ const v = u == null ? void 0 : u.current;
1340
+ return v && v.addEventListener("scroll", B), window.addEventListener("scroll", B), () => {
1341
+ v && v.removeEventListener("scroll", B), window.removeEventListener("scroll", B);
1196
1342
  };
1197
- }, []), /* @__PURE__ */ F(
1343
+ }, []);
1344
+ const R = /* @__PURE__ */ N(
1198
1345
  "div",
1199
1346
  {
1200
- className: `sa-calendar-wrapper${k ? " sa-calendar-wrapper-fullwidth" : ""}`,
1201
- style: { height: l ? "auto" : "100%" },
1202
- ref: l ? b : null,
1347
+ className: "sa-calendar-wrapper",
1348
+ style: { height: s ? "auto" : "100%" },
1349
+ ref: s ? x : null,
1203
1350
  children: [
1204
- l ? /* @__PURE__ */ t(
1205
- se,
1351
+ s ? /* @__PURE__ */ r(
1352
+ fe,
1206
1353
  {
1207
- value: T(),
1208
- onClick: () => s(!0),
1354
+ value: J(),
1355
+ onClick: () => L(!0),
1209
1356
  onChange: () => {
1210
1357
  },
1211
- placeholder: f,
1212
- disabled: c,
1213
- size: u,
1214
- status: n,
1358
+ placeholder: g,
1359
+ disabled: l,
1360
+ size: i,
1361
+ status: m,
1215
1362
  inputMode: "none",
1216
- clearable: M,
1217
- onClear: () => e(void 0)
1363
+ clearable: w,
1364
+ onClear: () => n(void 0)
1218
1365
  }
1219
1366
  ) : null,
1220
- y ? /* @__PURE__ */ F(
1367
+ F ? /* @__PURE__ */ N(
1221
1368
  "div",
1222
1369
  {
1223
- className: `sa-calendar ${l ? "" : "sa-calendar-no-input"}`,
1224
- ref: r,
1370
+ className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
1371
+ ref: C,
1225
1372
  children: [
1226
- /* @__PURE__ */ t(
1227
- de,
1373
+ /* @__PURE__ */ r(
1374
+ be,
1228
1375
  {
1229
- setViews: m,
1230
- views: i,
1231
- filter: o,
1232
- previewDate: w,
1233
- setPreviewDate: C,
1234
- isComponentVisible: y
1376
+ setViews: S,
1377
+ views: V,
1378
+ filter: t,
1379
+ previewDate: D,
1380
+ setPreviewDate: I,
1381
+ isComponentVisible: F
1235
1382
  }
1236
1383
  ),
1237
- /* @__PURE__ */ t("div", { className: "sa-calendar-body", children: i === "days" ? /* @__PURE__ */ t(
1238
- oe,
1384
+ /* @__PURE__ */ r("div", { className: "sa-calendar-body", children: V === "days" ? /* @__PURE__ */ r(
1385
+ me,
1239
1386
  {
1240
- date: d,
1241
- setDate: p,
1242
- previewDate: w,
1243
- setPreviewDate: C,
1244
- setIsComponentVisible: s,
1245
- input: l,
1246
- minDate: g,
1247
- maxDate: h,
1248
- onChange: e
1387
+ date: Y,
1388
+ setDate: E,
1389
+ previewDate: D,
1390
+ setPreviewDate: I,
1391
+ setIsComponentVisible: L,
1392
+ input: s,
1393
+ minDate: p,
1394
+ maxDate: d,
1395
+ onChange: n
1249
1396
  }
1250
- ) : i === "months" ? /* @__PURE__ */ t(
1251
- le,
1397
+ ) : V === "months" ? /* @__PURE__ */ r(
1398
+ ve,
1252
1399
  {
1253
- date: d,
1254
- setDate: p,
1255
- previewDate: w,
1256
- setPreviewDate: C,
1257
- filter: o,
1258
- setViews: m,
1259
- onChange: e,
1260
- minDate: g,
1261
- maxDate: h,
1262
- input: l
1400
+ date: Y,
1401
+ setDate: E,
1402
+ previewDate: D,
1403
+ setPreviewDate: I,
1404
+ filter: t,
1405
+ setViews: S,
1406
+ onChange: n,
1407
+ minDate: p,
1408
+ maxDate: d,
1409
+ input: s
1263
1410
  }
1264
- ) : /* @__PURE__ */ t(
1265
- ie,
1411
+ ) : /* @__PURE__ */ r(
1412
+ ye,
1266
1413
  {
1267
- date: d,
1268
- setDate: p,
1269
- previewDate: w,
1270
- setPreviewDate: C,
1271
- filter: o,
1272
- setViews: m,
1273
- onChange: e,
1274
- minDate: g,
1275
- maxDate: h,
1276
- input: l
1414
+ date: Y,
1415
+ setDate: E,
1416
+ previewDate: D,
1417
+ setPreviewDate: I,
1418
+ filter: t,
1419
+ setViews: S,
1420
+ onChange: n,
1421
+ minDate: p,
1422
+ maxDate: d,
1423
+ input: s
1277
1424
  }
1278
1425
  ) })
1279
1426
  ]
@@ -1282,58 +1429,68 @@ const ue = W(
1282
1429
  ]
1283
1430
  }
1284
1431
  );
1432
+ return /* @__PURE__ */ r(
1433
+ te,
1434
+ {
1435
+ label: k,
1436
+ labelPosition: M,
1437
+ required: f,
1438
+ optional: o,
1439
+ description: c,
1440
+ helperText: h,
1441
+ errorText: b,
1442
+ fullWidth: y,
1443
+ children: R
1444
+ }
1445
+ );
1285
1446
  }
1286
- ), pe = W(
1447
+ ), Ce = G(
1287
1448
  ({
1288
1449
  value: a,
1289
- onChange: e,
1290
- filter: o,
1291
- input: l = !0,
1292
- rangedDate: c,
1293
- disabled: g,
1294
- minDate: h,
1295
- maxDate: f,
1296
- placeholder: u,
1297
- size: n,
1298
- status: M,
1299
- clearable: k,
1300
- fullWidth: x
1301
- }, b) => /* @__PURE__ */ t(q, { children: c ? /* @__PURE__ */ t(
1302
- re,
1303
- {
1304
- onChange: e,
1305
- value: a,
1306
- input: l,
1307
- filter: o,
1308
- disabled: g,
1309
- ref: b,
1310
- minDate: h,
1311
- maxDate: f,
1312
- placeholder: u,
1313
- size: n,
1314
- status: M,
1315
- clearable: k,
1316
- fullWidth: x
1317
- }
1318
- ) : /* @__PURE__ */ t(
1319
- ue,
1320
- {
1321
- onChange: e,
1450
+ onChange: n,
1451
+ filter: t,
1452
+ input: s = !0,
1453
+ rangedDate: l,
1454
+ disabled: p,
1455
+ minDate: d,
1456
+ maxDate: g,
1457
+ placeholder: i,
1458
+ size: e,
1459
+ status: w,
1460
+ clearable: y,
1461
+ fullWidth: k,
1462
+ label: M,
1463
+ labelPosition: f,
1464
+ required: o,
1465
+ optional: c,
1466
+ description: h,
1467
+ helperText: b,
1468
+ errorText: u
1469
+ }, m) => {
1470
+ const x = {
1471
+ onChange: n,
1322
1472
  value: a,
1323
- input: l,
1324
- filter: o,
1325
- disabled: g,
1326
- ref: b,
1327
- minDate: h,
1328
- maxDate: f,
1329
- placeholder: u,
1330
- size: n,
1331
- status: M,
1332
- clearable: k,
1333
- fullWidth: x
1334
- }
1335
- ) })
1473
+ input: s,
1474
+ filter: t,
1475
+ disabled: p,
1476
+ minDate: d,
1477
+ maxDate: g,
1478
+ placeholder: i,
1479
+ size: e,
1480
+ status: w,
1481
+ clearable: y,
1482
+ fullWidth: k,
1483
+ label: M,
1484
+ labelPosition: f,
1485
+ required: o,
1486
+ optional: c,
1487
+ description: h,
1488
+ helperText: b,
1489
+ errorText: u
1490
+ };
1491
+ return /* @__PURE__ */ r(_, { children: l ? /* @__PURE__ */ r(pe, { ...x, ref: m }) : /* @__PURE__ */ r(xe, { ...x, ref: m }) });
1492
+ }
1336
1493
  );
1337
1494
  export {
1338
- pe as StarasiaDate
1495
+ Ce as StarasiaDate
1339
1496
  };