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