rk-designsystem 1.2.5 → 1.3.1
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 +45 -2
- package/dist/assets/images/ChevronLeftIcon.js +31 -0
- package/dist/assets/images/ChevronRightIcon.js +31 -0
- package/dist/components/Alert/index.js +16 -0
- package/dist/components/Avatar/index.js +9 -0
- package/dist/components/Badge/index.js +11 -0
- package/dist/components/Breadcrumbs/index.js +9 -0
- package/dist/components/Button/index.js +11 -0
- package/dist/components/Card/index.js +8 -0
- package/dist/components/Carousel/index.js +379 -0
- package/dist/components/Carousel/styles.module.css.js +38 -0
- package/dist/components/Checkbox/index.js +10 -0
- package/dist/components/Chip/index.js +6 -0
- package/dist/components/DateInput/index.js +258 -0
- package/dist/components/DateInput/styles.module.css.js +20 -0
- package/dist/components/DatePicker/index.js +357 -0
- package/dist/components/DatePicker/styles.module.css.js +30 -0
- package/dist/components/Details/index.js +6 -0
- package/dist/components/Dialog/index.js +6 -0
- package/dist/components/Divider/index.js +6 -0
- package/dist/components/Donor/index.js +382 -0
- package/dist/components/Donor/styles.module.css.js +42 -0
- package/dist/components/Dropdown/index.js +12 -0
- package/dist/components/ErrorSummary/index.js +6 -0
- package/dist/components/Field/index.js +10 -0
- package/dist/components/Fieldset/index.js +6 -0
- package/dist/components/Footer/index.js +722 -0
- package/dist/components/Footer/styles.module.css.js +138 -0
- package/dist/components/GraphicElement/index.js +317 -0
- package/dist/components/GraphicElement/styles.module.css.js +16 -0
- package/dist/components/Header/index.js +653 -0
- package/dist/components/Header/styles.module.css.js +114 -0
- package/dist/components/Heading/index.js +9 -0
- package/dist/components/Input/index.js +7 -0
- package/dist/components/Label/index.js +9 -0
- package/dist/components/Link/index.js +6 -0
- package/dist/components/List/index.js +6 -0
- package/dist/components/Pagination/index.js +11 -0
- package/dist/components/Paragraph/index.js +11 -0
- package/dist/components/Popover/index.js +6 -0
- package/dist/components/Radio/index.js +7 -0
- package/dist/components/Search/index.js +10 -0
- package/dist/components/Select/index.js +6 -0
- package/dist/components/SkeletonLoader/index.js +6 -0
- package/dist/components/SkipLink/index.js +6 -0
- package/dist/components/SpinnerLoader/index.js +6 -0
- package/dist/components/Suggestion/index.js +7 -0
- package/dist/components/Switch/index.js +6 -0
- package/dist/components/Table/index.js +6 -0
- package/dist/components/Tabs/index.js +6 -0
- package/dist/components/Tag/index.js +14 -0
- package/dist/components/Textarea/index.js +6 -0
- package/dist/components/Textfield/index.js +6 -0
- package/dist/components/ToggleGroup/index.js +6 -0
- package/dist/components/Tooltip/index.js +6 -0
- package/dist/components/ValidationMessage/index.js +9 -0
- package/dist/context/LanguageContext.js +91 -0
- package/dist/index.d.ts +357 -252
- package/dist/index.js +118 -0
- package/dist/rk-designsystem.css +1 -1
- package/dist/styles.css +15 -0
- package/dist/{componentlibrary.es.js → translations/index.js} +317 -3488
- package/dist/utils/search-index.js +106 -0
- package/package.json +22 -29
- package/dist/componentlibrary.umd.js +0 -1229
package/README.md
CHANGED
|
@@ -66,6 +66,11 @@ The design system includes the following components:
|
|
|
66
66
|
npm install rk-designsystem
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
> Since 1.4.0 the library declares `@digdir/designsystemet-react` and
|
|
70
|
+
> `@digdir/designsystemet-css` as peer dependencies (`~1.13.2`) and requires
|
|
71
|
+
> React `>=18.3.1`. npm 7+ installs peers automatically; with older
|
|
72
|
+
> setups install them alongside the package.
|
|
73
|
+
|
|
69
74
|
### 2. Setup Layout with Font
|
|
70
75
|
|
|
71
76
|
For Next.js projects, use `next/font` for optimal font loading:
|
|
@@ -216,6 +221,36 @@ The guide remains the main human-readable reference. The manifest is additive an
|
|
|
216
221
|
|
|
217
222
|
This guide provides a set of standards and best practices for creating new components. Following these guidelines ensures that our component library remains consistent, accessible, and easy to maintain.
|
|
218
223
|
|
|
224
|
+
## Migration notes (1.3.0 / 1.4.0)
|
|
225
|
+
|
|
226
|
+
The library is pre-production, so breaking changes ship as minor versions
|
|
227
|
+
until it has real production consumers. The breaking changes below landed in
|
|
228
|
+
1.3.0 unless marked otherwise. (Note: 1.2.5 already contained the
|
|
229
|
+
Button prop removals, mislabeled as a patch — 1.2.5 is deprecated.)
|
|
230
|
+
|
|
231
|
+
- **Peer dependencies (1.4.0):** `@digdir/designsystemet-react` and
|
|
232
|
+
`@digdir/designsystemet-css` (`~1.13.2`) are peers; React `>=18.3.1 || ^19`.
|
|
233
|
+
- **ESM-only (1.4.0):** the CommonJS/UMD entry is removed, so
|
|
234
|
+
`require('rk-designsystem')` now fails explicitly. It never actually worked:
|
|
235
|
+
the UMD file was parsed as ESM (the package is `"type": "module"`), and the
|
|
236
|
+
underlying Digdir library's own CJS entry is broken as well. Use `import`
|
|
237
|
+
(every bundler and modern Node setup).
|
|
238
|
+
- **`import 'rk-designsystem/styles'` now delivers everything:** Digdir base,
|
|
239
|
+
the Røde Kors theme, the component CSS and Source Sans 3.
|
|
240
|
+
- **Button:** `shape`/`pill` and `soft` props are removed — styling comes
|
|
241
|
+
from the design tokens.
|
|
242
|
+
- **CrossCorner is removed:** use `GraphicElement` with `shape="angle"`.
|
|
243
|
+
- **Footer:** `showCrossCorners` is renamed `showGraphicElements`.
|
|
244
|
+
- **Alert:** `title` renders visibly (previously a native tooltip); pass
|
|
245
|
+
`titleLevel` (2–6) when it should be a real heading.
|
|
246
|
+
- **DateInput:** invalid input is no longer silently rewritten (45 stays 45);
|
|
247
|
+
a built-in inline validation message appears on blur (`showValidationMessage`
|
|
248
|
+
to opt out), with `minDate`/`maxDate` (default 1900–2100) and an
|
|
249
|
+
`onValidationChange` callback. A label (or `aria-label`/`aria-labelledby`)
|
|
250
|
+
is required at type level.
|
|
251
|
+
- **DatePicker:** days outside the month are disabled for all input methods;
|
|
252
|
+
the calendar is a real ARIA grid with arrow-key navigation.
|
|
253
|
+
|
|
219
254
|
## Getting Started (for Contributors)
|
|
220
255
|
|
|
221
256
|
Follow these steps to get the local development environment running. All commands should be run from the root of the project.
|
|
@@ -231,6 +266,14 @@ pnpm build
|
|
|
231
266
|
pnpm storybook
|
|
232
267
|
```
|
|
233
268
|
|
|
269
|
+
## Testing
|
|
270
|
+
|
|
271
|
+
Testing i dette repoet følger Norges Røde Kors' testpolicy og overordnede teststrategi. Se **[TESTING.md](./TESTING.md)** for testplanen: testnivåer, risikobasert prioritering, kriterier for «klar til produksjon», feilhåndtering og rapportering. Kort versjon:
|
|
272
|
+
|
|
273
|
+
- Stories er testene: hver offentlig komponent har en assertion-bærende kontraktstory i ekte nettleser, og komponenter med brukeradferd har risikobaserte interaksjonstester. Automatisk WCAG-sjekk inngår i begge nivåer (brudd feiler bygget).
|
|
274
|
+
- Full regresjon (`npm test`) kjøres på hver pull request og hver push til `main` — ingenting merges eller publiseres utestet.
|
|
275
|
+
- Feil meldes som GitHub Issues med bug-malen; alvorlighetsgrad og reproduksjonssteg er påkrevd.
|
|
276
|
+
|
|
234
277
|
## Core Principles
|
|
235
278
|
|
|
236
279
|
Every component we build should adhere to these core principles:
|
|
@@ -317,9 +360,9 @@ Your Storybook file is the official documentation. It must be clear and comprehe
|
|
|
317
360
|
|
|
318
361
|
## Using NAV/Aksel Icons
|
|
319
362
|
|
|
320
|
-
This library is designed to work seamlessly with the official icon set from NAV/Aksel.
|
|
363
|
+
This library is designed to work seamlessly with the official icon set from NAV/Aksel. Since 1.4.0, `@navikt/aksel-icons` ships as a regular dependency of `rk-designsystem` — no separate install needed. To use the icons directly in your own code:
|
|
321
364
|
|
|
322
|
-
### Install
|
|
365
|
+
### Install (only for direct use in your app)
|
|
323
366
|
|
|
324
367
|
```bash
|
|
325
368
|
# npm
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
const i = ({ title: e, ...l }) => /* @__PURE__ */ n(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
viewBox: "0 0 28 28",
|
|
10
|
+
fill: "none",
|
|
11
|
+
"aria-hidden": e ? void 0 : !0,
|
|
12
|
+
focusable: "false",
|
|
13
|
+
...l,
|
|
14
|
+
children: [
|
|
15
|
+
e && /* @__PURE__ */ o("title", { children: e }),
|
|
16
|
+
/* @__PURE__ */ o(
|
|
17
|
+
"path",
|
|
18
|
+
{
|
|
19
|
+
fillRule: "evenodd",
|
|
20
|
+
clipRule: "evenodd",
|
|
21
|
+
d: "M16.952 6.96459C16.6103 6.62289 16.0563 6.62289 15.7146 6.96459L9.2979 13.3813C8.95621 13.723 8.95621 14.277 9.2979 14.6187L15.7146 21.0354C16.0563 21.3771 16.6103 21.3771 16.952 21.0354C17.2937 20.6937 17.2937 20.1396 16.952 19.7979L11.1541 14L16.952 8.20203C17.2937 7.86032 17.2937 7.3063 16.952 6.96459Z",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
i.displayName = "ChevronLeftIcon";
|
|
29
|
+
export {
|
|
30
|
+
i as ChevronLeftIcon
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
const n = ({ title: e, ...i }) => /* @__PURE__ */ l(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
viewBox: "0 0 28 28",
|
|
10
|
+
fill: "none",
|
|
11
|
+
"aria-hidden": e ? void 0 : !0,
|
|
12
|
+
focusable: "false",
|
|
13
|
+
...i,
|
|
14
|
+
children: [
|
|
15
|
+
e && /* @__PURE__ */ o("title", { children: e }),
|
|
16
|
+
/* @__PURE__ */ o(
|
|
17
|
+
"path",
|
|
18
|
+
{
|
|
19
|
+
fillRule: "evenodd",
|
|
20
|
+
clipRule: "evenodd",
|
|
21
|
+
d: "M11.048 6.96459C11.3897 6.62289 11.9437 6.62289 12.2854 6.96459L18.7021 13.3813C19.0438 13.723 19.0438 14.277 18.7021 14.6187L12.2854 21.0354C11.9437 21.3771 11.3897 21.3771 11.048 21.0354C10.7063 20.6937 10.7063 20.1396 11.048 19.7979L16.8459 14L11.048 8.20203C10.7063 7.86032 10.7063 7.3063 11.048 6.96459Z",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
n.displayName = "ChevronRightIcon";
|
|
29
|
+
export {
|
|
30
|
+
n as ChevronRightIcon
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as m } from "react";
|
|
4
|
+
import { Alert as d } from "@digdir/designsystemet-react";
|
|
5
|
+
import { Heading as n } from "../Heading/index.js";
|
|
6
|
+
const c = m((s, i) => {
|
|
7
|
+
const { title: e, titleLevel: r, children: l, ...a } = s;
|
|
8
|
+
return /* @__PURE__ */ o(d, { ref: i, ...a, children: [
|
|
9
|
+
e && (r ? /* @__PURE__ */ t(n, { level: r, "data-size": "2xs", style: { marginBottom: "var(--ds-size-1)" }, children: e }) : /* @__PURE__ */ t("p", { className: "ds-heading", "data-size": "2xs", style: { marginBottom: "var(--ds-size-1)" }, children: e })),
|
|
10
|
+
l
|
|
11
|
+
] });
|
|
12
|
+
});
|
|
13
|
+
c.displayName = "Alert";
|
|
14
|
+
export {
|
|
15
|
+
c as Alert
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as o } from "react";
|
|
4
|
+
import { Avatar as m } from "@digdir/designsystemet-react";
|
|
5
|
+
const e = o((r, a) => /* @__PURE__ */ t(m, { ref: a, ...r }));
|
|
6
|
+
e.displayName = "Avatar";
|
|
7
|
+
export {
|
|
8
|
+
e as Avatar
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as i } from "react";
|
|
4
|
+
import { BadgePosition as r, Badge as t } from "@digdir/designsystemet-react";
|
|
5
|
+
const s = i((o, e) => /* @__PURE__ */ a(t, { ref: e, ...o }));
|
|
6
|
+
s.displayName = "Badge";
|
|
7
|
+
const n = r;
|
|
8
|
+
export {
|
|
9
|
+
s as Badge,
|
|
10
|
+
n as BadgePosition
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Breadcrumbs as r, BreadcrumbsItem as s, BreadcrumbsLink as e, BreadcrumbsList as c } from "@digdir/designsystemet-react";
|
|
3
|
+
const a = r, t = c, u = s, b = e;
|
|
4
|
+
export {
|
|
5
|
+
a as Breadcrumbs,
|
|
6
|
+
u as BreadcrumbsItem,
|
|
7
|
+
b as BreadcrumbsLink,
|
|
8
|
+
t as BreadcrumbsList
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { Button as u } from "@digdir/designsystemet-react";
|
|
4
|
+
import { forwardRef as m } from "react";
|
|
5
|
+
const e = m(function({ variant: t, ...o }, r) {
|
|
6
|
+
return /* @__PURE__ */ n(u, { ref: r, variant: t, ...o });
|
|
7
|
+
});
|
|
8
|
+
e.displayName = "Button";
|
|
9
|
+
export {
|
|
10
|
+
e as Button
|
|
11
|
+
};
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as p, useState as d, useRef as J, useCallback as h, useMemo as Q } from "react";
|
|
4
|
+
import Y from "embla-carousel-react";
|
|
5
|
+
import a from "./styles.module.css.js";
|
|
6
|
+
import { ChevronLeftIcon as Z, ChevronRightIcon as V, PlayIcon as ee, PauseIcon as te } from "@navikt/aksel-icons";
|
|
7
|
+
import { Button as B } from "../Button/index.js";
|
|
8
|
+
import { Spinner as re } from "../SpinnerLoader/index.js";
|
|
9
|
+
import { useLanguageOptional as oe } from "../../context/LanguageContext.js";
|
|
10
|
+
const ae = ({
|
|
11
|
+
images: e,
|
|
12
|
+
autoPlay: l = !1,
|
|
13
|
+
autoDelay: b = 5,
|
|
14
|
+
showArrows: v = !0,
|
|
15
|
+
showDots: x = !0,
|
|
16
|
+
variant: P,
|
|
17
|
+
slidesPerView: $ = 1,
|
|
18
|
+
slideSpacing: y = 16,
|
|
19
|
+
cornerRadius: g = 0,
|
|
20
|
+
"data-color": A,
|
|
21
|
+
"data-size": F
|
|
22
|
+
}) => {
|
|
23
|
+
const { t: s } = oe();
|
|
24
|
+
p(() => {
|
|
25
|
+
const r = "rk-carousel-inline-styles";
|
|
26
|
+
if (typeof document > "u" || document.getElementById(r)) return;
|
|
27
|
+
const o = ie(a), i = document.createElement("style");
|
|
28
|
+
i.id = r, i.textContent = o, document.head.appendChild(i);
|
|
29
|
+
}, []);
|
|
30
|
+
const R = {
|
|
31
|
+
loop: !0,
|
|
32
|
+
align: "start",
|
|
33
|
+
containScroll: "trimSnaps",
|
|
34
|
+
slidesToScroll: 1
|
|
35
|
+
}, [T, t] = Y(R), [M, O] = d(0), [_, w] = d([]), [z, I] = d([]), k = J([]), D = (e ?? []).map((r) => r.src).join(`
|
|
36
|
+
`);
|
|
37
|
+
p(() => {
|
|
38
|
+
I(
|
|
39
|
+
(e ?? []).map((r, o) => {
|
|
40
|
+
const i = k.current[o];
|
|
41
|
+
return !!(i && i.complete && i.naturalWidth > 0);
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}, [D]);
|
|
45
|
+
const C = h((r) => {
|
|
46
|
+
I((o) => {
|
|
47
|
+
if (o[r]) return o;
|
|
48
|
+
const i = [...o];
|
|
49
|
+
return i[r] = !0, i;
|
|
50
|
+
});
|
|
51
|
+
}, []), N = Q(() => b * 1e3, [b]), c = h(() => {
|
|
52
|
+
t && O(t.selectedScrollSnap());
|
|
53
|
+
}, [t]), H = h((r) => t && t.scrollTo(r), [t]), K = h(() => t && t.scrollPrev(), [t]), U = h(() => t && t.scrollNext(), [t]);
|
|
54
|
+
p(() => {
|
|
55
|
+
if (t)
|
|
56
|
+
return t.on("select", c), t.on("reInit", c), w(t.scrollSnapList()), () => {
|
|
57
|
+
t.off("select", c), t.off("reInit", c);
|
|
58
|
+
};
|
|
59
|
+
}, [t, c]), p(() => {
|
|
60
|
+
t && (t.reInit(), w(t.scrollSnapList()));
|
|
61
|
+
}, [t, e, $, y]);
|
|
62
|
+
const [f, W] = d(!1), [X, S] = d(!1), [q, L] = d(!1), j = l && !f && !X && !q;
|
|
63
|
+
p(() => {
|
|
64
|
+
if (!j || !t || !e || e.length <= 1) return;
|
|
65
|
+
const r = window.setInterval(() => {
|
|
66
|
+
t.canScrollNext() && t.scrollNext();
|
|
67
|
+
}, N);
|
|
68
|
+
return () => {
|
|
69
|
+
window.clearInterval(r);
|
|
70
|
+
};
|
|
71
|
+
}, [j, N, t, e]);
|
|
72
|
+
const E = Math.max(1, $), G = `${100 / E}%`, m = y / 2;
|
|
73
|
+
return /* @__PURE__ */ u(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: a.carouselContainer,
|
|
77
|
+
"data-color": A,
|
|
78
|
+
"data-size": F,
|
|
79
|
+
"data-variant": P,
|
|
80
|
+
onMouseEnter: l ? () => S(!0) : void 0,
|
|
81
|
+
onMouseLeave: l ? () => S(!1) : void 0,
|
|
82
|
+
onFocus: l ? () => L(!0) : void 0,
|
|
83
|
+
onBlur: l ? (r) => {
|
|
84
|
+
r.currentTarget.contains(r.relatedTarget) || L(!1);
|
|
85
|
+
} : void 0,
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ n("div", { className: a.viewport, ref: T, children: /* @__PURE__ */ n(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: a.slides,
|
|
91
|
+
style: {
|
|
92
|
+
marginLeft: `-${m}px`,
|
|
93
|
+
marginRight: `-${m}px`
|
|
94
|
+
},
|
|
95
|
+
children: e && e.length > 0 ? e.map((r, o) => /* @__PURE__ */ n(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: a.slide,
|
|
99
|
+
style: {
|
|
100
|
+
flex: `0 0 ${G}`,
|
|
101
|
+
paddingLeft: `${m}px`,
|
|
102
|
+
paddingRight: `${m}px`,
|
|
103
|
+
borderRadius: g > 0 ? `${g}px` : void 0,
|
|
104
|
+
overflow: "hidden"
|
|
105
|
+
// Ensure radius clips content
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ u("div", { className: a.slideInner, style: { borderRadius: `${g}px`, overflow: "hidden", position: "relative", width: "100%", height: "100%" }, children: [
|
|
108
|
+
!z[o] && /* @__PURE__ */ n("div", { className: a.loaderOverlay, children: /* @__PURE__ */ n(re, { "aria-label": s("carousel.loading") }) }),
|
|
109
|
+
/* @__PURE__ */ n(
|
|
110
|
+
"img",
|
|
111
|
+
{
|
|
112
|
+
ref: (i) => {
|
|
113
|
+
k.current[o] = i;
|
|
114
|
+
},
|
|
115
|
+
className: `${a.image} ${z[o] ? a.loaded : a.loadingImage}`,
|
|
116
|
+
src: r.src,
|
|
117
|
+
alt: r.alt,
|
|
118
|
+
loading: o < E ? "eager" : "lazy",
|
|
119
|
+
crossOrigin: "anonymous",
|
|
120
|
+
onLoad: () => C(o),
|
|
121
|
+
onError: (i) => {
|
|
122
|
+
i.target.style.display = "none", C(o);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] })
|
|
127
|
+
},
|
|
128
|
+
`image-${o}-${r.src}`
|
|
129
|
+
)) : /* @__PURE__ */ n("div", { className: a.slide, style: { flex: "0 0 100%" }, children: /* @__PURE__ */ n("div", { className: a.empty, children: "Ingen bilder" }) })
|
|
130
|
+
}
|
|
131
|
+
) }),
|
|
132
|
+
(v || x && e && e.length > 1) && /* @__PURE__ */ u("div", { className: a.controls, "aria-hidden": "false", children: [
|
|
133
|
+
v && /* @__PURE__ */ u("div", { className: a.arrows, children: [
|
|
134
|
+
/* @__PURE__ */ n(
|
|
135
|
+
B,
|
|
136
|
+
{
|
|
137
|
+
variant: "primary",
|
|
138
|
+
icon: !0,
|
|
139
|
+
"aria-label": s("carousel.previousImage"),
|
|
140
|
+
onClick: K,
|
|
141
|
+
disabled: !e || e.length <= 1,
|
|
142
|
+
children: /* @__PURE__ */ n(Z, { "aria-hidden": !0 })
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ n(
|
|
146
|
+
B,
|
|
147
|
+
{
|
|
148
|
+
variant: "primary",
|
|
149
|
+
icon: !0,
|
|
150
|
+
"aria-label": s("carousel.nextImage"),
|
|
151
|
+
onClick: U,
|
|
152
|
+
disabled: !e || e.length <= 1,
|
|
153
|
+
children: /* @__PURE__ */ n(V, { "aria-hidden": !0 })
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] }),
|
|
157
|
+
x && e && e.length > 1 && /* @__PURE__ */ u("div", { className: a.dots, role: "group", "aria-label": s("carousel.imagePosition"), children: [
|
|
158
|
+
l && /* @__PURE__ */ n(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
className: a.playPause,
|
|
163
|
+
onClick: () => W((r) => !r),
|
|
164
|
+
"aria-label": s(f ? "carousel.resumeAutoplay" : "carousel.pauseAutoplay"),
|
|
165
|
+
"aria-pressed": f,
|
|
166
|
+
children: f ? /* @__PURE__ */ n(ee, { "aria-hidden": !0 }) : /* @__PURE__ */ n(te, { "aria-hidden": !0 })
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
_.map((r, o) => {
|
|
170
|
+
const i = o === M;
|
|
171
|
+
return /* @__PURE__ */ n(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
type: "button",
|
|
175
|
+
className: `${a.dot} ${i ? a.dotActive : ""}`,
|
|
176
|
+
onClick: () => H(o),
|
|
177
|
+
"aria-label": `${s("carousel.goToImage")} ${o + 1}`,
|
|
178
|
+
"aria-current": i || void 0
|
|
179
|
+
},
|
|
180
|
+
`dot-${o}`
|
|
181
|
+
);
|
|
182
|
+
})
|
|
183
|
+
] })
|
|
184
|
+
] })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
ae.displayName = "Carousel";
|
|
190
|
+
function ie(e) {
|
|
191
|
+
return `
|
|
192
|
+
.${e.carouselContainer} {
|
|
193
|
+
position: relative;
|
|
194
|
+
display: block;
|
|
195
|
+
width: 100%;
|
|
196
|
+
height: 100%;
|
|
197
|
+
min-height: 200px;
|
|
198
|
+
background-color: var(--ds-color-background-default, #fff);
|
|
199
|
+
color: var(--ds-color-text-default, #2b2b2b);
|
|
200
|
+
border-radius: var(--ds-border-radius-md, 4px);
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
max-width: 100%;
|
|
203
|
+
}
|
|
204
|
+
.${e.viewport} {
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
width: 100%;
|
|
207
|
+
height: 100%;
|
|
208
|
+
}
|
|
209
|
+
.${e.slides} {
|
|
210
|
+
display: flex;
|
|
211
|
+
height: 100%;
|
|
212
|
+
user-select: none;
|
|
213
|
+
-webkit-touch-callout: none;
|
|
214
|
+
-khtml-user-select: none;
|
|
215
|
+
-moz-user-select: none;
|
|
216
|
+
-ms-user-select: none;
|
|
217
|
+
}
|
|
218
|
+
.${e.slide} {
|
|
219
|
+
position: relative;
|
|
220
|
+
min-width: 0;
|
|
221
|
+
height: 100%;
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
box-sizing: border-box;
|
|
226
|
+
}
|
|
227
|
+
.${e.slideInner} {
|
|
228
|
+
position: relative;
|
|
229
|
+
width: 100%;
|
|
230
|
+
height: 100%;
|
|
231
|
+
background-color: var(--ds-color-neutral-surface-tinted, #f5f5f5);
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
}
|
|
234
|
+
.${e.loaderOverlay} {
|
|
235
|
+
position: absolute;
|
|
236
|
+
inset: 0;
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
justify-content: center;
|
|
240
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
241
|
+
z-index: 2;
|
|
242
|
+
}
|
|
243
|
+
.${e.image} {
|
|
244
|
+
position: absolute;
|
|
245
|
+
inset: 0;
|
|
246
|
+
width: 100%;
|
|
247
|
+
height: 100%;
|
|
248
|
+
object-fit: cover;
|
|
249
|
+
opacity: 0;
|
|
250
|
+
transition: opacity 0.3s ease-in-out;
|
|
251
|
+
z-index: 1;
|
|
252
|
+
}
|
|
253
|
+
.${e.image}.${e.loaded} {
|
|
254
|
+
opacity: 1;
|
|
255
|
+
}
|
|
256
|
+
.${e.loading} {
|
|
257
|
+
display: inline-flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
gap: var(--ds-size-2, 8px);
|
|
260
|
+
color: var(--ds-color-text-subtle, #5d5d5d);
|
|
261
|
+
font-size: var(--ds-font-size-2, 14px);
|
|
262
|
+
}
|
|
263
|
+
.${e.empty} {
|
|
264
|
+
color: var(--ds-color-text-subtle, #5d5d5d);
|
|
265
|
+
font-size: var(--ds-font-size-2, 14px);
|
|
266
|
+
text-align: center;
|
|
267
|
+
}
|
|
268
|
+
.${e.controls} {
|
|
269
|
+
position: absolute;
|
|
270
|
+
inset: 0;
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
justify-content: center;
|
|
274
|
+
pointer-events: none;
|
|
275
|
+
z-index: 10;
|
|
276
|
+
}
|
|
277
|
+
.${e.arrows} {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: space-between;
|
|
281
|
+
width: 100%;
|
|
282
|
+
padding: 0 var(--ds-size-4, 16px);
|
|
283
|
+
box-sizing: border-box;
|
|
284
|
+
pointer-events: auto;
|
|
285
|
+
}
|
|
286
|
+
.${e.dots} {
|
|
287
|
+
position: absolute;
|
|
288
|
+
left: 50%;
|
|
289
|
+
transform: translateX(-50%);
|
|
290
|
+
bottom: var(--ds-size-3, 12px);
|
|
291
|
+
display: inline-flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: var(--ds-size-2, 8px);
|
|
294
|
+
pointer-events: auto;
|
|
295
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
296
|
+
backdrop-filter: blur(4px);
|
|
297
|
+
padding: var(--ds-size-1, 4px) var(--ds-size-2, 8px);
|
|
298
|
+
border-radius: 999px;
|
|
299
|
+
}
|
|
300
|
+
.${e.dot} {
|
|
301
|
+
width: 12px;
|
|
302
|
+
height: 12px;
|
|
303
|
+
border-radius: 999px;
|
|
304
|
+
border: var(--ds-border-width-default, 1px) solid var(--ds-color-border-subtle, #d6d6d6);
|
|
305
|
+
background-color: rgba(255, 255, 255, 0.6);
|
|
306
|
+
padding: 0;
|
|
307
|
+
margin: 0;
|
|
308
|
+
cursor: pointer;
|
|
309
|
+
transition: all 0.2s ease;
|
|
310
|
+
}
|
|
311
|
+
.${e.playPause} {
|
|
312
|
+
display: inline-flex;
|
|
313
|
+
align-items: center;
|
|
314
|
+
justify-content: center;
|
|
315
|
+
width: var(--ds-size-6, 24px);
|
|
316
|
+
height: var(--ds-size-6, 24px);
|
|
317
|
+
border-radius: 999px;
|
|
318
|
+
border: var(--ds-border-width-default, 1px) solid var(--ds-color-border-subtle, #d6d6d6);
|
|
319
|
+
background-color: rgba(255, 255, 255, 0.85);
|
|
320
|
+
color: var(--ds-color-neutral-text-default, #2b2b2b);
|
|
321
|
+
padding: 0;
|
|
322
|
+
margin: 0;
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
}
|
|
325
|
+
.${e.dotActive} {
|
|
326
|
+
background-color: var(--ds-color-primary-color-red-base-default, #D52B1E);
|
|
327
|
+
border-color: var(--ds-color-primary-color-red-base-default, #D52B1E);
|
|
328
|
+
transform: scale(1.1);
|
|
329
|
+
}
|
|
330
|
+
@media (max-width: 640px) {
|
|
331
|
+
.${e.carouselContainer} {
|
|
332
|
+
height: auto;
|
|
333
|
+
min-height: 150px;
|
|
334
|
+
aspect-ratio: 16 / 9;
|
|
335
|
+
}
|
|
336
|
+
.${e.viewport} {
|
|
337
|
+
aspect-ratio: 16 / 9;
|
|
338
|
+
height: auto;
|
|
339
|
+
}
|
|
340
|
+
.${e.slides} {
|
|
341
|
+
height: auto;
|
|
342
|
+
min-height: 150px;
|
|
343
|
+
}
|
|
344
|
+
.${e.slide} {
|
|
345
|
+
height: auto;
|
|
346
|
+
min-height: 150px;
|
|
347
|
+
}
|
|
348
|
+
.${e.slideInner} {
|
|
349
|
+
aspect-ratio: 16 / 9;
|
|
350
|
+
height: auto;
|
|
351
|
+
}
|
|
352
|
+
.${e.arrows} {
|
|
353
|
+
padding: 0 var(--ds-size-2, 8px);
|
|
354
|
+
}
|
|
355
|
+
.${e.dots} {
|
|
356
|
+
bottom: var(--ds-size-2, 8px);
|
|
357
|
+
gap: var(--ds-size-1, 4px);
|
|
358
|
+
}
|
|
359
|
+
.${e.dot} {
|
|
360
|
+
width: 10px;
|
|
361
|
+
height: 10px;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
@media (max-width: 400px) {
|
|
365
|
+
.${e.carouselContainer} {
|
|
366
|
+
min-height: 120px;
|
|
367
|
+
}
|
|
368
|
+
.${e.arrows} {
|
|
369
|
+
padding: 0 var(--ds-size-1, 4px);
|
|
370
|
+
}
|
|
371
|
+
.${e.arrows} button {
|
|
372
|
+
transform: scale(0.85);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
`;
|
|
376
|
+
}
|
|
377
|
+
export {
|
|
378
|
+
ae as Carousel
|
|
379
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const o = "_carouselContainer_oit30_1", t = "_viewport_oit30_14", s = "_slides_oit30_20", _ = "_slide_oit30_20", e = "_slideInner_oit30_40", i = "_loaderOverlay_oit30_48", n = "_image_oit30_58", l = "_loaded_oit30_69", a = "_loading_oit30_73", d = "_empty_oit30_81", r = "_controls_oit30_87", c = "_arrows_oit30_97", p = "_dots_oit30_107", y = "_playPause_oit30_122", v = "_dot_oit30_107", u = "_dotActive_oit30_153", g = {
|
|
3
|
+
carouselContainer: o,
|
|
4
|
+
viewport: t,
|
|
5
|
+
slides: s,
|
|
6
|
+
slide: _,
|
|
7
|
+
slideInner: e,
|
|
8
|
+
loaderOverlay: i,
|
|
9
|
+
image: n,
|
|
10
|
+
loaded: l,
|
|
11
|
+
loading: a,
|
|
12
|
+
empty: d,
|
|
13
|
+
controls: r,
|
|
14
|
+
arrows: c,
|
|
15
|
+
dots: p,
|
|
16
|
+
playPause: y,
|
|
17
|
+
dot: v,
|
|
18
|
+
dotActive: u
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
c as arrows,
|
|
22
|
+
o as carouselContainer,
|
|
23
|
+
r as controls,
|
|
24
|
+
g as default,
|
|
25
|
+
v as dot,
|
|
26
|
+
u as dotActive,
|
|
27
|
+
p as dots,
|
|
28
|
+
d as empty,
|
|
29
|
+
n as image,
|
|
30
|
+
l as loaded,
|
|
31
|
+
i as loaderOverlay,
|
|
32
|
+
a as loading,
|
|
33
|
+
y as playPause,
|
|
34
|
+
_ as slide,
|
|
35
|
+
e as slideInner,
|
|
36
|
+
s as slides,
|
|
37
|
+
t as viewport
|
|
38
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Checkbox as e, useCheckboxGroup as o, Fieldset as s } from "@digdir/designsystemet-react";
|
|
3
|
+
const c = e, t = s, x = o;
|
|
4
|
+
c.displayName = "Checkbox";
|
|
5
|
+
t.displayName = "Fieldset";
|
|
6
|
+
export {
|
|
7
|
+
c as Checkbox,
|
|
8
|
+
t as Fieldset,
|
|
9
|
+
x as useCheckboxGroup
|
|
10
|
+
};
|