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