rk-designsystem 1.3.1 → 1.3.2
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/components/Carousel/index.js +7 -7
- package/dist/components/DateInput/index.js +34 -34
- package/dist/components/DatePicker/index.js +123 -120
- package/dist/components/DatePicker/styles.module.css.js +10 -10
- package/dist/components/Donor/index.js +1 -1
- package/dist/components/Footer/index.js +1 -1
- package/dist/components/Footer/styles.module.css.js +82 -82
- package/dist/components/GraphicElement/index.js +6 -6
- package/dist/components/Header/index.js +179 -155
- package/dist/components/Header/styles.module.css.js +74 -74
- package/dist/rk-designsystem.css +1 -1
- package/package.json +6 -12
|
@@ -25,7 +25,7 @@ const ae = ({
|
|
|
25
25
|
const r = "rk-carousel-inline-styles";
|
|
26
26
|
if (typeof document > "u" || document.getElementById(r)) return;
|
|
27
27
|
const o = ie(a), i = document.createElement("style");
|
|
28
|
-
i.id = r, i.textContent = o, document.head.
|
|
28
|
+
i.id = r, i.textContent = o, document.head.prepend(i);
|
|
29
29
|
}, []);
|
|
30
30
|
const R = {
|
|
31
31
|
loop: !0,
|
|
@@ -42,13 +42,13 @@ const ae = ({
|
|
|
42
42
|
})
|
|
43
43
|
);
|
|
44
44
|
}, [D]);
|
|
45
|
-
const
|
|
45
|
+
const N = h((r) => {
|
|
46
46
|
I((o) => {
|
|
47
47
|
if (o[r]) return o;
|
|
48
48
|
const i = [...o];
|
|
49
49
|
return i[r] = !0, i;
|
|
50
50
|
});
|
|
51
|
-
}, []),
|
|
51
|
+
}, []), C = Q(() => b * 1e3, [b]), c = h(() => {
|
|
52
52
|
t && O(t.selectedScrollSnap());
|
|
53
53
|
}, [t]), H = h((r) => t && t.scrollTo(r), [t]), K = h(() => t && t.scrollPrev(), [t]), U = h(() => t && t.scrollNext(), [t]);
|
|
54
54
|
p(() => {
|
|
@@ -64,11 +64,11 @@ const ae = ({
|
|
|
64
64
|
if (!j || !t || !e || e.length <= 1) return;
|
|
65
65
|
const r = window.setInterval(() => {
|
|
66
66
|
t.canScrollNext() && t.scrollNext();
|
|
67
|
-
},
|
|
67
|
+
}, C);
|
|
68
68
|
return () => {
|
|
69
69
|
window.clearInterval(r);
|
|
70
70
|
};
|
|
71
|
-
}, [j,
|
|
71
|
+
}, [j, C, t, e]);
|
|
72
72
|
const E = Math.max(1, $), G = `${100 / E}%`, m = y / 2;
|
|
73
73
|
return /* @__PURE__ */ u(
|
|
74
74
|
"div",
|
|
@@ -117,9 +117,9 @@ const ae = ({
|
|
|
117
117
|
alt: r.alt,
|
|
118
118
|
loading: o < E ? "eager" : "lazy",
|
|
119
119
|
crossOrigin: "anonymous",
|
|
120
|
-
onLoad: () =>
|
|
120
|
+
onLoad: () => N(o),
|
|
121
121
|
onError: (i) => {
|
|
122
|
-
i.target.style.display = "none",
|
|
122
|
+
i.target.style.display = "none", N(o);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
)
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as S, jsx as g } from "react/jsx-runtime";
|
|
3
3
|
import pe, { forwardRef as be, useEffect as O, useRef as P, useCallback as k, useState as me, useId as ve } from "react";
|
|
4
|
-
import { parse as ge, isValid as
|
|
4
|
+
import { parse as ge, isValid as xe } from "date-fns";
|
|
5
5
|
import a from "./styles.module.css.js";
|
|
6
|
-
import { useLanguageOptional as
|
|
7
|
-
const
|
|
8
|
-
const n = e.slice(0, 2),
|
|
9
|
-
return e.length > 4 ? `${n}.${
|
|
6
|
+
import { useLanguageOptional as he } from "../../context/LanguageContext.js";
|
|
7
|
+
const x = (e) => {
|
|
8
|
+
const n = e.slice(0, 2), h = e.slice(2, 4), o = e.slice(4, 8);
|
|
9
|
+
return e.length > 4 ? `${n}.${h}.${o}` : e.length > 2 ? `${n}.${h}` : e.length > 0 ? n : "";
|
|
10
10
|
}, N = (e) => (e || "").replace(/\D/g, "").slice(0, 8), q = (e) => {
|
|
11
11
|
if (e.length < 8) return null;
|
|
12
|
-
const n = ge(
|
|
13
|
-
return
|
|
12
|
+
const n = ge(x(e), "dd.MM.yyyy", /* @__PURE__ */ new Date());
|
|
13
|
+
return xe(n);
|
|
14
14
|
}, ye = be(
|
|
15
15
|
(e, n) => {
|
|
16
|
-
const { t:
|
|
16
|
+
const { t: h } = he();
|
|
17
17
|
O(() => {
|
|
18
|
-
const
|
|
19
|
-
if (typeof document > "u" || document.getElementById(
|
|
20
|
-
const
|
|
21
|
-
m.id =
|
|
18
|
+
const r = "rk-dateinput-inline-styles";
|
|
19
|
+
if (typeof document > "u" || document.getElementById(r)) return;
|
|
20
|
+
const t = Ie(a), m = document.createElement("style");
|
|
21
|
+
m.id = r, m.textContent = t, document.head.prepend(m);
|
|
22
22
|
}, []);
|
|
23
23
|
const {
|
|
24
24
|
label: o,
|
|
@@ -46,44 +46,44 @@ const h = (e) => {
|
|
|
46
46
|
description: C,
|
|
47
47
|
error: u,
|
|
48
48
|
"data-color": ee,
|
|
49
|
-
"data-size":
|
|
50
|
-
...
|
|
49
|
+
"data-size": re,
|
|
50
|
+
...te
|
|
51
51
|
} = e, B = y !== void 0, f = P(null);
|
|
52
52
|
pe.useImperativeHandle(
|
|
53
53
|
n,
|
|
54
54
|
() => f.current
|
|
55
55
|
);
|
|
56
56
|
const R = P(null), i = k(
|
|
57
|
-
(
|
|
58
|
-
|
|
57
|
+
(r, t) => {
|
|
58
|
+
r !== R.current && (R.current = r, $ == null || $(r, t));
|
|
59
59
|
},
|
|
60
60
|
[$]
|
|
61
61
|
), D = k(
|
|
62
|
-
(
|
|
62
|
+
(r) => x(N(r)),
|
|
63
63
|
[]
|
|
64
64
|
), [p, E] = me(
|
|
65
65
|
() => D(y ?? J)
|
|
66
66
|
);
|
|
67
67
|
O(() => {
|
|
68
68
|
if (B) {
|
|
69
|
-
const
|
|
70
|
-
|
|
69
|
+
const r = D(y);
|
|
70
|
+
r !== p && (E(r), f.current && f.current.value !== r && (f.current.value = r));
|
|
71
71
|
}
|
|
72
72
|
}, [y, B, p, D]);
|
|
73
73
|
const oe = k(
|
|
74
|
-
(
|
|
75
|
-
const
|
|
74
|
+
(r) => {
|
|
75
|
+
const t = r.target, m = p, s = N(t.value), d = x(s);
|
|
76
76
|
let l = 0;
|
|
77
|
-
const v =
|
|
78
|
-
v <= 2 ? l = v : v <= 4 ? l = v + 1 : l = v + 2, l = Math.min(l,
|
|
79
|
-
const fe = q(
|
|
80
|
-
(
|
|
77
|
+
const v = s.length;
|
|
78
|
+
v <= 2 ? l = v : v <= 4 ? l = v + 1 : l = v + 2, l = Math.min(l, d.length), E(d), t.value = d, t.setSelectionRange(l, l), (d !== m || B) && (I == null || I(r, d));
|
|
79
|
+
const fe = q(s);
|
|
80
|
+
(s.length === 0 || s.length === 8) && i(s.length === 0 ? null : fe, d);
|
|
81
81
|
},
|
|
82
82
|
[p, B, I, i]
|
|
83
83
|
), ae = k(
|
|
84
|
-
(
|
|
85
|
-
const
|
|
86
|
-
|
|
84
|
+
(r) => {
|
|
85
|
+
const t = N(r.target.value);
|
|
86
|
+
t.length === 0 ? i(null, "") : t.length < 8 ? i(!1, x(t)) : i(q(t), x(t)), z == null || z(r);
|
|
87
87
|
},
|
|
88
88
|
[z, i]
|
|
89
89
|
), ne = [a.fieldset, A].filter(Boolean).join(" "), le = [
|
|
@@ -92,12 +92,12 @@ const h = (e) => {
|
|
|
92
92
|
u ? a.inputWrapperError : ""
|
|
93
93
|
].filter(Boolean).join(" "), ie = [
|
|
94
94
|
G
|
|
95
|
-
].filter(Boolean).join(" "),
|
|
95
|
+
].filter(Boolean).join(" "), se = [
|
|
96
96
|
a.suffixButton,
|
|
97
97
|
c ? a.suffixButtonInteractive : ""
|
|
98
98
|
].filter(Boolean).join(" ");
|
|
99
99
|
!o && !j && !W && console.warn("Advarsel: DateInput-komponenten bør ha label, aria-label, eller aria-labelledby for tilgjengelighet.");
|
|
100
|
-
const
|
|
100
|
+
const de = ve(), b = T ?? `dateinput${de}`, F = o && typeof o == "string" ? `${b}-label` : void 0, L = C ? `${b}-desc` : void 0, M = u ? `${b}-err` : void 0, ce = [L, M].filter(Boolean).join(" ") || void 0, ue = W ?? F;
|
|
101
101
|
return (
|
|
102
102
|
// --- Bruk data-color og data-size på den ytre wrapperen ---
|
|
103
103
|
/* @__PURE__ */ S(
|
|
@@ -105,7 +105,7 @@ const h = (e) => {
|
|
|
105
105
|
{
|
|
106
106
|
className: ne,
|
|
107
107
|
"data-color": ee,
|
|
108
|
-
"data-size":
|
|
108
|
+
"data-size": re,
|
|
109
109
|
children: [
|
|
110
110
|
o && typeof o == "string" ? /* @__PURE__ */ g("label", { id: F, htmlFor: b, children: o }) : o,
|
|
111
111
|
C && /* @__PURE__ */ g("p", { id: L, className: a.description, children: C }),
|
|
@@ -135,19 +135,19 @@ const h = (e) => {
|
|
|
135
135
|
"aria-describedby": ce,
|
|
136
136
|
"aria-invalid": !!u,
|
|
137
137
|
className: ie,
|
|
138
|
-
...
|
|
138
|
+
...te
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
141
|
V && /* @__PURE__ */ g(
|
|
142
142
|
"button",
|
|
143
143
|
{
|
|
144
144
|
type: "button",
|
|
145
|
-
className:
|
|
145
|
+
className: se,
|
|
146
146
|
onClick: w ? void 0 : c,
|
|
147
147
|
tabIndex: c && !w ? 0 : -1,
|
|
148
148
|
"aria-hidden": !c,
|
|
149
149
|
disabled: w,
|
|
150
|
-
"aria-label": c ?
|
|
150
|
+
"aria-label": c ? h("dateInput.openDatePicker") : void 0,
|
|
151
151
|
children: V
|
|
152
152
|
}
|
|
153
153
|
)
|
|
@@ -1,141 +1,141 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as y, jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect as N, useState as B, useRef as R, useMemo as D, useCallback as
|
|
3
|
+
import { useEffect as N, useState as B, useRef as R, useMemo as D, useCallback as b, useId as te } from "react";
|
|
4
4
|
import { Button as A } from "@digdir/designsystemet-react";
|
|
5
|
-
import { startOfMonth as
|
|
6
|
-
import { nb as
|
|
7
|
-
import { ChevronLeftIcon as
|
|
8
|
-
import { ChevronRightIcon as
|
|
5
|
+
import { startOfMonth as f, isValid as w, isSameMonth as C, format as u, startOfWeek as I, addDays as g, subMonths as S, addMonths as W, endOfWeek as L, isSameDay as F, isToday as re, endOfMonth as oe, eachDayOfInterval as ae, getDaysInMonth as ne, setDate as ie } from "date-fns";
|
|
6
|
+
import { nb as d } from "date-fns/locale";
|
|
7
|
+
import { ChevronLeftIcon as se } from "../../assets/images/ChevronLeftIcon.js";
|
|
8
|
+
import { ChevronRightIcon as de } from "../../assets/images/ChevronRightIcon.js";
|
|
9
9
|
import n from "./styles.module.css.js";
|
|
10
|
-
import { useLanguageOptional as
|
|
11
|
-
const
|
|
12
|
-
const o =
|
|
13
|
-
return
|
|
14
|
-
}, H = (
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
},
|
|
18
|
-
initialDate:
|
|
10
|
+
import { useLanguageOptional as le } from "../../context/LanguageContext.js";
|
|
11
|
+
const ce = (t) => {
|
|
12
|
+
const o = f(t), l = I(o, { locale: d }), z = L(oe(t), { locale: d });
|
|
13
|
+
return ae({ start: l, end: z });
|
|
14
|
+
}, H = (t) => t && t.charAt(0).toUpperCase() + t.slice(1), v = (t, o) => {
|
|
15
|
+
const l = Math.min(t.getDate(), ne(o));
|
|
16
|
+
return ie(f(o), l);
|
|
17
|
+
}, ue = ({
|
|
18
|
+
initialDate: t = /* @__PURE__ */ new Date(),
|
|
19
19
|
selectedDate: o = null,
|
|
20
|
-
onDateSelect:
|
|
20
|
+
onDateSelect: l,
|
|
21
21
|
"data-color": z,
|
|
22
|
-
"data-size":
|
|
22
|
+
"data-size": Y
|
|
23
23
|
}) => {
|
|
24
|
-
const { t: E } =
|
|
24
|
+
const { t: E } = le();
|
|
25
25
|
N(() => {
|
|
26
|
-
const
|
|
27
|
-
if (typeof document > "u" || document.getElementById(
|
|
26
|
+
const r = "rk-datepicker-inline-styles";
|
|
27
|
+
if (typeof document > "u" || document.getElementById(r)) return;
|
|
28
28
|
const e = fe(n), a = document.createElement("style");
|
|
29
|
-
a.id =
|
|
29
|
+
a.id = r, a.textContent = e, document.head.prepend(a);
|
|
30
30
|
}, []);
|
|
31
|
-
const [
|
|
32
|
-
|
|
33
|
-
), [
|
|
34
|
-
() => o && w(o) ? o :
|
|
31
|
+
const [c, x] = B(
|
|
32
|
+
f(o && w(o) ? o : t)
|
|
33
|
+
), [h, p] = B(
|
|
34
|
+
() => o && w(o) ? o : t
|
|
35
35
|
), P = R(null), $ = R(!1);
|
|
36
36
|
N(() => {
|
|
37
37
|
if (o && w(o)) {
|
|
38
|
-
|
|
39
|
-
const
|
|
38
|
+
p(o);
|
|
39
|
+
const r = f(o);
|
|
40
40
|
x(
|
|
41
|
-
(e) => C(
|
|
41
|
+
(e) => C(r, e) ? e : r
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
}, [o]), N(() => {
|
|
45
45
|
var e;
|
|
46
46
|
if (!$.current) return;
|
|
47
47
|
$.current = !1;
|
|
48
|
-
const
|
|
49
|
-
`[data-date="${
|
|
48
|
+
const r = (e = P.current) == null ? void 0 : e.querySelector(
|
|
49
|
+
`[data-date="${u(h, "yyyy-MM-dd")}"]`
|
|
50
50
|
);
|
|
51
|
-
|
|
52
|
-
}, [
|
|
51
|
+
r == null || r.focus();
|
|
52
|
+
}, [h, c]);
|
|
53
53
|
const M = D(
|
|
54
|
-
() =>
|
|
55
|
-
[
|
|
56
|
-
),
|
|
57
|
-
const
|
|
54
|
+
() => ce(c),
|
|
55
|
+
[c]
|
|
56
|
+
), U = D(() => {
|
|
57
|
+
const r = [];
|
|
58
58
|
for (let e = 0; e < M.length; e += 7)
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
}, [M]),
|
|
62
|
-
const
|
|
59
|
+
r.push(M.slice(e, e + 7));
|
|
60
|
+
return r;
|
|
61
|
+
}, [M]), K = D(() => {
|
|
62
|
+
const r = I(/* @__PURE__ */ new Date(), { locale: d });
|
|
63
63
|
return Array.from({ length: 7 }).map((e, a) => {
|
|
64
|
-
const
|
|
65
|
-
return H(
|
|
64
|
+
const m = u(g(r, a), "EEEEEE", { locale: d });
|
|
65
|
+
return H(m);
|
|
66
66
|
});
|
|
67
|
-
}, []),
|
|
68
|
-
x((
|
|
69
|
-
const e =
|
|
70
|
-
return
|
|
67
|
+
}, []), T = b(() => {
|
|
68
|
+
x((r) => {
|
|
69
|
+
const e = f(S(r, 1));
|
|
70
|
+
return p((a) => v(a, e)), e;
|
|
71
71
|
});
|
|
72
|
-
}, []),
|
|
73
|
-
x((
|
|
74
|
-
const e =
|
|
75
|
-
return
|
|
72
|
+
}, []), q = b(() => {
|
|
73
|
+
x((r) => {
|
|
74
|
+
const e = f(W(r, 1));
|
|
75
|
+
return p((a) => v(a, e)), e;
|
|
76
76
|
});
|
|
77
|
-
}, []), k =
|
|
78
|
-
(
|
|
79
|
-
|
|
77
|
+
}, []), k = b(
|
|
78
|
+
(r) => {
|
|
79
|
+
p(r), l == null || l(r);
|
|
80
80
|
},
|
|
81
|
-
[
|
|
82
|
-
),
|
|
83
|
-
$.current = !0,
|
|
84
|
-
(e) => C(
|
|
81
|
+
[l]
|
|
82
|
+
), s = b((r) => {
|
|
83
|
+
$.current = !0, p(r), x(
|
|
84
|
+
(e) => C(r, e) ? e : f(r)
|
|
85
85
|
);
|
|
86
|
-
}, []),
|
|
87
|
-
(
|
|
88
|
-
switch (
|
|
86
|
+
}, []), V = b(
|
|
87
|
+
(r, e) => {
|
|
88
|
+
switch (r.key) {
|
|
89
89
|
case "Enter":
|
|
90
90
|
case " ":
|
|
91
|
-
|
|
91
|
+
r.preventDefault(), k(e);
|
|
92
92
|
return;
|
|
93
93
|
case "ArrowLeft":
|
|
94
|
-
|
|
94
|
+
r.preventDefault(), s(g(e, -1));
|
|
95
95
|
return;
|
|
96
96
|
case "ArrowRight":
|
|
97
|
-
|
|
97
|
+
r.preventDefault(), s(g(e, 1));
|
|
98
98
|
return;
|
|
99
99
|
case "ArrowUp":
|
|
100
|
-
|
|
100
|
+
r.preventDefault(), s(g(e, -7));
|
|
101
101
|
return;
|
|
102
102
|
case "ArrowDown":
|
|
103
|
-
|
|
103
|
+
r.preventDefault(), s(g(e, 7));
|
|
104
104
|
return;
|
|
105
105
|
case "Home":
|
|
106
|
-
|
|
106
|
+
r.preventDefault(), s(I(e, { locale: d }));
|
|
107
107
|
return;
|
|
108
108
|
case "End":
|
|
109
|
-
|
|
109
|
+
r.preventDefault(), s(L(e, { locale: d }));
|
|
110
110
|
return;
|
|
111
111
|
case "PageUp":
|
|
112
|
-
|
|
112
|
+
r.preventDefault(), s(v(e, S(e, 1)));
|
|
113
113
|
return;
|
|
114
114
|
case "PageDown":
|
|
115
|
-
|
|
115
|
+
r.preventDefault(), s(v(e, W(e, 1)));
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
-
[k,
|
|
120
|
-
),
|
|
119
|
+
[k, s]
|
|
120
|
+
), _ = u(c, "MMMM", { locale: d }), G = u(c, "yyyy", { locale: d }), J = `${H(_)} ${G}`, O = te(), Q = C(h, c) ? h : v(h, c);
|
|
121
121
|
return /* @__PURE__ */ y(
|
|
122
122
|
"div",
|
|
123
123
|
{
|
|
124
124
|
className: n.calendarContainer,
|
|
125
125
|
"data-color": z,
|
|
126
|
-
"data-size":
|
|
126
|
+
"data-size": Y,
|
|
127
127
|
children: [
|
|
128
128
|
/* @__PURE__ */ y("div", { className: n.calendarHeader, children: [
|
|
129
|
-
/* @__PURE__ */ i("span", { className: n.monthYear, id: O, "aria-live": "polite", children:
|
|
129
|
+
/* @__PURE__ */ i("span", { className: n.monthYear, id: O, "aria-live": "polite", children: J }),
|
|
130
130
|
/* @__PURE__ */ y("div", { className: n.navigationButtons, children: [
|
|
131
131
|
/* @__PURE__ */ i(
|
|
132
132
|
A,
|
|
133
133
|
{
|
|
134
134
|
variant: "tertiary",
|
|
135
135
|
icon: !0,
|
|
136
|
-
onClick:
|
|
136
|
+
onClick: T,
|
|
137
137
|
"aria-label": E("datePicker.previousMonth"),
|
|
138
|
-
children: /* @__PURE__ */ i(
|
|
138
|
+
children: /* @__PURE__ */ i(se, {})
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
141
|
/* @__PURE__ */ i(
|
|
@@ -143,49 +143,49 @@ const le = (r) => {
|
|
|
143
143
|
{
|
|
144
144
|
variant: "tertiary",
|
|
145
145
|
icon: !0,
|
|
146
|
-
onClick:
|
|
146
|
+
onClick: q,
|
|
147
147
|
"aria-label": E("datePicker.nextMonth"),
|
|
148
|
-
children: /* @__PURE__ */ i(
|
|
148
|
+
children: /* @__PURE__ */ i(de, {})
|
|
149
149
|
}
|
|
150
150
|
)
|
|
151
151
|
] })
|
|
152
152
|
] }),
|
|
153
153
|
/* @__PURE__ */ y("div", { role: "grid", "aria-labelledby": O, className: n.gridWrapper, ref: P, children: [
|
|
154
|
-
/* @__PURE__ */ i("div", { role: "row", className: n.gridRow, children:
|
|
155
|
-
|
|
156
|
-
const a = C(e,
|
|
154
|
+
/* @__PURE__ */ i("div", { role: "row", className: n.gridRow, children: K.map((r) => /* @__PURE__ */ i("div", { role: "columnheader", className: n.dayNameCell, children: r }, r)) }),
|
|
155
|
+
U.map((r) => /* @__PURE__ */ i("div", { role: "row", className: n.gridRow, children: r.map((e) => {
|
|
156
|
+
const a = C(e, c), m = o && w(o) && F(e, o), j = re(e), X = a && F(e, Q), Z = [
|
|
157
157
|
n.dateCell,
|
|
158
158
|
a ? "" : n.otherMonth,
|
|
159
|
-
|
|
160
|
-
j && !
|
|
159
|
+
m ? n.selectedDate : "",
|
|
160
|
+
j && !m ? n.todayDate : ""
|
|
161
161
|
].filter(Boolean).join(" ");
|
|
162
162
|
return /* @__PURE__ */ i(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
165
|
role: "gridcell",
|
|
166
|
-
className:
|
|
167
|
-
"data-date":
|
|
166
|
+
className: Z,
|
|
167
|
+
"data-date": u(e, "yyyy-MM-dd"),
|
|
168
168
|
onClick: a ? () => k(e) : void 0,
|
|
169
|
-
onKeyDown: a ? (
|
|
170
|
-
tabIndex: a ?
|
|
171
|
-
"aria-selected": a ? !!
|
|
169
|
+
onKeyDown: a ? (ee) => V(ee, e) : void 0,
|
|
170
|
+
tabIndex: a ? X ? 0 : -1 : void 0,
|
|
171
|
+
"aria-selected": a ? !!m : void 0,
|
|
172
172
|
"aria-disabled": !a || void 0,
|
|
173
173
|
"aria-current": j ? "date" : void 0,
|
|
174
|
-
"aria-label":
|
|
175
|
-
children: /* @__PURE__ */ i("span", { className: n.dateNumberContainer, children:
|
|
174
|
+
"aria-label": u(e, "PPP", { locale: d }),
|
|
175
|
+
children: /* @__PURE__ */ i("span", { className: n.dateNumberContainer, children: u(e, "d") })
|
|
176
176
|
},
|
|
177
177
|
e.toISOString()
|
|
178
178
|
);
|
|
179
|
-
}) },
|
|
179
|
+
}) }, r[0].toISOString()))
|
|
180
180
|
] })
|
|
181
181
|
]
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
};
|
|
185
|
-
|
|
186
|
-
function fe(
|
|
185
|
+
ue.displayName = "DatePicker";
|
|
186
|
+
function fe(t) {
|
|
187
187
|
return `
|
|
188
|
-
.${
|
|
188
|
+
.${t.calendarContainer} {
|
|
189
189
|
display: inline-flex;
|
|
190
190
|
padding: var(--ds-size-8, 32px);
|
|
191
191
|
flex-direction: column;
|
|
@@ -199,13 +199,13 @@ function fe(r) {
|
|
|
199
199
|
max-width: 100%;
|
|
200
200
|
box-sizing: border-box;
|
|
201
201
|
}
|
|
202
|
-
.${
|
|
202
|
+
.${t.calendarHeader} {
|
|
203
203
|
display: flex;
|
|
204
204
|
justify-content: space-between;
|
|
205
205
|
align-items: center;
|
|
206
206
|
align-self: stretch;
|
|
207
207
|
}
|
|
208
|
-
.${
|
|
208
|
+
.${t.monthYear} {
|
|
209
209
|
color: var(--ds-color-text-default, #2b2b2b);
|
|
210
210
|
font-family: var(--ds-font-family, sans-serif);
|
|
211
211
|
font-size: var(--ds-heading-sm-font-size, 1.5rem);
|
|
@@ -213,24 +213,24 @@ function fe(r) {
|
|
|
213
213
|
line-height: var(--ds-heading-sm-line-height, 1.3);
|
|
214
214
|
margin: 0;
|
|
215
215
|
}
|
|
216
|
-
.${
|
|
216
|
+
.${t.navigationButtons} {
|
|
217
217
|
display: flex;
|
|
218
218
|
gap: var(--ds-size-1, 4px);
|
|
219
219
|
}
|
|
220
|
-
.${
|
|
220
|
+
.${t.navigationButtons} > button:disabled svg {
|
|
221
221
|
opacity: var(--ds-opacity-disabled, 0.3);
|
|
222
222
|
}
|
|
223
|
-
.${
|
|
223
|
+
.${t.gridWrapper} {
|
|
224
224
|
width: 100%;
|
|
225
225
|
overflow: hidden;
|
|
226
226
|
}
|
|
227
|
-
.${
|
|
227
|
+
.${t.gridRow} {
|
|
228
228
|
display: grid;
|
|
229
229
|
grid-template-columns: repeat(7, 1fr);
|
|
230
230
|
width: 100%;
|
|
231
231
|
text-align: center;
|
|
232
232
|
}
|
|
233
|
-
.${
|
|
233
|
+
.${t.dayNameCell} {
|
|
234
234
|
display: flex;
|
|
235
235
|
padding: var(--ds-size-2, 8px);
|
|
236
236
|
flex-direction: column;
|
|
@@ -245,7 +245,7 @@ function fe(r) {
|
|
|
245
245
|
box-sizing: border-box;
|
|
246
246
|
min-width: 0;
|
|
247
247
|
}
|
|
248
|
-
.${
|
|
248
|
+
.${t.dateCell} {
|
|
249
249
|
display: flex;
|
|
250
250
|
padding: var(--ds-size-5, 22px);
|
|
251
251
|
flex-direction: column;
|
|
@@ -265,13 +265,13 @@ function fe(r) {
|
|
|
265
265
|
user-select: none;
|
|
266
266
|
min-width: 0;
|
|
267
267
|
}
|
|
268
|
-
.${
|
|
268
|
+
.${t.dateCell}:focus-visible {
|
|
269
269
|
outline: var(--ds-border-width-focus, 3px) solid var(--ds-color-focus-outer, #2b2b2b);
|
|
270
270
|
outline-offset: calc(-1 * var(--ds-border-width-focus, 3px));
|
|
271
271
|
position: relative;
|
|
272
272
|
z-index: 2;
|
|
273
273
|
}
|
|
274
|
-
.${
|
|
274
|
+
.${t.dateNumberContainer} {
|
|
275
275
|
display: flex;
|
|
276
276
|
justify-content: center;
|
|
277
277
|
align-items: center;
|
|
@@ -283,69 +283,72 @@ function fe(r) {
|
|
|
283
283
|
box-sizing: border-box;
|
|
284
284
|
background-color: transparent;
|
|
285
285
|
}
|
|
286
|
-
.${
|
|
286
|
+
.${t.dateCell}:hover:not(.${t.otherMonth}):not(.${t.disabled}) {
|
|
287
287
|
background-color: var(--ds-color-surface-hover, #eee);
|
|
288
288
|
position: relative;
|
|
289
289
|
z-index: 1;
|
|
290
290
|
}
|
|
291
|
-
.${
|
|
292
|
-
|
|
291
|
+
.${t.otherMonth} {
|
|
292
|
+
/* Neutral-scoped tokens on purpose: under the red color scope the
|
|
293
|
+
scope-relative tints turn pink, which emphasized the outside days
|
|
294
|
+
instead of muting them. */
|
|
295
|
+
color: var(--ds-color-neutral-text-subtle, #aaa);
|
|
293
296
|
cursor: default;
|
|
294
297
|
pointer-events: none;
|
|
295
|
-
background-color: var(--ds-color-surface-tinted, #e8e8e8);
|
|
296
|
-
border: var(--ds-border-width-default, 1px) solid var(--ds-color-border-subtle, #bcbcbc);
|
|
298
|
+
background-color: var(--ds-color-neutral-surface-tinted, #e8e8e8);
|
|
299
|
+
border: var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-subtle, #bcbcbc);
|
|
297
300
|
margin: -0.5px;
|
|
298
301
|
}
|
|
299
|
-
.${
|
|
302
|
+
.${t.selectedDate} {
|
|
300
303
|
background-color: var(--ds-color-base-default, #C30000);
|
|
301
304
|
border-color: var(--ds-color-base-default, #C30000);
|
|
302
305
|
color: var(--ds-color-base-contrast-default, #fff);
|
|
303
306
|
position: relative;
|
|
304
307
|
z-index: 1;
|
|
305
308
|
}
|
|
306
|
-
.${
|
|
309
|
+
.${t.selectedDate} .${t.dateNumberContainer} {
|
|
307
310
|
color: var(--ds-color-base-contrast-default, #fff);
|
|
308
311
|
font-weight: var(--ds-font-weight-semibold, 600);
|
|
309
312
|
background-color: transparent;
|
|
310
313
|
}
|
|
311
|
-
.${
|
|
314
|
+
.${t.todayDate} .${t.dateNumberContainer} {
|
|
312
315
|
font-weight: var(--ds-font-weight-semibold, 600);
|
|
313
316
|
}
|
|
314
317
|
@media (max-width: 480px) {
|
|
315
|
-
.${
|
|
318
|
+
.${t.calendarContainer} {
|
|
316
319
|
padding: var(--ds-size-4, 16px);
|
|
317
320
|
gap: var(--ds-size-2, 8px);
|
|
318
321
|
width: 100%;
|
|
319
322
|
}
|
|
320
|
-
.${
|
|
323
|
+
.${t.monthYear} {
|
|
321
324
|
font-size: var(--ds-heading-xs-font-size, 1.125rem);
|
|
322
325
|
}
|
|
323
|
-
.${
|
|
326
|
+
.${t.dayNameCell} {
|
|
324
327
|
padding: var(--ds-size-1, 4px);
|
|
325
328
|
font-size: var(--ds-font-size-1, 12px);
|
|
326
329
|
}
|
|
327
|
-
.${
|
|
330
|
+
.${t.dateCell} {
|
|
328
331
|
padding: var(--ds-size-2, 8px);
|
|
329
332
|
font-size: var(--ds-font-size-1, 12px);
|
|
330
333
|
}
|
|
331
|
-
.${
|
|
334
|
+
.${t.dateNumberContainer} {
|
|
332
335
|
width: 20px;
|
|
333
336
|
height: 20px;
|
|
334
337
|
}
|
|
335
338
|
}
|
|
336
339
|
@media (max-width: 360px) {
|
|
337
|
-
.${
|
|
340
|
+
.${t.calendarContainer} {
|
|
338
341
|
padding: var(--ds-size-2, 8px);
|
|
339
342
|
}
|
|
340
|
-
.${
|
|
343
|
+
.${t.dayNameCell} {
|
|
341
344
|
padding: 2px;
|
|
342
345
|
font-size: 10px;
|
|
343
346
|
}
|
|
344
|
-
.${
|
|
347
|
+
.${t.dateCell} {
|
|
345
348
|
padding: var(--ds-size-1, 4px);
|
|
346
349
|
font-size: 11px;
|
|
347
350
|
}
|
|
348
|
-
.${
|
|
351
|
+
.${t.dateNumberContainer} {
|
|
349
352
|
width: 16px;
|
|
350
353
|
height: 16px;
|
|
351
354
|
}
|
|
@@ -353,5 +356,5 @@ function fe(r) {
|
|
|
353
356
|
`;
|
|
354
357
|
}
|
|
355
358
|
export {
|
|
356
|
-
|
|
359
|
+
ue as DatePicker
|
|
357
360
|
};
|