@navikt/ds-react 6.3.2 → 6.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/date/hooks/useDatepicker.js +1 -1
- package/cjs/date/hooks/useDatepicker.js.map +1 -1
- package/cjs/expansion-card/ExpansionCard.js +14 -13
- package/cjs/expansion-card/ExpansionCard.js.map +1 -1
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js +3 -3
- package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/cjs/form/switch/Switch.js +2 -1
- package/cjs/form/switch/Switch.js.map +1 -1
- package/esm/date/hooks/useDatepicker.js +1 -1
- package/esm/date/hooks/useDatepicker.js.map +1 -1
- package/esm/expansion-card/ExpansionCard.js +15 -14
- package/esm/expansion-card/ExpansionCard.js.map +1 -1
- package/esm/form/file-upload/parts/dropzone/Dropzone.js +3 -3
- package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -1
- package/esm/form/switch/Switch.js +2 -1
- package/esm/form/switch/Switch.js.map +1 -1
- package/package.json +3 -3
- package/src/date/datepicker/datepicker.stories.tsx +1 -0
- package/src/date/hooks/useDatepicker.tsx +1 -1
- package/src/dropdown/dropdown.stories.tsx +56 -20
- package/src/expansion-card/ExpansionCard.tsx +15 -14
- package/src/form/error-summary/error-summary.stories.tsx +47 -11
- package/src/form/fieldset/fieldset.stories.tsx +111 -76
- package/src/form/file-upload/parts/dropzone/Dropzone.tsx +6 -1
- package/src/form/radio/radio.stories.tsx +1 -0
- package/src/form/switch/Switch.tsx +3 -1
- package/src/form/switch/switch.stories.tsx +96 -57
- package/src/read-more/readmore.stories.tsx +79 -53
|
@@ -1,65 +1,91 @@
|
|
|
1
|
-
import { Meta,
|
|
2
|
-
import
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { fn } from "@storybook/test";
|
|
3
|
+
import React from "react";
|
|
3
4
|
import { ReadMore } from ".";
|
|
5
|
+
import { VStack } from "../layout/stack";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
export default {
|
|
6
8
|
title: "ds-react/ReadMore",
|
|
7
9
|
component: ReadMore,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
parameters: {
|
|
11
|
+
chromatic: { disable: true },
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof ReadMore>;
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
type Story = StoryObj<typeof ReadMore>;
|
|
16
|
+
|
|
17
|
+
const Content = (
|
|
18
|
+
<div style={{ maxWidth: 300 }}>
|
|
19
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Mollitia, tempore
|
|
20
|
+
corporis exercitationem minus dignissimos eius aspernatur fugiat iusto.
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</ReadMore>
|
|
33
|
-
);
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
size: "medium",
|
|
27
|
+
defaultOpen: false,
|
|
28
|
+
onOpenChange: fn(),
|
|
29
|
+
children: Content,
|
|
30
|
+
header: "Grunnen til at vi spør om dette og i tillegg ber om vedlegg",
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
size: {
|
|
34
|
+
options: ["medium", "small"],
|
|
35
|
+
control: { type: "radio" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
34
38
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
|
|
40
|
+
export const Small: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
...Default.args,
|
|
43
|
+
size: "small",
|
|
44
|
+
},
|
|
39
45
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
|
|
47
|
+
export const DefaultOpen: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
...Default.args,
|
|
50
|
+
defaultOpen: true,
|
|
44
51
|
},
|
|
45
52
|
};
|
|
46
53
|
|
|
47
|
-
export const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
our approach. Deactivate the security shield.
|
|
54
|
-
</ReadMore>
|
|
55
|
-
);
|
|
54
|
+
export const Open: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
...Default.args,
|
|
57
|
+
open: true,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
56
60
|
|
|
57
|
-
export const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
export const Chromatic: Story = {
|
|
62
|
+
render: () => {
|
|
63
|
+
return (
|
|
64
|
+
<VStack gap="4">
|
|
65
|
+
<div>
|
|
66
|
+
<h2>Default</h2>
|
|
67
|
+
{/* @ts-expect-error Args are partial, leading to required prop mismatch */}
|
|
68
|
+
<ReadMore {...Default.args} />
|
|
69
|
+
</div>
|
|
70
|
+
<div>
|
|
71
|
+
<h2>Small</h2>
|
|
72
|
+
{/* @ts-expect-error Args are partial, leading to required prop mismatch */}
|
|
73
|
+
<ReadMore {...Small.args} />
|
|
74
|
+
</div>
|
|
75
|
+
<div>
|
|
76
|
+
<h2>DefaultOpen</h2>
|
|
77
|
+
{/* @ts-expect-error Args are partial, leading to required prop mismatch */}
|
|
78
|
+
<ReadMore {...DefaultOpen.args} />
|
|
79
|
+
</div>
|
|
80
|
+
<div>
|
|
81
|
+
<h2>Controlled open</h2>
|
|
82
|
+
{/* @ts-expect-error Args are partial, leading to required prop mismatch */}
|
|
83
|
+
<ReadMore {...Open.args} />
|
|
84
|
+
</div>
|
|
85
|
+
</VStack>
|
|
86
|
+
);
|
|
87
|
+
},
|
|
88
|
+
parameters: {
|
|
89
|
+
chromatic: { disable: false },
|
|
90
|
+
},
|
|
91
|
+
};
|