@starasia/date 1.0.3 → 1.0.4
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 +115 -115
- package/dist/date.umd.js +5 -5
- package/package.json +1 -1
package/dist/date.es.js
CHANGED
|
@@ -49,10 +49,10 @@ const I = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
/* brand */
|
|
52
|
-
--starasia-ui-date-color-primary-blue: var(--starasia-ui-brand-primary-default);
|
|
53
|
-
--starasia-ui-date-color-secondary-blue: var(--starasia-ui-brand-primary-default);
|
|
54
|
-
--starasia-ui-date-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
|
|
55
|
-
--starasia-ui-date-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
52
|
+
--starasia-ui-date-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
53
|
+
--starasia-ui-date-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
54
|
+
--starasia-ui-date-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary, rgba(144, 176, 218, 1));
|
|
55
|
+
--starasia-ui-date-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
56
56
|
|
|
57
57
|
/* spacing */
|
|
58
58
|
--starasia-ui-date-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
|
|
@@ -244,7 +244,7 @@ const I = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
244
244
|
|
|
245
245
|
.starasia-calendar-input-container:has(input:focus) {
|
|
246
246
|
border-color: var(--starasia-ui-date-color-primary-blue);
|
|
247
|
-
box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary), 0.2);
|
|
247
|
+
box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary, 144, 176, 218), 0.2);
|
|
248
248
|
}
|
|
249
249
|
.starasia-calendar-input-container:has(input:disabled) {
|
|
250
250
|
/* border-color: var(--starasia-ui-input-color-tertiary-gray); */
|
|
@@ -348,30 +348,30 @@ const I = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
348
348
|
"Nov",
|
|
349
349
|
"Dec"
|
|
350
350
|
];
|
|
351
|
-
function J(
|
|
352
|
-
const [a, t] = F(
|
|
351
|
+
function J(e) {
|
|
352
|
+
const [a, t] = F(e), s = E(null), i = (g) => {
|
|
353
353
|
s.current && !s.current.contains(g.target) && t(!1);
|
|
354
354
|
};
|
|
355
355
|
return D(() => (document.addEventListener("click", i, !0), () => {
|
|
356
356
|
document.removeEventListener("click", i, !0);
|
|
357
357
|
}), []), { ref: s, isComponentVisible: a, setIsComponentVisible: t };
|
|
358
358
|
}
|
|
359
|
-
const j = "starasia-calendar-input-styles", U = (
|
|
359
|
+
const j = "starasia-calendar-input-styles", U = (e) => {
|
|
360
360
|
if (!document.getElementById(j)) {
|
|
361
361
|
const a = document.createElement("style");
|
|
362
|
-
a.id = j, a.textContent =
|
|
362
|
+
a.id = j, a.textContent = e, document.head.appendChild(a);
|
|
363
363
|
}
|
|
364
364
|
};
|
|
365
365
|
U(I);
|
|
366
|
-
const T = (
|
|
367
|
-
if (
|
|
366
|
+
const T = (e) => {
|
|
367
|
+
if (e === "sm")
|
|
368
368
|
return 16;
|
|
369
|
-
if (
|
|
369
|
+
if (e === "md")
|
|
370
370
|
return 16;
|
|
371
|
-
if (
|
|
371
|
+
if (e === "lg")
|
|
372
372
|
return 20;
|
|
373
|
-
}, K = (
|
|
374
|
-
const { size: a = "md", status: t = "default", variant: s = "outline", ...i } =
|
|
373
|
+
}, K = (e) => {
|
|
374
|
+
const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = e, g = E(null), f = () => {
|
|
375
375
|
g.current && i.onClick && (g.current.focus(), i.onClick(""));
|
|
376
376
|
};
|
|
377
377
|
return /* @__PURE__ */ $(
|
|
@@ -434,7 +434,7 @@ const T = (r) => {
|
|
|
434
434
|
}
|
|
435
435
|
);
|
|
436
436
|
}, Q = ({
|
|
437
|
-
date:
|
|
437
|
+
date: e,
|
|
438
438
|
setDate: a,
|
|
439
439
|
dateRange: t,
|
|
440
440
|
setDateRange: s,
|
|
@@ -444,11 +444,11 @@ const T = (r) => {
|
|
|
444
444
|
input: v
|
|
445
445
|
}) => {
|
|
446
446
|
var u, n, c;
|
|
447
|
-
let h = new Date(
|
|
448
|
-
const b =
|
|
447
|
+
let h = new Date(e.getFullYear(), e.getMonth(), 1), r = h.getDay(), w = [];
|
|
448
|
+
const b = e.getMonth();
|
|
449
449
|
for (let d = 0; d < 42; d++) {
|
|
450
|
-
d === 0 &&
|
|
451
|
-
h.getDate() + (d -
|
|
450
|
+
d === 0 && r === 0 ? h.setDate(h.getDate() - 7) : d === 0 ? h.setDate(
|
|
451
|
+
h.getDate() + (d - r)
|
|
452
452
|
) : h.setDate(h.getDate() + 1);
|
|
453
453
|
let y = {
|
|
454
454
|
currentMonth: h.getMonth() === b,
|
|
@@ -500,7 +500,7 @@ const T = (r) => {
|
|
|
500
500
|
}) })
|
|
501
501
|
] });
|
|
502
502
|
}, X = ({
|
|
503
|
-
date:
|
|
503
|
+
date: e,
|
|
504
504
|
setDate: a,
|
|
505
505
|
filter: t,
|
|
506
506
|
setViews: s,
|
|
@@ -509,9 +509,9 @@ const T = (r) => {
|
|
|
509
509
|
onChange: f,
|
|
510
510
|
minDate: v,
|
|
511
511
|
maxDate: h,
|
|
512
|
-
input:
|
|
512
|
+
input: r
|
|
513
513
|
}) => {
|
|
514
|
-
const w = i.from.getFullYear(), b =
|
|
514
|
+
const w = i.from.getFullYear(), b = e.getFullYear(), k = (u) => {
|
|
515
515
|
t ? (M(u), a(u)) : (s("days"), a(u));
|
|
516
516
|
}, M = (u) => {
|
|
517
517
|
var c;
|
|
@@ -536,7 +536,7 @@ const T = (r) => {
|
|
|
536
536
|
pointerEvents: d ? "none" : void 0,
|
|
537
537
|
cursor: d ? "not-allowed" : "pointer",
|
|
538
538
|
color: d ? "#ccc" : c ? "#b0b0b0" : "",
|
|
539
|
-
...
|
|
539
|
+
...r ? {} : { width: "100%" }
|
|
540
540
|
},
|
|
541
541
|
onClick: () => {
|
|
542
542
|
d || k(new Date(b, n));
|
|
@@ -546,11 +546,11 @@ const T = (r) => {
|
|
|
546
546
|
n
|
|
547
547
|
);
|
|
548
548
|
}) });
|
|
549
|
-
}, B = (
|
|
550
|
-
const a = Math.floor(
|
|
549
|
+
}, B = (e) => {
|
|
550
|
+
const a = Math.floor(e / 10) * 10, t = a + 10;
|
|
551
551
|
return { start: a, end: t };
|
|
552
552
|
}, Z = ({
|
|
553
|
-
date:
|
|
553
|
+
date: e,
|
|
554
554
|
filter: a,
|
|
555
555
|
setViews: t,
|
|
556
556
|
setDate: s,
|
|
@@ -559,11 +559,11 @@ const T = (r) => {
|
|
|
559
559
|
onChange: f,
|
|
560
560
|
minDate: v,
|
|
561
561
|
maxDate: h,
|
|
562
|
-
input:
|
|
562
|
+
input: r
|
|
563
563
|
}) => {
|
|
564
564
|
var y;
|
|
565
565
|
let w = [];
|
|
566
|
-
const b =
|
|
566
|
+
const b = e.getFullYear(), { start: k, end: M } = B(b), u = i.from.getFullYear(), n = (y = i.to) == null ? void 0 : y.getFullYear();
|
|
567
567
|
for (let o = k; o < M; o++) {
|
|
568
568
|
const p = new Date(o, 0), C = (!v || p >= v) && (!h || p <= h), x = o === u || o === n, m = p > i.from && p < i.to;
|
|
569
569
|
w.push({
|
|
@@ -598,13 +598,13 @@ const T = (r) => {
|
|
|
598
598
|
color: o.highlight ? "#b0b0b0" : o.active ? "" : o.disabled ? "#ccc" : "",
|
|
599
599
|
cursor: o.disabled ? "not-allowed" : "pointer",
|
|
600
600
|
pointerEvents: o.disbled ? "none" : "all",
|
|
601
|
-
...
|
|
601
|
+
...r ? {} : { width: "100%" }
|
|
602
602
|
},
|
|
603
603
|
children: o.year
|
|
604
604
|
},
|
|
605
605
|
p
|
|
606
606
|
)) });
|
|
607
|
-
}, q = ({ ...
|
|
607
|
+
}, q = ({ ...e }) => /* @__PURE__ */ l(
|
|
608
608
|
"svg",
|
|
609
609
|
{
|
|
610
610
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -612,7 +612,7 @@ const T = (r) => {
|
|
|
612
612
|
height: "20",
|
|
613
613
|
viewBox: "0 0 20 20",
|
|
614
614
|
fill: "none",
|
|
615
|
-
...
|
|
615
|
+
...e,
|
|
616
616
|
children: /* @__PURE__ */ l(
|
|
617
617
|
"path",
|
|
618
618
|
{
|
|
@@ -624,7 +624,7 @@ const T = (r) => {
|
|
|
624
624
|
}
|
|
625
625
|
)
|
|
626
626
|
}
|
|
627
|
-
), P = ({ ...
|
|
627
|
+
), P = ({ ...e }) => /* @__PURE__ */ l(
|
|
628
628
|
"svg",
|
|
629
629
|
{
|
|
630
630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -632,7 +632,7 @@ const T = (r) => {
|
|
|
632
632
|
height: "20",
|
|
633
633
|
viewBox: "0 0 20 20",
|
|
634
634
|
fill: "none",
|
|
635
|
-
...
|
|
635
|
+
...e,
|
|
636
636
|
children: /* @__PURE__ */ l(
|
|
637
637
|
"path",
|
|
638
638
|
{
|
|
@@ -645,37 +645,37 @@ const T = (r) => {
|
|
|
645
645
|
)
|
|
646
646
|
}
|
|
647
647
|
), _ = ({
|
|
648
|
-
setViews:
|
|
648
|
+
setViews: e,
|
|
649
649
|
views: a,
|
|
650
650
|
filter: t,
|
|
651
651
|
date: s,
|
|
652
652
|
setDate: i
|
|
653
653
|
}) => {
|
|
654
654
|
const g = () => {
|
|
655
|
-
t ||
|
|
655
|
+
t || e((r) => r === "days" ? "months" : r === "months" ? "years" : "days");
|
|
656
656
|
}, f = () => {
|
|
657
657
|
if (a === "years") {
|
|
658
|
-
i((
|
|
658
|
+
i((r) => new Date(r.getFullYear() + 10, 0));
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
661
|
if (a === "months") {
|
|
662
|
-
i((
|
|
662
|
+
i((r) => new Date(r.getFullYear() + 1, r.getMonth()));
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
|
-
i((
|
|
665
|
+
i((r) => new Date(r.getFullYear(), r.getMonth() + 1));
|
|
666
666
|
}, v = () => {
|
|
667
667
|
if (a === "years") {
|
|
668
|
-
i((
|
|
668
|
+
i((r) => new Date(r.getFullYear() - 10, 0));
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
671
|
if (a === "months") {
|
|
672
|
-
i((
|
|
672
|
+
i((r) => new Date(r.getFullYear() - 1, r.getMonth()));
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
i(
|
|
676
|
-
(
|
|
677
|
-
|
|
678
|
-
|
|
676
|
+
(r) => new Date(
|
|
677
|
+
r.getMonth() === 0 ? r.getFullYear() - 1 : r.getFullYear(),
|
|
678
|
+
r.getMonth() === 0 ? 11 : r.getMonth() - 1
|
|
679
679
|
)
|
|
680
680
|
);
|
|
681
681
|
};
|
|
@@ -692,20 +692,20 @@ const T = (r) => {
|
|
|
692
692
|
/* @__PURE__ */ l(P, { onClick: () => f() })
|
|
693
693
|
] });
|
|
694
694
|
};
|
|
695
|
-
function L(
|
|
696
|
-
const a = new Date(
|
|
695
|
+
function L(e) {
|
|
696
|
+
const a = new Date(e), t = a.getFullYear(), s = a.getMonth();
|
|
697
697
|
return `${a.getDate().toString().padStart(2, "0")} ${G[s]} ${t}`;
|
|
698
698
|
}
|
|
699
|
-
const z = "starasia-calendar-styles", aa = (
|
|
699
|
+
const z = "starasia-calendar-styles", aa = (e) => {
|
|
700
700
|
if (!document.getElementById(z)) {
|
|
701
701
|
const a = document.createElement("style");
|
|
702
|
-
a.id = z, a.textContent =
|
|
702
|
+
a.id = z, a.textContent = e, document.head.appendChild(a);
|
|
703
703
|
}
|
|
704
704
|
};
|
|
705
705
|
aa(I);
|
|
706
|
-
const
|
|
706
|
+
const ra = W(
|
|
707
707
|
({
|
|
708
|
-
value:
|
|
708
|
+
value: e,
|
|
709
709
|
onChange: a,
|
|
710
710
|
filter: t,
|
|
711
711
|
input: s = !0,
|
|
@@ -714,18 +714,18 @@ const ea = W(
|
|
|
714
714
|
maxDate: f,
|
|
715
715
|
placeholder: v,
|
|
716
716
|
size: h,
|
|
717
|
-
status:
|
|
717
|
+
status: r
|
|
718
718
|
}, w) => {
|
|
719
719
|
const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [n, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F({
|
|
720
|
-
from: (
|
|
721
|
-
to: (
|
|
720
|
+
from: (e == null ? void 0 : e.from) || /* @__PURE__ */ new Date(),
|
|
721
|
+
to: (e == null ? void 0 : e.to) || /* @__PURE__ */ new Date()
|
|
722
722
|
});
|
|
723
723
|
D(() => {
|
|
724
|
-
|
|
724
|
+
e ? (y(e.from), p(e)) : (y(/* @__PURE__ */ new Date()), p({
|
|
725
725
|
from: /* @__PURE__ */ new Date(),
|
|
726
726
|
to: /* @__PURE__ */ new Date()
|
|
727
727
|
}));
|
|
728
|
-
}, [
|
|
728
|
+
}, [e]), D(() => {
|
|
729
729
|
t && c(t);
|
|
730
730
|
}, [t]), D(() => {
|
|
731
731
|
t || c("days");
|
|
@@ -734,7 +734,7 @@ const ea = W(
|
|
|
734
734
|
}, [s]);
|
|
735
735
|
const C = () => {
|
|
736
736
|
var m, Y;
|
|
737
|
-
if (!
|
|
737
|
+
if (!e)
|
|
738
738
|
return "";
|
|
739
739
|
if (t) {
|
|
740
740
|
if (n === "days")
|
|
@@ -778,7 +778,7 @@ const ea = W(
|
|
|
778
778
|
disabled: i,
|
|
779
779
|
placeholder: v,
|
|
780
780
|
size: h,
|
|
781
|
-
status:
|
|
781
|
+
status: r
|
|
782
782
|
}
|
|
783
783
|
) : null,
|
|
784
784
|
k ? /* @__PURE__ */ $(
|
|
@@ -848,22 +848,22 @@ const ea = W(
|
|
|
848
848
|
}
|
|
849
849
|
);
|
|
850
850
|
}
|
|
851
|
-
), O = "starasia-calendar-input-styles",
|
|
851
|
+
), O = "starasia-calendar-input-styles", ea = (e) => {
|
|
852
852
|
if (!document.getElementById(O)) {
|
|
853
853
|
const a = document.createElement("style");
|
|
854
|
-
a.id = O, a.textContent =
|
|
854
|
+
a.id = O, a.textContent = e, document.head.appendChild(a);
|
|
855
855
|
}
|
|
856
856
|
};
|
|
857
|
-
|
|
858
|
-
const S = (
|
|
859
|
-
if (
|
|
857
|
+
ea(I);
|
|
858
|
+
const S = (e) => {
|
|
859
|
+
if (e === "sm")
|
|
860
860
|
return 16;
|
|
861
|
-
if (
|
|
861
|
+
if (e === "md")
|
|
862
862
|
return 16;
|
|
863
|
-
if (
|
|
863
|
+
if (e === "lg")
|
|
864
864
|
return 20;
|
|
865
|
-
}, na = (
|
|
866
|
-
const { size: a = "md", status: t = "default", variant: s = "outline", ...i } =
|
|
865
|
+
}, na = (e) => {
|
|
866
|
+
const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = e, g = E(null), f = () => {
|
|
867
867
|
g.current && i.onClick && (g.current.focus(), i.onClick(""));
|
|
868
868
|
};
|
|
869
869
|
return /* @__PURE__ */ $(
|
|
@@ -926,7 +926,7 @@ const S = (r) => {
|
|
|
926
926
|
}
|
|
927
927
|
);
|
|
928
928
|
}, ta = ({
|
|
929
|
-
date:
|
|
929
|
+
date: e,
|
|
930
930
|
setDate: a,
|
|
931
931
|
previewDate: t,
|
|
932
932
|
setPreviewDate: s,
|
|
@@ -936,24 +936,24 @@ const S = (r) => {
|
|
|
936
936
|
input: v,
|
|
937
937
|
onChange: h
|
|
938
938
|
}) => {
|
|
939
|
-
let
|
|
939
|
+
let r = new Date(
|
|
940
940
|
t.getFullYear(),
|
|
941
941
|
t.getMonth(),
|
|
942
942
|
1
|
|
943
|
-
), w =
|
|
944
|
-
const k =
|
|
943
|
+
), w = r.getDay(), b = [];
|
|
944
|
+
const k = e.toDateString(), M = t.getMonth();
|
|
945
945
|
for (let n = 0; n < 42; n++) {
|
|
946
|
-
n === 0 && w === 0 ?
|
|
947
|
-
|
|
948
|
-
) :
|
|
946
|
+
n === 0 && w === 0 ? r.setDate(r.getDate() - 7) : n === 0 ? r.setDate(
|
|
947
|
+
r.getDate() + (n - w)
|
|
948
|
+
) : r.setDate(r.getDate() + 1);
|
|
949
949
|
let c = {
|
|
950
|
-
currentMonth:
|
|
951
|
-
date: new Date(
|
|
952
|
-
month:
|
|
953
|
-
number:
|
|
954
|
-
selected:
|
|
955
|
-
year:
|
|
956
|
-
isDisabled: g &&
|
|
950
|
+
currentMonth: r.getMonth() === M,
|
|
951
|
+
date: new Date(r),
|
|
952
|
+
month: r.getMonth(),
|
|
953
|
+
number: r.getDate(),
|
|
954
|
+
selected: r.toDateString() === k,
|
|
955
|
+
year: r.getFullYear(),
|
|
956
|
+
isDisabled: g && r < g || f && r > f
|
|
957
957
|
};
|
|
958
958
|
b.push(c);
|
|
959
959
|
}
|
|
@@ -984,7 +984,7 @@ const S = (r) => {
|
|
|
984
984
|
}) })
|
|
985
985
|
] });
|
|
986
986
|
}, sa = ({
|
|
987
|
-
date:
|
|
987
|
+
date: e,
|
|
988
988
|
setDate: a,
|
|
989
989
|
filter: t,
|
|
990
990
|
setViews: s,
|
|
@@ -993,9 +993,9 @@ const S = (r) => {
|
|
|
993
993
|
setPreviewDate: f,
|
|
994
994
|
minDate: v,
|
|
995
995
|
maxDate: h,
|
|
996
|
-
input:
|
|
996
|
+
input: r
|
|
997
997
|
}) => {
|
|
998
|
-
const w =
|
|
998
|
+
const w = e.getMonth(), b = e.getFullYear(), k = g.getFullYear(), M = (u) => {
|
|
999
999
|
(!v || u >= v) && (!h || u <= h) && (t ? (i(u), a(u), f(u)) : (s("days"), f(u)));
|
|
1000
1000
|
};
|
|
1001
1001
|
return /* @__PURE__ */ l("div", { className: "starasia-calendar-months-preview", children: N.map((u, n) => {
|
|
@@ -1008,7 +1008,7 @@ const S = (r) => {
|
|
|
1008
1008
|
color: c ? "#ccc" : void 0,
|
|
1009
1009
|
pointerEvents: c ? "none" : void 0,
|
|
1010
1010
|
cursor: c ? "not-allowed" : "pointer",
|
|
1011
|
-
...
|
|
1011
|
+
...r ? {} : { width: "100%" }
|
|
1012
1012
|
},
|
|
1013
1013
|
onClick: () => {
|
|
1014
1014
|
c || M(new Date(k, n));
|
|
@@ -1018,11 +1018,11 @@ const S = (r) => {
|
|
|
1018
1018
|
n
|
|
1019
1019
|
);
|
|
1020
1020
|
}) });
|
|
1021
|
-
}, V = (
|
|
1022
|
-
const a = Math.floor(
|
|
1021
|
+
}, V = (e) => {
|
|
1022
|
+
const a = Math.floor(e / 10) * 10, t = a + 10;
|
|
1023
1023
|
return { start: a, end: t };
|
|
1024
1024
|
}, ia = ({
|
|
1025
|
-
date:
|
|
1025
|
+
date: e,
|
|
1026
1026
|
filter: a,
|
|
1027
1027
|
setViews: t,
|
|
1028
1028
|
setDate: s,
|
|
@@ -1031,10 +1031,10 @@ const S = (r) => {
|
|
|
1031
1031
|
setPreviewDate: f,
|
|
1032
1032
|
minDate: v,
|
|
1033
1033
|
maxDate: h,
|
|
1034
|
-
input:
|
|
1034
|
+
input: r
|
|
1035
1035
|
}) => {
|
|
1036
1036
|
let w = [];
|
|
1037
|
-
const b = g.getFullYear(), { start: k, end: M } = V(b), u =
|
|
1037
|
+
const b = g.getFullYear(), { start: k, end: M } = V(b), u = e.getFullYear();
|
|
1038
1038
|
for (let c = k; c < M; c++) {
|
|
1039
1039
|
let d = v && new Date(c, 0, 1) < v || h && new Date(c, 11, 31) > h;
|
|
1040
1040
|
w.push({ year: c, active: c === u, isDisabled: d });
|
|
@@ -1050,7 +1050,7 @@ const S = (r) => {
|
|
|
1050
1050
|
color: c.isDisabled ? "#ccc" : void 0,
|
|
1051
1051
|
pointerEvents: c.isDisabled ? "none" : void 0,
|
|
1052
1052
|
cursor: c.isDisabled ? "not-allowed" : "pointer",
|
|
1053
|
-
...
|
|
1053
|
+
...r ? {} : { width: "100%" }
|
|
1054
1054
|
},
|
|
1055
1055
|
onClick: () => {
|
|
1056
1056
|
c.isDisabled || n(new Date(c.year, 0));
|
|
@@ -1060,41 +1060,41 @@ const S = (r) => {
|
|
|
1060
1060
|
d
|
|
1061
1061
|
)) });
|
|
1062
1062
|
}, oa = ({
|
|
1063
|
-
setViews:
|
|
1063
|
+
setViews: e,
|
|
1064
1064
|
views: a,
|
|
1065
1065
|
filter: t,
|
|
1066
1066
|
previewDate: s,
|
|
1067
1067
|
setPreviewDate: i
|
|
1068
1068
|
}) => {
|
|
1069
1069
|
const g = () => {
|
|
1070
|
-
t ||
|
|
1070
|
+
t || e((r) => r === "days" ? "months" : r === "months" ? "years" : "days");
|
|
1071
1071
|
}, f = () => {
|
|
1072
1072
|
if (a === "years") {
|
|
1073
|
-
i((
|
|
1073
|
+
i((r) => new Date(r.getFullYear() + 10, 0));
|
|
1074
1074
|
return;
|
|
1075
1075
|
}
|
|
1076
1076
|
if (a === "months") {
|
|
1077
1077
|
i(
|
|
1078
|
-
(
|
|
1078
|
+
(r) => new Date(r.getFullYear() + 1, r.getMonth())
|
|
1079
1079
|
);
|
|
1080
1080
|
return;
|
|
1081
1081
|
}
|
|
1082
|
-
i((
|
|
1082
|
+
i((r) => new Date(r.getFullYear(), r.getMonth() + 1));
|
|
1083
1083
|
}, v = () => {
|
|
1084
1084
|
if (a === "years") {
|
|
1085
|
-
i((
|
|
1085
|
+
i((r) => new Date(r.getFullYear() - 10, 0));
|
|
1086
1086
|
return;
|
|
1087
1087
|
}
|
|
1088
1088
|
if (a === "months") {
|
|
1089
1089
|
i(
|
|
1090
|
-
(
|
|
1090
|
+
(r) => new Date(r.getFullYear() - 1, r.getMonth())
|
|
1091
1091
|
);
|
|
1092
1092
|
return;
|
|
1093
1093
|
}
|
|
1094
1094
|
i(
|
|
1095
|
-
(
|
|
1096
|
-
|
|
1097
|
-
|
|
1095
|
+
(r) => new Date(
|
|
1096
|
+
r.getMonth() === 0 ? r.getFullYear() - 1 : r.getFullYear(),
|
|
1097
|
+
r.getMonth() === 0 ? 11 : r.getMonth() - 1
|
|
1098
1098
|
)
|
|
1099
1099
|
);
|
|
1100
1100
|
};
|
|
@@ -1110,16 +1110,16 @@ const S = (r) => {
|
|
|
1110
1110
|
})() }),
|
|
1111
1111
|
/* @__PURE__ */ l(P, { onClick: () => f() })
|
|
1112
1112
|
] });
|
|
1113
|
-
}, H = "starasia-calendar-styles", la = (
|
|
1113
|
+
}, H = "starasia-calendar-styles", la = (e) => {
|
|
1114
1114
|
if (!document.getElementById(H)) {
|
|
1115
1115
|
const a = document.createElement("style");
|
|
1116
|
-
a.id = H, a.textContent =
|
|
1116
|
+
a.id = H, a.textContent = e, document.head.appendChild(a);
|
|
1117
1117
|
}
|
|
1118
1118
|
};
|
|
1119
1119
|
la(I);
|
|
1120
1120
|
const ca = W(
|
|
1121
1121
|
({
|
|
1122
|
-
value:
|
|
1122
|
+
value: e,
|
|
1123
1123
|
onChange: a,
|
|
1124
1124
|
filter: t,
|
|
1125
1125
|
input: s = !0,
|
|
@@ -1128,19 +1128,19 @@ const ca = W(
|
|
|
1128
1128
|
maxDate: f,
|
|
1129
1129
|
placeholder: v,
|
|
1130
1130
|
size: h,
|
|
1131
|
-
status:
|
|
1131
|
+
status: r
|
|
1132
1132
|
}, w) => {
|
|
1133
1133
|
const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [n, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F(/* @__PURE__ */ new Date());
|
|
1134
1134
|
D(() => {
|
|
1135
|
-
|
|
1136
|
-
}, [
|
|
1135
|
+
e ? (y(e), p(e)) : (y(/* @__PURE__ */ new Date()), p(/* @__PURE__ */ new Date()));
|
|
1136
|
+
}, [e]), D(() => {
|
|
1137
1137
|
t && c(t);
|
|
1138
1138
|
}, [t]), D(() => {
|
|
1139
1139
|
t || c("days");
|
|
1140
1140
|
}, [k]), D(() => {
|
|
1141
1141
|
s || M(!0);
|
|
1142
1142
|
}, [s]);
|
|
1143
|
-
const C = () =>
|
|
1143
|
+
const C = () => e ? t === "days" ? L(d) : t === "months" ? `${N[d.getMonth()]} ${d.getFullYear()}` : t === "years" ? d.getFullYear() : L(d) : "", x = () => {
|
|
1144
1144
|
if (u.current && b.current && s) {
|
|
1145
1145
|
const m = b.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
|
|
1146
1146
|
window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
|
|
@@ -1170,7 +1170,7 @@ const ca = W(
|
|
|
1170
1170
|
placeholder: v,
|
|
1171
1171
|
disabled: i,
|
|
1172
1172
|
size: h,
|
|
1173
|
-
status:
|
|
1173
|
+
status: r,
|
|
1174
1174
|
inputMode: "none"
|
|
1175
1175
|
}
|
|
1176
1176
|
) : null,
|
|
@@ -1242,7 +1242,7 @@ const ca = W(
|
|
|
1242
1242
|
}
|
|
1243
1243
|
), ha = W(
|
|
1244
1244
|
({
|
|
1245
|
-
value:
|
|
1245
|
+
value: e,
|
|
1246
1246
|
onChange: a,
|
|
1247
1247
|
filter: t,
|
|
1248
1248
|
input: s = !0,
|
|
@@ -1251,13 +1251,13 @@ const ca = W(
|
|
|
1251
1251
|
minDate: f,
|
|
1252
1252
|
maxDate: v,
|
|
1253
1253
|
placeholder: h,
|
|
1254
|
-
size:
|
|
1254
|
+
size: r,
|
|
1255
1255
|
status: w
|
|
1256
1256
|
}, b) => /* @__PURE__ */ l(R, { children: i ? /* @__PURE__ */ l(
|
|
1257
|
-
|
|
1257
|
+
ra,
|
|
1258
1258
|
{
|
|
1259
1259
|
onChange: a,
|
|
1260
|
-
value:
|
|
1260
|
+
value: e,
|
|
1261
1261
|
input: s,
|
|
1262
1262
|
filter: t,
|
|
1263
1263
|
disabled: g,
|
|
@@ -1265,14 +1265,14 @@ const ca = W(
|
|
|
1265
1265
|
minDate: f,
|
|
1266
1266
|
maxDate: v,
|
|
1267
1267
|
placeholder: h,
|
|
1268
|
-
size:
|
|
1268
|
+
size: r,
|
|
1269
1269
|
status: w
|
|
1270
1270
|
}
|
|
1271
1271
|
) : /* @__PURE__ */ l(
|
|
1272
1272
|
ca,
|
|
1273
1273
|
{
|
|
1274
1274
|
onChange: a,
|
|
1275
|
-
value:
|
|
1275
|
+
value: e,
|
|
1276
1276
|
input: s,
|
|
1277
1277
|
filter: t,
|
|
1278
1278
|
disabled: g,
|
|
@@ -1280,7 +1280,7 @@ const ca = W(
|
|
|
1280
1280
|
minDate: f,
|
|
1281
1281
|
maxDate: v,
|
|
1282
1282
|
placeholder: h,
|
|
1283
|
-
size:
|
|
1283
|
+
size: r,
|
|
1284
1284
|
status: w
|
|
1285
1285
|
}
|
|
1286
1286
|
) })
|
package/dist/date.umd.js
CHANGED
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
/* brand */
|
|
50
|
-
--starasia-ui-date-color-primary-blue: var(--starasia-ui-brand-primary-default);
|
|
51
|
-
--starasia-ui-date-color-secondary-blue: var(--starasia-ui-brand-primary-default);
|
|
52
|
-
--starasia-ui-date-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary);
|
|
53
|
-
--starasia-ui-date-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary);
|
|
50
|
+
--starasia-ui-date-color-primary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
51
|
+
--starasia-ui-date-color-secondary-blue: var(--starasia-ui-brand-primary-default, rgba(74, 106, 148, 1));
|
|
52
|
+
--starasia-ui-date-color-tertiary-blue: var(--starasia-ui-brand-primary-secondary, rgba(144, 176, 218, 1));
|
|
53
|
+
--starasia-ui-date-color-quaternary-blue: var(--starasia-ui-brand-primary-tertiary, rgba(227, 237, 248, 1));
|
|
54
54
|
|
|
55
55
|
/* spacing */
|
|
56
56
|
--starasia-ui-date-spacing-xs: var(--starasia-ui-spacing-xs, 4px);
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
|
|
243
243
|
.starasia-calendar-input-container:has(input:focus) {
|
|
244
244
|
border-color: var(--starasia-ui-date-color-primary-blue);
|
|
245
|
-
box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary), 0.2);
|
|
245
|
+
box-shadow: 0px 0px 0px 2px rgba(var(--starasia-ui-raw-color-brand-secondary, 144, 176, 218), 0.2);
|
|
246
246
|
}
|
|
247
247
|
.starasia-calendar-input-container:has(input:disabled) {
|
|
248
248
|
/* border-color: var(--starasia-ui-input-color-tertiary-gray); */
|