rk-designsystem 1.3.4 → 1.4.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/README.md +9 -3
- package/dist/components/Carousel/index.js +215 -166
- package/dist/components/Carousel/styles.module.css.js +35 -31
- package/dist/components/DateInput/index.js +85 -87
- package/dist/components/DateInput/styles.module.css.js +1 -1
- package/dist/components/DatePicker/index.js +197 -175
- package/dist/components/DatePicker/styles.module.css.js +20 -20
- package/dist/components/Donor/index.js +71 -68
- package/dist/components/Donor/styles.module.css.js +22 -22
- package/dist/components/Footer/index.js +88 -86
- package/dist/components/GraphicElement/index.js +3 -3
- package/dist/components/Header/index.js +277 -242
- package/dist/components/Header/styles.module.css.js +49 -49
- package/dist/context/LanguageContext.js +17 -14
- package/dist/index.d.ts +44 -5
- package/dist/rk-designsystem.css +1 -1
- package/dist/translations/index.js +10 -2
- package/package.json +18 -26
- package/dist/utils/search-index.js +0 -106
|
@@ -1,52 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { RedCrossLogo as
|
|
5
|
-
import { useLanguageOptional as
|
|
6
|
-
import { Link as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Avatar as
|
|
9
|
-
import { Paragraph as
|
|
10
|
-
import { Search as
|
|
11
|
-
import { Switch as
|
|
12
|
-
import { Dropdown as
|
|
2
|
+
import { jsxs as o, jsx as r, Fragment as Te } from "react/jsx-runtime";
|
|
3
|
+
import C, { useState as E, useEffect as g, useMemo as Oe } from "react";
|
|
4
|
+
import { RedCrossLogo as ie } from "../../assets/logos/RedCrossLogo.js";
|
|
5
|
+
import { useLanguageOptional as Re } from "../../context/LanguageContext.js";
|
|
6
|
+
import { Link as D } from "../Link/index.js";
|
|
7
|
+
import { Button as K } from "../Button/index.js";
|
|
8
|
+
import { Avatar as Ie } from "../Avatar/index.js";
|
|
9
|
+
import { Paragraph as U } from "../Paragraph/index.js";
|
|
10
|
+
import { Search as W } from "../Search/index.js";
|
|
11
|
+
import { Switch as Q } from "../Switch/index.js";
|
|
12
|
+
import { Dropdown as c } from "../Dropdown/index.js";
|
|
13
13
|
import n from "./styles.module.css.js";
|
|
14
|
-
import { ChevronDownIcon as
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
return
|
|
14
|
+
import { ChevronDownIcon as oe, XMarkIcon as se, MagnifyingGlassIcon as le, MenuHamburgerIcon as Se, HeartIcon as De } from "@navikt/aksel-icons";
|
|
15
|
+
const de = 'a[href], button, input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
16
|
+
function We(w) {
|
|
17
|
+
return w.split(/\s+/).map((e) => e[0] ?? "").join("").slice(0, 2).toUpperCase();
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
variant:
|
|
19
|
+
const Ae = [], Pe = ({
|
|
20
|
+
variant: w = "default",
|
|
21
21
|
"data-color": e = "primary-color-red",
|
|
22
|
-
activePage:
|
|
23
|
-
setPage:
|
|
24
|
-
children:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
activePage: ce,
|
|
23
|
+
setPage: f,
|
|
24
|
+
children: he,
|
|
25
|
+
// All three OFF by default: the old defaults showed a placeholder user,
|
|
26
|
+
// a dead login link and a search box over data the consumer never
|
|
27
|
+
// provided, on every page that dropped in a bare <Header />.
|
|
28
|
+
showUser: ue = !1,
|
|
29
|
+
showSearch: me = !1,
|
|
30
|
+
showLogin: fe = !1,
|
|
31
|
+
loginHref: V,
|
|
32
|
+
onLoginClick: _,
|
|
33
|
+
searchItems: G = Ae,
|
|
34
|
+
showCta: ge = !1,
|
|
35
|
+
ctaLabel: pe,
|
|
36
|
+
ctaIcon: X = /* @__PURE__ */ r(De, { "aria-hidden": !0 }),
|
|
37
|
+
onCtaClick: ve,
|
|
38
|
+
showThemeToggle: xe = !1,
|
|
39
|
+
secondaryLogo: be = !1,
|
|
40
|
+
secondaryLogoSrc: Y,
|
|
41
|
+
secondaryLogoSrcDark: J,
|
|
42
|
+
secondaryLogoAlt: ye = "Secondary Logo",
|
|
43
|
+
navItems: b,
|
|
44
|
+
showNavItems: P = !0,
|
|
45
|
+
showMenuButton: $e = !0,
|
|
46
|
+
showHeaderExtension: A = !1,
|
|
47
|
+
showModeToggle: k = !1,
|
|
48
|
+
showLanguageSwitch: B = !1,
|
|
49
|
+
extensionColor: Z,
|
|
50
|
+
userName: M,
|
|
51
|
+
userInitials: we,
|
|
52
|
+
userAvatarSrc: j,
|
|
53
|
+
onUserClick: z
|
|
48
54
|
}) => {
|
|
49
|
-
const [
|
|
55
|
+
const [l, L] = E(!1), [h, v] = E(!1), T = C.useRef(null), ee = C.useRef(null), q = C.useRef(null), te = C.useRef(null), [u, y] = E(""), [x, ke] = E(() => {
|
|
50
56
|
var t;
|
|
51
57
|
if (typeof document < "u") {
|
|
52
58
|
const a = document.documentElement.getAttribute("data-color-scheme");
|
|
@@ -54,238 +60,257 @@ const Ue = ({
|
|
|
54
60
|
if ((t = window.matchMedia) != null && t.call(window, "(prefers-color-scheme: dark)").matches) return "dark";
|
|
55
61
|
}
|
|
56
62
|
return "light";
|
|
57
|
-
}), { language:
|
|
58
|
-
|
|
63
|
+
}), { language: ne, setLanguage: O, t: s } = Re(), [m, ze] = E(!1), Le = k && (A && !m || m);
|
|
64
|
+
g(() => {
|
|
59
65
|
const t = "rk-header-inline-styles";
|
|
60
66
|
if (typeof document > "u" || document.getElementById(t)) return;
|
|
61
|
-
const a =
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
if (!(typeof document > "u") &&
|
|
67
|
+
const a = Me(n), i = document.createElement("style");
|
|
68
|
+
i.id = t, i.textContent = a, document.head.prepend(i);
|
|
69
|
+
}, []), g(() => {
|
|
70
|
+
L(!1), v(!1), y("");
|
|
71
|
+
}, [ce]), g(() => {
|
|
72
|
+
if (!(typeof document > "u") && l && m) {
|
|
67
73
|
const t = document.body.style.overflow;
|
|
68
74
|
return document.body.style.overflow = "hidden", () => {
|
|
69
75
|
document.body.style.overflow = t;
|
|
70
76
|
};
|
|
71
77
|
}
|
|
72
|
-
}, [
|
|
78
|
+
}, [l, m]), g(() => {
|
|
73
79
|
if (typeof window > "u" || typeof window.matchMedia > "u") return;
|
|
74
|
-
const t = window.matchMedia("(max-width: 850px)"), a = (
|
|
80
|
+
const t = window.matchMedia("(max-width: 850px)"), a = (i) => ze("matches" in i ? i.matches : t.matches);
|
|
75
81
|
return a(t), t.addEventListener ? t.addEventListener("change", a) : t.addListener(a), () => {
|
|
76
82
|
t.removeEventListener ? t.removeEventListener("change", a) : t.removeListener(a);
|
|
77
83
|
};
|
|
78
|
-
}, []),
|
|
84
|
+
}, []), g(() => {
|
|
79
85
|
if (typeof document > "u") return;
|
|
80
86
|
const t = document.querySelector(`.${n.header}`);
|
|
81
87
|
if (!t) return;
|
|
82
88
|
const a = () => {
|
|
83
|
-
const
|
|
84
|
-
document.documentElement.style.setProperty("--header-height-mobile", `${
|
|
89
|
+
const d = t.offsetHeight;
|
|
90
|
+
document.documentElement.style.setProperty("--header-height-mobile", `${d}px`);
|
|
85
91
|
};
|
|
86
92
|
a(), window.addEventListener("resize", a);
|
|
87
|
-
const
|
|
93
|
+
const i = new ResizeObserver(() => {
|
|
88
94
|
a();
|
|
89
95
|
});
|
|
90
|
-
return
|
|
91
|
-
window.removeEventListener("resize", a),
|
|
96
|
+
return i.observe(t), () => {
|
|
97
|
+
window.removeEventListener("resize", a), i.disconnect();
|
|
92
98
|
};
|
|
93
|
-
}, [
|
|
99
|
+
}, [m]), g(() => {
|
|
94
100
|
if (typeof document > "u") return;
|
|
95
101
|
const t = document.querySelector(`.${n.logoWrapper}`);
|
|
96
102
|
if (!t) return;
|
|
97
103
|
const a = () => {
|
|
98
|
-
const
|
|
99
|
-
document.documentElement.style.setProperty("--rk-logo-width", `${
|
|
104
|
+
const i = t.offsetWidth;
|
|
105
|
+
document.documentElement.style.setProperty("--rk-logo-width", `${i}px`);
|
|
100
106
|
};
|
|
101
107
|
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
102
|
-
}, [
|
|
103
|
-
if (typeof document > "u" || !
|
|
108
|
+
}, [m]), g(() => {
|
|
109
|
+
if (typeof document > "u" || !h) {
|
|
104
110
|
document.documentElement.style.setProperty("--rk-search-overlay-height", "0px");
|
|
105
111
|
return;
|
|
106
112
|
}
|
|
107
113
|
const t = document.querySelector(`.${n.searchOverlay}`);
|
|
108
114
|
if (!t) return;
|
|
109
115
|
const a = () => {
|
|
110
|
-
const
|
|
111
|
-
document.documentElement.style.setProperty("--rk-search-overlay-height", `${
|
|
116
|
+
const d = t.offsetHeight;
|
|
117
|
+
document.documentElement.style.setProperty("--rk-search-overlay-height", `${d}px`);
|
|
112
118
|
};
|
|
113
119
|
requestAnimationFrame(a), window.addEventListener("resize", a);
|
|
114
|
-
const
|
|
115
|
-
return
|
|
116
|
-
window.removeEventListener("resize", a),
|
|
120
|
+
const i = new ResizeObserver(a);
|
|
121
|
+
return i.observe(t), () => {
|
|
122
|
+
window.removeEventListener("resize", a), i.disconnect();
|
|
117
123
|
};
|
|
118
|
-
}, [
|
|
119
|
-
if (!
|
|
124
|
+
}, [h]), g(() => {
|
|
125
|
+
if (!l && !h) return;
|
|
120
126
|
const t = (a) => {
|
|
121
|
-
var
|
|
122
|
-
a.key === "Escape" && (
|
|
127
|
+
var i, d;
|
|
128
|
+
a.key === "Escape" && (l && (L(!1), (i = T.current) == null || i.focus()), h && (v(!1), (d = ee.current) == null || d.focus()));
|
|
123
129
|
};
|
|
124
130
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
125
|
-
}, [
|
|
126
|
-
var t, a,
|
|
127
|
-
|
|
128
|
-
}, [
|
|
129
|
-
|
|
130
|
-
const t =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
}, [l, h]), g(() => {
|
|
132
|
+
var t, a, i;
|
|
133
|
+
h ? (t = te.current) == null || t.focus() : l && ((i = (a = q.current) == null ? void 0 : a.querySelector(de)) == null || i.focus());
|
|
134
|
+
}, [l, h]), g(() => {
|
|
135
|
+
if (!l || !m) return;
|
|
136
|
+
const t = (a) => {
|
|
137
|
+
if (a.key !== "Tab") return;
|
|
138
|
+
const i = q.current;
|
|
139
|
+
if (!i) return;
|
|
140
|
+
const d = (p) => typeof p.checkVisibility == "function" ? p.checkVisibility() : p.offsetParent !== null, N = Array.from(i.querySelectorAll(de)).filter(
|
|
141
|
+
(p) => !p.hasAttribute("disabled") && p.getAttribute("aria-hidden") !== "true" && d(p)
|
|
142
|
+
), R = [T.current, ...N].filter((p) => !!p), I = R[0], H = R[R.length - 1];
|
|
143
|
+
if (!I || !H) return;
|
|
144
|
+
const S = document.activeElement;
|
|
145
|
+
(a.shiftKey ? S === I : S === H) ? (a.preventDefault(), (a.shiftKey ? H : I).focus()) : (!S || !R.includes(S)) && (a.preventDefault(), I.focus());
|
|
146
|
+
};
|
|
147
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
148
|
+
}, [l, m]);
|
|
149
|
+
const re = C.useRef(!1);
|
|
150
|
+
g(() => {
|
|
151
|
+
var t;
|
|
152
|
+
re.current && !l && typeof document < "u" && (!document.activeElement || document.activeElement === document.body) && ((t = T.current) == null || t.focus()), re.current = l;
|
|
153
|
+
}, [l]);
|
|
154
|
+
const F = () => {
|
|
155
|
+
const t = x === "light" ? "dark" : "light";
|
|
156
|
+
ke(t), document.documentElement.setAttribute("data-color-scheme", t);
|
|
157
|
+
}, Ne = (t) => {
|
|
158
|
+
f && (t.preventDefault(), f("home")), L(!1), v(!1);
|
|
159
|
+
}, Ce = () => {
|
|
160
|
+
L(!l), h && v(!1), !l && typeof document < "u" && requestAnimationFrame(() => {
|
|
136
161
|
const t = document.querySelector(`.${n.header}`);
|
|
137
162
|
if (t) {
|
|
138
163
|
const a = t.offsetHeight;
|
|
139
164
|
document.documentElement.style.setProperty("--header-height-mobile", `${a}px`);
|
|
140
165
|
}
|
|
141
166
|
});
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
},
|
|
145
|
-
if (!
|
|
146
|
-
const t =
|
|
147
|
-
return
|
|
148
|
-
const
|
|
149
|
-
return
|
|
167
|
+
}, Ee = () => {
|
|
168
|
+
v(!h), l && L(!1);
|
|
169
|
+
}, $ = Oe(() => {
|
|
170
|
+
if (!u.trim()) return [];
|
|
171
|
+
const t = u.toLowerCase();
|
|
172
|
+
return G.filter((a) => a.title.toLowerCase().includes(t)).sort((a, i) => {
|
|
173
|
+
const d = a.title.toLowerCase().startsWith(t) ? 0 : 1, N = i.title.toLowerCase().startsWith(t) ? 0 : 1;
|
|
174
|
+
return d - N;
|
|
150
175
|
});
|
|
151
|
-
}, [
|
|
152
|
-
!
|
|
153
|
-
},
|
|
154
|
-
|
|
176
|
+
}, [u, G]), ae = () => {
|
|
177
|
+
!f || !u.trim() || (f(`search/${encodeURIComponent(u.trim())}`), v(!1), y(""));
|
|
178
|
+
}, Be = (t) => {
|
|
179
|
+
f && f(t), v(!1), y("");
|
|
155
180
|
};
|
|
156
181
|
return (
|
|
157
182
|
// The attribute sets a real Digdir theme scope, so the extension CSS can
|
|
158
183
|
// use scope-relative variables (--ds-color-base-default etc.) and any
|
|
159
184
|
// scope themes it correctly. Legacy 'primary' aliases to the scope it
|
|
160
185
|
// always meant.
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
186
|
+
/* @__PURE__ */ o("header", { className: n.header, "data-open": l ? "true" : "false", "data-color": e === "primary" ? "primary-color-red" : e, "data-variant": w, "data-header-extension": A ? "true" : "false", children: [
|
|
187
|
+
A && /* @__PURE__ */ r("div", { className: `${n.headerExtension}${Z === "tinted" ? ` ${n.headerExtensionTinted}` : ""}`, "data-color-scheme": "light", "data-extension-color": Z, children: /* @__PURE__ */ o("div", { className: n.extensionContentWrapper, children: [
|
|
188
|
+
k && /* @__PURE__ */ r("div", { className: n.extensionContent, children: /* @__PURE__ */ r(
|
|
189
|
+
Q,
|
|
165
190
|
{
|
|
166
191
|
"data-size": "sm",
|
|
167
|
-
checked:
|
|
168
|
-
onChange:
|
|
169
|
-
label:
|
|
192
|
+
checked: x === "dark",
|
|
193
|
+
onChange: F,
|
|
194
|
+
label: s("header.darkMode"),
|
|
170
195
|
color: "neutral",
|
|
171
196
|
"data-color-scheme": "light"
|
|
172
197
|
}
|
|
173
198
|
) }),
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/* @__PURE__ */ r("span", { className: n.languageLabel, children:
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
|
|
199
|
+
k && B && /* @__PURE__ */ r("div", { className: n.extensionDivider }),
|
|
200
|
+
B && /* @__PURE__ */ o("div", { className: n.languageSwitch, children: [
|
|
201
|
+
/* @__PURE__ */ r("span", { className: n.languageLabel, children: s("header.language") }),
|
|
202
|
+
/* @__PURE__ */ o(c.TriggerContext, { children: [
|
|
203
|
+
/* @__PURE__ */ o(
|
|
204
|
+
c.Trigger,
|
|
180
205
|
{
|
|
181
206
|
className: n.languageLink,
|
|
182
|
-
"aria-label":
|
|
207
|
+
"aria-label": s("header.selectLanguage"),
|
|
183
208
|
style: { background: "transparent", border: "none", padding: 0, cursor: "pointer", font: "inherit" },
|
|
184
209
|
children: [
|
|
185
|
-
|
|
210
|
+
ne,
|
|
186
211
|
" ",
|
|
187
|
-
/* @__PURE__ */ r(
|
|
212
|
+
/* @__PURE__ */ r(oe, { "aria-hidden": !0 })
|
|
188
213
|
]
|
|
189
214
|
}
|
|
190
215
|
),
|
|
191
216
|
/* @__PURE__ */ r(
|
|
192
|
-
|
|
217
|
+
c,
|
|
193
218
|
{
|
|
194
|
-
"data-color-scheme":
|
|
219
|
+
"data-color-scheme": x,
|
|
195
220
|
placement: "bottom-end",
|
|
196
|
-
children: /* @__PURE__ */
|
|
197
|
-
/* @__PURE__ */ r(
|
|
198
|
-
/* @__PURE__ */ r(
|
|
221
|
+
children: /* @__PURE__ */ o(c.List, { children: [
|
|
222
|
+
/* @__PURE__ */ r(c.Item, { children: /* @__PURE__ */ r(c.Button, { onClick: () => O("NO"), children: "Norsk (NO)" }) }),
|
|
223
|
+
/* @__PURE__ */ r(c.Item, { children: /* @__PURE__ */ r(c.Button, { onClick: () => O("EN"), children: "English (EN)" }) })
|
|
199
224
|
] })
|
|
200
225
|
}
|
|
201
226
|
)
|
|
202
227
|
] })
|
|
203
228
|
] })
|
|
204
229
|
] }) }),
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ o("div", { className: n.headerInner, children: [
|
|
231
|
+
/* @__PURE__ */ o("div", { className: n.logoWrapper, children: [
|
|
207
232
|
/* @__PURE__ */ r(
|
|
208
|
-
|
|
233
|
+
D,
|
|
209
234
|
{
|
|
210
235
|
href: "/",
|
|
211
236
|
className: `${n.logo} ${n.primaryLogo}`,
|
|
212
|
-
"aria-label":
|
|
213
|
-
onClick:
|
|
214
|
-
children: /* @__PURE__ */ r(
|
|
237
|
+
"aria-label": s("header.homeAriaLabel"),
|
|
238
|
+
onClick: Ne,
|
|
239
|
+
children: /* @__PURE__ */ r(ie, { className: n.redCrossLogo })
|
|
215
240
|
}
|
|
216
241
|
),
|
|
217
|
-
|
|
242
|
+
be && /* @__PURE__ */ r("div", { className: n.secondaryLogoWrapper, children: Y ? /* @__PURE__ */ r(
|
|
218
243
|
"img",
|
|
219
244
|
{
|
|
220
|
-
src:
|
|
221
|
-
alt:
|
|
245
|
+
src: x === "dark" && J ? J : Y,
|
|
246
|
+
alt: ye,
|
|
222
247
|
className: n.secondaryLogo
|
|
223
248
|
}
|
|
224
249
|
) : /* @__PURE__ */ r("div", { className: n.slotComponent, children: /* @__PURE__ */ r("div", { className: n.slotContainer, children: /* @__PURE__ */ r("p", { className: n.slotText, children: "SLOT" }) }) }) })
|
|
225
250
|
] }),
|
|
226
|
-
|
|
227
|
-
|
|
251
|
+
P && b && b.length > 0 && !m && /* @__PURE__ */ r("nav", { className: n.navItems, children: b.map((t, a) => /* @__PURE__ */ r(
|
|
252
|
+
D,
|
|
228
253
|
{
|
|
229
254
|
href: t.href,
|
|
230
255
|
className: n.navLink,
|
|
231
|
-
onClick: (
|
|
232
|
-
|
|
256
|
+
onClick: (i) => {
|
|
257
|
+
f && (i.preventDefault(), f(t.href));
|
|
233
258
|
},
|
|
234
259
|
children: t.label
|
|
235
260
|
},
|
|
236
261
|
a
|
|
237
262
|
)) }),
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
|
|
263
|
+
/* @__PURE__ */ o("div", { className: n.actions, children: [
|
|
264
|
+
ge && // data-color="main" was removed here and on the search/menu buttons below:
|
|
240
265
|
// "main" matches no theme scope, so the buttons always inherited the
|
|
241
266
|
// ancestor scope — now they do so explicitly. data-color is
|
|
242
267
|
// compile-checked against the real scopes since 1.4.0.
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
268
|
+
/* @__PURE__ */ o(
|
|
269
|
+
K,
|
|
245
270
|
{
|
|
246
271
|
variant: "primary",
|
|
247
272
|
"data-size": "md",
|
|
248
273
|
className: n.ctaButton,
|
|
249
|
-
onClick:
|
|
274
|
+
onClick: ve,
|
|
250
275
|
children: [
|
|
251
|
-
|
|
252
|
-
/* @__PURE__ */ r("span", { className:
|
|
276
|
+
X,
|
|
277
|
+
/* @__PURE__ */ r("span", { className: X ? n.buttonText : void 0, children: pe || s("header.supportUs") })
|
|
253
278
|
]
|
|
254
279
|
}
|
|
255
280
|
),
|
|
256
|
-
|
|
257
|
-
|
|
281
|
+
xe && !Le && /* @__PURE__ */ r("div", { className: n.themeToggle, children: /* @__PURE__ */ r(
|
|
282
|
+
Q,
|
|
258
283
|
{
|
|
259
|
-
checked:
|
|
260
|
-
onChange:
|
|
261
|
-
"aria-label":
|
|
284
|
+
checked: x === "dark",
|
|
285
|
+
onChange: F,
|
|
286
|
+
"aria-label": s("header.toggleTheme")
|
|
262
287
|
}
|
|
263
288
|
) }),
|
|
264
|
-
|
|
265
|
-
const t =
|
|
266
|
-
return /* @__PURE__ */
|
|
289
|
+
ue && M && (() => {
|
|
290
|
+
const t = M, a = we ?? We(M), i = !!z;
|
|
291
|
+
return /* @__PURE__ */ o(
|
|
267
292
|
"div",
|
|
268
293
|
{
|
|
269
294
|
className: n.userInfo,
|
|
270
|
-
onClick:
|
|
271
|
-
role:
|
|
272
|
-
tabIndex:
|
|
273
|
-
onKeyDown:
|
|
274
|
-
(
|
|
295
|
+
onClick: z,
|
|
296
|
+
role: i ? "button" : void 0,
|
|
297
|
+
tabIndex: i ? 0 : void 0,
|
|
298
|
+
onKeyDown: i ? (d) => {
|
|
299
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), z == null || z());
|
|
275
300
|
} : void 0,
|
|
276
|
-
style:
|
|
301
|
+
style: i ? { cursor: "pointer" } : void 0,
|
|
277
302
|
children: [
|
|
278
|
-
/* @__PURE__ */ r(
|
|
303
|
+
/* @__PURE__ */ r(U, { "data-size": "md", className: n.userName, children: t }),
|
|
279
304
|
/* @__PURE__ */ r(
|
|
280
|
-
|
|
305
|
+
Ie,
|
|
281
306
|
{
|
|
282
307
|
"aria-label": t,
|
|
283
308
|
variant: "circle",
|
|
284
|
-
initials:
|
|
285
|
-
children:
|
|
309
|
+
initials: j ? void 0 : a,
|
|
310
|
+
children: j ? /* @__PURE__ */ r(
|
|
286
311
|
"img",
|
|
287
312
|
{
|
|
288
|
-
src:
|
|
313
|
+
src: j,
|
|
289
314
|
alt: "",
|
|
290
315
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
291
316
|
}
|
|
@@ -296,176 +321,186 @@ const Ue = ({
|
|
|
296
321
|
}
|
|
297
322
|
);
|
|
298
323
|
})(),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
/* @__PURE__ */ r("div", { className: n.underline })
|
|
302
|
-
] }),
|
|
303
|
-
re && /* @__PURE__ */ r("div", { className: n.searchButtonWrapper, children: /* @__PURE__ */ i(
|
|
304
|
-
D,
|
|
324
|
+
fe && /* @__PURE__ */ o(
|
|
325
|
+
"a",
|
|
305
326
|
{
|
|
306
|
-
|
|
327
|
+
href: V ?? "#",
|
|
328
|
+
className: n.loginLink,
|
|
329
|
+
onClick: _ ? (t) => {
|
|
330
|
+
V || t.preventDefault(), _();
|
|
331
|
+
} : void 0,
|
|
332
|
+
children: [
|
|
333
|
+
/* @__PURE__ */ r(U, { "data-size": "md", className: n.loginText, children: s("header.login") }),
|
|
334
|
+
/* @__PURE__ */ r("div", { className: n.underline })
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
me && /* @__PURE__ */ r("div", { className: n.searchButtonWrapper, children: /* @__PURE__ */ o(
|
|
339
|
+
K,
|
|
340
|
+
{
|
|
341
|
+
ref: ee,
|
|
307
342
|
variant: "secondary",
|
|
308
343
|
"data-size": "md",
|
|
309
|
-
onClick:
|
|
310
|
-
"aria-expanded":
|
|
311
|
-
"aria-label":
|
|
344
|
+
onClick: Ee,
|
|
345
|
+
"aria-expanded": h,
|
|
346
|
+
"aria-label": s(h ? "header.closeSearch" : "header.openSearch"),
|
|
312
347
|
children: [
|
|
313
|
-
|
|
314
|
-
/* @__PURE__ */ r("span", { className: n.buttonText, children:
|
|
348
|
+
h ? /* @__PURE__ */ r(se, { "aria-hidden": !0 }) : /* @__PURE__ */ r(le, { "aria-hidden": !0 }),
|
|
349
|
+
/* @__PURE__ */ r("span", { className: n.buttonText, children: s(h ? "header.close" : "header.search") })
|
|
315
350
|
]
|
|
316
351
|
}
|
|
317
352
|
) }),
|
|
318
|
-
(
|
|
319
|
-
|
|
353
|
+
($e || m) && /* @__PURE__ */ o(
|
|
354
|
+
K,
|
|
320
355
|
{
|
|
321
|
-
ref:
|
|
356
|
+
ref: T,
|
|
322
357
|
variant: "primary",
|
|
323
358
|
"data-size": "md",
|
|
324
|
-
onClick:
|
|
325
|
-
"aria-expanded":
|
|
326
|
-
"aria-label": l
|
|
359
|
+
onClick: Ce,
|
|
360
|
+
"aria-expanded": l,
|
|
361
|
+
"aria-label": s(l ? "header.closeMenu" : "header.openMenu"),
|
|
327
362
|
className: n.menuButton,
|
|
328
363
|
children: [
|
|
329
|
-
|
|
330
|
-
/* @__PURE__ */ r("span", { className: n.buttonText, children: l
|
|
364
|
+
l ? /* @__PURE__ */ r(se, { "aria-hidden": !0 }) : /* @__PURE__ */ r(Se, { "aria-hidden": !0 }),
|
|
365
|
+
/* @__PURE__ */ r("span", { className: n.buttonText, children: s(l ? "header.close" : "header.menu") })
|
|
331
366
|
]
|
|
332
367
|
}
|
|
333
368
|
)
|
|
334
369
|
] })
|
|
335
370
|
] }),
|
|
336
|
-
|
|
371
|
+
l && /* @__PURE__ */ r("div", { className: n.menuOverlay, ref: q, children: /* @__PURE__ */ o("div", { className: n.menuContent, children: [
|
|
337
372
|
/* @__PURE__ */ r("div", { className: n.menuLeftColumn }),
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
/* @__PURE__ */ r("span", { className: n.languageLabel, children:
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
|
|
373
|
+
/* @__PURE__ */ o("div", { className: n.menuRightColumn, children: [
|
|
374
|
+
m && (B || k) && /* @__PURE__ */ o("div", { className: n.menuUtilities, children: [
|
|
375
|
+
B && /* @__PURE__ */ o("div", { className: n.languageSwitch, children: [
|
|
376
|
+
/* @__PURE__ */ r("span", { className: n.languageLabel, children: s("header.language") }),
|
|
377
|
+
/* @__PURE__ */ o(c.TriggerContext, { children: [
|
|
378
|
+
/* @__PURE__ */ o(
|
|
379
|
+
c.Trigger,
|
|
345
380
|
{
|
|
346
381
|
className: n.languageLink,
|
|
347
|
-
"aria-label":
|
|
382
|
+
"aria-label": s("header.selectLanguage"),
|
|
348
383
|
style: { background: "transparent", border: "none", padding: 0, cursor: "pointer", font: "inherit" },
|
|
349
384
|
children: [
|
|
350
|
-
|
|
385
|
+
ne,
|
|
351
386
|
" ",
|
|
352
|
-
/* @__PURE__ */ r(
|
|
387
|
+
/* @__PURE__ */ r(oe, { "aria-hidden": !0 })
|
|
353
388
|
]
|
|
354
389
|
}
|
|
355
390
|
),
|
|
356
391
|
/* @__PURE__ */ r(
|
|
357
|
-
|
|
392
|
+
c,
|
|
358
393
|
{
|
|
359
|
-
"data-color-scheme":
|
|
394
|
+
"data-color-scheme": x,
|
|
360
395
|
placement: "bottom-start",
|
|
361
|
-
children: /* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */ r(
|
|
363
|
-
/* @__PURE__ */ r(
|
|
396
|
+
children: /* @__PURE__ */ o(c.List, { children: [
|
|
397
|
+
/* @__PURE__ */ r(c.Item, { children: /* @__PURE__ */ r(c.Button, { onClick: () => O("NO"), children: "Norsk (NO)" }) }),
|
|
398
|
+
/* @__PURE__ */ r(c.Item, { children: /* @__PURE__ */ r(c.Button, { onClick: () => O("EN"), children: "English (EN)" }) })
|
|
364
399
|
] })
|
|
365
400
|
}
|
|
366
401
|
)
|
|
367
402
|
] })
|
|
368
403
|
] }),
|
|
369
|
-
|
|
370
|
-
|
|
404
|
+
k && /* @__PURE__ */ r("div", { className: n.extensionContent, children: /* @__PURE__ */ r(
|
|
405
|
+
Q,
|
|
371
406
|
{
|
|
372
407
|
"data-size": "sm",
|
|
373
|
-
checked:
|
|
374
|
-
onChange:
|
|
375
|
-
label:
|
|
408
|
+
checked: x === "dark",
|
|
409
|
+
onChange: F,
|
|
410
|
+
label: s("header.darkMode"),
|
|
376
411
|
color: "neutral",
|
|
377
412
|
"data-color-scheme": "light"
|
|
378
413
|
}
|
|
379
414
|
) })
|
|
380
415
|
] }),
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
416
|
+
/* @__PURE__ */ o("div", { className: n.slotContent, children: [
|
|
417
|
+
he,
|
|
418
|
+
m && P && b && b.length > 0 && /* @__PURE__ */ r("nav", { className: n.navList, children: b.map((t, a) => /* @__PURE__ */ r(
|
|
419
|
+
D,
|
|
385
420
|
{
|
|
386
421
|
href: t.href,
|
|
387
422
|
className: n.navLink,
|
|
388
|
-
onClick: (
|
|
389
|
-
|
|
423
|
+
onClick: (i) => {
|
|
424
|
+
f && (i.preventDefault(), f(t.href));
|
|
390
425
|
},
|
|
391
426
|
children: t.label
|
|
392
427
|
},
|
|
393
428
|
a
|
|
394
429
|
)) })
|
|
395
430
|
] }),
|
|
396
|
-
|
|
431
|
+
m && /* @__PURE__ */ r("div", { className: n.menuBrand, children: /* @__PURE__ */ r(ie, { className: n.redCrossLogo }) })
|
|
397
432
|
] })
|
|
398
433
|
] }) }),
|
|
399
|
-
|
|
400
|
-
/* @__PURE__ */
|
|
434
|
+
h && /* @__PURE__ */ r("div", { className: n.searchOverlay, children: /* @__PURE__ */ o("div", { className: n.searchContent, children: [
|
|
435
|
+
/* @__PURE__ */ o(W, { children: [
|
|
401
436
|
/* @__PURE__ */ r(
|
|
402
|
-
|
|
437
|
+
W.Input,
|
|
403
438
|
{
|
|
404
|
-
ref:
|
|
405
|
-
"aria-label":
|
|
406
|
-
placeholder:
|
|
407
|
-
value:
|
|
408
|
-
onChange: (t) =>
|
|
439
|
+
ref: te,
|
|
440
|
+
"aria-label": s("header.search"),
|
|
441
|
+
placeholder: s("header.searchPlaceholder"),
|
|
442
|
+
value: u,
|
|
443
|
+
onChange: (t) => y(t.target.value),
|
|
409
444
|
onKeyDown: (t) => {
|
|
410
|
-
t.key === "Enter" &&
|
|
445
|
+
t.key === "Enter" && ae();
|
|
411
446
|
}
|
|
412
447
|
}
|
|
413
448
|
),
|
|
414
|
-
/* @__PURE__ */ r(
|
|
415
|
-
/* @__PURE__ */ r(
|
|
449
|
+
/* @__PURE__ */ r(W.Button, { "aria-label": s("header.search"), onClick: ae }),
|
|
450
|
+
/* @__PURE__ */ r(W.ClearButton, { onClick: () => y(""), "aria-label": s("header.clearSearch") })
|
|
416
451
|
] }),
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
/* @__PURE__ */ r("h3", { className: n.suggestionsTitle, children:
|
|
420
|
-
/* @__PURE__ */ r("ul", { className: n.resultList, children:
|
|
452
|
+
u && /* @__PURE__ */ r("div", { role: "status", className: "ds-sr-only", children: $.length > 0 ? s("header.suggestionCount").replace("{count}", String(Math.min($.length, 5))) : `${s("header.noResults")} ${u}` }),
|
|
453
|
+
u && /* @__PURE__ */ r("div", { className: n.searchResults, children: $.length > 0 ? /* @__PURE__ */ o("div", { className: n.suggestionsSection, children: [
|
|
454
|
+
/* @__PURE__ */ r("h3", { className: n.suggestionsTitle, children: s("header.suggestions") }),
|
|
455
|
+
/* @__PURE__ */ r("ul", { className: n.resultList, children: $.slice(0, 5).map((t) => /* @__PURE__ */ r("li", { className: n.resultItem, children: /* @__PURE__ */ o(
|
|
421
456
|
"button",
|
|
422
457
|
{
|
|
423
458
|
className: n.resultLink,
|
|
424
|
-
onClick: () =>
|
|
459
|
+
onClick: () => Be(t.path),
|
|
425
460
|
children: [
|
|
426
|
-
/* @__PURE__ */ r("span", { className: n.suggestionIcon, children: /* @__PURE__ */ r(
|
|
461
|
+
/* @__PURE__ */ r("span", { className: n.suggestionIcon, children: /* @__PURE__ */ r(le, { "aria-hidden": !0 }) }),
|
|
427
462
|
/* @__PURE__ */ r("span", { className: n.suggestionText, children: (() => {
|
|
428
|
-
const a = t.title.toLowerCase().indexOf(
|
|
463
|
+
const a = t.title.toLowerCase().indexOf(u.toLowerCase());
|
|
429
464
|
if (a === -1) return /* @__PURE__ */ r("span", { className: n.remainingText, children: t.title });
|
|
430
|
-
const
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */ r("span", { className: n.remainingText, children:
|
|
433
|
-
/* @__PURE__ */ r("span", { className: n.highlightedText, children:
|
|
434
|
-
/* @__PURE__ */ r("span", { className: n.remainingText, children:
|
|
465
|
+
const i = t.title.slice(0, a), d = t.title.slice(a, a + u.length), N = t.title.slice(a + u.length);
|
|
466
|
+
return /* @__PURE__ */ o(Te, { children: [
|
|
467
|
+
/* @__PURE__ */ r("span", { className: n.remainingText, children: i }),
|
|
468
|
+
/* @__PURE__ */ r("span", { className: n.highlightedText, children: d }),
|
|
469
|
+
/* @__PURE__ */ r("span", { className: n.remainingText, children: N })
|
|
435
470
|
] });
|
|
436
471
|
})() })
|
|
437
472
|
]
|
|
438
473
|
}
|
|
439
474
|
) }, t.id)) }),
|
|
440
|
-
|
|
441
|
-
|
|
475
|
+
$.length > 5 && /* @__PURE__ */ o(
|
|
476
|
+
D,
|
|
442
477
|
{
|
|
443
478
|
href: "#",
|
|
444
479
|
"data-color": "neutral",
|
|
445
480
|
className: n.viewAllLink,
|
|
446
481
|
onClick: (t) => {
|
|
447
|
-
t.preventDefault(),
|
|
482
|
+
t.preventDefault(), f && f(`search/${encodeURIComponent(u)}`), v(!1), y("");
|
|
448
483
|
},
|
|
449
484
|
children: [
|
|
450
|
-
|
|
485
|
+
s("header.viewAll"),
|
|
451
486
|
" (",
|
|
452
|
-
|
|
487
|
+
$.length,
|
|
453
488
|
")"
|
|
454
489
|
]
|
|
455
490
|
}
|
|
456
491
|
)
|
|
457
|
-
] }) : /* @__PURE__ */ r("div", { className: n.noResults, children: /* @__PURE__ */
|
|
458
|
-
|
|
492
|
+
] }) : /* @__PURE__ */ r("div", { className: n.noResults, children: /* @__PURE__ */ o(U, { children: [
|
|
493
|
+
s("header.noResults"),
|
|
459
494
|
' "',
|
|
460
|
-
|
|
495
|
+
u,
|
|
461
496
|
'"'
|
|
462
497
|
] }) }) })
|
|
463
498
|
] }) })
|
|
464
499
|
] })
|
|
465
500
|
);
|
|
466
501
|
};
|
|
467
|
-
function
|
|
468
|
-
const e =
|
|
502
|
+
function Me(w) {
|
|
503
|
+
const e = w;
|
|
469
504
|
return `
|
|
470
505
|
.${e.header} {
|
|
471
506
|
--rk-header-extension-height: 44px;
|
|
@@ -543,7 +578,7 @@ function Ee($) {
|
|
|
543
578
|
.${e.extensionDivider} { width: 1px; height: 18px; background-color: rgba(247,233,232,1); }
|
|
544
579
|
.${e.languageSwitch} { display: flex; align-items: center; gap: var(--ds-size-2); }
|
|
545
580
|
.${e.languageLabel} { font-size: var(--ds-font-size-3); color: #ECECEC; }
|
|
546
|
-
.${e.languageLink} { color: white !important; text-decoration: none; display: flex; align-items: center; gap: 4px; }
|
|
581
|
+
.${e.languageLink} { color: white !important; text-decoration: none; display: flex; align-items: center; gap: var(--ds-size-1, 4px); }
|
|
547
582
|
.${e.header}[data-color] .${e.languageLabel} { color: var(--ds-color-base-contrast-subtle); }
|
|
548
583
|
.${e.header}[data-color] .${e.languageLink} { color: var(--ds-color-base-contrast-default) !important; }
|
|
549
584
|
.${e.languageSwitch} [popover] { margin-top: 0 !important; background-color: var(--ds-color-neutral-background-default) !important; position: fixed !important; overflow: visible; z-index: 20000 !important; }
|
|
@@ -564,7 +599,7 @@ function Ee($) {
|
|
|
564
599
|
.${e.header}[data-variant="compact"] .${e.redCrossLogo} { color: var(--ds-color-neutral-text-default); }
|
|
565
600
|
.${e.secondaryLogoWrapper} { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 var(--ds-size-6); background-color: var(--ds-color-neutral-background-default); }
|
|
566
601
|
.${e.secondaryLogo} { height: 24px; width: auto; display: block; }
|
|
567
|
-
.${e.navItems} { display: flex; gap: 40px; align-items: center; margin-left: 24px; flex-grow: 1; justify-content: center; }
|
|
602
|
+
.${e.navItems} { display: flex; gap: 40px; align-items: center; margin-left: var(--ds-size-6, 24px); flex-grow: 1; justify-content: center; }
|
|
568
603
|
.${e.navLink} { color: var(--ds-color-primary-color-red-text-default); font-family: inherit; font-size: var(--ds-font-size-3); text-decoration: none; font-weight: var(--ds-font-weight-regular); letter-spacing: 0.09px; }
|
|
569
604
|
.${e.navLink}:hover { text-decoration: underline; }
|
|
570
605
|
.${e.actions} { display: flex; align-items: center; gap: var(--ds-size-6); flex-shrink: 0; margin-left: auto; }
|
|
@@ -597,7 +632,7 @@ function Ee($) {
|
|
|
597
632
|
}
|
|
598
633
|
.${e.menuContent} { max-width: 1364px; margin: 0 auto; display: flex; flex-direction: row; align-items: stretch; box-sizing: border-box; }
|
|
599
634
|
.${e.menuLeftColumn} { width: calc(217px + var(--ds-size-6)); flex-shrink: 0; display: flex; }
|
|
600
|
-
.${e.menuRightColumn} { flex: 1; display: flex; flex-direction: column; padding: 48px 24px 80px 24px; gap: 24px; }
|
|
635
|
+
.${e.menuRightColumn} { flex: 1; display: flex; flex-direction: column; padding: var(--ds-size-12, 48px) var(--ds-size-6, 24px) 80px var(--ds-size-6, 24px); gap: var(--ds-size-6, 24px); }
|
|
601
636
|
.${e.slotContent} { width: 100%; padding: var(--ds-size-10) 0; text-align: left; color: var(--ds-color-neutral-text-subtle); font-size: var(--ds-font-size-3); border-radius: var(--ds-border-radius-md); display: flex; flex-direction: column; gap: var(--ds-size-4); align-items: flex-start; }
|
|
602
637
|
.${e.navList} { display: flex; flex-direction: column; gap: var(--ds-size-3); align-items: flex-start; }
|
|
603
638
|
.${e.menuBrand} { display: none; }
|
|
@@ -652,5 +687,5 @@ function Ee($) {
|
|
|
652
687
|
`;
|
|
653
688
|
}
|
|
654
689
|
export {
|
|
655
|
-
|
|
690
|
+
Pe as Header
|
|
656
691
|
};
|