@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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { BodyLong, GuidePanel } from "../index";
|
|
2
|
+
import { BodyLong, GuidePanel, VStack } from "../index";
|
|
3
3
|
import { Meta } from "@storybook/react";
|
|
4
|
+
import { InformationIcon } from "@navikt/aksel-icons";
|
|
5
|
+
|
|
4
6
|
export default {
|
|
5
7
|
title: "ds-react/GuidePanel",
|
|
6
8
|
component: GuidePanel,
|
|
7
|
-
}
|
|
9
|
+
} satisfies Meta<typeof GuidePanel>;
|
|
8
10
|
|
|
9
11
|
const panelText = `Sit sint eu dolore reprehenderit exercitation labore aute anim sit
|
|
10
12
|
adipisicing proident. Tempor ipsum ea cupidatat qui esse do veniam
|
|
@@ -12,18 +14,16 @@ cupidatat. Excepteur irure reprehenderit esse tempor nisi duis qui ea
|
|
|
12
14
|
enim id.`;
|
|
13
15
|
|
|
14
16
|
export const Default = {
|
|
15
|
-
render: (props) => {
|
|
16
|
-
const
|
|
17
|
-
? {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
}
|
|
17
|
+
render: (props: { poster: boolean; colorOverride: boolean }) => {
|
|
18
|
+
const style = props.colorOverride
|
|
19
|
+
? ({
|
|
20
|
+
"--ac-guide-panel-illustration-bg": "var(--a-purple-200)",
|
|
21
|
+
"--ac-guide-panel-border": "var(--a-purple-400)",
|
|
22
|
+
} as React.CSSProperties)
|
|
23
23
|
: {};
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<GuidePanel {
|
|
26
|
+
<GuidePanel style={style} poster={props?.poster}>
|
|
27
27
|
{panelText}
|
|
28
28
|
</GuidePanel>
|
|
29
29
|
);
|
|
@@ -35,13 +35,34 @@ export const Default = {
|
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export const
|
|
38
|
+
export const PosterVariants = {
|
|
39
|
+
render: () => (
|
|
40
|
+
<VStack gap="6" align="start">
|
|
41
|
+
<GuidePanel>
|
|
42
|
+
If you exclude the <code>poster</code> prop, you will get the poster
|
|
43
|
+
variant on mobile (<480px) and the non-poster variant otherwise.
|
|
44
|
+
</GuidePanel>
|
|
45
|
+
<GuidePanel poster>
|
|
46
|
+
Use the <code>poster</code> prop to get the poster variant on all
|
|
47
|
+
viewports.
|
|
48
|
+
</GuidePanel>
|
|
49
|
+
<GuidePanel poster={false}>
|
|
50
|
+
Set <code>poster=false</code> to get the non-poster variant on all
|
|
51
|
+
viewports.
|
|
52
|
+
</GuidePanel>
|
|
53
|
+
</VStack>
|
|
54
|
+
),
|
|
55
|
+
|
|
56
|
+
parameters: {
|
|
57
|
+
chromatic: { viewports: [479, 800] },
|
|
58
|
+
},
|
|
59
|
+
};
|
|
39
60
|
|
|
40
61
|
export const ColorOverride = () => (
|
|
41
62
|
<GuidePanel
|
|
42
63
|
style={{
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
"--ac-guide-panel-illustration-bg": "var(--a-purple-200)",
|
|
65
|
+
"--ac-guide-panel-border": "var(--a-purple-400)",
|
|
45
66
|
}}
|
|
46
67
|
>
|
|
47
68
|
{panelText}
|
|
@@ -63,3 +84,7 @@ export const Content = () => (
|
|
|
63
84
|
</BodyLong>
|
|
64
85
|
</GuidePanel>
|
|
65
86
|
);
|
|
87
|
+
|
|
88
|
+
export const CustomIllustration = () => (
|
|
89
|
+
<GuidePanel illustration={<InformationIcon />}>{panelText}</GuidePanel>
|
|
90
|
+
);
|
package/src/guide-panel/index.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
7
|
export interface BodyLongProps
|
|
6
|
-
extends
|
|
8
|
+
extends TypoProps,
|
|
9
|
+
React.HTMLAttributes<HTMLParagraphElement> {
|
|
7
10
|
/**
|
|
8
|
-
* medium: 18px, small: 16px
|
|
11
|
+
* large: 20px, medium: 18px, small: 16px
|
|
9
12
|
* @default "medium"
|
|
10
13
|
*/
|
|
11
|
-
size?: "medium" | "small";
|
|
14
|
+
size?: "large" | "medium" | "small";
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
16
|
+
* Text
|
|
14
17
|
*/
|
|
15
18
|
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Adds margin-bottom
|
|
18
|
-
*/
|
|
19
|
-
spacing?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -28,8 +27,10 @@ export interface BodyLongProps
|
|
|
28
27
|
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```jsx
|
|
31
|
-
* <BodyLong
|
|
32
|
-
*
|
|
30
|
+
* <BodyLong>
|
|
31
|
+
* Hvis du ikke bor sammen med begge foreldrene dine,
|
|
32
|
+
* kan du ha rett til barnebidrag fra en eller begge foreldre mens du
|
|
33
|
+
* fullfører videregående skole eller tilsvarende.
|
|
33
34
|
* </BodyLong>
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
@@ -38,16 +39,36 @@ export const BodyLong: OverridableComponent<
|
|
|
38
39
|
HTMLParagraphElement
|
|
39
40
|
> = forwardRef(
|
|
40
41
|
(
|
|
41
|
-
{
|
|
42
|
+
{
|
|
43
|
+
className,
|
|
44
|
+
size = "medium",
|
|
45
|
+
as: Component = "p",
|
|
46
|
+
spacing,
|
|
47
|
+
truncate,
|
|
48
|
+
weight = "regular",
|
|
49
|
+
align,
|
|
50
|
+
visuallyHidden,
|
|
51
|
+
textColor,
|
|
52
|
+
...rest
|
|
53
|
+
},
|
|
42
54
|
ref
|
|
43
55
|
) => (
|
|
44
56
|
<Component
|
|
45
57
|
{...rest}
|
|
46
58
|
ref={ref}
|
|
47
|
-
className={cl(
|
|
48
|
-
|
|
49
|
-
"navds-
|
|
50
|
-
|
|
59
|
+
className={cl(
|
|
60
|
+
className,
|
|
61
|
+
"navds-body-long",
|
|
62
|
+
`navds-body-long--${size}`,
|
|
63
|
+
typoClassNames({
|
|
64
|
+
spacing,
|
|
65
|
+
truncate,
|
|
66
|
+
weight,
|
|
67
|
+
align,
|
|
68
|
+
visuallyHidden,
|
|
69
|
+
textColor,
|
|
70
|
+
})
|
|
71
|
+
)}
|
|
51
72
|
/>
|
|
52
73
|
)
|
|
53
74
|
);
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
7
|
export interface BodyShortProps
|
|
6
|
-
extends
|
|
8
|
+
extends TypoProps,
|
|
9
|
+
React.HTMLAttributes<HTMLParagraphElement> {
|
|
7
10
|
/**
|
|
8
|
-
* medium: 18px, small: 16px
|
|
11
|
+
* large: 20px, medium: 18px, small: 16px
|
|
9
12
|
* @default "medium"
|
|
10
13
|
*/
|
|
11
|
-
size?: "medium" | "small";
|
|
14
|
+
size?: "large" | "medium" | "small";
|
|
12
15
|
/**
|
|
13
16
|
* Paragraph text
|
|
14
17
|
*/
|
|
15
18
|
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Adds margin-bottom
|
|
18
|
-
*/
|
|
19
|
-
spacing?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -28,8 +27,8 @@ export interface BodyShortProps
|
|
|
28
27
|
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```jsx
|
|
31
|
-
* <BodyShort
|
|
32
|
-
*
|
|
30
|
+
* <BodyShort>
|
|
31
|
+
* Du må gjøre en filtrering for å se brukere i listen.
|
|
33
32
|
* </BodyShort>
|
|
34
33
|
* ```
|
|
35
34
|
*/
|
|
@@ -38,16 +37,36 @@ export const BodyShort: OverridableComponent<
|
|
|
38
37
|
HTMLParagraphElement
|
|
39
38
|
> = forwardRef(
|
|
40
39
|
(
|
|
41
|
-
{
|
|
40
|
+
{
|
|
41
|
+
className,
|
|
42
|
+
size = "medium",
|
|
43
|
+
as: Component = "p",
|
|
44
|
+
spacing,
|
|
45
|
+
truncate,
|
|
46
|
+
weight = "regular",
|
|
47
|
+
align,
|
|
48
|
+
visuallyHidden,
|
|
49
|
+
textColor,
|
|
50
|
+
...rest
|
|
51
|
+
},
|
|
42
52
|
ref
|
|
43
53
|
) => (
|
|
44
54
|
<Component
|
|
45
55
|
{...rest}
|
|
46
56
|
ref={ref}
|
|
47
|
-
className={cl(
|
|
48
|
-
|
|
49
|
-
"navds-
|
|
50
|
-
|
|
57
|
+
className={cl(
|
|
58
|
+
className,
|
|
59
|
+
"navds-body-short",
|
|
60
|
+
`navds-body-short--${size}`,
|
|
61
|
+
typoClassNames({
|
|
62
|
+
spacing,
|
|
63
|
+
truncate,
|
|
64
|
+
weight,
|
|
65
|
+
align,
|
|
66
|
+
visuallyHidden,
|
|
67
|
+
textColor,
|
|
68
|
+
})
|
|
69
|
+
)}
|
|
51
70
|
/>
|
|
52
71
|
)
|
|
53
72
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
7
|
export interface DetailProps
|
|
6
|
-
extends
|
|
8
|
+
extends TypoProps,
|
|
9
|
+
React.HTMLAttributes<HTMLParagraphElement> {
|
|
7
10
|
/**
|
|
8
11
|
* @deprecated Medium === small
|
|
9
12
|
*/
|
|
@@ -12,10 +15,6 @@ export interface DetailProps
|
|
|
12
15
|
* Paragraph text
|
|
13
16
|
*/
|
|
14
17
|
children: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* Adds margin-bottom
|
|
17
|
-
*/
|
|
18
|
-
spacing?: boolean;
|
|
19
18
|
/**
|
|
20
19
|
* All caps
|
|
21
20
|
*/
|
|
@@ -31,8 +30,8 @@ export interface DetailProps
|
|
|
31
30
|
*
|
|
32
31
|
* @example
|
|
33
32
|
* ```jsx
|
|
34
|
-
* <Detail
|
|
35
|
-
*
|
|
33
|
+
* <Detail>
|
|
34
|
+
* Du må gjøre en filtrering for å se brukere i listen.
|
|
36
35
|
* </Detail>
|
|
37
36
|
* ```
|
|
38
37
|
*/
|
|
@@ -45,6 +44,11 @@ export const Detail: OverridableComponent<DetailProps, HTMLParagraphElement> =
|
|
|
45
44
|
spacing,
|
|
46
45
|
uppercase,
|
|
47
46
|
as: Component = "p",
|
|
47
|
+
truncate,
|
|
48
|
+
weight = "regular",
|
|
49
|
+
align,
|
|
50
|
+
visuallyHidden,
|
|
51
|
+
textColor,
|
|
48
52
|
...rest
|
|
49
53
|
},
|
|
50
54
|
ref
|
|
@@ -52,11 +56,22 @@ export const Detail: OverridableComponent<DetailProps, HTMLParagraphElement> =
|
|
|
52
56
|
<Component
|
|
53
57
|
{...rest}
|
|
54
58
|
ref={ref}
|
|
55
|
-
className={cl(
|
|
56
|
-
|
|
57
|
-
"navds-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
className={cl(
|
|
60
|
+
className,
|
|
61
|
+
"navds-detail",
|
|
62
|
+
typoClassNames({
|
|
63
|
+
spacing,
|
|
64
|
+
truncate,
|
|
65
|
+
weight,
|
|
66
|
+
align,
|
|
67
|
+
visuallyHidden,
|
|
68
|
+
textColor,
|
|
69
|
+
uppercase,
|
|
70
|
+
}),
|
|
71
|
+
{
|
|
72
|
+
"navds-detail--small": size === "small",
|
|
73
|
+
}
|
|
74
|
+
)}
|
|
60
75
|
/>
|
|
61
76
|
)
|
|
62
77
|
);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import cl from "clsx";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
7
|
export interface ErrorMessageProps
|
|
6
|
-
extends
|
|
8
|
+
extends Pick<TypoProps, "spacing">,
|
|
9
|
+
React.HTMLAttributes<HTMLParagraphElement> {
|
|
7
10
|
/**
|
|
8
11
|
* medium: 18px, small: 16px
|
|
9
12
|
* @default "medium"
|
|
@@ -13,10 +16,6 @@ export interface ErrorMessageProps
|
|
|
13
16
|
* Error text
|
|
14
17
|
*/
|
|
15
18
|
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Adds margin-bottom
|
|
18
|
-
*/
|
|
19
|
-
spacing?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -28,8 +27,8 @@ export interface ErrorMessageProps
|
|
|
28
27
|
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```jsx
|
|
31
|
-
* <ErrorMessage
|
|
32
|
-
*
|
|
30
|
+
* <ErrorMessage>
|
|
31
|
+
* Du må fylle ut: Oppgi årsaken til at du har ventet mer enn 6 måneder med å søke om refusjon
|
|
33
32
|
* </ErrorMessage>
|
|
34
33
|
* ```
|
|
35
34
|
*/
|
|
@@ -41,10 +40,17 @@ export const ErrorMessage: OverridableComponent<
|
|
|
41
40
|
<Component
|
|
42
41
|
{...rest}
|
|
43
42
|
ref={ref}
|
|
44
|
-
className={cl(
|
|
45
|
-
"navds-
|
|
46
|
-
"navds-
|
|
47
|
-
|
|
43
|
+
className={cl(
|
|
44
|
+
"navds-error-message",
|
|
45
|
+
"navds-label",
|
|
46
|
+
className,
|
|
47
|
+
typoClassNames({
|
|
48
|
+
spacing,
|
|
49
|
+
}),
|
|
50
|
+
{
|
|
51
|
+
"navds-label--small": size === "small",
|
|
52
|
+
}
|
|
53
|
+
)}
|
|
48
54
|
/>
|
|
49
55
|
)
|
|
50
56
|
);
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
|
-
export interface HeadingProps
|
|
7
|
+
export interface HeadingProps
|
|
8
|
+
extends Pick<TypoProps, "spacing" | "visuallyHidden" | "align" | "textColor">,
|
|
9
|
+
React.HTMLAttributes<HTMLHeadingElement> {
|
|
6
10
|
/**
|
|
7
11
|
* Heading level
|
|
8
12
|
* @default "1"
|
|
@@ -16,11 +20,6 @@ export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
16
20
|
* Heading text
|
|
17
21
|
*/
|
|
18
22
|
children: React.ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Adds margin-bottom
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
spacing?: boolean;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
/**
|
|
@@ -33,22 +32,43 @@ export interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
|
33
32
|
* @example
|
|
34
33
|
* ```jsx
|
|
35
34
|
* <Heading level="1" size="xlarge">
|
|
36
|
-
*
|
|
35
|
+
* Hva kan vi hjelpe deg med?
|
|
37
36
|
* </Heading>
|
|
38
37
|
* ```
|
|
39
38
|
*/
|
|
40
39
|
export const Heading: OverridableComponent<HeadingProps, HTMLHeadingElement> =
|
|
41
40
|
forwardRef(
|
|
42
|
-
(
|
|
41
|
+
(
|
|
42
|
+
{
|
|
43
|
+
level = "1",
|
|
44
|
+
size,
|
|
45
|
+
className,
|
|
46
|
+
as,
|
|
47
|
+
spacing,
|
|
48
|
+
align,
|
|
49
|
+
visuallyHidden,
|
|
50
|
+
textColor,
|
|
51
|
+
...rest
|
|
52
|
+
},
|
|
53
|
+
ref
|
|
54
|
+
) => {
|
|
43
55
|
let HeadingTag = as ?? (`h${level}` as React.ElementType);
|
|
44
56
|
|
|
45
57
|
return (
|
|
46
58
|
<HeadingTag
|
|
47
59
|
{...rest}
|
|
48
60
|
ref={ref}
|
|
49
|
-
className={cl(
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
className={cl(
|
|
62
|
+
className,
|
|
63
|
+
"navds-heading",
|
|
64
|
+
`navds-heading--${size}`,
|
|
65
|
+
typoClassNames({
|
|
66
|
+
spacing,
|
|
67
|
+
align,
|
|
68
|
+
visuallyHidden,
|
|
69
|
+
textColor,
|
|
70
|
+
})
|
|
71
|
+
)}
|
|
52
72
|
/>
|
|
53
73
|
);
|
|
54
74
|
}
|
|
@@ -15,6 +15,8 @@ export interface IngressProps
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
+
* @deprecated Use `<BodyLong size="large" />`
|
|
19
|
+
*
|
|
18
20
|
* Part of a set of components for displaying text with consistent typography.
|
|
19
21
|
*
|
|
20
22
|
* @see [📝 Documentation](https://aksel.nav.no/komponenter/core/typography)
|
|
@@ -23,8 +25,8 @@ export interface IngressProps
|
|
|
23
25
|
*
|
|
24
26
|
* @example
|
|
25
27
|
* ```jsx
|
|
26
|
-
* <Ingress
|
|
27
|
-
*
|
|
28
|
+
* <Ingress>
|
|
29
|
+
* Hvis du ikke bor sammen med begge foreldrene dine, kan du ha rett til barnebidrag fra en eller begge foreldre mens du fullfører videregående skole eller tilsvarende.
|
|
28
30
|
* </Ingress>
|
|
29
31
|
* ```
|
|
30
32
|
*/
|
package/src/typography/Label.tsx
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
1
|
import cl from "clsx";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
3
|
import { OverridableComponent } from "../util/OverridableComponent";
|
|
4
|
+
import { TypoProps } from "./types";
|
|
5
|
+
import { typoClassNames } from "./util";
|
|
4
6
|
|
|
5
7
|
export interface LabelProps
|
|
6
|
-
extends
|
|
8
|
+
extends Omit<TypoProps, "weight" | "align" | "truncate">,
|
|
9
|
+
React.LabelHTMLAttributes<HTMLLabelElement> {
|
|
7
10
|
/**
|
|
8
11
|
* medium: 18px, small: 16px
|
|
9
12
|
* @default "medium"
|
|
@@ -13,10 +16,6 @@ export interface LabelProps
|
|
|
13
16
|
* Paragraph text
|
|
14
17
|
*/
|
|
15
18
|
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Adds margin-bottom
|
|
18
|
-
*/
|
|
19
|
-
spacing?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -28,24 +27,40 @@ export interface LabelProps
|
|
|
28
27
|
*
|
|
29
28
|
* @example
|
|
30
29
|
* ```jsx
|
|
31
|
-
* <Label
|
|
32
|
-
*
|
|
30
|
+
* <Label>
|
|
31
|
+
* Oppgi årsaken til at du har ventet mer enn 6 måneder med å søke om refusjon
|
|
33
32
|
* </Label>
|
|
34
33
|
* ```
|
|
35
34
|
*/
|
|
36
35
|
export const Label: OverridableComponent<LabelProps, HTMLLabelElement> =
|
|
37
36
|
forwardRef(
|
|
38
37
|
(
|
|
39
|
-
{
|
|
38
|
+
{
|
|
39
|
+
className,
|
|
40
|
+
size = "medium",
|
|
41
|
+
as: Component = "label",
|
|
42
|
+
spacing,
|
|
43
|
+
visuallyHidden,
|
|
44
|
+
textColor,
|
|
45
|
+
...rest
|
|
46
|
+
},
|
|
40
47
|
ref
|
|
41
48
|
) => (
|
|
42
49
|
<Component
|
|
43
50
|
{...rest}
|
|
44
51
|
ref={ref}
|
|
45
|
-
className={cl(
|
|
46
|
-
|
|
47
|
-
"navds-
|
|
48
|
-
|
|
52
|
+
className={cl(
|
|
53
|
+
className,
|
|
54
|
+
"navds-label",
|
|
55
|
+
typoClassNames({
|
|
56
|
+
spacing,
|
|
57
|
+
visuallyHidden,
|
|
58
|
+
textColor,
|
|
59
|
+
}),
|
|
60
|
+
{
|
|
61
|
+
"navds-label--small": size === "small",
|
|
62
|
+
}
|
|
63
|
+
)}
|
|
49
64
|
/>
|
|
50
65
|
)
|
|
51
66
|
);
|