@mattilsynet/design 3.2.9 → 3.3.0
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/mtds/ai/AGENTS.md +892 -0
- package/mtds/ai/alert.mdx +63 -0
- package/mtds/ai/alert.stories.tsx +128 -0
- package/mtds/ai/analytics.mdx +185 -0
- package/mtds/ai/app.mdx +60 -0
- package/mtds/ai/app.stories.tsx +897 -0
- package/mtds/ai/atlas.mdx +82 -0
- package/mtds/ai/atlas.stories.tsx +424 -0
- package/mtds/ai/avatar.mdx +45 -0
- package/mtds/ai/avatar.stories.tsx +109 -0
- package/mtds/ai/badge.mdx +70 -0
- package/mtds/ai/badge.stories.tsx +122 -0
- package/mtds/ai/breadcrumbs.mdx +36 -0
- package/mtds/ai/breadcrumbs.stories.tsx +158 -0
- package/mtds/ai/button.mdx +179 -0
- package/mtds/ai/button.stories.tsx +440 -0
- package/mtds/ai/card.mdx +51 -0
- package/mtds/ai/card.stories.tsx +469 -0
- package/mtds/ai/chart.mdx +67 -0
- package/mtds/ai/chart.stories.tsx +519 -0
- package/mtds/ai/chip.mdx +71 -0
- package/mtds/ai/chip.stories.tsx +211 -0
- package/mtds/ai/details.mdx +33 -0
- package/mtds/ai/details.stories.tsx +91 -0
- package/mtds/ai/dialog.mdx +38 -0
- package/mtds/ai/dialog.stories.tsx +373 -0
- package/mtds/ai/divider.mdx +19 -0
- package/mtds/ai/divider.stories.tsx +50 -0
- package/mtds/ai/errorsummary.mdx +26 -0
- package/mtds/ai/errorsummary.stories.tsx +137 -0
- package/mtds/ai/field.mdx +86 -0
- package/mtds/ai/field.stories.tsx +863 -0
- package/mtds/ai/fieldset.mdx +126 -0
- package/mtds/ai/fieldset.stories.tsx +298 -0
- package/mtds/ai/fileupload.mdx +16 -0
- package/mtds/ai/fileupload.stories.tsx +126 -0
- package/mtds/ai/helptext.mdx +24 -0
- package/mtds/ai/helptext.stories.tsx +106 -0
- package/mtds/ai/input.mdx +223 -0
- package/mtds/ai/input.stories.tsx +352 -0
- package/mtds/ai/law.mdx +115 -0
- package/mtds/ai/law.stories.tsx +168 -0
- package/mtds/ai/layout.mdx +145 -0
- package/mtds/ai/layout.stories.tsx +443 -0
- package/mtds/ai/link.mdx +45 -0
- package/mtds/ai/link.stories.tsx +44 -0
- package/mtds/ai/logo.mdx +86 -0
- package/mtds/ai/logo.stories.tsx +146 -0
- package/mtds/ai/pagination.mdx +136 -0
- package/mtds/ai/pagination.stories.tsx +404 -0
- package/mtds/ai/popover.mdx +86 -0
- package/mtds/ai/popover.stories.tsx +355 -0
- package/mtds/ai/print.mdx +96 -0
- package/mtds/ai/print.stories.tsx +839 -0
- package/mtds/ai/progress.mdx +41 -0
- package/mtds/ai/progress.stories.tsx +141 -0
- package/mtds/ai/skeleton.mdx +26 -0
- package/mtds/ai/skeleton.stories.tsx +131 -0
- package/mtds/ai/spinner.mdx +26 -0
- package/mtds/ai/spinner.stories.tsx +72 -0
- package/mtds/ai/steps.mdx +37 -0
- package/mtds/ai/steps.stories.tsx +568 -0
- package/mtds/ai/table.mdx +124 -0
- package/mtds/ai/table.stories.tsx +1715 -0
- package/mtds/ai/tabs.mdx +106 -0
- package/mtds/ai/tabs.stories.tsx +159 -0
- package/mtds/ai/tag.mdx +49 -0
- package/mtds/ai/tag.stories.tsx +111 -0
- package/mtds/ai/toast.mdx +67 -0
- package/mtds/ai/toast.stories.tsx +215 -0
- package/mtds/ai/togglegroup.mdx +75 -0
- package/mtds/ai/togglegroup.stories.tsx +96 -0
- package/mtds/ai/tooltip.mdx +32 -0
- package/mtds/ai/tooltip.stories.tsx +34 -0
- package/mtds/ai/typography.mdx +67 -0
- package/mtds/ai/typography.stories.tsx +798 -0
- package/mtds/ai/validation.mdx +19 -0
- package/mtds/ai/validation.stories.tsx +45 -0
- package/mtds/atlas/atlas-element.js +1 -1
- package/mtds/chart/chart-lines.js +19 -19
- package/mtds/chart/chart-lines.js.map +1 -1
- package/mtds/chart/chart.css.js +16 -1
- package/mtds/chart/chart.css.js.map +1 -1
- package/mtds/chart/chart.stories.d.ts +1 -0
- package/mtds/index.iife.js +32 -17
- package/mtds/package.json.js +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/table/table-observer.js +26 -15
- package/mtds/table/table-observer.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Chip,
|
|
5
|
+
Fieldset,
|
|
6
|
+
Flex,
|
|
7
|
+
Input,
|
|
8
|
+
Prose,
|
|
9
|
+
Validation,
|
|
10
|
+
} from "../react";
|
|
11
|
+
import styles from "../styles.module.css";
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: "Designsystem/Chip",
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div className={styles.flex}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
} satisfies Meta;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const React: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<>
|
|
30
|
+
<Fieldset aria-label="Velg språk">
|
|
31
|
+
<Flex>
|
|
32
|
+
<Chip>
|
|
33
|
+
<Input
|
|
34
|
+
type="radio"
|
|
35
|
+
value="nynorsk"
|
|
36
|
+
defaultChecked
|
|
37
|
+
name="my-radio"
|
|
38
|
+
/>
|
|
39
|
+
Nynorsk
|
|
40
|
+
</Chip>
|
|
41
|
+
<Chip>
|
|
42
|
+
<Input type="radio" value="bokmål" name="my-radio" />
|
|
43
|
+
Bokmål
|
|
44
|
+
</Chip>
|
|
45
|
+
</Flex>
|
|
46
|
+
</Fieldset>
|
|
47
|
+
<Chip data-removable>Bokmål</Chip>
|
|
48
|
+
<Fieldset aria-label="Filtering">
|
|
49
|
+
<Flex>
|
|
50
|
+
<Chip>
|
|
51
|
+
<Input type="checkbox" value="filter-1" name="my-check" />
|
|
52
|
+
Filter 1
|
|
53
|
+
</Chip>
|
|
54
|
+
<Chip>
|
|
55
|
+
<Input type="checkbox" value="filter-1" name="my-check" />
|
|
56
|
+
Filter 2
|
|
57
|
+
</Chip>
|
|
58
|
+
</Flex>
|
|
59
|
+
</Fieldset>
|
|
60
|
+
</>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const Sizes: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<fieldset className={styles.fieldset} aria-label="Size">
|
|
67
|
+
<div className={styles.flex} data-align="center">
|
|
68
|
+
<label className={styles.chip} data-size="sm">
|
|
69
|
+
<input
|
|
70
|
+
className={styles.input}
|
|
71
|
+
type="radio"
|
|
72
|
+
value="sm"
|
|
73
|
+
defaultChecked
|
|
74
|
+
name="my-size"
|
|
75
|
+
/>
|
|
76
|
+
Small
|
|
77
|
+
</label>
|
|
78
|
+
<label className={styles.chip} data-size="md">
|
|
79
|
+
<input
|
|
80
|
+
className={styles.input}
|
|
81
|
+
type="radio"
|
|
82
|
+
value="md"
|
|
83
|
+
defaultChecked
|
|
84
|
+
name="my-size"
|
|
85
|
+
/>
|
|
86
|
+
Medium
|
|
87
|
+
</label>
|
|
88
|
+
<label className={styles.chip} data-size="lg">
|
|
89
|
+
<input
|
|
90
|
+
className={styles.input}
|
|
91
|
+
type="radio"
|
|
92
|
+
value="lg"
|
|
93
|
+
defaultChecked
|
|
94
|
+
name="my-size"
|
|
95
|
+
/>
|
|
96
|
+
Large
|
|
97
|
+
</label>
|
|
98
|
+
</div>
|
|
99
|
+
</fieldset>
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const Radio: Story = {
|
|
104
|
+
render: () => (
|
|
105
|
+
<fieldset className={styles.fieldset} aria-label="Velg språk">
|
|
106
|
+
<div className={styles.flex}>
|
|
107
|
+
<label className={styles.chip}>
|
|
108
|
+
<input
|
|
109
|
+
className={styles.input}
|
|
110
|
+
type="radio"
|
|
111
|
+
value="nynorsk"
|
|
112
|
+
defaultChecked
|
|
113
|
+
name="my-radio"
|
|
114
|
+
/>
|
|
115
|
+
Nynorsk
|
|
116
|
+
</label>
|
|
117
|
+
<label className={styles.chip}>
|
|
118
|
+
<input
|
|
119
|
+
className={styles.input}
|
|
120
|
+
type="radio"
|
|
121
|
+
value="bokmål"
|
|
122
|
+
name="my-radio"
|
|
123
|
+
/>
|
|
124
|
+
Bokmål
|
|
125
|
+
</label>
|
|
126
|
+
</div>
|
|
127
|
+
</fieldset>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Checkbox: Story = {
|
|
132
|
+
render: () => (
|
|
133
|
+
<fieldset className={styles.fieldset} aria-label="Velg språk">
|
|
134
|
+
<div className={styles.flex}>
|
|
135
|
+
<label className={styles.chip}>
|
|
136
|
+
<input
|
|
137
|
+
className={styles.input}
|
|
138
|
+
type="checkbox"
|
|
139
|
+
value="nynorsk"
|
|
140
|
+
defaultChecked
|
|
141
|
+
name="my-checkbox"
|
|
142
|
+
/>
|
|
143
|
+
Nynorsk
|
|
144
|
+
</label>
|
|
145
|
+
<label className={styles.chip}>
|
|
146
|
+
<input
|
|
147
|
+
className={styles.input}
|
|
148
|
+
type="checkbox"
|
|
149
|
+
value="bokmål"
|
|
150
|
+
name="my-checkbox"
|
|
151
|
+
/>
|
|
152
|
+
Bokmål
|
|
153
|
+
</label>
|
|
154
|
+
</div>
|
|
155
|
+
</fieldset>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const Removable: Story = {
|
|
160
|
+
render: () => (
|
|
161
|
+
<button type="button" className={styles.chip} data-removable>
|
|
162
|
+
Nynorsk
|
|
163
|
+
</button>
|
|
164
|
+
),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Nowrap: Story = {
|
|
168
|
+
render: () => (
|
|
169
|
+
<div className={styles.grid} data-items="auto" style={{ width: 250 }}>
|
|
170
|
+
<div>
|
|
171
|
+
<p>Med nowrap:</p>
|
|
172
|
+
<button type="button" className={styles.chip} data-removable>
|
|
173
|
+
<span data-nowrap>Mine favoritter</span>
|
|
174
|
+
</button>
|
|
175
|
+
</div>
|
|
176
|
+
<div>
|
|
177
|
+
<p>Uten nowrap:</p>
|
|
178
|
+
<button type="button" className={styles.chip} data-removable>
|
|
179
|
+
Mine favoritter
|
|
180
|
+
</button>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
),
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export const WithValidationForm: Story = {
|
|
187
|
+
parameters: {
|
|
188
|
+
showInOverview: true,
|
|
189
|
+
},
|
|
190
|
+
render: () => (
|
|
191
|
+
<Prose as="form" action="#" data-validation="form">
|
|
192
|
+
<Fieldset>
|
|
193
|
+
<Fieldset.Legend>Hvilke foretrekker du?</Fieldset.Legend>
|
|
194
|
+
<Flex>
|
|
195
|
+
<Chip>
|
|
196
|
+
<Input type="radio" name="my-radio-validation" required />
|
|
197
|
+
Radio 1
|
|
198
|
+
</Chip>
|
|
199
|
+
<Chip>
|
|
200
|
+
<Input type="radio" name="my-radio-validation" required />
|
|
201
|
+
Radio 2
|
|
202
|
+
</Chip>
|
|
203
|
+
</Flex>
|
|
204
|
+
<Validation hidden>Feilmelding</Validation>
|
|
205
|
+
</Fieldset>
|
|
206
|
+
<Button type="submit" data-variant="primary">
|
|
207
|
+
Send inn
|
|
208
|
+
</Button>
|
|
209
|
+
</Prose>
|
|
210
|
+
),
|
|
211
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CssVariables } from '../../.storybook/blocks';
|
|
3
|
+
import * as stories from './details.stories';
|
|
4
|
+
import { Details } from '../react';
|
|
5
|
+
|
|
6
|
+
<Meta of={stories} />
|
|
7
|
+
|
|
8
|
+
# Details
|
|
9
|
+
>Trekkspill, accordions, expander eller details - kjært barn, mange navn. Med details kan du presentere mye innhold på liten plass i en eller flere rader. Hele raden er klikkbar og lar brukere åpne eller lukke visningen av innholdet under.
|
|
10
|
+
|
|
11
|
+
## Kode
|
|
12
|
+
- Legg klassen `details` på `<u-details>`
|
|
13
|
+
- Legg `<u-summary>` til som første barn med tittelen inni
|
|
14
|
+
- **React?** Bruk `<Details>` og `<Details.Summary>`
|
|
15
|
+
|
|
16
|
+
<Details>
|
|
17
|
+
<Details.Summary>Hva er `u-details`?</Details.Summary>
|
|
18
|
+
|
|
19
|
+
[u-details](https://u-elements.github.io/u-elements/elements/u-details) er en del av prosjektet [u-elements](https://u-elements.github.io/u-elements)
|
|
20
|
+
som sikrer universell utforming. Dette lastes automatisk når du bruker `@mattilsynet/design`.
|
|
21
|
+
Du kan benytte native tilhørende [HTMLDetailsElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement) interface ved behov.
|
|
22
|
+
</Details>
|
|
23
|
+
|
|
24
|
+
<Canvas of={stories.Default} />
|
|
25
|
+
|
|
26
|
+
## Card variant
|
|
27
|
+
- Bruk `data-variant="card"` for å få avrunnede kanter og bakgrunn
|
|
28
|
+
- Bruk `data-color="main | neutral"` for å endre farge
|
|
29
|
+
- Bruk `data-align="start"` for å justere innholdet til toppen
|
|
30
|
+
- Legg eventuelt til ikon som første barn av `<u-summary>`
|
|
31
|
+
<Canvas of={stories.VariantCard} />
|
|
32
|
+
|
|
33
|
+
<CssVariables component="details" />
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ShrimpIcon } from "@phosphor-icons/react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
3
|
+
import { Details } from "../react";
|
|
4
|
+
import styles from "../styles.module.css";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Designsystem/Details",
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "padded",
|
|
10
|
+
},
|
|
11
|
+
} satisfies Meta;
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<>
|
|
19
|
+
<details className={styles.details}>
|
|
20
|
+
<summary>Åpne/lukk</summary>
|
|
21
|
+
Innhold
|
|
22
|
+
</details>
|
|
23
|
+
<details className={styles.details}>
|
|
24
|
+
<summary>Åpne/lukk</summary>
|
|
25
|
+
Innhold
|
|
26
|
+
</details>
|
|
27
|
+
<details className={styles.details}>
|
|
28
|
+
<summary>Åpne/lukk</summary>
|
|
29
|
+
Innhold
|
|
30
|
+
</details>
|
|
31
|
+
<details className={styles.details}>
|
|
32
|
+
<summary>Åpne/lukk</summary>
|
|
33
|
+
Innhold
|
|
34
|
+
</details>
|
|
35
|
+
<details className={styles.details}>
|
|
36
|
+
<summary>Åpne/lukk</summary>
|
|
37
|
+
Innhold
|
|
38
|
+
</details>
|
|
39
|
+
<details className={styles.details}>
|
|
40
|
+
<summary>Åpne/lukk</summary>
|
|
41
|
+
Innhold
|
|
42
|
+
</details>
|
|
43
|
+
</>
|
|
44
|
+
),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const React: Story = {
|
|
48
|
+
render: () => (
|
|
49
|
+
<Details>
|
|
50
|
+
<Details.Summary>Åpne/lukk</Details.Summary>
|
|
51
|
+
Innhold
|
|
52
|
+
</Details>
|
|
53
|
+
),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const DefaultOpen: Story = {
|
|
57
|
+
render: () => (
|
|
58
|
+
<details className={styles.details} open>
|
|
59
|
+
<summary>Default open</summary>
|
|
60
|
+
Innhold
|
|
61
|
+
</details>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const VariantCard: Story = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<div className={styles.grid}>
|
|
68
|
+
<details className={styles.details} data-variant="card">
|
|
69
|
+
<summary>Details with data-variant="card"</summary>
|
|
70
|
+
Innhold
|
|
71
|
+
</details>
|
|
72
|
+
<details className={styles.details} data-variant="card">
|
|
73
|
+
<summary>
|
|
74
|
+
<ShrimpIcon /> Details with data-variant="card" and icon
|
|
75
|
+
</summary>
|
|
76
|
+
Innhold
|
|
77
|
+
</details>
|
|
78
|
+
<details
|
|
79
|
+
className={styles.details}
|
|
80
|
+
data-variant="card"
|
|
81
|
+
data-color="neutral"
|
|
82
|
+
>
|
|
83
|
+
<summary>
|
|
84
|
+
<ShrimpIcon /> Details with data-variant="card" and icon and
|
|
85
|
+
data-color="neutral"
|
|
86
|
+
</summary>
|
|
87
|
+
Innhold
|
|
88
|
+
</details>
|
|
89
|
+
</div>
|
|
90
|
+
),
|
|
91
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CssVariables, JumpTo } from '../../.storybook/blocks';
|
|
3
|
+
import * as stories from './dialog.stories';
|
|
4
|
+
|
|
5
|
+
<Meta of={stories} />
|
|
6
|
+
|
|
7
|
+
# Dialog
|
|
8
|
+
|
|
9
|
+
> Dialog lar deg lage et vindu som kan vises foran innholdet på en side. Den kan enten være modal, som betyr at brukeren må gjøre noe før de kan komme videre, eller ikke-modalt, som bare er et vanlig vindu som kan lukkes når man vil.
|
|
10
|
+
|
|
11
|
+
<JumpTo />
|
|
12
|
+
|
|
13
|
+
## Kode
|
|
14
|
+
- Legg klassen `dialog` på `<dialog>`
|
|
15
|
+
- Åpnes enten med `open` attribute, button med `command="show-modal | show" commandfor="DIALOG-ID"` eller `.showModal() | .show()` metodene
|
|
16
|
+
- **Merk:** Dialog sentreres med `transform`, så skal du plassere den et annet sted, sett `transform: none`
|
|
17
|
+
<Canvas of={stories.Default} />
|
|
18
|
+
|
|
19
|
+
## Lukke knapp
|
|
20
|
+
- Legg `command="close" commandfor="DIALOG-ID"` på en button inni for lukke-knapp
|
|
21
|
+
- Første tomme knapp i `<dialog>` vil automatisk styles som lukke-knapp
|
|
22
|
+
- Legg evt. til flere knapper for lukking
|
|
23
|
+
<Canvas of={stories.WithClose} />
|
|
24
|
+
|
|
25
|
+
## Klikk utenfor dialog for å lukke
|
|
26
|
+
- Legg `closedby="any"` på `<dialog>`
|
|
27
|
+
<Canvas of={stories.WithBackdropClose} />
|
|
28
|
+
|
|
29
|
+
## Ikke-modal
|
|
30
|
+
- Legg `data-modal="false"` på `<dialog>`
|
|
31
|
+
<Canvas of={stories.WithoutBackdrop} />
|
|
32
|
+
|
|
33
|
+
## Med sticky footer
|
|
34
|
+
- Legg et `<footer>` element inn som siste barn for å få sticky footer
|
|
35
|
+
- **Merk:** Legg `form="ID-OF-FORM-HERE"` på knappen i footer som skal sende inn skjema
|
|
36
|
+
<Canvas of={stories.VariantDrawerWithoutBackdrop} />
|
|
37
|
+
|
|
38
|
+
<CssVariables component="dialog" exclude="divider" />
|