@mattilsynet/design 3.2.8 → 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/app/app-observer.js +1 -1
- package/mtds/app/app-toggle.js +26 -10
- package/mtds/app/app-toggle.js.map +1 -1
- package/mtds/app/app-toggle2.js +10 -26
- package/mtds/app/app-toggle2.js.map +1 -1
- package/mtds/app/app.js +1 -1
- package/mtds/atlas/atlas-element.js +1 -1
- package/mtds/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/mtds/breadcrumbs/breadcrumbs.js.map +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/deprecations.js +6 -5
- package/mtds/deprecations.js.map +1 -1
- package/mtds/errorsummary/errorsummary.d.ts +1 -1
- package/mtds/errorsummary/errorsummary.js.map +1 -1
- package/mtds/field/field.d.ts +1 -1
- package/mtds/field/field.js.map +1 -1
- package/mtds/index.d.ts +1 -2
- package/mtds/index.iife.js +29 -18
- package/mtds/index.js +32 -37
- package/mtds/index.js.map +1 -1
- package/mtds/package.json.js +1 -1
- package/mtds/pagination/pagination.d.ts +1 -1
- package/mtds/pagination/pagination.js +9 -8
- package/mtds/pagination/pagination.js.map +1 -1
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +23 -23
- package/mtds/styles.module.css.js +33 -33
- package/mtds/table/table-observer.js +26 -15
- package/mtds/table/table-observer.js.map +1 -1
- package/mtds/tabs/tabs.d.ts +1 -1
- package/mtds/tabs/tabs.js.map +1 -1
- package/mtds/tailwind.css +0 -1
- package/mtds/tooltip/tooltip-element.js +7 -6
- package/mtds/tooltip/tooltip-element.js.map +1 -1
- package/package.json +8 -6
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +0 -238
- package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +0 -1
- package/mtds/external/@u-elements/u-details/dist/u-details.js +0 -101
- package/mtds/external/@u-elements/u-details/dist/u-details.js.map +0 -1
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +0 -235
- package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +0 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { HeartIcon, ListIcon, StarIcon, XIcon } from "@phosphor-icons/react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button, Flex, Grid } from "../react";
|
|
5
|
+
import styles from "../styles.module.css";
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Designsystem/Button",
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div className={styles.flex} data-align="center">
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
} satisfies Meta;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
render: () => (
|
|
23
|
+
<>
|
|
24
|
+
<button type="button" className={styles.button} data-variant="primary">
|
|
25
|
+
Primary
|
|
26
|
+
</button>
|
|
27
|
+
<button type="button" className={styles.button} data-variant="secondary">
|
|
28
|
+
Secondary
|
|
29
|
+
</button>
|
|
30
|
+
<button type="button" className={styles.button}>
|
|
31
|
+
Tertiary (default)
|
|
32
|
+
</button>
|
|
33
|
+
</>
|
|
34
|
+
),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const React: Story = {
|
|
38
|
+
render: () => (
|
|
39
|
+
<>
|
|
40
|
+
<Button data-variant="primary">Primary</Button>
|
|
41
|
+
<Button data-variant="secondary">Secondary</Button>
|
|
42
|
+
<Button>Tertiary as button</Button>
|
|
43
|
+
<Button href="#">Tertiary as link</Button>
|
|
44
|
+
</>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Sizes: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
className={styles.button}
|
|
54
|
+
data-variant="primary"
|
|
55
|
+
data-size="sm"
|
|
56
|
+
>
|
|
57
|
+
Small
|
|
58
|
+
</button>
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
className={styles.button}
|
|
62
|
+
data-variant="primary"
|
|
63
|
+
data-size="md"
|
|
64
|
+
>
|
|
65
|
+
Medium
|
|
66
|
+
</button>
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
className={styles.button}
|
|
70
|
+
data-variant="primary"
|
|
71
|
+
data-size="lg"
|
|
72
|
+
>
|
|
73
|
+
Large
|
|
74
|
+
</button>
|
|
75
|
+
</>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const Colors: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<div className={styles.grid}>
|
|
82
|
+
<button type="button" className={styles.button} data-variant="primary">
|
|
83
|
+
Main primary
|
|
84
|
+
</button>
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
className={styles.button}
|
|
88
|
+
data-variant="primary"
|
|
89
|
+
data-color="danger"
|
|
90
|
+
>
|
|
91
|
+
Danger primary
|
|
92
|
+
</button>
|
|
93
|
+
<button type="button" className={styles.button} data-variant="secondary">
|
|
94
|
+
Main secondary
|
|
95
|
+
</button>
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
className={styles.button}
|
|
99
|
+
data-variant="secondary"
|
|
100
|
+
data-color="danger"
|
|
101
|
+
>
|
|
102
|
+
Danger secondary
|
|
103
|
+
</button>
|
|
104
|
+
<button type="button" className={styles.button}>
|
|
105
|
+
Main tertiary
|
|
106
|
+
</button>
|
|
107
|
+
<button type="button" className={styles.button} data-color="danger">
|
|
108
|
+
Danger tertiary
|
|
109
|
+
</button>
|
|
110
|
+
</div>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const Nowrap: Story = {
|
|
115
|
+
render: () => (
|
|
116
|
+
<div className={styles.grid} data-items="auto" style={{ width: 250 }}>
|
|
117
|
+
<div>
|
|
118
|
+
<p>Med nowrap:</p>
|
|
119
|
+
<button
|
|
120
|
+
type="button"
|
|
121
|
+
className={styles.button}
|
|
122
|
+
data-variant="secondary"
|
|
123
|
+
>
|
|
124
|
+
<StarIcon />
|
|
125
|
+
<span data-nowrap>Lagre favoritt</span>
|
|
126
|
+
</button>
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<p>Uten nowrap:</p>
|
|
130
|
+
<button
|
|
131
|
+
type="button"
|
|
132
|
+
className={styles.button}
|
|
133
|
+
data-variant="secondary"
|
|
134
|
+
>
|
|
135
|
+
<StarIcon />
|
|
136
|
+
Lagre favoritt
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
),
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const Justify: Story = {
|
|
144
|
+
render: () => (
|
|
145
|
+
<div className={styles.grid} style={{ width: 350 }}>
|
|
146
|
+
<button
|
|
147
|
+
className={styles.button}
|
|
148
|
+
data-justify="center"
|
|
149
|
+
data-variant="secondary"
|
|
150
|
+
type="button"
|
|
151
|
+
>
|
|
152
|
+
<StarIcon />
|
|
153
|
+
Center
|
|
154
|
+
</button>
|
|
155
|
+
<button
|
|
156
|
+
className={styles.button}
|
|
157
|
+
data-arrow="left"
|
|
158
|
+
data-justify="start"
|
|
159
|
+
data-variant="secondary"
|
|
160
|
+
type="button"
|
|
161
|
+
>
|
|
162
|
+
Start
|
|
163
|
+
</button>
|
|
164
|
+
<button
|
|
165
|
+
className={styles.button}
|
|
166
|
+
data-arrow="right"
|
|
167
|
+
data-justify="end"
|
|
168
|
+
data-variant="secondary"
|
|
169
|
+
type="button"
|
|
170
|
+
>
|
|
171
|
+
End
|
|
172
|
+
</button>
|
|
173
|
+
</div>
|
|
174
|
+
),
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const Pressed: Story = {
|
|
178
|
+
render: function Render() {
|
|
179
|
+
const [pressed, setPressed] = useState(false);
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<button
|
|
184
|
+
aria-pressed={pressed}
|
|
185
|
+
type="button"
|
|
186
|
+
className={styles.button}
|
|
187
|
+
onClick={() => setPressed(!pressed)}
|
|
188
|
+
>
|
|
189
|
+
<StarIcon data-pressed="false" />
|
|
190
|
+
<span data-pressed="false">Lagre favoritt</span>
|
|
191
|
+
<StarIcon data-pressed="true" weight="fill" />
|
|
192
|
+
<span data-pressed="true">Fjern favoritt</span>
|
|
193
|
+
</button>
|
|
194
|
+
<button
|
|
195
|
+
className={styles.button}
|
|
196
|
+
popoverTarget="pop-pressed"
|
|
197
|
+
type="button"
|
|
198
|
+
>
|
|
199
|
+
With popover
|
|
200
|
+
<ListIcon data-pressed="false" />
|
|
201
|
+
<XIcon data-pressed="true" />
|
|
202
|
+
</button>
|
|
203
|
+
<menu className={styles.popover} id="pop-pressed" popover="auto">
|
|
204
|
+
<li>
|
|
205
|
+
<button type="button" className={styles.button}>
|
|
206
|
+
Knapp 1
|
|
207
|
+
</button>
|
|
208
|
+
</li>
|
|
209
|
+
<li>
|
|
210
|
+
<button type="button" className={styles.button}>
|
|
211
|
+
Knapp 2
|
|
212
|
+
</button>
|
|
213
|
+
</li>
|
|
214
|
+
</menu>
|
|
215
|
+
</>
|
|
216
|
+
);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export const WithArrows: Story = {
|
|
221
|
+
render: () => (
|
|
222
|
+
<>
|
|
223
|
+
<button type="button" className={styles.button} data-arrow>
|
|
224
|
+
Knapp
|
|
225
|
+
</button>
|
|
226
|
+
<button type="button" className={styles.button} data-arrow="left">
|
|
227
|
+
Knapp
|
|
228
|
+
</button>
|
|
229
|
+
<a className={styles.button} data-arrow="right" href="#none">
|
|
230
|
+
Lenkeknapp
|
|
231
|
+
</a>
|
|
232
|
+
<button
|
|
233
|
+
data-arrow
|
|
234
|
+
popoverTarget="pop-1"
|
|
235
|
+
type="button"
|
|
236
|
+
className={styles.button}
|
|
237
|
+
>
|
|
238
|
+
Popover
|
|
239
|
+
</button>
|
|
240
|
+
|
|
241
|
+
<menu className={styles.popover} id="pop-1" popover="auto">
|
|
242
|
+
<li>
|
|
243
|
+
<button type="button" className={styles.button}>
|
|
244
|
+
Knapp 1
|
|
245
|
+
</button>
|
|
246
|
+
</li>
|
|
247
|
+
<li>
|
|
248
|
+
<button type="button" className={styles.button}>
|
|
249
|
+
Knapp 2
|
|
250
|
+
</button>
|
|
251
|
+
</li>
|
|
252
|
+
<li>
|
|
253
|
+
<button type="button" className={styles.button}>
|
|
254
|
+
Knapp 3
|
|
255
|
+
</button>
|
|
256
|
+
</li>
|
|
257
|
+
</menu>
|
|
258
|
+
</>
|
|
259
|
+
),
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export const WithIcons: Story = {
|
|
263
|
+
render: () => (
|
|
264
|
+
<>
|
|
265
|
+
<button type="button" className={styles.button} data-variant="secondary">
|
|
266
|
+
<HeartIcon />
|
|
267
|
+
Ikon før
|
|
268
|
+
</button>
|
|
269
|
+
<button type="button" className={styles.button} data-variant="secondary">
|
|
270
|
+
Ikon etter
|
|
271
|
+
<StarIcon />
|
|
272
|
+
</button>
|
|
273
|
+
</>
|
|
274
|
+
),
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export const WithSpinner: Story = {
|
|
278
|
+
render: () => (
|
|
279
|
+
<Grid>
|
|
280
|
+
<Flex>
|
|
281
|
+
<Button aria-busy="true" data-variant="primary">
|
|
282
|
+
Knapp
|
|
283
|
+
</Button>
|
|
284
|
+
<Button aria-busy="true" data-variant="primary">
|
|
285
|
+
Lenkeknapp
|
|
286
|
+
</Button>
|
|
287
|
+
</Flex>
|
|
288
|
+
<Flex>
|
|
289
|
+
<Button aria-busy="true" data-arrow="right" data-variant="primary">
|
|
290
|
+
Knapp med høyrepil
|
|
291
|
+
</Button>
|
|
292
|
+
<Button aria-busy="true" data-arrow="left" data-variant="primary">
|
|
293
|
+
Knapp med venstrepil
|
|
294
|
+
</Button>
|
|
295
|
+
</Flex>
|
|
296
|
+
<Flex>
|
|
297
|
+
<Button aria-busy="true" data-variant="primary">
|
|
298
|
+
Knapp med høyre-ikon
|
|
299
|
+
<StarIcon />
|
|
300
|
+
</Button>
|
|
301
|
+
<Button aria-busy="true" data-variant="primary">
|
|
302
|
+
<StarIcon />
|
|
303
|
+
Knapp med venstre-ikon
|
|
304
|
+
</Button>
|
|
305
|
+
</Flex>
|
|
306
|
+
<Flex>
|
|
307
|
+
<Button aria-busy="true" data-variant="primary" data-arrow="right">
|
|
308
|
+
Knapp med høyre-ikon og høyrepil
|
|
309
|
+
<StarIcon />
|
|
310
|
+
</Button>
|
|
311
|
+
<Button aria-busy="true" data-variant="primary" data-arrow="left">
|
|
312
|
+
<StarIcon />
|
|
313
|
+
Knapp med venstre-ikon og venstrepil
|
|
314
|
+
</Button>
|
|
315
|
+
</Flex>
|
|
316
|
+
<Flex>
|
|
317
|
+
<Button aria-busy="true" data-variant="primary" data-arrow="left">
|
|
318
|
+
Knapp med høyre-ikon og venstreepil
|
|
319
|
+
<StarIcon />
|
|
320
|
+
</Button>
|
|
321
|
+
<Button aria-busy="true" data-variant="primary" data-arrow="right">
|
|
322
|
+
<StarIcon />
|
|
323
|
+
Knapp med venstre-ikon og høyrepil
|
|
324
|
+
</Button>
|
|
325
|
+
</Flex>
|
|
326
|
+
</Grid>
|
|
327
|
+
),
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export const WithFullWidth: Story = {
|
|
331
|
+
render: () => (
|
|
332
|
+
<button
|
|
333
|
+
className={styles.button}
|
|
334
|
+
data-self="full"
|
|
335
|
+
data-variant="primary"
|
|
336
|
+
type="button"
|
|
337
|
+
>
|
|
338
|
+
Knapp
|
|
339
|
+
</button>
|
|
340
|
+
),
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export const WithMenu: Story = {
|
|
344
|
+
render: () => (
|
|
345
|
+
<>
|
|
346
|
+
<button
|
|
347
|
+
aria-label="Handlinger"
|
|
348
|
+
className={styles.button}
|
|
349
|
+
popoverTarget="pop-2"
|
|
350
|
+
type="button"
|
|
351
|
+
/>
|
|
352
|
+
<menu popover="auto" id="pop-2" className={styles.popover}>
|
|
353
|
+
<li>
|
|
354
|
+
<button type="button" className={styles.button}>
|
|
355
|
+
Knapp 1
|
|
356
|
+
</button>
|
|
357
|
+
</li>
|
|
358
|
+
<li>
|
|
359
|
+
<button type="button" className={styles.button}>
|
|
360
|
+
Knapp 2
|
|
361
|
+
</button>
|
|
362
|
+
</li>
|
|
363
|
+
<li>
|
|
364
|
+
<button type="button" className={styles.button}>
|
|
365
|
+
Knapp 3
|
|
366
|
+
</button>
|
|
367
|
+
</li>
|
|
368
|
+
</menu>
|
|
369
|
+
</>
|
|
370
|
+
),
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export const WithTooltip: Story = {
|
|
374
|
+
render: function Render() {
|
|
375
|
+
const [pressed, setPressed] = useState(false);
|
|
376
|
+
|
|
377
|
+
return (
|
|
378
|
+
<button
|
|
379
|
+
data-tooltip="Favoritt"
|
|
380
|
+
aria-pressed={pressed}
|
|
381
|
+
className={styles.button}
|
|
382
|
+
onClick={() => setPressed(!pressed)}
|
|
383
|
+
type="button"
|
|
384
|
+
>
|
|
385
|
+
<StarIcon data-pressed="false" />
|
|
386
|
+
<StarIcon data-pressed="true" weight="fill" />
|
|
387
|
+
</button>
|
|
388
|
+
);
|
|
389
|
+
},
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
export const InMenu: Story = {
|
|
393
|
+
render: () => (
|
|
394
|
+
<menu>
|
|
395
|
+
<li>
|
|
396
|
+
<button type="button" className={styles.button} aria-pressed="true">
|
|
397
|
+
Valgt knapp
|
|
398
|
+
</button>
|
|
399
|
+
</li>
|
|
400
|
+
<li>
|
|
401
|
+
<button type="button" className={styles.button}>
|
|
402
|
+
Knapp med veldig lang tekst
|
|
403
|
+
</button>
|
|
404
|
+
</li>
|
|
405
|
+
<li>
|
|
406
|
+
<button type="button" className={styles.button} aria-current="page">
|
|
407
|
+
Nåværende side
|
|
408
|
+
</button>
|
|
409
|
+
</li>
|
|
410
|
+
<li>
|
|
411
|
+
<button type="button" className={styles.button}>
|
|
412
|
+
Knapp 4
|
|
413
|
+
</button>
|
|
414
|
+
</li>
|
|
415
|
+
</menu>
|
|
416
|
+
),
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
export const Invert: Story = {
|
|
420
|
+
name: "Invert",
|
|
421
|
+
render: () => (
|
|
422
|
+
<div data-color="inverted" className={`${styles.card} ${styles.flex}`}>
|
|
423
|
+
<p style={{ flex: "1 0 100%" }}>
|
|
424
|
+
Use data-color="inverted" on parent element or button itself to invert
|
|
425
|
+
</p>
|
|
426
|
+
<button type="button" className={styles.button} data-variant="primary">
|
|
427
|
+
Primary
|
|
428
|
+
</button>
|
|
429
|
+
<button type="button" className={styles.button} data-variant="secondary">
|
|
430
|
+
Secondary
|
|
431
|
+
</button>
|
|
432
|
+
<button type="button" className={styles.button} data-variant="tertiary">
|
|
433
|
+
Tertiary
|
|
434
|
+
</button>
|
|
435
|
+
<button aria-current="page" type="button" className={styles.button}>
|
|
436
|
+
aria-current="page"
|
|
437
|
+
</button>
|
|
438
|
+
</div>
|
|
439
|
+
),
|
|
440
|
+
};
|
package/mtds/ai/card.mdx
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { CssVariables } from '../../.storybook/blocks';
|
|
3
|
+
import { Alert, Button } from '../react';
|
|
4
|
+
import * as stories from './card.stories';
|
|
5
|
+
|
|
6
|
+
<Meta of={stories} />
|
|
7
|
+
|
|
8
|
+
# Card og Group
|
|
9
|
+
|
|
10
|
+
> Med Card kan vi gruppere og fremheve informasjon eller oppgaver som hører sammen. Group brukes til å gruppere flere Cards.
|
|
11
|
+
|
|
12
|
+
## Kode
|
|
13
|
+
- Bruk klassen `card` på typisk `<div>`, `<a>` eller `<button>`
|
|
14
|
+
- Bruk [`info`](?path=/story/designsystem-typography--info-story) rundt ledetekst+verdi, ikon+verdi eller verdi for enkelt, responsivt oppsett
|
|
15
|
+
<Canvas of={stories.Default} />
|
|
16
|
+
|
|
17
|
+
## Padding
|
|
18
|
+
- Både `card` og `group` støtter `data-pad="0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 22 | 26 | 30"` for endring av padding (`5` er default)
|
|
19
|
+
- **Fluid padding:** Bruk `data-pad="TALL-TALL"` - da får du voksende padding fra første tall `368px` til siste tall på `1440px`
|
|
20
|
+
- **Brekkpunkt-padding:** Bruk `data-pad-sm` (over `640px`), `data-pad-md` (over `768px`),<br />`data-pad-lg` (over `1024px`), `data-pad-xl` (over `1280px`) og<br />`data-pad-2xl` (over `1536px`)
|
|
21
|
+
<div className="sbdocs-canvas-thumbnail">
|
|
22
|
+
<Button data-arrow data-variant="primary" href="?path=/story/designsystem-card--padding">Se paddings i egen visning</Button>
|
|
23
|
+
<Canvas of={stories.Padding} />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
## Border radius
|
|
27
|
+
- Både `card` og `group` støtter `data-radius="sm | md | lg | lg"` for endring av padding (`lg` er default for card, og `xl` er default for group)
|
|
28
|
+
<Canvas of={stories.Radius} />
|
|
29
|
+
|
|
30
|
+
## Interaktiv
|
|
31
|
+
- Når `card` er klikkbart, får hele kortet `hover` og `active`-effekter
|
|
32
|
+
- **Merk:** Klikkbare `card` kan ikke inneholde andre klikkbare elementer
|
|
33
|
+
<Canvas of={stories.Interactive} />
|
|
34
|
+
|
|
35
|
+
## Responsiv
|
|
36
|
+
- Legg `flex` og `grid` inni `card` for å lage responsive design
|
|
37
|
+
|
|
38
|
+
<Alert>
|
|
39
|
+
**Å lage gode responsive kort er utfordrende**, fordi gruppering og brekkpunkter burde bestemmes av innholdet.
|
|
40
|
+
I stede for å tilby et fastlåst "one size fits nobody" design, gir vi deg heller stor fleksibilitet, men dermed også mer ansvar.
|
|
41
|
+
Frykt ikke dog! Du kan kontakt oss på [#designsystem](https://mattilsynet-hq.slack.com/archives/C03FAJ7N1EU) så kommer vi i gang sammen 💙
|
|
42
|
+
</Alert>
|
|
43
|
+
|
|
44
|
+
<Canvas of={stories.Responsive} />
|
|
45
|
+
|
|
46
|
+
## Gruppering
|
|
47
|
+
- Bruk `group` på typisk en `grid` eller `flex` for å gruppere flere `card`
|
|
48
|
+
- Kan også benyttes rundt annet innhold for å visuelt vise gruppering
|
|
49
|
+
<Canvas of={stories.GroupStory} />
|
|
50
|
+
|
|
51
|
+
<CssVariables component="card" />
|