@navikt/ds-react 0.18.7 → 0.19.2
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 +77 -56
- package/cjs/form/Textarea.js +6 -3
- package/cjs/form/useFormField.js +1 -1
- package/cjs/read-more/ReadMore.js +7 -4
- package/esm/form/Switch.d.ts +4 -0
- package/esm/form/Switch.js.map +1 -1
- package/esm/form/Textarea.js +7 -4
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.d.ts +4 -0
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/radio/Radio.d.ts +4 -0
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/useFormField.js +1 -1
- package/esm/form/useFormField.js.map +1 -1
- package/esm/read-more/ReadMore.d.ts +7 -2
- package/esm/read-more/ReadMore.js +7 -4
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/read-more/index.d.ts +2 -1
- package/esm/read-more/index.js.map +1 -1
- package/package.json +3 -3
- package/src/form/Switch.tsx +4 -0
- package/src/form/Textarea.tsx +11 -2
- package/src/form/checkbox/Checkbox.tsx +4 -0
- package/src/form/checkbox/checkbox.stories.tsx +46 -41
- package/src/form/radio/Radio.tsx +4 -0
- package/src/form/radio/radio.stories.tsx +1 -1
- package/src/form/stories/confirmation-panel.stories.tsx +68 -43
- package/src/form/stories/fieldset.stories.tsx +97 -58
- package/src/form/stories/select.stories.tsx +86 -42
- package/src/form/stories/switch.stories.tsx +89 -76
- package/src/form/stories/text-field.stories.tsx +57 -53
- package/src/form/stories/textarea.stories.tsx +84 -77
- package/src/form/useFormField.ts +2 -1
- package/src/read-more/ReadMore.tsx +21 -7
- package/src/read-more/index.ts +2 -1
- package/src/read-more/readmore.stories.tsx +56 -0
- package/src/tooltip/tooltip.stories.tsx +52 -117
- package/src/form/stories/confirmation-panel.stories.mdx +0 -59
- package/src/form/stories/fieldset.stories.mdx +0 -136
- package/src/form/stories/live-examples.tsx +0 -26
- package/src/form/stories/select.stories.mdx +0 -134
- package/src/form/stories/switch.stories.mdx +0 -174
- package/src/form/stories/text-field.stories.mdx +0 -86
- package/src/form/stories/textarea.stories.mdx +0 -167
- package/src/read-more/read-more.stories.tsx +0 -60
package/src/form/Switch.tsx
CHANGED
package/src/form/Textarea.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import React, { forwardRef, useState } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
3
|
import TextareaAutosize from "@material-ui/core/TextareaAutosize";
|
|
4
4
|
import { BodyShort, Label, omit } from "..";
|
|
@@ -67,6 +67,10 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
67
67
|
const maxLengthId = `TextareaMaxLength-${useId()}`;
|
|
68
68
|
const hasMaxLength = maxLength !== undefined && maxLength > 0;
|
|
69
69
|
|
|
70
|
+
const [controlledValue, setControlledValue] = useState<string>(
|
|
71
|
+
props?.defaultValue ?? ""
|
|
72
|
+
);
|
|
73
|
+
|
|
70
74
|
return (
|
|
71
75
|
<div
|
|
72
76
|
className={cl(
|
|
@@ -105,6 +109,11 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
105
109
|
<TextareaAutosize
|
|
106
110
|
{...omit(rest, ["error", "errorId", "size"])}
|
|
107
111
|
{...inputProps}
|
|
112
|
+
onChange={(e) =>
|
|
113
|
+
props.onChange
|
|
114
|
+
? props.onChange(e)
|
|
115
|
+
: setControlledValue(e.target.value)
|
|
116
|
+
}
|
|
108
117
|
ref={ref}
|
|
109
118
|
className={cl(
|
|
110
119
|
"navds-textarea__input",
|
|
@@ -126,7 +135,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
126
135
|
</span>
|
|
127
136
|
<Counter
|
|
128
137
|
maxLength={maxLength}
|
|
129
|
-
currentLength={props.value?.length}
|
|
138
|
+
currentLength={props.value?.length ?? controlledValue?.length}
|
|
130
139
|
size={size}
|
|
131
140
|
/>
|
|
132
141
|
</>
|
|
@@ -29,6 +29,10 @@ export interface CheckboxProps
|
|
|
29
29
|
* @default false
|
|
30
30
|
*/
|
|
31
31
|
indeterminate?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a description to extend labling of Checkbox
|
|
34
|
+
*/
|
|
35
|
+
description?: string;
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
|
@@ -14,48 +14,52 @@ export const Default = (props) => {
|
|
|
14
14
|
const [state, setState] = useState(["checkbox1"]);
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<Checkbox
|
|
27
|
-
value="checkbox1"
|
|
28
|
-
indeterminate={props.indeterminate}
|
|
29
|
-
hideLabel={props.hideLabel}
|
|
30
|
-
>
|
|
31
|
-
{props.children || "Apple"}
|
|
32
|
-
</Checkbox>
|
|
33
|
-
<Checkbox
|
|
34
|
-
value="checkbox2"
|
|
35
|
-
error={props.errorSingle}
|
|
36
|
-
description={
|
|
37
|
-
props.checkboxDescription ? "Orange description" : undefined
|
|
38
|
-
}
|
|
39
|
-
indeterminate={props.indeterminate}
|
|
40
|
-
hideLabel={props.hideLabel}
|
|
41
|
-
>
|
|
42
|
-
{props.children || "Orange"}
|
|
43
|
-
</Checkbox>
|
|
44
|
-
<Checkbox
|
|
45
|
-
value="checkbox3"
|
|
46
|
-
indeterminate={props.indeterminate}
|
|
47
|
-
hideLabel={props.hideLabel}
|
|
48
|
-
>
|
|
49
|
-
{props.children || "Banana"}
|
|
50
|
-
</Checkbox>
|
|
51
|
-
<Checkbox
|
|
52
|
-
value="checkbox4"
|
|
53
|
-
indeterminate={props.indeterminate}
|
|
54
|
-
hideLabel={props.hideLabel}
|
|
17
|
+
<div>
|
|
18
|
+
<CheckboxGroup
|
|
19
|
+
legend={props.legend}
|
|
20
|
+
description={props.description}
|
|
21
|
+
value={props.controlled ? state : undefined}
|
|
22
|
+
onChange={props.controlled ? setState : undefined}
|
|
23
|
+
hideLegend={props.hideLegend}
|
|
24
|
+
error={props.errorGroup ? "Errormelding" : undefined}
|
|
25
|
+
{...props}
|
|
55
26
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
27
|
+
<Checkbox
|
|
28
|
+
value="checkbox1"
|
|
29
|
+
indeterminate={props.indeterminate}
|
|
30
|
+
hideLabel={props.hideLabel}
|
|
31
|
+
>
|
|
32
|
+
{props.children || "Apple"}
|
|
33
|
+
</Checkbox>
|
|
34
|
+
<Checkbox
|
|
35
|
+
value="checkbox2"
|
|
36
|
+
error={props.errorSingle}
|
|
37
|
+
description={
|
|
38
|
+
props.checkboxDescription
|
|
39
|
+
? "Quis laborum culpa enim amet cillum veniam."
|
|
40
|
+
: undefined
|
|
41
|
+
}
|
|
42
|
+
indeterminate={props.indeterminate}
|
|
43
|
+
hideLabel={props.hideLabel}
|
|
44
|
+
>
|
|
45
|
+
{props.children || "Orange"}
|
|
46
|
+
</Checkbox>
|
|
47
|
+
<Checkbox
|
|
48
|
+
value="checkbox3"
|
|
49
|
+
indeterminate={props.indeterminate}
|
|
50
|
+
hideLabel={props.hideLabel}
|
|
51
|
+
>
|
|
52
|
+
{props.children || "Banana"}
|
|
53
|
+
</Checkbox>
|
|
54
|
+
<Checkbox
|
|
55
|
+
value="checkbox4"
|
|
56
|
+
indeterminate={props.indeterminate}
|
|
57
|
+
hideLabel={props.hideLabel}
|
|
58
|
+
>
|
|
59
|
+
{props.children || "Melon"}
|
|
60
|
+
</Checkbox>
|
|
61
|
+
</CheckboxGroup>
|
|
62
|
+
</div>
|
|
59
63
|
);
|
|
60
64
|
};
|
|
61
65
|
|
|
@@ -63,6 +67,7 @@ Default.args = {
|
|
|
63
67
|
controlled: false,
|
|
64
68
|
legend: "Legend-tekst",
|
|
65
69
|
checkboxDescription: false,
|
|
70
|
+
hideLabel: false,
|
|
66
71
|
hideLegend: false,
|
|
67
72
|
errorSingle: false,
|
|
68
73
|
children: "",
|
package/src/form/radio/Radio.tsx
CHANGED
|
@@ -15,6 +15,10 @@ export interface RadioProps
|
|
|
15
15
|
* The value of the HTML element
|
|
16
16
|
*/
|
|
17
17
|
value: any;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a description to extend labling of Radio
|
|
20
|
+
*/
|
|
21
|
+
description?: string;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export const Radio = forwardRef<HTMLInputElement, RadioProps>((props, ref) => {
|
|
@@ -3,67 +3,92 @@ import { ConfirmationPanel } from "../index";
|
|
|
3
3
|
import { Meta } from "@storybook/react/types-6-0";
|
|
4
4
|
import { Link } from "../..";
|
|
5
5
|
export default {
|
|
6
|
-
title: "ds-react/form/
|
|
6
|
+
title: "ds-react/form/ConfirmationPanel",
|
|
7
7
|
component: ConfirmationPanel,
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "radio",
|
|
12
|
+
options: ["medium", "small"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
error: {
|
|
16
|
+
type: "string",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
8
19
|
} as Meta;
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
const content = (
|
|
22
|
+
<>
|
|
23
|
+
Ipsum voluptate pariatur <Link href="#123">testlink</Link> anim officia
|
|
24
|
+
minim ut mollit voluptate exercitation nulla mollit.
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const Default = (props) => {
|
|
29
|
+
return (
|
|
30
|
+
<ConfirmationPanel
|
|
31
|
+
error={props?.error}
|
|
32
|
+
size={props?.size}
|
|
33
|
+
checked={props?.checked ?? undefined}
|
|
34
|
+
label={props?.label ?? "Checkbox label text"}
|
|
35
|
+
>
|
|
36
|
+
{content}
|
|
37
|
+
</ConfirmationPanel>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Default.args = {
|
|
42
|
+
label: "Checkbox label text",
|
|
43
|
+
checked: false,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Small = () => {
|
|
11
47
|
const [checked, setChecked] = useState(false);
|
|
12
48
|
return (
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
<ConfirmationPanel
|
|
50
|
+
checked={checked}
|
|
51
|
+
onChange={() => setChecked(!checked)}
|
|
52
|
+
label="Checkbox label text"
|
|
53
|
+
size="small"
|
|
54
|
+
>
|
|
55
|
+
{content}
|
|
56
|
+
</ConfirmationPanel>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const NoContent = () => {
|
|
61
|
+
const [checked, setChecked] = useState(false);
|
|
62
|
+
return (
|
|
63
|
+
<ConfirmationPanel
|
|
64
|
+
checked={checked}
|
|
65
|
+
onChange={() => setChecked(!checked)}
|
|
66
|
+
label="Checkbox label text"
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Error = () => {
|
|
72
|
+
const [checked, setChecked] = useState(false);
|
|
73
|
+
return (
|
|
74
|
+
<div className="colgap">
|
|
34
75
|
<ConfirmationPanel
|
|
35
76
|
checked={checked}
|
|
36
77
|
onChange={() => setChecked(!checked)}
|
|
37
78
|
label="Checkbox label text"
|
|
38
|
-
error="
|
|
79
|
+
error="Adipisicing sint aute quis veniam incididunt duis est sint aute cillum."
|
|
39
80
|
>
|
|
40
|
-
|
|
41
|
-
minim ut mollit voluptate exercitation nulla mollit.
|
|
81
|
+
{content}
|
|
42
82
|
</ConfirmationPanel>
|
|
43
|
-
<h3>error small</h3>
|
|
44
83
|
<ConfirmationPanel
|
|
45
84
|
checked={checked}
|
|
46
85
|
onChange={() => setChecked(!checked)}
|
|
47
86
|
label="Checkbox label text"
|
|
48
|
-
error="
|
|
87
|
+
error="Adipisicing sint aute quis veniam incididunt duis est sint aute cillum."
|
|
49
88
|
size="small"
|
|
50
89
|
>
|
|
51
|
-
|
|
52
|
-
minim ut mollit voluptate exercitation nulla mollit.
|
|
90
|
+
{content}
|
|
53
91
|
</ConfirmationPanel>
|
|
54
|
-
<h2>Empty</h2>
|
|
55
|
-
<ConfirmationPanel
|
|
56
|
-
checked={checked}
|
|
57
|
-
onChange={() => setChecked(!checked)}
|
|
58
|
-
label="Checkbox label text"
|
|
59
|
-
></ConfirmationPanel>
|
|
60
|
-
<h2>Uncontrolled</h2>
|
|
61
|
-
<ConfirmationPanel label="Checkbox label text"></ConfirmationPanel>
|
|
62
|
-
<h3>defaultChecked</h3>
|
|
63
|
-
<ConfirmationPanel
|
|
64
|
-
defaultChecked
|
|
65
|
-
label="Checkbox label text"
|
|
66
|
-
></ConfirmationPanel>
|
|
67
92
|
</div>
|
|
68
93
|
);
|
|
69
94
|
};
|
|
@@ -3,72 +3,111 @@ import { Fieldset } from "../index";
|
|
|
3
3
|
import { Meta } from "@storybook/react/types-6-0";
|
|
4
4
|
import { TextField } from "../../index";
|
|
5
5
|
export default {
|
|
6
|
-
title: "ds-react/form/
|
|
6
|
+
title: "ds-react/form/Fieldset",
|
|
7
7
|
component: Fieldset,
|
|
8
|
+
argTypes: {
|
|
9
|
+
size: {
|
|
10
|
+
control: {
|
|
11
|
+
type: "radio",
|
|
12
|
+
options: ["medium", "small"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
description: {
|
|
16
|
+
type: "string",
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
type: "string",
|
|
20
|
+
},
|
|
21
|
+
hideLegend: {
|
|
22
|
+
type: "boolean",
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
type: "boolean",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
8
28
|
} as Meta;
|
|
9
29
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<TextField label="Textfield label" hideLabel />
|
|
17
|
-
<TextField label="Textfield label" hideLabel />
|
|
18
|
-
</Fieldset>
|
|
19
|
-
|
|
20
|
-
<h2>Description</h2>
|
|
21
|
-
|
|
22
|
-
<Fieldset
|
|
23
|
-
legend="Mollit eiusmod"
|
|
24
|
-
description={<div>Quis reprehenderit esse cillum</div>}
|
|
25
|
-
>
|
|
26
|
-
<TextField
|
|
27
|
-
label="Textfield label"
|
|
28
|
-
hideLabel
|
|
29
|
-
description={<div>Quis reprehenderit esse cillum</div>}
|
|
30
|
-
/>
|
|
31
|
-
<TextField label="Textfield label" hideLabel />
|
|
32
|
-
</Fieldset>
|
|
33
|
-
|
|
34
|
-
<h2>Errors</h2>
|
|
35
|
-
|
|
36
|
-
<Fieldset legend="Mollit eiusmod" error="Fieldsett error">
|
|
37
|
-
<TextField label="Textfield label" hideLabel />
|
|
38
|
-
<TextField label="Textfield label" hideLabel />
|
|
39
|
-
</Fieldset>
|
|
30
|
+
const content = (
|
|
31
|
+
<>
|
|
32
|
+
<TextField label="Textfield label" hideLabel />
|
|
33
|
+
<TextField label="Textfield label" hideLabel />
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
export const Default = (props) => {
|
|
38
|
+
return (
|
|
39
|
+
<Fieldset legend="Mollit eiusmod" {...props}>
|
|
40
|
+
{content}
|
|
41
|
+
</Fieldset>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
errorPropagation={false}
|
|
47
|
-
>
|
|
48
|
-
<TextField label="Textfield label" hideLabel error="Må være fylt ut" />
|
|
49
|
-
<TextField label="Textfield label" hideLabel />
|
|
50
|
-
</Fieldset>
|
|
45
|
+
Default.args = {
|
|
46
|
+
errorPropagation: true,
|
|
47
|
+
};
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
export const Small = () => (
|
|
50
|
+
<Fieldset
|
|
51
|
+
size="small"
|
|
52
|
+
legend="Mollit eiusmod"
|
|
53
|
+
description="Do ullamco amet mollit labore tempor minim cupidatat dolore voluptate velit irure."
|
|
54
|
+
>
|
|
55
|
+
{content}
|
|
56
|
+
</Fieldset>
|
|
57
|
+
);
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
export const Description = () => (
|
|
60
|
+
<Fieldset
|
|
61
|
+
legend="Mollit eiusmod"
|
|
62
|
+
description="Esse cupidatat reprehenderit est culpa consectetur sit dolor esse."
|
|
63
|
+
>
|
|
64
|
+
<TextField label="Textfield label" hideLabel />
|
|
65
|
+
<TextField label="Textfield label" hideLabel />
|
|
66
|
+
</Fieldset>
|
|
67
|
+
);
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
export const ErrorPropagation = () => (
|
|
70
|
+
<Fieldset
|
|
71
|
+
legend="Mollit eiusmod"
|
|
72
|
+
error="Fieldsett error"
|
|
73
|
+
errorPropagation={false}
|
|
74
|
+
>
|
|
75
|
+
<TextField label="Textfield label" hideLabel error="Må være fylt ut" />
|
|
76
|
+
<TextField label="Textfield label" hideLabel />
|
|
77
|
+
</Fieldset>
|
|
78
|
+
);
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
export const Error = () => (
|
|
81
|
+
<div className="colgap">
|
|
82
|
+
<Fieldset
|
|
83
|
+
legend="Mollit eiusmod"
|
|
84
|
+
error="Laborum officia nisi aliqua esse minim in amet."
|
|
85
|
+
>
|
|
86
|
+
{content}
|
|
87
|
+
</Fieldset>
|
|
88
|
+
<Fieldset
|
|
89
|
+
size="small"
|
|
90
|
+
legend="Mollit eiusmod"
|
|
91
|
+
error="Laborum officia nisi aliqua esse minim in amet."
|
|
92
|
+
>
|
|
93
|
+
{content}
|
|
94
|
+
</Fieldset>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
65
97
|
|
|
66
|
-
|
|
98
|
+
export const Disabled = () => (
|
|
99
|
+
<div className="colgap">
|
|
100
|
+
<Fieldset legend="Mollit eiusmod" disabled>
|
|
101
|
+
{content}
|
|
102
|
+
</Fieldset>
|
|
103
|
+
<Fieldset size="small" legend="Mollit eiusmod" disabled>
|
|
104
|
+
{content}
|
|
105
|
+
</Fieldset>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
67
108
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
};
|
|
109
|
+
export const hideLegend = () => (
|
|
110
|
+
<Fieldset legend="Mollit eiusmod" hideLegend>
|
|
111
|
+
{content}
|
|
112
|
+
</Fieldset>
|
|
113
|
+
);
|
|
@@ -2,69 +2,113 @@ import React from "react";
|
|
|
2
2
|
import { Select } from "../index";
|
|
3
3
|
import { Meta } from "@storybook/react/types-6-0";
|
|
4
4
|
export default {
|
|
5
|
-
title: "ds-react/form/
|
|
5
|
+
title: "ds-react/form/Select",
|
|
6
6
|
component: Select,
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "radio",
|
|
11
|
+
options: ["medium", "small"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
description: {
|
|
15
|
+
type: "string",
|
|
16
|
+
},
|
|
17
|
+
error: {
|
|
18
|
+
type: "string",
|
|
19
|
+
},
|
|
20
|
+
hideLabel: {
|
|
21
|
+
type: "boolean",
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
type: "boolean",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
7
27
|
} as Meta;
|
|
8
28
|
|
|
9
|
-
|
|
29
|
+
const content = (
|
|
30
|
+
<>
|
|
31
|
+
<option value="">Velg land</option>
|
|
32
|
+
<option value="norge">Norge</option>
|
|
33
|
+
<option value="sverige">Sverige</option>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const Default = (props) => {
|
|
10
38
|
return (
|
|
11
|
-
<
|
|
12
|
-
|
|
39
|
+
<Select {...props} label="Ipsum enim quis culpa">
|
|
40
|
+
{content}
|
|
41
|
+
</Select>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
13
44
|
|
|
14
|
-
|
|
15
|
-
<option value="">Velg land</option>
|
|
16
|
-
<option value="norge">Norge</option>
|
|
17
|
-
<option value="sverige">Sverige</option>
|
|
18
|
-
</Select>
|
|
45
|
+
Default.args = {};
|
|
19
46
|
|
|
20
|
-
|
|
47
|
+
export const Small = () => {
|
|
48
|
+
return (
|
|
49
|
+
<Select size="small" label="Ipsum enim quis culpa">
|
|
50
|
+
{content}
|
|
51
|
+
</Select>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
21
54
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
55
|
+
export const Description = () => {
|
|
56
|
+
return (
|
|
57
|
+
<div className="colgap">
|
|
58
|
+
<Select
|
|
59
|
+
label="Ipsum enim quis culpa"
|
|
60
|
+
description="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
|
|
61
|
+
>
|
|
62
|
+
{content}
|
|
26
63
|
</Select>
|
|
27
|
-
|
|
28
|
-
<h2>Errors</h2>
|
|
29
|
-
|
|
30
64
|
<Select
|
|
31
65
|
label="Ipsum enim quis culpa"
|
|
32
|
-
description="
|
|
33
|
-
|
|
66
|
+
description="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
|
|
67
|
+
size="small"
|
|
34
68
|
>
|
|
35
|
-
|
|
36
|
-
<option value="norge">Norge</option>
|
|
37
|
-
<option value="sverige">Sverige</option>
|
|
69
|
+
{content}
|
|
38
70
|
</Select>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
39
74
|
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
export const Error = () => {
|
|
76
|
+
return (
|
|
77
|
+
<div className="colgap">
|
|
42
78
|
<Select
|
|
43
79
|
label="Ipsum enim quis culpa"
|
|
44
|
-
|
|
45
|
-
|
|
80
|
+
error="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
|
|
81
|
+
>
|
|
82
|
+
{content}
|
|
83
|
+
</Select>
|
|
84
|
+
<Select
|
|
85
|
+
label="Ipsum enim quis culpa"
|
|
86
|
+
error="Consectetur labore velit eiusmod Lorem ut nostrud mollit labore ullamco laboris laboris in."
|
|
46
87
|
size="small"
|
|
47
88
|
>
|
|
48
|
-
|
|
49
|
-
<option value="norge">Norge</option>
|
|
50
|
-
<option value="sverige">Sverige</option>
|
|
89
|
+
{content}
|
|
51
90
|
</Select>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
52
94
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<option value="sverige">Sverige</option>
|
|
95
|
+
export const Disabled = () => {
|
|
96
|
+
return (
|
|
97
|
+
<div className="colgap">
|
|
98
|
+
<Select label="Ipsum enim quis culpa" disabled>
|
|
99
|
+
{content}
|
|
59
100
|
</Select>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<Select label="Ipsum enim quis culpa" description="Aute enim" disabled>
|
|
64
|
-
<option value="">Velg land</option>
|
|
65
|
-
<option value="norge">Norge</option>
|
|
66
|
-
<option value="sverige">Sverige</option>
|
|
101
|
+
<Select label="Ipsum enim quis culpa" disabled size="small">
|
|
102
|
+
{content}
|
|
67
103
|
</Select>
|
|
68
104
|
</div>
|
|
69
105
|
);
|
|
70
106
|
};
|
|
107
|
+
|
|
108
|
+
export const HideLabel = () => {
|
|
109
|
+
return (
|
|
110
|
+
<Select label="Ipsum enim quis culpa" hideLabel>
|
|
111
|
+
{content}
|
|
112
|
+
</Select>
|
|
113
|
+
);
|
|
114
|
+
};
|