rk-designsystem 1.3.2 → 1.3.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/assets/logos/RedCrossLogo.js +30 -0
- package/dist/components/Carousel/index.js +11 -10
- package/dist/components/Carousel/styles.module.css.js +24 -24
- package/dist/components/DatePicker/index.js +30 -30
- package/dist/components/DatePicker/styles.module.css.js +20 -18
- package/dist/components/Donor/index.js +35 -24
- package/dist/components/Footer/index.js +180 -185
- package/dist/components/Footer/styles.module.css.js +44 -44
- package/dist/components/Header/index.js +219 -240
- package/dist/components/Header/styles.module.css.js +76 -76
- package/dist/rk-designsystem.css +1 -1
- package/package.json +2 -2
|
@@ -1,316 +1,291 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as i, jsx as
|
|
3
|
-
import E, { useState as L, useEffect as
|
|
4
|
-
import {
|
|
2
|
+
import { jsxs as i, jsx as r, Fragment as ye } from "react/jsx-runtime";
|
|
3
|
+
import E, { useState as L, useEffect as p, useMemo as $e } from "react";
|
|
4
|
+
import { RedCrossLogo as Y } from "../../assets/logos/RedCrossLogo.js";
|
|
5
|
+
import { useLanguageOptional as we } from "../../context/LanguageContext.js";
|
|
5
6
|
import { Link as B } from "../Link/index.js";
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Avatar as
|
|
8
|
-
import { Paragraph as
|
|
7
|
+
import { Button as D } from "../Button/index.js";
|
|
8
|
+
import { Avatar as ke } from "../Avatar/index.js";
|
|
9
|
+
import { Paragraph as j } from "../Paragraph/index.js";
|
|
9
10
|
import { Search as T } from "../Search/index.js";
|
|
10
|
-
import { Switch as
|
|
11
|
+
import { Switch as M } from "../Switch/index.js";
|
|
11
12
|
import { Dropdown as d } from "../Dropdown/index.js";
|
|
12
|
-
import
|
|
13
|
-
import { ChevronDownIcon as
|
|
14
|
-
import { searchIndex as
|
|
15
|
-
function
|
|
16
|
-
return
|
|
13
|
+
import n from "./styles.module.css.js";
|
|
14
|
+
import { ChevronDownIcon as Z, XMarkIcon as _, MagnifyingGlassIcon as P, MenuHamburgerIcon as ze, HeartIcon as Le } from "@navikt/aksel-icons";
|
|
15
|
+
import { searchIndex as Ne } from "../../utils/search-index.js";
|
|
16
|
+
function Ce($) {
|
|
17
|
+
return $.split(/\s+/).map((e) => e[0] ?? "").join("").slice(0, 2).toUpperCase();
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
-
variant:
|
|
19
|
+
const Ue = ({
|
|
20
|
+
variant: $ = "default",
|
|
20
21
|
"data-color": e = "primary-color-red",
|
|
21
|
-
activePage:
|
|
22
|
+
activePage: ee,
|
|
22
23
|
setPage: m,
|
|
23
|
-
children:
|
|
24
|
-
showUser:
|
|
25
|
-
showSearch:
|
|
26
|
-
showLogin:
|
|
27
|
-
showCta:
|
|
28
|
-
ctaLabel:
|
|
29
|
-
ctaIcon:
|
|
30
|
-
onCtaClick:
|
|
31
|
-
showThemeToggle:
|
|
32
|
-
secondaryLogo:
|
|
33
|
-
secondaryLogoSrc:
|
|
34
|
-
secondaryLogoSrcDark:
|
|
24
|
+
children: te,
|
|
25
|
+
showUser: ne = !0,
|
|
26
|
+
showSearch: re = !0,
|
|
27
|
+
showLogin: ae = !0,
|
|
28
|
+
showCta: oe = !1,
|
|
29
|
+
ctaLabel: ie,
|
|
30
|
+
ctaIcon: q = /* @__PURE__ */ r(Le, { "aria-hidden": !0 }),
|
|
31
|
+
onCtaClick: le,
|
|
32
|
+
showThemeToggle: se = !1,
|
|
33
|
+
secondaryLogo: de = !1,
|
|
34
|
+
secondaryLogoSrc: A,
|
|
35
|
+
secondaryLogoSrcDark: F,
|
|
35
36
|
secondaryLogoAlt: ce = "Secondary Logo",
|
|
36
37
|
navItems: x,
|
|
37
|
-
showNavItems:
|
|
38
|
+
showNavItems: H = !0,
|
|
38
39
|
showMenuButton: he = !0,
|
|
39
|
-
showHeaderExtension:
|
|
40
|
-
showModeToggle:
|
|
41
|
-
showLanguageSwitch:
|
|
42
|
-
extensionColor:
|
|
43
|
-
userName:
|
|
40
|
+
showHeaderExtension: I = !1,
|
|
41
|
+
showModeToggle: w = !1,
|
|
42
|
+
showLanguageSwitch: N = !1,
|
|
43
|
+
extensionColor: U,
|
|
44
|
+
userName: O,
|
|
44
45
|
userInitials: ue,
|
|
45
|
-
userAvatarSrc:
|
|
46
|
-
onUserClick:
|
|
46
|
+
userAvatarSrc: R,
|
|
47
|
+
onUserClick: k
|
|
47
48
|
}) => {
|
|
48
|
-
const [s,
|
|
49
|
-
var
|
|
49
|
+
const [s, z] = L(!1), [c, f] = L(!1), K = E.useRef(null), Q = E.useRef(null), G = E.useRef(null), X = E.useRef(null), [h, b] = L(""), [v, me] = L(() => {
|
|
50
|
+
var t;
|
|
50
51
|
if (typeof document < "u") {
|
|
51
52
|
const a = document.documentElement.getAttribute("data-color-scheme");
|
|
52
53
|
if (a === "dark" || a === "light") return a;
|
|
53
|
-
if ((
|
|
54
|
+
if ((t = window.matchMedia) != null && t.call(window, "(prefers-color-scheme: dark)").matches) return "dark";
|
|
54
55
|
}
|
|
55
56
|
return "light";
|
|
56
|
-
}), { language:
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
if (typeof document > "u" || document.getElementById(
|
|
60
|
-
const a =
|
|
61
|
-
o.id =
|
|
62
|
-
}, [])
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
{
|
|
66
|
-
width: "170",
|
|
67
|
-
height: "119",
|
|
68
|
-
viewBox: "24 0 170 119",
|
|
69
|
-
fill: "none",
|
|
70
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
71
|
-
"aria-hidden": !0,
|
|
72
|
-
focusable: "false",
|
|
73
|
-
className: r.redCrossLogo,
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ t("path", { d: "M76.1036 48.1397C77.8925 47.8781 79.6984 47.7525 81.5061 47.7639C84.1713 47.7639 86.0396 48.1669 87.3182 49.1857C87.8735 49.639 88.3149 50.2176 88.6067 50.8744C88.8984 51.5312 89.0323 52.2479 88.9974 52.9665C88.9839 53.9451 88.6724 54.896 88.1049 55.691C87.5373 56.4861 86.7411 57.087 85.8235 57.4129V57.4944C87.0796 58.006 87.7684 59.2104 88.2231 60.8722C88.7813 62.9097 89.3441 65.2688 89.6907 65.9661H85.5309C85.2382 65.4544 84.7835 63.9829 84.2793 61.7597C83.7751 59.5365 83.0097 58.8527 81.344 58.8527H80.1284V65.9661H76.1036V48.1397ZM80.1284 55.9141H81.7312C83.7526 55.9141 84.9546 54.8954 84.9546 53.3151C84.9546 51.6534 83.8336 50.8202 81.9698 50.7931C81.3532 50.7814 80.7368 50.8268 80.1284 50.9289V55.9141Z", fill: "currentColor" }),
|
|
76
|
-
/* @__PURE__ */ t("path", { d: "M97.8528 52.5633C98.9439 52.5351 100.026 52.7744 101.004 53.2606L102.256 51.4087L103.669 52.4003L102.467 54.2115C103.188 54.8589 103.758 55.6585 104.137 56.5531C104.515 57.4478 104.692 58.4154 104.655 59.3869C104.655 64.0506 101.243 66.2738 97.8573 66.2738C96.7852 66.2984 95.7234 66.059 94.7644 65.5765L93.4543 67.4556L92.1037 66.387L93.2787 64.6438C91.8651 63.4892 91.0277 61.7233 91.0277 59.414C91.0277 55.2891 93.7965 52.5543 97.8213 52.5543L97.8528 52.5633ZM99.2934 55.9411C98.8798 55.6237 98.3731 55.4533 97.8528 55.4566C95.7458 55.4566 94.949 57.5757 94.949 59.4005C94.9265 60.126 95.0909 60.845 95.4262 61.4878L95.4802 61.515L99.2934 55.9411ZM96.4932 62.8552C96.8653 63.1843 97.3486 63.3576 97.8438 63.3397C99.6446 63.3397 100.748 61.7821 100.748 59.4774C100.76 58.7777 100.625 58.0833 100.351 57.4399L100.27 57.4127L96.4932 62.8552Z", fill: "currentColor" }),
|
|
77
|
-
/* @__PURE__ */ t("path", { d: "M119.76 46.9351V62.0537C119.76 63.5253 119.814 65.0829 119.868 65.9659H116.266L116.077 64.037H116.01C115.593 64.7375 114.998 65.3131 114.285 65.7041C113.573 66.095 112.769 66.287 111.958 66.2602C108.865 66.2602 106.384 63.6068 106.384 59.5317C106.384 55.1079 109.085 52.5632 112.237 52.5632C113.835 52.5632 115.087 53.1247 115.676 54.0393H115.726V46.9351H119.76ZM115.708 58.4088C115.708 58.1914 115.681 57.8971 115.658 57.6843C115.556 57.1295 115.266 56.6274 114.838 56.2627C114.41 55.8981 113.869 55.6933 113.308 55.683C111.467 55.683 110.508 57.3447 110.508 59.4094C110.508 61.6327 111.602 63.0318 113.281 63.0318C113.838 63.0337 114.378 62.8389 114.807 62.4814C115.235 62.1239 115.526 61.6264 115.627 61.0757C115.702 60.7676 115.737 60.451 115.73 60.1339L115.708 58.4088Z", fill: "currentColor" }),
|
|
78
|
-
/* @__PURE__ */ t("path", { d: "M126.13 60.6869C126.265 62.3758 127.931 63.1772 129.808 63.1772C131.029 63.1934 132.245 63.013 133.41 62.6429L133.946 65.4049C132.438 65.9752 130.838 66.2562 129.227 66.2335C124.802 66.2335 122.272 63.6345 122.272 59.5322C122.272 56.2088 124.325 52.5366 128.854 52.5366C133.063 52.5366 134.666 55.8329 134.666 59.0794C134.666 59.6271 134.62 60.1738 134.531 60.714L126.13 60.6869ZM130.902 57.8977C130.902 56.9061 130.475 55.2443 128.611 55.2443C126.904 55.2443 126.211 56.8246 126.103 57.8977H130.902Z", fill: "currentColor" }),
|
|
79
|
-
/* @__PURE__ */ t("path", { d: "M142.603 47.8994H146.623V55.8866H146.7C147.1 55.1893 147.501 54.5283 147.929 53.9034L151.981 47.8994H156.978L151.035 55.5969L157.297 65.9703H152.57L148.172 58.1687L146.623 60.0704V65.9567H142.598L142.603 47.8994Z", fill: "currentColor" }),
|
|
80
|
-
/* @__PURE__ */ t("path", { d: "M164.294 66.2599C160.485 66.2599 157.541 63.7424 157.541 59.5043C157.541 55.2662 160.309 52.563 164.496 52.563C168.494 52.563 171.159 55.325 171.159 59.2643C171.159 64.0639 167.774 66.2599 164.307 66.2599H164.294ZM164.375 63.3394C165.946 63.3394 166.959 61.7592 166.959 59.4001C166.959 57.4395 166.216 55.4563 164.375 55.4563C162.43 55.4563 161.709 57.4667 161.709 59.4001C161.709 61.6641 162.641 63.3394 164.348 63.3394H164.375Z", fill: "currentColor" }),
|
|
81
|
-
/* @__PURE__ */ t("path", { d: "M173.676 57.1727C173.676 55.2438 173.622 54.0031 173.568 52.8576H177.062L177.197 55.271H177.3C177.535 54.507 178 53.8353 178.63 53.3486C179.261 52.8619 180.026 52.5843 180.821 52.5542C181.105 52.5425 181.391 52.5607 181.672 52.6086V56.4392C181.303 56.3736 180.93 56.3387 180.555 56.335C179.06 56.335 178.048 57.1365 177.782 58.3997C177.726 58.6983 177.699 59.0015 177.701 59.3053V65.9659H173.649L173.676 57.1727Z", fill: "currentColor" }),
|
|
82
|
-
/* @__PURE__ */ t("path", { d: "M183.752 62.4023C184.824 62.9936 186.018 63.3283 187.241 63.3803C188.47 63.3803 188.974 62.9275 188.974 62.28C188.974 61.6325 188.573 61.2613 187.056 60.7768C184.355 59.8712 183.351 58.3951 183.351 56.8375C183.351 54.3969 185.404 52.5496 188.654 52.5496C189.92 52.5283 191.175 52.7848 192.332 53.3012L191.612 56.1357C190.741 55.6712 189.775 55.4155 188.789 55.3886C187.803 55.3886 187.241 55.787 187.241 56.4571C187.241 57.1273 187.749 57.4216 189.348 57.9604C191.828 58.8162 192.868 60.0795 192.891 62.0084C192.891 64.4444 190.973 66.2691 187.241 66.2691C185.784 66.2951 184.341 65.974 183.031 65.3318L183.752 62.4023Z", fill: "currentColor" }),
|
|
83
|
-
/* @__PURE__ */ t("path", { d: "M50.1985 39.8037H37.1426V79.1965H50.1985V39.8037Z", fill: "#D52B1E" }),
|
|
84
|
-
/* @__PURE__ */ t("path", { d: "M63.2545 52.9331H24.0869V66.0625H63.2545V52.9331Z", fill: "#D52B1E" })
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
f(() => {
|
|
89
|
-
w(!1), p(!1), b("");
|
|
90
|
-
}, [te]), f(() => {
|
|
57
|
+
}), { language: J, setLanguage: C, t: l } = we(), [g, ge] = L(!1), pe = w && (I && !g || g);
|
|
58
|
+
p(() => {
|
|
59
|
+
const t = "rk-header-inline-styles";
|
|
60
|
+
if (typeof document > "u" || document.getElementById(t)) return;
|
|
61
|
+
const a = Ee(n), o = document.createElement("style");
|
|
62
|
+
o.id = t, o.textContent = a, document.head.prepend(o);
|
|
63
|
+
}, []), p(() => {
|
|
64
|
+
z(!1), f(!1), b("");
|
|
65
|
+
}, [ee]), p(() => {
|
|
91
66
|
if (!(typeof document > "u") && s && g) {
|
|
92
|
-
const
|
|
67
|
+
const t = document.body.style.overflow;
|
|
93
68
|
return document.body.style.overflow = "hidden", () => {
|
|
94
|
-
document.body.style.overflow =
|
|
69
|
+
document.body.style.overflow = t;
|
|
95
70
|
};
|
|
96
71
|
}
|
|
97
|
-
}, [s, g]),
|
|
72
|
+
}, [s, g]), p(() => {
|
|
98
73
|
if (typeof window > "u" || typeof window.matchMedia > "u") return;
|
|
99
|
-
const
|
|
100
|
-
return a(
|
|
101
|
-
|
|
74
|
+
const t = window.matchMedia("(max-width: 850px)"), a = (o) => ge("matches" in o ? o.matches : t.matches);
|
|
75
|
+
return a(t), t.addEventListener ? t.addEventListener("change", a) : t.addListener(a), () => {
|
|
76
|
+
t.removeEventListener ? t.removeEventListener("change", a) : t.removeListener(a);
|
|
102
77
|
};
|
|
103
|
-
}, []),
|
|
78
|
+
}, []), p(() => {
|
|
104
79
|
if (typeof document > "u") return;
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
80
|
+
const t = document.querySelector(`.${n.header}`);
|
|
81
|
+
if (!t) return;
|
|
107
82
|
const a = () => {
|
|
108
|
-
const u =
|
|
83
|
+
const u = t.offsetHeight;
|
|
109
84
|
document.documentElement.style.setProperty("--header-height-mobile", `${u}px`);
|
|
110
85
|
};
|
|
111
86
|
a(), window.addEventListener("resize", a);
|
|
112
87
|
const o = new ResizeObserver(() => {
|
|
113
88
|
a();
|
|
114
89
|
});
|
|
115
|
-
return o.observe(
|
|
90
|
+
return o.observe(t), () => {
|
|
116
91
|
window.removeEventListener("resize", a), o.disconnect();
|
|
117
92
|
};
|
|
118
|
-
}, [g]),
|
|
93
|
+
}, [g]), p(() => {
|
|
119
94
|
if (typeof document > "u") return;
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
95
|
+
const t = document.querySelector(`.${n.logoWrapper}`);
|
|
96
|
+
if (!t) return;
|
|
122
97
|
const a = () => {
|
|
123
|
-
const o =
|
|
98
|
+
const o = t.offsetWidth;
|
|
124
99
|
document.documentElement.style.setProperty("--rk-logo-width", `${o}px`);
|
|
125
100
|
};
|
|
126
101
|
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
127
|
-
}, [g]),
|
|
102
|
+
}, [g]), p(() => {
|
|
128
103
|
if (typeof document > "u" || !c) {
|
|
129
104
|
document.documentElement.style.setProperty("--rk-search-overlay-height", "0px");
|
|
130
105
|
return;
|
|
131
106
|
}
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
107
|
+
const t = document.querySelector(`.${n.searchOverlay}`);
|
|
108
|
+
if (!t) return;
|
|
134
109
|
const a = () => {
|
|
135
|
-
const u =
|
|
110
|
+
const u = t.offsetHeight;
|
|
136
111
|
document.documentElement.style.setProperty("--rk-search-overlay-height", `${u}px`);
|
|
137
112
|
};
|
|
138
113
|
requestAnimationFrame(a), window.addEventListener("resize", a);
|
|
139
114
|
const o = new ResizeObserver(a);
|
|
140
|
-
return o.observe(
|
|
115
|
+
return o.observe(t), () => {
|
|
141
116
|
window.removeEventListener("resize", a), o.disconnect();
|
|
142
117
|
};
|
|
143
|
-
}, [c]),
|
|
118
|
+
}, [c]), p(() => {
|
|
144
119
|
if (!s && !c) return;
|
|
145
|
-
const
|
|
120
|
+
const t = (a) => {
|
|
146
121
|
var o, u;
|
|
147
|
-
a.key === "Escape" && (s && (
|
|
122
|
+
a.key === "Escape" && (s && (z(!1), (o = K.current) == null || o.focus()), c && (f(!1), (u = Q.current) == null || u.focus()));
|
|
148
123
|
};
|
|
149
|
-
return document.addEventListener("keydown",
|
|
150
|
-
}, [s, c]),
|
|
151
|
-
var
|
|
152
|
-
c ? (
|
|
124
|
+
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
125
|
+
}, [s, c]), p(() => {
|
|
126
|
+
var t, a, o;
|
|
127
|
+
c ? (t = X.current) == null || t.focus() : s && ((o = (a = G.current) == null ? void 0 : a.querySelector('a[href], button, input, select, [tabindex]:not([tabindex="-1"])')) == null || o.focus());
|
|
153
128
|
}, [s, c]);
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
me(
|
|
157
|
-
}, fe = (
|
|
158
|
-
m && (
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
const a =
|
|
129
|
+
const S = () => {
|
|
130
|
+
const t = v === "light" ? "dark" : "light";
|
|
131
|
+
me(t), document.documentElement.setAttribute("data-color-scheme", t);
|
|
132
|
+
}, fe = (t) => {
|
|
133
|
+
m && (t.preventDefault(), m("home")), z(!1), f(!1);
|
|
134
|
+
}, ve = () => {
|
|
135
|
+
z(!s), c && f(!1), !s && typeof document < "u" && requestAnimationFrame(() => {
|
|
136
|
+
const t = document.querySelector(`.${n.header}`);
|
|
137
|
+
if (t) {
|
|
138
|
+
const a = t.offsetHeight;
|
|
164
139
|
document.documentElement.style.setProperty("--header-height-mobile", `${a}px`);
|
|
165
140
|
}
|
|
166
141
|
});
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
}, y =
|
|
142
|
+
}, xe = () => {
|
|
143
|
+
f(!c), s && z(!1);
|
|
144
|
+
}, y = $e(() => {
|
|
170
145
|
if (!h.trim()) return [];
|
|
171
|
-
const
|
|
172
|
-
return
|
|
173
|
-
const u = a.title.toLowerCase().startsWith(
|
|
174
|
-
return u -
|
|
146
|
+
const t = h.toLowerCase();
|
|
147
|
+
return Ne.filter((a) => a.title.toLowerCase().includes(t)).sort((a, o) => {
|
|
148
|
+
const u = a.title.toLowerCase().startsWith(t) ? 0 : 1, W = o.title.toLowerCase().startsWith(t) ? 0 : 1;
|
|
149
|
+
return u - W;
|
|
175
150
|
});
|
|
176
|
-
}, [h]),
|
|
177
|
-
!m || !h.trim() || (m(`search/${encodeURIComponent(h.trim())}`),
|
|
178
|
-
},
|
|
179
|
-
m && m(
|
|
151
|
+
}, [h]), V = () => {
|
|
152
|
+
!m || !h.trim() || (m(`search/${encodeURIComponent(h.trim())}`), f(!1), b(""));
|
|
153
|
+
}, be = (t) => {
|
|
154
|
+
m && m(t), f(!1), b("");
|
|
180
155
|
};
|
|
181
156
|
return (
|
|
182
157
|
// The attribute sets a real Digdir theme scope, so the extension CSS can
|
|
183
158
|
// use scope-relative variables (--ds-color-base-default etc.) and any
|
|
184
159
|
// scope themes it correctly. Legacy 'primary' aliases to the scope it
|
|
185
160
|
// always meant.
|
|
186
|
-
/* @__PURE__ */ i("header", { className:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
161
|
+
/* @__PURE__ */ i("header", { className: n.header, "data-open": s ? "true" : "false", "data-color": e === "primary" ? "primary-color-red" : e, "data-variant": $, "data-header-extension": I ? "true" : "false", children: [
|
|
162
|
+
I && /* @__PURE__ */ r("div", { className: `${n.headerExtension}${U === "tinted" ? ` ${n.headerExtensionTinted}` : ""}`, "data-color-scheme": "light", "data-extension-color": U, children: /* @__PURE__ */ i("div", { className: n.extensionContentWrapper, children: [
|
|
163
|
+
w && /* @__PURE__ */ r("div", { className: n.extensionContent, children: /* @__PURE__ */ r(
|
|
164
|
+
M,
|
|
190
165
|
{
|
|
191
166
|
"data-size": "sm",
|
|
192
167
|
checked: v === "dark",
|
|
193
|
-
onChange:
|
|
168
|
+
onChange: S,
|
|
194
169
|
label: l("header.darkMode"),
|
|
195
170
|
color: "neutral",
|
|
196
171
|
"data-color-scheme": "light"
|
|
197
172
|
}
|
|
198
173
|
) }),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/* @__PURE__ */
|
|
174
|
+
w && N && /* @__PURE__ */ r("div", { className: n.extensionDivider }),
|
|
175
|
+
N && /* @__PURE__ */ i("div", { className: n.languageSwitch, children: [
|
|
176
|
+
/* @__PURE__ */ r("span", { className: n.languageLabel, children: l("header.language") }),
|
|
202
177
|
/* @__PURE__ */ i(d.TriggerContext, { children: [
|
|
203
178
|
/* @__PURE__ */ i(
|
|
204
179
|
d.Trigger,
|
|
205
180
|
{
|
|
206
|
-
className:
|
|
181
|
+
className: n.languageLink,
|
|
207
182
|
"aria-label": l("header.selectLanguage"),
|
|
208
183
|
style: { background: "transparent", border: "none", padding: 0, cursor: "pointer", font: "inherit" },
|
|
209
184
|
children: [
|
|
210
|
-
|
|
185
|
+
J,
|
|
211
186
|
" ",
|
|
212
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ r(Z, { "aria-hidden": !0 })
|
|
213
188
|
]
|
|
214
189
|
}
|
|
215
190
|
),
|
|
216
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ r(
|
|
217
192
|
d,
|
|
218
193
|
{
|
|
219
194
|
"data-color-scheme": v,
|
|
220
195
|
placement: "bottom-end",
|
|
221
196
|
children: /* @__PURE__ */ i(d.List, { children: [
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ r(d.Item, { children: /* @__PURE__ */ r(d.Button, { onClick: () => C("NO"), children: "Norsk (NO)" }) }),
|
|
198
|
+
/* @__PURE__ */ r(d.Item, { children: /* @__PURE__ */ r(d.Button, { onClick: () => C("EN"), children: "English (EN)" }) })
|
|
224
199
|
] })
|
|
225
200
|
}
|
|
226
201
|
)
|
|
227
202
|
] })
|
|
228
203
|
] })
|
|
229
204
|
] }) }),
|
|
230
|
-
/* @__PURE__ */ i("div", { className:
|
|
231
|
-
/* @__PURE__ */ i("div", { className:
|
|
232
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ i("div", { className: n.headerInner, children: [
|
|
206
|
+
/* @__PURE__ */ i("div", { className: n.logoWrapper, children: [
|
|
207
|
+
/* @__PURE__ */ r(
|
|
233
208
|
B,
|
|
234
209
|
{
|
|
235
210
|
href: "/",
|
|
236
|
-
className: `${
|
|
211
|
+
className: `${n.logo} ${n.primaryLogo}`,
|
|
237
212
|
"aria-label": l("header.homeAriaLabel"),
|
|
238
213
|
onClick: fe,
|
|
239
|
-
children: /* @__PURE__ */
|
|
214
|
+
children: /* @__PURE__ */ r(Y, { className: n.redCrossLogo })
|
|
240
215
|
}
|
|
241
216
|
),
|
|
242
|
-
/* @__PURE__ */
|
|
217
|
+
de && /* @__PURE__ */ r("div", { className: n.secondaryLogoWrapper, children: A ? /* @__PURE__ */ r(
|
|
243
218
|
"img",
|
|
244
219
|
{
|
|
245
|
-
src: v === "dark" &&
|
|
220
|
+
src: v === "dark" && F ? F : A,
|
|
246
221
|
alt: ce,
|
|
247
|
-
className:
|
|
222
|
+
className: n.secondaryLogo
|
|
248
223
|
}
|
|
249
|
-
) :
|
|
224
|
+
) : /* @__PURE__ */ r("div", { className: n.slotComponent, children: /* @__PURE__ */ r("div", { className: n.slotContainer, children: /* @__PURE__ */ r("p", { className: n.slotText, children: "SLOT" }) }) }) })
|
|
250
225
|
] }),
|
|
251
|
-
|
|
226
|
+
H && x && x.length > 0 && !g && /* @__PURE__ */ r("nav", { className: n.navItems, children: x.map((t, a) => /* @__PURE__ */ r(
|
|
252
227
|
B,
|
|
253
228
|
{
|
|
254
|
-
href:
|
|
255
|
-
className:
|
|
229
|
+
href: t.href,
|
|
230
|
+
className: n.navLink,
|
|
256
231
|
onClick: (o) => {
|
|
257
|
-
m && (o.preventDefault(), m(
|
|
232
|
+
m && (o.preventDefault(), m(t.href));
|
|
258
233
|
},
|
|
259
|
-
children:
|
|
234
|
+
children: t.label
|
|
260
235
|
},
|
|
261
236
|
a
|
|
262
237
|
)) }),
|
|
263
|
-
/* @__PURE__ */ i("div", { className:
|
|
264
|
-
|
|
238
|
+
/* @__PURE__ */ i("div", { className: n.actions, children: [
|
|
239
|
+
oe && // data-color="main" was removed here and on the search/menu buttons below:
|
|
265
240
|
// "main" matches no theme scope, so the buttons always inherited the
|
|
266
241
|
// ancestor scope — now they do so explicitly. data-color is
|
|
267
242
|
// compile-checked against the real scopes since 1.4.0.
|
|
268
243
|
/* @__PURE__ */ i(
|
|
269
|
-
|
|
244
|
+
D,
|
|
270
245
|
{
|
|
271
246
|
variant: "primary",
|
|
272
247
|
"data-size": "md",
|
|
273
|
-
className:
|
|
274
|
-
onClick:
|
|
248
|
+
className: n.ctaButton,
|
|
249
|
+
onClick: le,
|
|
275
250
|
children: [
|
|
276
|
-
|
|
277
|
-
/* @__PURE__ */
|
|
251
|
+
q,
|
|
252
|
+
/* @__PURE__ */ r("span", { className: q ? n.buttonText : void 0, children: ie || l("header.supportUs") })
|
|
278
253
|
]
|
|
279
254
|
}
|
|
280
255
|
),
|
|
281
|
-
|
|
282
|
-
|
|
256
|
+
se && !pe && /* @__PURE__ */ r("div", { className: n.themeToggle, children: /* @__PURE__ */ r(
|
|
257
|
+
M,
|
|
283
258
|
{
|
|
284
259
|
checked: v === "dark",
|
|
285
|
-
onChange:
|
|
260
|
+
onChange: S,
|
|
286
261
|
"aria-label": l("header.toggleTheme")
|
|
287
262
|
}
|
|
288
263
|
) }),
|
|
289
|
-
|
|
290
|
-
const
|
|
264
|
+
ne && (() => {
|
|
265
|
+
const t = O ?? "Frodo Baggins", a = ue ?? (O ? Ce(O) : "FB"), o = !!k;
|
|
291
266
|
return /* @__PURE__ */ i(
|
|
292
267
|
"div",
|
|
293
268
|
{
|
|
294
|
-
className:
|
|
295
|
-
onClick:
|
|
269
|
+
className: n.userInfo,
|
|
270
|
+
onClick: k,
|
|
296
271
|
role: o ? "button" : void 0,
|
|
297
272
|
tabIndex: o ? 0 : void 0,
|
|
298
273
|
onKeyDown: o ? (u) => {
|
|
299
|
-
(u.key === "Enter" || u.key === " ") && (u.preventDefault(),
|
|
274
|
+
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), k == null || k());
|
|
300
275
|
} : void 0,
|
|
301
276
|
style: o ? { cursor: "pointer" } : void 0,
|
|
302
277
|
children: [
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
|
|
278
|
+
/* @__PURE__ */ r(j, { "data-size": "md", className: n.userName, children: t }),
|
|
279
|
+
/* @__PURE__ */ r(
|
|
280
|
+
ke,
|
|
306
281
|
{
|
|
307
|
-
"aria-label":
|
|
282
|
+
"aria-label": t,
|
|
308
283
|
variant: "circle",
|
|
309
|
-
initials:
|
|
310
|
-
children:
|
|
284
|
+
initials: R ? void 0 : a,
|
|
285
|
+
children: R ? /* @__PURE__ */ r(
|
|
311
286
|
"img",
|
|
312
287
|
{
|
|
313
|
-
src:
|
|
288
|
+
src: R,
|
|
314
289
|
alt: "",
|
|
315
290
|
style: { width: "100%", height: "100%", objectFit: "cover" }
|
|
316
291
|
}
|
|
@@ -321,155 +296,155 @@ const je = ({
|
|
|
321
296
|
}
|
|
322
297
|
);
|
|
323
298
|
})(),
|
|
324
|
-
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
299
|
+
ae && /* @__PURE__ */ i("a", { href: "#", className: n.loginLink, children: [
|
|
300
|
+
/* @__PURE__ */ r(j, { "data-size": "md", className: n.loginText, children: l("header.login") }),
|
|
301
|
+
/* @__PURE__ */ r("div", { className: n.underline })
|
|
327
302
|
] }),
|
|
328
|
-
|
|
329
|
-
|
|
303
|
+
re && /* @__PURE__ */ r("div", { className: n.searchButtonWrapper, children: /* @__PURE__ */ i(
|
|
304
|
+
D,
|
|
330
305
|
{
|
|
331
|
-
ref:
|
|
306
|
+
ref: Q,
|
|
332
307
|
variant: "secondary",
|
|
333
308
|
"data-size": "md",
|
|
334
|
-
onClick:
|
|
309
|
+
onClick: xe,
|
|
335
310
|
"aria-expanded": c,
|
|
336
311
|
"aria-label": l(c ? "header.closeSearch" : "header.openSearch"),
|
|
337
312
|
children: [
|
|
338
|
-
c ? /* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
313
|
+
c ? /* @__PURE__ */ r(_, { "aria-hidden": !0 }) : /* @__PURE__ */ r(P, { "aria-hidden": !0 }),
|
|
314
|
+
/* @__PURE__ */ r("span", { className: n.buttonText, children: l(c ? "header.close" : "header.search") })
|
|
340
315
|
]
|
|
341
316
|
}
|
|
342
317
|
) }),
|
|
343
318
|
(he || g) && /* @__PURE__ */ i(
|
|
344
|
-
|
|
319
|
+
D,
|
|
345
320
|
{
|
|
346
|
-
ref:
|
|
321
|
+
ref: K,
|
|
347
322
|
variant: "primary",
|
|
348
323
|
"data-size": "md",
|
|
349
|
-
onClick:
|
|
324
|
+
onClick: ve,
|
|
350
325
|
"aria-expanded": s,
|
|
351
326
|
"aria-label": l(s ? "header.closeMenu" : "header.openMenu"),
|
|
352
|
-
className:
|
|
327
|
+
className: n.menuButton,
|
|
353
328
|
children: [
|
|
354
|
-
s ? /* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
329
|
+
s ? /* @__PURE__ */ r(_, { "aria-hidden": !0 }) : /* @__PURE__ */ r(ze, { "aria-hidden": !0 }),
|
|
330
|
+
/* @__PURE__ */ r("span", { className: n.buttonText, children: l(s ? "header.close" : "header.menu") })
|
|
356
331
|
]
|
|
357
332
|
}
|
|
358
333
|
)
|
|
359
334
|
] })
|
|
360
335
|
] }),
|
|
361
|
-
s && /* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */ i("div", { className:
|
|
364
|
-
g && (
|
|
365
|
-
|
|
366
|
-
/* @__PURE__ */
|
|
336
|
+
s && /* @__PURE__ */ r("div", { className: n.menuOverlay, ref: G, children: /* @__PURE__ */ i("div", { className: n.menuContent, children: [
|
|
337
|
+
/* @__PURE__ */ r("div", { className: n.menuLeftColumn }),
|
|
338
|
+
/* @__PURE__ */ i("div", { className: n.menuRightColumn, children: [
|
|
339
|
+
g && (N || w) && /* @__PURE__ */ i("div", { className: n.menuUtilities, children: [
|
|
340
|
+
N && /* @__PURE__ */ i("div", { className: n.languageSwitch, children: [
|
|
341
|
+
/* @__PURE__ */ r("span", { className: n.languageLabel, children: l("header.language") }),
|
|
367
342
|
/* @__PURE__ */ i(d.TriggerContext, { children: [
|
|
368
343
|
/* @__PURE__ */ i(
|
|
369
344
|
d.Trigger,
|
|
370
345
|
{
|
|
371
|
-
className:
|
|
346
|
+
className: n.languageLink,
|
|
372
347
|
"aria-label": l("header.selectLanguage"),
|
|
373
348
|
style: { background: "transparent", border: "none", padding: 0, cursor: "pointer", font: "inherit" },
|
|
374
349
|
children: [
|
|
375
|
-
|
|
350
|
+
J,
|
|
376
351
|
" ",
|
|
377
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ r(Z, { "aria-hidden": !0 })
|
|
378
353
|
]
|
|
379
354
|
}
|
|
380
355
|
),
|
|
381
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ r(
|
|
382
357
|
d,
|
|
383
358
|
{
|
|
384
359
|
"data-color-scheme": v,
|
|
385
360
|
placement: "bottom-start",
|
|
386
361
|
children: /* @__PURE__ */ i(d.List, { children: [
|
|
387
|
-
/* @__PURE__ */
|
|
388
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ r(d.Item, { children: /* @__PURE__ */ r(d.Button, { onClick: () => C("NO"), children: "Norsk (NO)" }) }),
|
|
363
|
+
/* @__PURE__ */ r(d.Item, { children: /* @__PURE__ */ r(d.Button, { onClick: () => C("EN"), children: "English (EN)" }) })
|
|
389
364
|
] })
|
|
390
365
|
}
|
|
391
366
|
)
|
|
392
367
|
] })
|
|
393
368
|
] }),
|
|
394
|
-
|
|
395
|
-
|
|
369
|
+
w && /* @__PURE__ */ r("div", { className: n.extensionContent, children: /* @__PURE__ */ r(
|
|
370
|
+
M,
|
|
396
371
|
{
|
|
397
372
|
"data-size": "sm",
|
|
398
373
|
checked: v === "dark",
|
|
399
|
-
onChange:
|
|
374
|
+
onChange: S,
|
|
400
375
|
label: l("header.darkMode"),
|
|
401
376
|
color: "neutral",
|
|
402
377
|
"data-color-scheme": "light"
|
|
403
378
|
}
|
|
404
379
|
) })
|
|
405
380
|
] }),
|
|
406
|
-
/* @__PURE__ */ i("div", { className:
|
|
407
|
-
|
|
408
|
-
g &&
|
|
381
|
+
/* @__PURE__ */ i("div", { className: n.slotContent, children: [
|
|
382
|
+
te,
|
|
383
|
+
g && H && x && x.length > 0 && /* @__PURE__ */ r("nav", { className: n.navList, children: x.map((t, a) => /* @__PURE__ */ r(
|
|
409
384
|
B,
|
|
410
385
|
{
|
|
411
|
-
href:
|
|
412
|
-
className:
|
|
386
|
+
href: t.href,
|
|
387
|
+
className: n.navLink,
|
|
413
388
|
onClick: (o) => {
|
|
414
|
-
m && (o.preventDefault(), m(
|
|
389
|
+
m && (o.preventDefault(), m(t.href));
|
|
415
390
|
},
|
|
416
|
-
children:
|
|
391
|
+
children: t.label
|
|
417
392
|
},
|
|
418
393
|
a
|
|
419
394
|
)) })
|
|
420
395
|
] }),
|
|
421
|
-
g && /* @__PURE__ */
|
|
396
|
+
g && /* @__PURE__ */ r("div", { className: n.menuBrand, children: /* @__PURE__ */ r(Y, { className: n.redCrossLogo }) })
|
|
422
397
|
] })
|
|
423
398
|
] }) }),
|
|
424
|
-
c && /* @__PURE__ */
|
|
399
|
+
c && /* @__PURE__ */ r("div", { className: n.searchOverlay, children: /* @__PURE__ */ i("div", { className: n.searchContent, children: [
|
|
425
400
|
/* @__PURE__ */ i(T, { children: [
|
|
426
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ r(
|
|
427
402
|
T.Input,
|
|
428
403
|
{
|
|
429
|
-
ref:
|
|
404
|
+
ref: X,
|
|
430
405
|
"aria-label": l("header.search"),
|
|
431
406
|
placeholder: l("header.searchPlaceholder"),
|
|
432
407
|
value: h,
|
|
433
|
-
onChange: (
|
|
434
|
-
onKeyDown: (
|
|
435
|
-
|
|
408
|
+
onChange: (t) => b(t.target.value),
|
|
409
|
+
onKeyDown: (t) => {
|
|
410
|
+
t.key === "Enter" && V();
|
|
436
411
|
}
|
|
437
412
|
}
|
|
438
413
|
),
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ r(T.Button, { "aria-label": l("header.search"), onClick: V }),
|
|
415
|
+
/* @__PURE__ */ r(T.ClearButton, { onClick: () => b(""), "aria-label": l("header.clearSearch") })
|
|
441
416
|
] }),
|
|
442
|
-
h && /* @__PURE__ */
|
|
443
|
-
h && /* @__PURE__ */
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
417
|
+
h && /* @__PURE__ */ r("div", { role: "status", className: "ds-sr-only", children: y.length > 0 ? l("header.suggestionCount").replace("{count}", String(Math.min(y.length, 5))) : `${l("header.noResults")} ${h}` }),
|
|
418
|
+
h && /* @__PURE__ */ r("div", { className: n.searchResults, children: y.length > 0 ? /* @__PURE__ */ i("div", { className: n.suggestionsSection, children: [
|
|
419
|
+
/* @__PURE__ */ r("h3", { className: n.suggestionsTitle, children: l("header.suggestions") }),
|
|
420
|
+
/* @__PURE__ */ r("ul", { className: n.resultList, children: y.slice(0, 5).map((t) => /* @__PURE__ */ r("li", { className: n.resultItem, children: /* @__PURE__ */ i(
|
|
446
421
|
"button",
|
|
447
422
|
{
|
|
448
|
-
className:
|
|
449
|
-
onClick: () =>
|
|
423
|
+
className: n.resultLink,
|
|
424
|
+
onClick: () => be(t.path),
|
|
450
425
|
children: [
|
|
451
|
-
/* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
const a =
|
|
454
|
-
if (a === -1) return /* @__PURE__ */
|
|
455
|
-
const o =
|
|
456
|
-
return /* @__PURE__ */ i(
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ r("span", { className: n.suggestionIcon, children: /* @__PURE__ */ r(P, { "aria-hidden": !0 }) }),
|
|
427
|
+
/* @__PURE__ */ r("span", { className: n.suggestionText, children: (() => {
|
|
428
|
+
const a = t.title.toLowerCase().indexOf(h.toLowerCase());
|
|
429
|
+
if (a === -1) return /* @__PURE__ */ r("span", { className: n.remainingText, children: t.title });
|
|
430
|
+
const o = t.title.slice(0, a), u = t.title.slice(a, a + h.length), W = t.title.slice(a + h.length);
|
|
431
|
+
return /* @__PURE__ */ i(ye, { children: [
|
|
432
|
+
/* @__PURE__ */ r("span", { className: n.remainingText, children: o }),
|
|
433
|
+
/* @__PURE__ */ r("span", { className: n.highlightedText, children: u }),
|
|
434
|
+
/* @__PURE__ */ r("span", { className: n.remainingText, children: W })
|
|
460
435
|
] });
|
|
461
436
|
})() })
|
|
462
437
|
]
|
|
463
438
|
}
|
|
464
|
-
) },
|
|
439
|
+
) }, t.id)) }),
|
|
465
440
|
y.length > 5 && /* @__PURE__ */ i(
|
|
466
441
|
B,
|
|
467
442
|
{
|
|
468
443
|
href: "#",
|
|
469
444
|
"data-color": "neutral",
|
|
470
|
-
className:
|
|
471
|
-
onClick: (
|
|
472
|
-
|
|
445
|
+
className: n.viewAllLink,
|
|
446
|
+
onClick: (t) => {
|
|
447
|
+
t.preventDefault(), m && m(`search/${encodeURIComponent(h)}`), f(!1), b("");
|
|
473
448
|
},
|
|
474
449
|
children: [
|
|
475
450
|
l("header.viewAll"),
|
|
@@ -479,7 +454,7 @@ const je = ({
|
|
|
479
454
|
]
|
|
480
455
|
}
|
|
481
456
|
)
|
|
482
|
-
] }) : /* @__PURE__ */
|
|
457
|
+
] }) : /* @__PURE__ */ r("div", { className: n.noResults, children: /* @__PURE__ */ i(j, { children: [
|
|
483
458
|
l("header.noResults"),
|
|
484
459
|
' "',
|
|
485
460
|
h,
|
|
@@ -489,8 +464,8 @@ const je = ({
|
|
|
489
464
|
] })
|
|
490
465
|
);
|
|
491
466
|
};
|
|
492
|
-
function
|
|
493
|
-
const e =
|
|
467
|
+
function Ee($) {
|
|
468
|
+
const e = $;
|
|
494
469
|
return `
|
|
495
470
|
.${e.header} {
|
|
496
471
|
--rk-header-extension-height: 44px;
|
|
@@ -516,6 +491,10 @@ function Ne(C) {
|
|
|
516
491
|
}
|
|
517
492
|
.${e.header}[data-header-extension="true"]::before { top: var(--rk-header-extension-height); }
|
|
518
493
|
.${e.header}[data-variant="compact"]::before { display: none; }
|
|
494
|
+
.${e.header}[data-variant="compact"] .${e.headerInner} { min-height: var(--ds-size-18, 72px); }
|
|
495
|
+
.${e.header}[data-variant="compact"] .${e.logoWrapper} { background-color: transparent; margin-left: 0; padding-left: 0; height: auto; }
|
|
496
|
+
.${e.header}[data-variant="compact"] .${e.logo} { width: auto; height: auto; }
|
|
497
|
+
.${e.header}[data-variant="compact"] .${e.redCrossLogo} { width: auto; height: 44px; }
|
|
519
498
|
.${e.headerExtension} {
|
|
520
499
|
background-color: var(--ds-color-primary-color-red-base-default, #D52B1E);
|
|
521
500
|
width: 100%;
|
|
@@ -673,5 +652,5 @@ function Ne(C) {
|
|
|
673
652
|
`;
|
|
674
653
|
}
|
|
675
654
|
export {
|
|
676
|
-
|
|
655
|
+
Ue as Header
|
|
677
656
|
};
|