@navikt/ds-react 5.2.1 → 5.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/_docs.json +336 -140
- package/cjs/date/DateInput.js +1 -1
- package/cjs/date/monthpicker/MonthButton.js +5 -5
- package/cjs/form/Textarea.js +1 -4
- package/cjs/guide-panel/GuidePanel.js +7 -5
- package/cjs/guide-panel/Illustration.js +12 -16
- package/cjs/typography/BodyLong.js +14 -7
- package/cjs/typography/BodyShort.js +13 -8
- package/cjs/typography/Detail.js +14 -7
- package/cjs/typography/ErrorMessage.js +6 -4
- package/cjs/typography/Heading.js +10 -6
- package/cjs/typography/Ingress.js +4 -2
- package/cjs/typography/Label.js +10 -6
- package/cjs/typography/types.js +2 -0
- package/cjs/typography/util.js +19 -0
- package/esm/date/DateInput.js +1 -1
- package/esm/date/DateInput.js.map +1 -1
- package/esm/date/monthpicker/MonthButton.js +5 -5
- package/esm/date/monthpicker/MonthButton.js.map +1 -1
- package/esm/form/Textarea.js +1 -4
- package/esm/form/Textarea.js.map +1 -1
- package/esm/guide-panel/GuidePanel.d.ts +3 -3
- package/esm/guide-panel/GuidePanel.js +7 -5
- package/esm/guide-panel/GuidePanel.js.map +1 -1
- package/esm/guide-panel/Illustration.js +12 -16
- package/esm/guide-panel/Illustration.js.map +1 -1
- package/esm/guide-panel/index.d.ts +0 -1
- package/esm/guide-panel/index.js.map +1 -1
- package/esm/typography/BodyLong.d.ts +9 -10
- package/esm/typography/BodyLong.js +14 -7
- package/esm/typography/BodyLong.js.map +1 -1
- package/esm/typography/BodyShort.d.ts +6 -9
- package/esm/typography/BodyShort.js +13 -8
- package/esm/typography/BodyShort.js.map +1 -1
- package/esm/typography/Detail.d.ts +4 -7
- package/esm/typography/Detail.js +14 -7
- package/esm/typography/Detail.js.map +1 -1
- package/esm/typography/ErrorMessage.d.ts +4 -7
- package/esm/typography/ErrorMessage.js +6 -4
- package/esm/typography/ErrorMessage.js.map +1 -1
- package/esm/typography/Heading.d.ts +3 -7
- package/esm/typography/Heading.js +10 -6
- package/esm/typography/Heading.js.map +1 -1
- package/esm/typography/Ingress.d.ts +4 -2
- package/esm/typography/Ingress.js +4 -2
- package/esm/typography/Ingress.js.map +1 -1
- package/esm/typography/Label.d.ts +4 -7
- package/esm/typography/Label.js +10 -6
- package/esm/typography/Label.js.map +1 -1
- package/esm/typography/types.d.ts +26 -0
- package/esm/typography/types.js +2 -0
- package/esm/typography/types.js.map +1 -0
- package/esm/typography/util.d.ts +4 -0
- package/esm/typography/util.js +13 -0
- package/esm/typography/util.js.map +1 -0
- package/package.json +2 -2
- package/src/date/DateInput.tsx +1 -1
- package/src/date/datepicker/datepicker.stories.tsx +23 -19
- package/src/date/monthpicker/MonthButton.tsx +5 -7
- package/src/date/monthpicker/monthpicker.stories.tsx +30 -32
- package/src/form/Textarea.tsx +1 -1
- package/src/guide-panel/GuidePanel.tsx +11 -10
- package/src/guide-panel/Illustration.tsx +23 -47
- package/src/guide-panel/guidepanel.stories.tsx +39 -14
- package/src/guide-panel/index.ts +0 -1
- package/src/typography/BodyLong.tsx +36 -15
- package/src/typography/BodyShort.tsx +34 -15
- package/src/typography/Detail.tsx +28 -13
- package/src/typography/ErrorMessage.tsx +17 -11
- package/src/typography/Heading.tsx +32 -12
- package/src/typography/Ingress.tsx +4 -2
- package/src/typography/Label.tsx +28 -13
- package/src/typography/stories/bodylong.stories.tsx +165 -0
- package/src/typography/stories/bodyshort.stories.tsx +164 -0
- package/src/typography/stories/detail.stories.tsx +88 -0
- package/src/typography/stories/error-message.stories.tsx +93 -0
- package/src/typography/stories/heading.stories.tsx +143 -0
- package/src/typography/stories/ingress.stories.tsx +51 -0
- package/src/typography/stories/label.stories.tsx +98 -0
- package/src/typography/types.ts +26 -0
- package/src/typography/util.ts +14 -0
- package/cjs/guide-panel/Guide.js +0 -48
- package/esm/guide-panel/Guide.d.ts +0 -14
- package/esm/guide-panel/Guide.js +0 -21
- package/esm/guide-panel/Guide.js.map +0 -1
- package/src/guide-panel/Guide.tsx +0 -34
- package/src/typography/heading.stories.tsx +0 -77
- package/src/typography/typography.stories.tsx +0 -166
package/esm/typography/Label.js
CHANGED
|
@@ -9,8 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import React, { forwardRef } from "react";
|
|
13
12
|
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef } from "react";
|
|
14
|
+
import { typoClassNames } from "./util";
|
|
14
15
|
/**
|
|
15
16
|
* Part of a set of components for displaying text with consistent typography.
|
|
16
17
|
*
|
|
@@ -20,16 +21,19 @@ import cl from "clsx";
|
|
|
20
21
|
*
|
|
21
22
|
* @example
|
|
22
23
|
* ```jsx
|
|
23
|
-
* <Label
|
|
24
|
-
*
|
|
24
|
+
* <Label>
|
|
25
|
+
* Oppgi årsaken til at du har ventet mer enn 6 måneder med å søke om refusjon
|
|
25
26
|
* </Label>
|
|
26
27
|
* ```
|
|
27
28
|
*/
|
|
28
29
|
export const Label = forwardRef((_a, ref) => {
|
|
29
|
-
var { className, size = "medium",
|
|
30
|
-
return (React.createElement(Component, Object.assign({}, rest, { ref: ref, className: cl(className, "navds-label", {
|
|
30
|
+
var { className, size = "medium", as: Component = "label", spacing, visuallyHidden, textColor } = _a, rest = __rest(_a, ["className", "size", "as", "spacing", "visuallyHidden", "textColor"]);
|
|
31
|
+
return (React.createElement(Component, Object.assign({}, rest, { ref: ref, className: cl(className, "navds-label", typoClassNames({
|
|
32
|
+
spacing,
|
|
33
|
+
visuallyHidden,
|
|
34
|
+
textColor,
|
|
35
|
+
}), {
|
|
31
36
|
"navds-label--small": size === "small",
|
|
32
|
-
"navds-typo--spacing": !!spacing,
|
|
33
37
|
}) })));
|
|
34
38
|
});
|
|
35
39
|
export default Label;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../src/typography/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../src/typography/Label.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAgBxC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAChB,UAAU,CACR,CACE,EAQC,EACD,GAAG,EACH,EAAE;QAVF,EACE,SAAS,EACT,IAAI,GAAG,QAAQ,EACf,EAAE,EAAE,SAAS,GAAG,OAAO,EACvB,OAAO,EACP,cAAc,EACd,SAAS,OAEV,EADI,IAAI,cAPT,qEAQC,CADQ;IAGN,OAAA,CACH,oBAAC,SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,SAAS,EACT,aAAa,EACb,cAAc,CAAC;YACb,OAAO;YACP,cAAc;YACd,SAAS;SACV,CAAC,EACF;YACE,oBAAoB,EAAE,IAAI,KAAK,OAAO;SACvC,CACF,IACD,CACH,CAAA;CAAA,CACF,CAAC;AAEJ,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type TypoProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Truncate text overflow with ellipsis.
|
|
4
|
+
*/
|
|
5
|
+
truncate?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Adjusts font-weight.
|
|
8
|
+
*/
|
|
9
|
+
weight?: "regular" | "semibold";
|
|
10
|
+
/**
|
|
11
|
+
* Adjust text-align.
|
|
12
|
+
*/
|
|
13
|
+
align?: "start" | "center" | "end";
|
|
14
|
+
/**
|
|
15
|
+
* Visually hide text. Text will still be accessible for screenreaders
|
|
16
|
+
*/
|
|
17
|
+
visuallyHidden?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Adds spacing below text
|
|
20
|
+
*/
|
|
21
|
+
spacing?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Adjusts color
|
|
24
|
+
*/
|
|
25
|
+
textColor?: "default" | "subtle";
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/typography/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import cl from "clsx";
|
|
2
|
+
export const typoClassNames = (props) => {
|
|
3
|
+
return cl({
|
|
4
|
+
"navds-typo--spacing": props.spacing,
|
|
5
|
+
"navds-typo--truncate": props.truncate,
|
|
6
|
+
"navds-typo--semibold": props.weight === "semibold",
|
|
7
|
+
[`navds-typo--align-${props.align}`]: props.align,
|
|
8
|
+
[`navds-typo--color-${props.textColor}`]: props.textColor,
|
|
9
|
+
"navds-typo--visually-hidden": props.visuallyHidden,
|
|
10
|
+
"navds-typo--uppercase": props.uppercase,
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/typography/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AAGtB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA0C,EAAE,EAAE;IAC3E,OAAO,EAAE,CAAC;QACR,qBAAqB,EAAE,KAAK,CAAC,OAAO;QACpC,sBAAsB,EAAE,KAAK,CAAC,QAAQ;QACtC,sBAAsB,EAAE,KAAK,CAAC,MAAM,KAAK,UAAU;QACnD,CAAC,qBAAqB,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK;QACjD,CAAC,qBAAqB,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS;QACzD,6BAA6B,EAAE,KAAK,CAAC,cAAc;QACnD,uBAAuB,EAAE,KAAK,CAAC,SAAS;KACzC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Aksel react-components for NAV designsystem",
|
|
5
5
|
"author": "Aksel | NAV designsystem team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "0.24.1",
|
|
41
|
-
"@navikt/aksel-icons": "^5.
|
|
41
|
+
"@navikt/aksel-icons": "^5.3.1",
|
|
42
42
|
"@radix-ui/react-tabs": "1.0.0",
|
|
43
43
|
"@radix-ui/react-toggle-group": "1.0.0",
|
|
44
44
|
"clsx": "^1.2.1",
|
package/src/date/DateInput.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import React, { useId, useState } from "react";
|
|
3
4
|
import { useDatepicker, useRangeDatepicker } from "..";
|
|
4
5
|
import { Button } from "../..";
|
|
5
|
-
import DatePicker from "./DatePicker";
|
|
6
|
+
import DatePicker, { DatePickerProps } from "./DatePicker";
|
|
6
7
|
|
|
7
8
|
const disabledDays = [
|
|
8
9
|
new Date("Oct 10 2022"),
|
|
@@ -12,20 +13,29 @@ const disabledDays = [
|
|
|
12
13
|
export default {
|
|
13
14
|
title: "ds-react/Datepicker",
|
|
14
15
|
component: DatePicker,
|
|
16
|
+
} satisfies Meta<typeof DatePicker>;
|
|
17
|
+
|
|
18
|
+
type DefaultStoryProps = DatePickerProps & {
|
|
19
|
+
size: "medium" | "small";
|
|
20
|
+
openOnFocus: boolean;
|
|
21
|
+
inputfield: boolean;
|
|
22
|
+
standalone: boolean;
|
|
15
23
|
};
|
|
16
24
|
|
|
17
|
-
export const Default = {
|
|
25
|
+
export const Default: StoryObj<DefaultStoryProps> = {
|
|
18
26
|
render: (props) => {
|
|
19
27
|
const [open, setOpen] = useState(false);
|
|
20
28
|
|
|
21
29
|
const rangeCtx = useRangeDatepicker({
|
|
22
30
|
fromDate: new Date("Aug 23 2020"),
|
|
23
31
|
toDate: new Date("Aug 23 2023"),
|
|
32
|
+
openOnFocus: props.openOnFocus,
|
|
24
33
|
});
|
|
25
34
|
|
|
26
35
|
const singleCtx = useDatepicker({
|
|
27
36
|
fromDate: new Date("Aug 23 2020"),
|
|
28
37
|
toDate: new Date("Aug 23 2023"),
|
|
38
|
+
openOnFocus: props.openOnFocus,
|
|
29
39
|
});
|
|
30
40
|
|
|
31
41
|
const newProps = {
|
|
@@ -44,9 +54,7 @@ export const Default = {
|
|
|
44
54
|
return (
|
|
45
55
|
<div>
|
|
46
56
|
<Comp
|
|
47
|
-
|
|
48
|
-
dropdownCaption={props?.dropdownCaption}
|
|
49
|
-
disableWeekends={props?.disableWeekends}
|
|
57
|
+
dropdownCaption={props.dropdownCaption}
|
|
50
58
|
showWeekNumber={props.showWeekNumber}
|
|
51
59
|
mode={props.mode}
|
|
52
60
|
{...(props.mode === "single"
|
|
@@ -55,6 +63,8 @@ export const Default = {
|
|
|
55
63
|
? rangeCtx.datepickerProps
|
|
56
64
|
: {})}
|
|
57
65
|
{...newProps}
|
|
66
|
+
locale={props.locale}
|
|
67
|
+
disableWeekends={props.disableWeekends}
|
|
58
68
|
>
|
|
59
69
|
{!props.standalone && (
|
|
60
70
|
<>
|
|
@@ -99,29 +109,23 @@ export const Default = {
|
|
|
99
109
|
dropdownCaption: false,
|
|
100
110
|
disableWeekends: false,
|
|
101
111
|
showWeekNumber: false,
|
|
112
|
+
mode: "single",
|
|
113
|
+
openOnFocus: true,
|
|
102
114
|
inputfield: true,
|
|
103
115
|
standalone: false,
|
|
104
|
-
openOnFocus: true,
|
|
105
|
-
mode: "single",
|
|
106
116
|
},
|
|
107
117
|
argTypes: {
|
|
108
118
|
size: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
options: ["medium", "small"],
|
|
112
|
-
},
|
|
119
|
+
options: ["medium", "small"],
|
|
120
|
+
control: { type: "radio" },
|
|
113
121
|
},
|
|
114
122
|
locale: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
options: ["nb", "nn", "en"],
|
|
118
|
-
},
|
|
123
|
+
options: ["nb", "nn", "en"],
|
|
124
|
+
control: { type: "radio" },
|
|
119
125
|
},
|
|
120
126
|
mode: {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
options: ["single", "multiple", "range"],
|
|
124
|
-
},
|
|
127
|
+
options: ["single", "multiple", "range"],
|
|
128
|
+
control: { type: "radio" },
|
|
125
129
|
},
|
|
126
130
|
},
|
|
127
131
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import cl from "clsx";
|
|
2
|
-
import compareAsc from "date-fns/compareAsc";
|
|
3
|
-
import compareDesc from "date-fns/compareDesc";
|
|
4
2
|
import format from "date-fns/format";
|
|
5
3
|
import isSameMonth from "date-fns/isSameMonth";
|
|
4
|
+
import isSameYear from "date-fns/isSameYear";
|
|
6
5
|
import setYear from "date-fns/setYear";
|
|
7
6
|
import React, { useEffect, useRef } from "react";
|
|
8
7
|
import { useDayPicker } from "react-day-picker";
|
|
@@ -20,13 +19,12 @@ interface MonthType {
|
|
|
20
19
|
|
|
21
20
|
const disableMonth = (month: Date, fromDate?: Date, toDate?: Date) => {
|
|
22
21
|
if (fromDate && toDate) {
|
|
23
|
-
return (
|
|
24
|
-
|
|
25
|
-
);
|
|
22
|
+
return (isSameMonth(month, fromDate) && isSameYear(month, fromDate))
|
|
23
|
+
|| (isSameMonth(month, toDate) && isSameYear(month, toDate))
|
|
26
24
|
} else if (fromDate) {
|
|
27
|
-
return
|
|
25
|
+
return isSameMonth(month, fromDate) && isSameYear(month, fromDate)
|
|
28
26
|
} else if (toDate) {
|
|
29
|
-
return
|
|
27
|
+
return isSameMonth(month, toDate) && isSameYear(month, toDate)
|
|
30
28
|
}
|
|
31
29
|
return false;
|
|
32
30
|
};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
1
2
|
import React, { useId, useState } from "react";
|
|
2
|
-
import { Button } from "../..";
|
|
3
|
+
import { Button, DateInputProps } from "../..";
|
|
3
4
|
import { useMonthpicker } from "../hooks";
|
|
4
|
-
import MonthPicker from "./MonthPicker";
|
|
5
|
+
import MonthPicker, { MonthPickerProps } from "./MonthPicker";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "ds-react/Monthpicker",
|
|
8
9
|
component: MonthPicker,
|
|
9
|
-
|
|
10
|
-
size: {
|
|
11
|
-
control: {
|
|
12
|
-
type: "radio",
|
|
13
|
-
options: ["medium", "small"],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
locale: {
|
|
17
|
-
control: {
|
|
18
|
-
type: "radio",
|
|
19
|
-
options: ["nb", "nn", "en"],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
10
|
+
} satisfies Meta<typeof MonthPicker>;
|
|
24
11
|
|
|
25
|
-
export const Default
|
|
12
|
+
export const Default: StoryFn<{
|
|
13
|
+
size: DateInputProps["size"];
|
|
14
|
+
locale: MonthPickerProps["locale"];
|
|
15
|
+
}> = (props) => {
|
|
26
16
|
const { inputProps, monthpickerProps } = useMonthpicker({
|
|
27
17
|
disabled: [new Date("Apr 1 2022")],
|
|
18
|
+
locale: props.locale,
|
|
28
19
|
});
|
|
29
20
|
|
|
30
21
|
return (
|
|
@@ -33,12 +24,23 @@ export const Default = () => {
|
|
|
33
24
|
<MonthPicker.Input
|
|
34
25
|
label="Velg måned"
|
|
35
26
|
variant="monthpicker"
|
|
27
|
+
size={props.size}
|
|
36
28
|
{...inputProps}
|
|
37
29
|
/>
|
|
38
30
|
</MonthPicker>
|
|
39
31
|
</div>
|
|
40
32
|
);
|
|
41
33
|
};
|
|
34
|
+
Default.argTypes = {
|
|
35
|
+
size: {
|
|
36
|
+
options: ["medium", "small"],
|
|
37
|
+
control: { type: "radio" },
|
|
38
|
+
},
|
|
39
|
+
locale: {
|
|
40
|
+
options: ["nb", "nn", "en"],
|
|
41
|
+
control: { type: "radio" },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
42
44
|
|
|
43
45
|
export const dropdownCaption = () => {
|
|
44
46
|
return (
|
|
@@ -54,20 +56,16 @@ export const NB = () => <MonthPicker.Standalone locale="nb" />;
|
|
|
54
56
|
export const NN = () => <MonthPicker.Standalone locale="nn" />;
|
|
55
57
|
export const EN = () => <MonthPicker.Standalone locale="en" />;
|
|
56
58
|
|
|
57
|
-
export const DisabledMonths =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/>
|
|
68
|
-
);
|
|
69
|
-
},
|
|
70
|
-
};
|
|
59
|
+
export const DisabledMonths = () => (
|
|
60
|
+
<MonthPicker.Standalone
|
|
61
|
+
disabled={[
|
|
62
|
+
{ from: new Date("Jan 1 2022"), to: new Date("Jul 6 2022") },
|
|
63
|
+
{ from: new Date("Apr 2 2023"), to: new Date("Dec 4 2023") },
|
|
64
|
+
new Date("Sep 5 2022"),
|
|
65
|
+
new Date("Jan 5 2023"),
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
71
69
|
|
|
72
70
|
export const Standalone = () => {
|
|
73
71
|
return <MonthPicker.Standalone />;
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -171,7 +171,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
171
171
|
{hasMaxLength && (
|
|
172
172
|
<>
|
|
173
173
|
<span id={maxLengthId} className="navds-sr-only">
|
|
174
|
-
Tekstområde med plass til {maxLength} tegn
|
|
174
|
+
{`Tekstområde med plass til ${maxLength} tegn.`}
|
|
175
175
|
</span>
|
|
176
176
|
<Counter
|
|
177
177
|
maxLength={maxLength}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, HTMLAttributes } from "react";
|
|
2
|
-
import Guide from "./Guide";
|
|
3
2
|
import cl from "clsx";
|
|
3
|
+
import { DefaultIllustration } from "./Illustration";
|
|
4
4
|
|
|
5
5
|
export interface GuidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
6
|
/**
|
|
@@ -12,14 +12,14 @@ export interface GuidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
*/
|
|
13
13
|
illustration?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @default
|
|
15
|
+
* Render illustation above content
|
|
16
|
+
* @default true on mobile (<480px)
|
|
17
17
|
*/
|
|
18
18
|
poster?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* A component
|
|
22
|
+
* A component for guiding users on the website
|
|
23
23
|
*
|
|
24
24
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/guidepanel)
|
|
25
25
|
* @see 🏷️ {@link GuidePanelProps}
|
|
@@ -34,18 +34,19 @@ export interface GuidePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export const GuidePanel = forwardRef<HTMLDivElement, GuidePanelProps>(
|
|
37
|
-
(
|
|
38
|
-
{ children, className, illustration, poster = false, color, ...rest },
|
|
39
|
-
ref
|
|
40
|
-
) => (
|
|
37
|
+
({ children, className, illustration, poster, ...rest }, ref) => (
|
|
41
38
|
<div
|
|
42
39
|
{...rest}
|
|
43
40
|
ref={ref}
|
|
44
41
|
className={cl("navds-guide-panel", className, {
|
|
45
|
-
"navds-guide-panel--poster": poster,
|
|
42
|
+
"navds-guide-panel--poster": poster === true,
|
|
43
|
+
"navds-guide-panel--not-poster": poster === false,
|
|
44
|
+
"navds-guide-panel--responsive-poster": poster === undefined,
|
|
46
45
|
})}
|
|
47
46
|
>
|
|
48
|
-
<
|
|
47
|
+
<div className="navds-guide">
|
|
48
|
+
{illustration ?? <DefaultIllustration />}
|
|
49
|
+
</div>
|
|
49
50
|
<div className="navds-guide-panel__content">{children}</div>
|
|
50
51
|
</div>
|
|
51
52
|
)
|
|
@@ -20,9 +20,9 @@ export const DefaultIllustration: DefaultIllustrationType = ({
|
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<svg
|
|
23
|
-
width="
|
|
24
|
-
height="
|
|
25
|
-
viewBox="0 0
|
|
23
|
+
width="56"
|
|
24
|
+
height="85"
|
|
25
|
+
viewBox="0 0 56 85"
|
|
26
26
|
fill="none"
|
|
27
27
|
xmlns="http://www.w3.org/2000/svg"
|
|
28
28
|
aria-label="NAV veileder illustrasjon"
|
|
@@ -35,89 +35,65 @@ export const DefaultIllustration: DefaultIllustrationType = ({
|
|
|
35
35
|
<path
|
|
36
36
|
fillRule="evenodd"
|
|
37
37
|
clipRule="evenodd"
|
|
38
|
-
d="
|
|
39
|
-
fill="#
|
|
38
|
+
d="M43.1888 40.4308C41.795 44.9808 39.0663 48.7576 35.5693 51.069L35.7484 53.0952L35.7474 53.1777L33.857 69.8797H21.8679L21.8181 69.5289L19.5004 53.1489L19.5862 51.1002C16.0715 48.795 13.3274 45.0119 11.9257 40.4499C11.8781 40.4544 11.83 40.4566 11.7812 40.4566C10.8745 40.4566 10.1562 39.6595 10.1562 38.6939V33.2298C10.1562 32.5825 10.479 32.0106 10.9648 31.7039C11.7229 21.5028 18.8443 13.4855 27.554 13.4855C36.2401 13.4855 43.3472 21.4596 44.1376 31.6211C44.7049 31.8986 45.0937 32.5184 45.0937 33.2298V38.6939C45.0937 39.66 44.3765 40.4566 43.4687 40.4566C43.3731 40.4566 43.2796 40.4478 43.1888 40.4308Z"
|
|
39
|
+
fill="#F7F7F7"
|
|
40
40
|
/>
|
|
41
41
|
<path
|
|
42
42
|
fillRule="evenodd"
|
|
43
43
|
clipRule="evenodd"
|
|
44
|
-
d="
|
|
45
|
-
fill="#
|
|
44
|
+
d="M35.1471 51.6345C35.0789 55.2819 31.7373 59.0239 27.625 59.0239C23.4949 59.0239 20.142 55.2493 20.1022 51.5869C17.9622 52.1325 14.6956 53.7781 11.9995 56.5281C9.38852 59.1912 7.3125 63.1941 7.3125 66.2993V85.0001H47.9375V66.2993C47.9375 63.1878 45.8167 59.178 43.1575 56.5119C40.4983 53.8458 37.3007 52.2225 35.1471 51.6345Z"
|
|
45
|
+
fill="#005B82"
|
|
46
46
|
/>
|
|
47
47
|
<path
|
|
48
48
|
fillRule="evenodd"
|
|
49
49
|
clipRule="evenodd"
|
|
50
|
-
d="
|
|
51
|
-
fill="#
|
|
50
|
+
d="M19.9671 51.7134C17.9959 52.4333 14.6891 54.0068 12.1875 56.3964C4.875 54.7595 1.625 50.87 1.625 50.87C1.625 50.87 8.36213 44.2596 8.3662 32.698V32.6857C8.3662 19.1478 15.6319 9.80762 27.6022 9.80762C39.5742 9.80762 46.8399 19.1478 46.8399 32.6857H46.883C46.883 44.2555 53.625 50.87 53.625 50.87C53.625 50.87 50.375 54.7595 43.0625 56.3942L43.0515 56.3964C40.6353 54.1853 37.1309 52.4799 35.2243 51.7589L35.2265 51.7582L35.1508 50.9012L35.1917 50.8302C38.7891 48.5155 41.5804 44.6159 42.9262 39.904C43.0909 39.9961 43.277 40.048 43.4739 40.048C44.1476 40.048 44.6928 39.4431 44.6928 38.6939V33.2298C44.6928 32.5887 44.2936 32.0528 43.7564 31.9114C43.7559 31.904 43.7554 31.8966 43.7549 31.8892C26.7466 33.7984 20.6199 22.068 20.117 22.0672C20.117 22.0672 14.4686 26.1538 11.769 31.0124C11.769 31.0124 11.3576 31.9296 11.3556 31.9605C10.8934 32.1527 10.5637 32.648 10.5637 33.2298V38.6939C10.5637 39.4431 11.1103 40.048 11.7826 40.048C11.9316 40.048 12.0743 40.0184 12.2062 39.9642C13.5668 44.6785 16.3759 48.5738 19.9901 50.8732L20.0035 50.9012L19.9695 51.7134H19.9671Z"
|
|
51
|
+
fill="#F25C5C"
|
|
52
52
|
/>
|
|
53
53
|
<path
|
|
54
54
|
fillRule="evenodd"
|
|
55
55
|
clipRule="evenodd"
|
|
56
|
-
d="
|
|
57
|
-
fill="#
|
|
56
|
+
d="M21.8159 35.8563C20.766 35.9417 20.4722 34.2696 20.7885 33.1776C20.848 32.9706 21.1956 32.0283 21.8109 32.0283C22.4254 32.0283 22.6968 32.5434 22.7345 32.632C23.1865 33.6965 22.9645 35.7622 21.8159 35.8563"
|
|
57
|
+
fill="#262626"
|
|
58
58
|
/>
|
|
59
59
|
<path
|
|
60
60
|
fillRule="evenodd"
|
|
61
61
|
clipRule="evenodd"
|
|
62
|
-
d="
|
|
63
|
-
fill="#
|
|
62
|
+
d="M33.9927 35.8563C35.0425 35.9417 35.3364 34.2696 35.0201 33.1776C34.9606 32.9706 34.613 32.0283 33.9977 32.0283C33.3832 32.0283 33.1118 32.5434 33.0741 32.632C32.6221 33.6965 32.8441 35.7622 33.9927 35.8563"
|
|
63
|
+
fill="#262626"
|
|
64
64
|
/>
|
|
65
65
|
<path
|
|
66
|
-
d="
|
|
67
|
-
fill="#
|
|
66
|
+
d="M28.2935 37.5041C28.9213 37.396 29.3501 37.4638 29.5036 37.6748C30.0833 38.4721 29.8979 39.3156 28.9035 40.0081C28.3806 40.372 27.661 40.5001 27.28 40.3114C27.0937 40.2191 26.8758 40.3133 26.7934 40.5218C26.7109 40.7304 26.7951 40.9742 26.9814 41.0665C27.6111 41.3784 28.5794 41.206 29.2931 40.7092C30.6445 39.7682 30.9537 38.3611 30.0758 37.1534C29.7042 36.643 29.0465 36.5389 28.1812 36.688C27.9799 36.7227 27.8418 36.9335 27.8728 37.1589C27.9038 37.3842 28.0921 37.5388 28.2935 37.5041Z"
|
|
67
|
+
fill="#262626"
|
|
68
68
|
/>
|
|
69
69
|
<path
|
|
70
|
-
d="
|
|
71
|
-
fill="#
|
|
70
|
+
d="M32.8337 42.9837C32.7968 43.0623 32.7122 43.2128 32.5763 43.411C32.3463 43.7465 32.0574 44.0829 31.7066 44.3966C30.6611 45.3314 29.3002 45.872 27.5683 45.8225C25.8795 45.7743 24.5247 45.2421 23.4626 44.3839C23.0726 44.0688 22.7506 43.7314 22.4933 43.395C22.3415 43.1967 22.2468 43.0463 22.2053 42.9679C22.1056 42.7794 21.8606 42.7018 21.6581 42.7946C21.4555 42.8873 21.3721 43.1153 21.4718 43.3039C21.5318 43.4174 21.6487 43.6029 21.8273 43.8363C22.1206 44.2196 22.4852 44.6018 22.9266 44.9584C24.1256 45.9272 25.6579 46.5292 27.5432 46.583C29.5064 46.6391 31.0759 46.0156 32.273 44.9453C32.6733 44.5874 33.0023 44.2042 33.2656 43.8202C33.4257 43.5867 33.5298 43.4014 33.5829 43.2881C33.6733 43.0955 33.5788 42.8713 33.3719 42.7872C33.165 42.7032 32.924 42.7911 32.8337 42.9837Z"
|
|
71
|
+
fill="#262626"
|
|
72
72
|
/>
|
|
73
73
|
<path
|
|
74
74
|
fillRule="evenodd"
|
|
75
75
|
clipRule="evenodd"
|
|
76
|
-
d="
|
|
76
|
+
d="M41.8629 70.5H30.8865C30.3966 70.5 30 70.0974 30 69.6001V63.609C30 63.1117 30.3966 62.7084 30.8865 62.7084H41.8629C42.3527 62.7084 42.75 63.1117 42.75 63.609V69.6001C42.75 70.0974 42.3527 70.5 41.8629 70.5"
|
|
77
77
|
fill="white"
|
|
78
78
|
/>
|
|
79
79
|
<path
|
|
80
80
|
fillRule="evenodd"
|
|
81
81
|
clipRule="evenodd"
|
|
82
|
-
d="
|
|
83
|
-
fill="#
|
|
82
|
+
d="M37.0345 63.9451H35.8971C35.8128 63.9451 35.7449 63.8775 35.7449 63.7937V63.6029C35.7449 63.5197 35.8128 63.4515 35.8971 63.4515H37.0345C37.1188 63.4515 37.1867 63.5197 37.1867 63.6029V63.7937C37.1867 63.8775 37.1188 63.9451 37.0345 63.9451"
|
|
83
|
+
fill="#262626"
|
|
84
84
|
/>
|
|
85
85
|
<path
|
|
86
86
|
fillRule="evenodd"
|
|
87
87
|
clipRule="evenodd"
|
|
88
|
-
d="
|
|
89
|
-
fill="#
|
|
88
|
+
d="M36.1365 63.7708H36.7955V62H36.1365V63.7708Z"
|
|
89
|
+
fill="#8F8F8F"
|
|
90
90
|
/>
|
|
91
91
|
<path
|
|
92
92
|
fillRule="evenodd"
|
|
93
93
|
clipRule="evenodd"
|
|
94
|
-
d="
|
|
94
|
+
d="M40.5417 65.5H39.6457C39.6457 65.5 39.5839 65.5 39.5621 65.5545L39.0662 67.0725L38.5708 65.5545C38.5489 65.5 38.4868 65.5 38.4868 65.5H36.764C36.7267 65.5 36.6954 65.5311 36.6954 65.5682V66.0837C36.6954 65.6748 36.2603 65.5 36.0055 65.5C35.4349 65.5 35.053 65.8758 34.934 66.4472C34.9276 66.0681 34.8961 65.9323 34.794 65.7932C34.7471 65.7251 34.6793 65.6678 34.6055 65.6204C34.4535 65.5314 34.317 65.5 34.0237 65.5H33.6794C33.6794 65.5 33.6171 65.5 33.5952 65.5545L33.2818 66.331V65.5682C33.2818 65.5311 33.2508 65.5 33.2136 65.5H32.4167C32.4167 65.5 32.3552 65.5 32.3328 65.5545L32.0071 66.362C32.0071 66.362 31.9746 66.4427 32.0489 66.4427H32.3552V67.9813C32.3552 68.0195 32.3853 68.0497 32.4236 68.0497H33.2136C33.2508 68.0497 33.2818 68.0195 33.2818 67.9813V66.4427H33.5898C33.7664 66.4427 33.8039 66.4475 33.8726 66.4796C33.914 66.4952 33.9513 66.5268 33.9716 66.5633C34.0133 66.6417 34.0237 66.7359 34.0237 67.0135V67.9813C34.0237 68.0195 34.0544 68.0497 34.0923 68.0497H34.8494C34.8494 68.0497 34.935 68.0497 34.9688 67.9652L35.1366 67.5505C35.3597 67.863 35.7269 68.0497 36.1833 68.0497H36.283C36.283 68.0497 36.3691 68.0497 36.4032 67.9652L36.6954 67.2415V67.9813C36.6954 68.0195 36.7267 68.0497 36.764 68.0497H37.5368C37.5368 68.0497 37.6221 68.0497 37.6564 67.9652C37.6564 67.9652 37.9655 67.1978 37.9667 67.192H37.9671C37.979 67.1281 37.8983 67.1281 37.8983 67.1281H37.6225V65.8113L38.4904 67.9652C38.5243 68.0497 38.6097 68.0497 38.6097 68.0497H39.5228C39.5228 68.0497 39.6087 68.0497 39.6426 67.9652L40.6048 65.5826C40.6381 65.5 40.5417 65.5 40.5417 65.5V65.5ZM36.6954 67.128H36.1763C35.9696 67.128 35.8015 66.9607 35.8015 66.7538C35.8015 66.5473 35.9696 66.3789 36.1763 66.3789H36.3215C36.5276 66.3789 36.6954 66.5473 36.6954 66.7538V67.128Z"
|
|
95
95
|
fill="#C30000"
|
|
96
96
|
/>
|
|
97
|
-
<path
|
|
98
|
-
fillRule="evenodd"
|
|
99
|
-
clipRule="evenodd"
|
|
100
|
-
d="M23.6667 55.3511L24.1434 54.1712H24.6015L24.1254 55.3511H23.6667Z"
|
|
101
|
-
fill="#C30000"
|
|
102
|
-
/>
|
|
103
|
-
<path
|
|
104
|
-
fillRule="evenodd"
|
|
105
|
-
clipRule="evenodd"
|
|
106
|
-
d="M29.5496 55.3511L30.0202 54.1712H30.2699L29.7993 55.3511H29.5496Z"
|
|
107
|
-
fill="#C30000"
|
|
108
|
-
/>
|
|
109
|
-
<path
|
|
110
|
-
fillRule="evenodd"
|
|
111
|
-
clipRule="evenodd"
|
|
112
|
-
d="M30.4752 55.3511L30.9457 54.1712H31.0783L30.6077 55.3511H30.4752Z"
|
|
113
|
-
fill="#C30000"
|
|
114
|
-
/>
|
|
115
|
-
<path
|
|
116
|
-
fillRule="evenodd"
|
|
117
|
-
clipRule="evenodd"
|
|
118
|
-
d="M29.1165 54.1712H28.7019C28.7019 54.1712 28.6733 54.1712 28.6632 54.1964L28.4337 54.8989L28.2044 54.1964C28.1943 54.1712 28.1656 54.1712 28.1656 54.1712H27.3683C27.3511 54.1712 27.3366 54.1856 27.3366 54.2028V54.4413C27.3366 54.2521 27.1352 54.1712 27.0173 54.1712C26.7533 54.1712 26.5765 54.3451 26.5215 54.6095C26.5185 54.4341 26.5039 54.3713 26.4567 54.3069C26.435 54.2754 26.4036 54.2489 26.3695 54.2269C26.2991 54.1857 26.236 54.1712 26.1003 54.1712H25.9409C25.9409 54.1712 25.9121 54.1712 25.9019 54.1964L25.7569 54.5558V54.2028C25.7569 54.1856 25.7426 54.1712 25.7253 54.1712H25.3566C25.3566 54.1712 25.3281 54.1712 25.3178 54.1964L25.167 54.5701C25.167 54.5701 25.152 54.6074 25.1864 54.6074H25.3281V55.3194C25.3281 55.3371 25.342 55.3511 25.3598 55.3511H25.7253C25.7426 55.3511 25.7569 55.3371 25.7569 55.3194V54.6074H25.8994C25.9812 54.6074 25.9985 54.6097 26.0303 54.6245C26.0495 54.6317 26.0667 54.6464 26.0762 54.6632C26.0954 54.6995 26.1003 54.7431 26.1003 54.8716V55.3194C26.1003 55.3371 26.1145 55.3511 26.132 55.3511H26.4823C26.4823 55.3511 26.5219 55.3511 26.5376 55.312L26.6152 55.1201C26.7185 55.2647 26.8884 55.3511 27.0996 55.3511H27.1458C27.1458 55.3511 27.1856 55.3511 27.2014 55.312L27.3366 54.9771V55.3194C27.3366 55.3371 27.3511 55.3511 27.3683 55.3511H27.726C27.726 55.3511 27.7654 55.3511 27.7813 55.312C27.7813 55.312 27.9243 54.9569 27.9249 54.9542H27.9251C27.9306 54.9246 27.8933 54.9246 27.8933 54.9246H27.7656V54.3153L28.1672 55.312C28.1829 55.3511 28.2225 55.3511 28.2225 55.3511H28.645C28.645 55.3511 28.6847 55.3511 28.7004 55.312L29.1457 54.2094C29.1611 54.1712 29.1165 54.1712 29.1165 54.1712V54.1712ZM27.3366 54.9246H27.0964C27.0007 54.9246 26.9229 54.8472 26.9229 54.7515C26.9229 54.6559 27.0007 54.578 27.0964 54.578H27.1635C27.2589 54.578 27.3366 54.6559 27.3366 54.7515V54.9246Z"
|
|
119
|
-
fill="white"
|
|
120
|
-
/>
|
|
121
97
|
</svg>
|
|
122
98
|
);
|
|
123
99
|
};
|