@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,519 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Chart, Grid, Table } from "../react";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Designsystem/Chart",
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "padded",
|
|
8
|
+
},
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div
|
|
12
|
+
style={{
|
|
13
|
+
maxWidth: 800,
|
|
14
|
+
margin: "auto",
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<Story />
|
|
18
|
+
</div>
|
|
19
|
+
),
|
|
20
|
+
],
|
|
21
|
+
} satisfies Meta;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
const table = (
|
|
27
|
+
<table>
|
|
28
|
+
<thead>
|
|
29
|
+
<tr>
|
|
30
|
+
<th>Risikofordeling</th>
|
|
31
|
+
<th>Q1</th>
|
|
32
|
+
<th>Q2</th>
|
|
33
|
+
<th>Q3</th>
|
|
34
|
+
</tr>
|
|
35
|
+
</thead>
|
|
36
|
+
<tbody>
|
|
37
|
+
<tr>
|
|
38
|
+
<th>Large</th>
|
|
39
|
+
<td>50</td>
|
|
40
|
+
<td>20</td>
|
|
41
|
+
<td>40</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<th>Medium</th>
|
|
45
|
+
<td>25</td>
|
|
46
|
+
<td>30</td>
|
|
47
|
+
<td>35</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<th>Small</th>
|
|
51
|
+
<td>15</td>
|
|
52
|
+
<td>5</td>
|
|
53
|
+
<td>100</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<th>Venti</th>
|
|
57
|
+
<td>35</td>
|
|
58
|
+
<td>80</td>
|
|
59
|
+
<td>35</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<th>Grandi</th>
|
|
63
|
+
<td>40</td>
|
|
64
|
+
<td>30</td>
|
|
65
|
+
<td>10</td>
|
|
66
|
+
</tr>
|
|
67
|
+
</tbody>
|
|
68
|
+
</table>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export const Default: Story = {
|
|
72
|
+
render: () => (
|
|
73
|
+
<mtds-chart>
|
|
74
|
+
<table>
|
|
75
|
+
<thead>
|
|
76
|
+
<tr>
|
|
77
|
+
<th>Risikofordeling</th>
|
|
78
|
+
<th>Q1</th>
|
|
79
|
+
</tr>
|
|
80
|
+
</thead>
|
|
81
|
+
<tbody>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Large</th>
|
|
84
|
+
<td>50</td>
|
|
85
|
+
</tr>
|
|
86
|
+
<tr>
|
|
87
|
+
<th>Medium</th>
|
|
88
|
+
<td>25</td>
|
|
89
|
+
</tr>
|
|
90
|
+
<tr>
|
|
91
|
+
<th>Small</th>
|
|
92
|
+
<td>15</td>
|
|
93
|
+
</tr>
|
|
94
|
+
</tbody>
|
|
95
|
+
</table>
|
|
96
|
+
</mtds-chart>
|
|
97
|
+
),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const React: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<Grid data-items="300">
|
|
103
|
+
<Chart>
|
|
104
|
+
<Table>
|
|
105
|
+
<Table.Thead>
|
|
106
|
+
<Table.Tr>
|
|
107
|
+
<Table.Th>Risikofordeling</Table.Th>
|
|
108
|
+
<Table.Th>Q1</Table.Th>
|
|
109
|
+
</Table.Tr>
|
|
110
|
+
</Table.Thead>
|
|
111
|
+
<Table.Tbody>
|
|
112
|
+
<Table.Tr>
|
|
113
|
+
<Table.Th>Large</Table.Th>
|
|
114
|
+
<Table.Td>50</Table.Td>
|
|
115
|
+
</Table.Tr>
|
|
116
|
+
<Table.Tr>
|
|
117
|
+
<Table.Th>Medium</Table.Th>
|
|
118
|
+
<Table.Td>25</Table.Td>
|
|
119
|
+
</Table.Tr>
|
|
120
|
+
<Table.Tr>
|
|
121
|
+
<Table.Th>Small</Table.Th>
|
|
122
|
+
<Table.Td>15</Table.Td>
|
|
123
|
+
</Table.Tr>
|
|
124
|
+
</Table.Tbody>
|
|
125
|
+
</Table>
|
|
126
|
+
</Chart>
|
|
127
|
+
<Chart
|
|
128
|
+
data-variant="doughnut"
|
|
129
|
+
data={[
|
|
130
|
+
["Risikofordeling", "Q1"],
|
|
131
|
+
["Large", 50],
|
|
132
|
+
["Medium", 25],
|
|
133
|
+
["Small", 15],
|
|
134
|
+
]}
|
|
135
|
+
/>
|
|
136
|
+
</Grid>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const Column: Story = {
|
|
141
|
+
render: () => <mtds-chart data-variant="column">{table}</mtds-chart>,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const ColumnSingleDataset: Story = {
|
|
145
|
+
render: () => (
|
|
146
|
+
<mtds-chart data-variant="column">
|
|
147
|
+
<table>
|
|
148
|
+
<thead>
|
|
149
|
+
<tr>
|
|
150
|
+
<th>Risikofordeling</th>
|
|
151
|
+
<th>Janaur</th>
|
|
152
|
+
<th>Februar</th>
|
|
153
|
+
<th>Mars</th>
|
|
154
|
+
<th>April</th>
|
|
155
|
+
<th>Mai</th>
|
|
156
|
+
<th>Juni</th>
|
|
157
|
+
<th>Juli</th>
|
|
158
|
+
<th>August</th>
|
|
159
|
+
<th>September</th>
|
|
160
|
+
<th>Oktober</th>
|
|
161
|
+
<th>November</th>
|
|
162
|
+
<th>Desember</th>
|
|
163
|
+
</tr>
|
|
164
|
+
</thead>
|
|
165
|
+
<tbody>
|
|
166
|
+
<tr>
|
|
167
|
+
<th>Slakt av laks</th>
|
|
168
|
+
<td data-tooltip="Januar: 10">10</td>
|
|
169
|
+
<td data-tooltip="Februar: 15">15</td>
|
|
170
|
+
<td data-tooltip="Mars: 25">25</td>
|
|
171
|
+
<td data-tooltip="April: 40">40</td>
|
|
172
|
+
<td data-tooltip="Mai: 10">10</td>
|
|
173
|
+
<td data-tooltip="Juni: 5">5</td>
|
|
174
|
+
<td data-tooltip="Juli: 15">15</td>
|
|
175
|
+
<td data-tooltip="August: 30">30</td>
|
|
176
|
+
<td data-tooltip="September: 20">20</td>
|
|
177
|
+
<td data-tooltip="Oktober: 25">25</td>
|
|
178
|
+
<td data-tooltip="November: 35">35</td>
|
|
179
|
+
<td data-tooltip="Desember: 55">55</td>
|
|
180
|
+
</tr>
|
|
181
|
+
</tbody>
|
|
182
|
+
</table>
|
|
183
|
+
</mtds-chart>
|
|
184
|
+
),
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export const ColorsSingleDataset: Story = {
|
|
188
|
+
render: () => (
|
|
189
|
+
<mtds-chart
|
|
190
|
+
data-variant="column"
|
|
191
|
+
style={
|
|
192
|
+
{
|
|
193
|
+
"--mtdsc-chart-color-1-1": "var(--mtds-color-charts-chart-e)",
|
|
194
|
+
"--mtdsc-chart-color-1-2": "var(--mtds-color-charts-chart-b)",
|
|
195
|
+
"--mtdsc-chart-color-1-3": "var(--mtds-color-charts-chart-c)",
|
|
196
|
+
"--mtdsc-chart-color-1-4": "var(--mtds-color-charts-chart-d)",
|
|
197
|
+
"--mtdsc-chart-color-1-5": "var(--mtds-color-charts-chart-e)",
|
|
198
|
+
"--mtdsc-chart-color-1-6": "var(--mtds-color-charts-chart-e)",
|
|
199
|
+
"--mtdsc-chart-color-1-7": "var(--mtds-color-charts-chart-e)",
|
|
200
|
+
"--mtdsc-chart-color-1-8": "var(--mtds-color-charts-chart-d)",
|
|
201
|
+
"--mtdsc-chart-color-1-9": "var(--mtds-color-charts-chart-d)",
|
|
202
|
+
"--mtdsc-chart-color-1-10": "var(--mtds-color-charts-chart-c)",
|
|
203
|
+
"--mtdsc-chart-color-1-11": "var(--mtds-color-charts-chart-b)",
|
|
204
|
+
} as React.CSSProperties
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
<table>
|
|
208
|
+
<thead>
|
|
209
|
+
<tr>
|
|
210
|
+
<th>Risikofordeling</th>
|
|
211
|
+
<th>Janaur</th>
|
|
212
|
+
<th>Februar</th>
|
|
213
|
+
<th>Mars</th>
|
|
214
|
+
<th>April</th>
|
|
215
|
+
<th>Mai</th>
|
|
216
|
+
<th>Juni</th>
|
|
217
|
+
<th>Juli</th>
|
|
218
|
+
<th>August</th>
|
|
219
|
+
<th>September</th>
|
|
220
|
+
<th>Oktober</th>
|
|
221
|
+
<th>November</th>
|
|
222
|
+
<th>Desember</th>
|
|
223
|
+
</tr>
|
|
224
|
+
</thead>
|
|
225
|
+
<tbody>
|
|
226
|
+
<tr>
|
|
227
|
+
<th>Slakt av laks</th>
|
|
228
|
+
<td data-tooltip="Januar: 10">10</td>
|
|
229
|
+
<td data-tooltip="Februar: 15">15</td>
|
|
230
|
+
<td data-tooltip="Mars: 25">25</td>
|
|
231
|
+
<td data-tooltip="April: 40">40</td>
|
|
232
|
+
<td data-tooltip="Mai: 10">10</td>
|
|
233
|
+
<td data-tooltip="Juni: 5">5</td>
|
|
234
|
+
<td data-tooltip="Juli: 15">15</td>
|
|
235
|
+
<td data-tooltip="August: 30">30</td>
|
|
236
|
+
<td data-tooltip="September: 20">20</td>
|
|
237
|
+
<td data-tooltip="Oktober: 25">25</td>
|
|
238
|
+
<td data-tooltip="November: 35">35</td>
|
|
239
|
+
<td data-tooltip="Desember: 55">55</td>
|
|
240
|
+
</tr>
|
|
241
|
+
</tbody>
|
|
242
|
+
</table>
|
|
243
|
+
</mtds-chart>
|
|
244
|
+
),
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export const ColumnStacked: Story = {
|
|
248
|
+
render: () => <mtds-chart data-variant="column-stacked">{table}</mtds-chart>,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const Bar: Story = {
|
|
252
|
+
render: () => <mtds-chart data-variant="bar">{table}</mtds-chart>,
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export const BarStacked: Story = {
|
|
256
|
+
render: () => <mtds-chart data-variant="bar-stacked">{table}</mtds-chart>,
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const Line: Story = {
|
|
260
|
+
render: () => (
|
|
261
|
+
<mtds-chart data-variant="line">
|
|
262
|
+
<table>
|
|
263
|
+
<thead>
|
|
264
|
+
<tr>
|
|
265
|
+
<th>Risikofordeling</th>
|
|
266
|
+
<th>Q1</th>
|
|
267
|
+
<th>Q2</th>
|
|
268
|
+
<th>Q3</th>
|
|
269
|
+
<th>Q4</th>
|
|
270
|
+
</tr>
|
|
271
|
+
</thead>
|
|
272
|
+
<tbody>
|
|
273
|
+
<tr>
|
|
274
|
+
<th>Large</th>
|
|
275
|
+
<td>30</td>
|
|
276
|
+
<td>40</td>
|
|
277
|
+
<td>20</td>
|
|
278
|
+
<td>60</td>
|
|
279
|
+
</tr>
|
|
280
|
+
<tr>
|
|
281
|
+
<th>Medium</th>
|
|
282
|
+
<td>10</td>
|
|
283
|
+
<td>20</td>
|
|
284
|
+
<td>40</td>
|
|
285
|
+
<td>50</td>
|
|
286
|
+
</tr>
|
|
287
|
+
</tbody>
|
|
288
|
+
</table>
|
|
289
|
+
</mtds-chart>
|
|
290
|
+
),
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
export const Area: Story = {
|
|
294
|
+
render: () => (
|
|
295
|
+
<mtds-chart data-variant="area">
|
|
296
|
+
<table>
|
|
297
|
+
<thead>
|
|
298
|
+
<tr>
|
|
299
|
+
<th>Risikofordeling</th>
|
|
300
|
+
<th>Q1</th>
|
|
301
|
+
<th>Q2</th>
|
|
302
|
+
<th>Q3</th>
|
|
303
|
+
<th>Q4</th>
|
|
304
|
+
</tr>
|
|
305
|
+
</thead>
|
|
306
|
+
<tbody>
|
|
307
|
+
<tr>
|
|
308
|
+
<th>Large</th>
|
|
309
|
+
<td>30</td>
|
|
310
|
+
<td>40</td>
|
|
311
|
+
<td>20</td>
|
|
312
|
+
<td>60</td>
|
|
313
|
+
</tr>
|
|
314
|
+
<tr>
|
|
315
|
+
<th>Medium</th>
|
|
316
|
+
<td>10</td>
|
|
317
|
+
<td>20</td>
|
|
318
|
+
<td>40</td>
|
|
319
|
+
<td>50</td>
|
|
320
|
+
</tr>
|
|
321
|
+
</tbody>
|
|
322
|
+
</table>
|
|
323
|
+
</mtds-chart>
|
|
324
|
+
),
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export const Doughnut: Story = {
|
|
328
|
+
render: () => <mtds-chart data-variant="doughnut">{table}</mtds-chart>,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export const Pie: Story = {
|
|
332
|
+
render: () => <mtds-chart data-variant="pie">{table}</mtds-chart>,
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export const WithLegendDisabled: Story = {
|
|
336
|
+
render: () => (
|
|
337
|
+
<mtds-chart data-legend="false">
|
|
338
|
+
<table>
|
|
339
|
+
<thead>
|
|
340
|
+
<tr>
|
|
341
|
+
<th>Risikofordeling</th>
|
|
342
|
+
<th>Q1</th>
|
|
343
|
+
</tr>
|
|
344
|
+
</thead>
|
|
345
|
+
<tbody>
|
|
346
|
+
<tr>
|
|
347
|
+
<th>Large</th>
|
|
348
|
+
<td data-tooltip="En">50%</td>
|
|
349
|
+
</tr>
|
|
350
|
+
<tr>
|
|
351
|
+
<th>Medium</th>
|
|
352
|
+
<td data-tooltip="To">25%</td>
|
|
353
|
+
</tr>
|
|
354
|
+
<tr>
|
|
355
|
+
<th>Small</th>
|
|
356
|
+
<td data-tooltip="Tre">15%</td>
|
|
357
|
+
</tr>
|
|
358
|
+
</tbody>
|
|
359
|
+
</table>
|
|
360
|
+
</mtds-chart>
|
|
361
|
+
),
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export const WithCustomTooltips: Story = {
|
|
365
|
+
render: () => (
|
|
366
|
+
<mtds-chart data-variant="doughnut">
|
|
367
|
+
<table>
|
|
368
|
+
<thead>
|
|
369
|
+
<tr>
|
|
370
|
+
<th>Risikofordeling</th>
|
|
371
|
+
<th>Q1</th>
|
|
372
|
+
</tr>
|
|
373
|
+
</thead>
|
|
374
|
+
<tbody>
|
|
375
|
+
<tr>
|
|
376
|
+
<th>Large</th>
|
|
377
|
+
<td data-tooltip="En">50%</td>
|
|
378
|
+
</tr>
|
|
379
|
+
<tr>
|
|
380
|
+
<th>Medium</th>
|
|
381
|
+
<td data-tooltip="To">25%</td>
|
|
382
|
+
</tr>
|
|
383
|
+
<tr>
|
|
384
|
+
<th>Small</th>
|
|
385
|
+
<td data-tooltip="Tre">15%</td>
|
|
386
|
+
</tr>
|
|
387
|
+
</tbody>
|
|
388
|
+
</table>
|
|
389
|
+
</mtds-chart>
|
|
390
|
+
),
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
export const WithDotsDisabled: Story = {
|
|
394
|
+
render: () => (
|
|
395
|
+
<mtds-chart data-variant="line" data-dots="false">
|
|
396
|
+
<table>
|
|
397
|
+
<thead>
|
|
398
|
+
<tr>
|
|
399
|
+
<th>Risikofordeling</th>
|
|
400
|
+
<th>Q1</th>
|
|
401
|
+
<th>Q2</th>
|
|
402
|
+
<th>Q3</th>
|
|
403
|
+
<th>Q4</th>
|
|
404
|
+
</tr>
|
|
405
|
+
</thead>
|
|
406
|
+
<tbody>
|
|
407
|
+
<tr>
|
|
408
|
+
<th>Large</th>
|
|
409
|
+
<td>30</td>
|
|
410
|
+
<td>40</td>
|
|
411
|
+
<td>20</td>
|
|
412
|
+
<td>60</td>
|
|
413
|
+
</tr>
|
|
414
|
+
<tr>
|
|
415
|
+
<th>Medium</th>
|
|
416
|
+
<td>10</td>
|
|
417
|
+
<td>20</td>
|
|
418
|
+
<td>40</td>
|
|
419
|
+
<td>50</td>
|
|
420
|
+
</tr>
|
|
421
|
+
</tbody>
|
|
422
|
+
</table>
|
|
423
|
+
</mtds-chart>
|
|
424
|
+
),
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export const WithCustomInteractions: Story = {
|
|
428
|
+
render: () => (
|
|
429
|
+
<Grid>
|
|
430
|
+
Trykk på pai-sykkene:
|
|
431
|
+
<mtds-chart data-variant="doughnut">
|
|
432
|
+
<table>
|
|
433
|
+
<thead>
|
|
434
|
+
<tr>
|
|
435
|
+
<th>Risikofordeling</th>
|
|
436
|
+
<th>Q1</th>
|
|
437
|
+
</tr>
|
|
438
|
+
</thead>
|
|
439
|
+
<tbody>
|
|
440
|
+
<tr>
|
|
441
|
+
<th>Large</th>
|
|
442
|
+
<td>
|
|
443
|
+
<button type="button" onClick={() => alert("Klikk på 50%")}>
|
|
444
|
+
50%
|
|
445
|
+
</button>
|
|
446
|
+
</td>
|
|
447
|
+
</tr>
|
|
448
|
+
<tr>
|
|
449
|
+
<th>Medium</th>
|
|
450
|
+
<td>
|
|
451
|
+
<button type="button" onClick={() => alert("Klikk på 25%")}>
|
|
452
|
+
25%
|
|
453
|
+
</button>
|
|
454
|
+
</td>
|
|
455
|
+
</tr>
|
|
456
|
+
<tr>
|
|
457
|
+
<th>Small</th>
|
|
458
|
+
<td>
|
|
459
|
+
<button type="button" onClick={() => alert("Klikk på 15%")}>
|
|
460
|
+
15%
|
|
461
|
+
</button>
|
|
462
|
+
</td>
|
|
463
|
+
</tr>
|
|
464
|
+
</tbody>
|
|
465
|
+
</table>
|
|
466
|
+
</mtds-chart>
|
|
467
|
+
</Grid>
|
|
468
|
+
),
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export const WithHiddenSteps: Story = {
|
|
472
|
+
render: () => (
|
|
473
|
+
<mtds-chart data-variant="bar" data-steps="false">
|
|
474
|
+
{table}
|
|
475
|
+
</mtds-chart>
|
|
476
|
+
),
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
export const WithHiddeLabels: Story = {
|
|
480
|
+
render: () => (
|
|
481
|
+
<mtds-chart data-variant="bar" data-labels="false">
|
|
482
|
+
{table}
|
|
483
|
+
</mtds-chart>
|
|
484
|
+
),
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
export const WithHiddeLabelsLine: Story = {
|
|
488
|
+
render: () => (
|
|
489
|
+
<mtds-chart data-variant="line" data-labels="false">
|
|
490
|
+
<table>
|
|
491
|
+
<thead>
|
|
492
|
+
<tr>
|
|
493
|
+
<th>Risikofordeling</th>
|
|
494
|
+
<th>Q1</th>
|
|
495
|
+
<th>Q2</th>
|
|
496
|
+
<th>Q3</th>
|
|
497
|
+
<th>Q4</th>
|
|
498
|
+
</tr>
|
|
499
|
+
</thead>
|
|
500
|
+
<tbody>
|
|
501
|
+
<tr>
|
|
502
|
+
<th>Large</th>
|
|
503
|
+
<td>30</td>
|
|
504
|
+
<td>40</td>
|
|
505
|
+
<td>20</td>
|
|
506
|
+
<td>60</td>
|
|
507
|
+
</tr>
|
|
508
|
+
<tr>
|
|
509
|
+
<th>Medium</th>
|
|
510
|
+
<td>10</td>
|
|
511
|
+
<td>20</td>
|
|
512
|
+
<td>40</td>
|
|
513
|
+
<td>50</td>
|
|
514
|
+
</tr>
|
|
515
|
+
</tbody>
|
|
516
|
+
</table>
|
|
517
|
+
</mtds-chart>
|
|
518
|
+
),
|
|
519
|
+
};
|
package/mtds/ai/chip.mdx
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Meta, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import { Example, CssVariables } from '../../.storybook/blocks';
|
|
3
|
+
import * as stories from './chip.stories';
|
|
4
|
+
import { Flex, Prose } from '../react';
|
|
5
|
+
import styles from '../styles.module.css';
|
|
6
|
+
|
|
7
|
+
<Meta of={stories} />
|
|
8
|
+
|
|
9
|
+
# Chip
|
|
10
|
+
> Chip er små, interaktive komponenter som lar brukerne styre hvordan de vil se innhold. For eksempel kan de brukes til å filtrere kategorier i et søkeresultat og vise hvilke filtere som er aktive.
|
|
11
|
+
|
|
12
|
+
## Kode
|
|
13
|
+
- Bruk klassen `chip` på `<label>`
|
|
14
|
+
- Legg en `<input type="radio">` med klassen `input`
|
|
15
|
+
<Canvas of={stories.Radio} />
|
|
16
|
+
|
|
17
|
+
## Skikk og bruk
|
|
18
|
+
<Flex data-items="350">
|
|
19
|
+
{/* Tekstmengde i chip: */}
|
|
20
|
+
<Example data-color="success" text="Bruk korte konsiste ord i Chips" zoom="100%">
|
|
21
|
+
<button type="button" className={styles.chip} data-removable> Rødspette </button>
|
|
22
|
+
</Example>
|
|
23
|
+
<Example data-color="danger" text="Unngå lange tekster i chips. Prøv å begrense til maks et par ord" zoom="100%">
|
|
24
|
+
<button type="button" className={styles.chip} data-removable> Gebyr for tilsyn av fiskehelse og fiskevelferd </button>
|
|
25
|
+
</Example>
|
|
26
|
+
|
|
27
|
+
{/* Chip alignment: */}
|
|
28
|
+
<Example data-color="success" text="Chips skal ligge etter hverandre og organisk brekke ned på neste linje." zoom="100%">
|
|
29
|
+
<Flex data-gap="2">
|
|
30
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Laks" defaultChecked name="my-do" />Laks</label>
|
|
31
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Rødspette" name="my-do" />Rødspette</label>
|
|
32
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Sei" name="my-do" />Sei</label>
|
|
33
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Torsk" name="my-do" />Torsk</label>
|
|
34
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Ørret" name="my-do" />Ørret</label>
|
|
35
|
+
|
|
36
|
+
</Flex>
|
|
37
|
+
</Example>
|
|
38
|
+
|
|
39
|
+
<Example data-color="danger" text="Chips skal ikke stables over hverandre, bruk heller radiobuttons." zoom="100%">
|
|
40
|
+
<div>
|
|
41
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Laks" defaultChecked name="my-dont" />Laks</label>
|
|
42
|
+
<br />
|
|
43
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Rødspette" name="my-dont" />Rødspette</label>
|
|
44
|
+
<br />
|
|
45
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Sei" name="my-dont" />Sei</label>
|
|
46
|
+
<br />
|
|
47
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Torsk" name="my-dont" />Torsk</label>
|
|
48
|
+
<br />
|
|
49
|
+
<label className={styles.chip}><input className={styles.input} type="radio" value="Ørret" name="my-dont" />Ørret</label>
|
|
50
|
+
</div>
|
|
51
|
+
</Example>
|
|
52
|
+
|
|
53
|
+
</Flex>
|
|
54
|
+
|
|
55
|
+
## Sizes
|
|
56
|
+
- Bruk `data-size="sm | md | lg"`
|
|
57
|
+
<Canvas of={stories.Sizes} />
|
|
58
|
+
|
|
59
|
+
## Checkbox
|
|
60
|
+
- Bruk `type="checkbox"` i stedet for `type="radio"`
|
|
61
|
+
<Canvas of={stories.Checkbox} />
|
|
62
|
+
|
|
63
|
+
## Removable
|
|
64
|
+
- Bruk `data-removable` for å få lukke-kryss
|
|
65
|
+
<Canvas of={stories.Removable} />
|
|
66
|
+
|
|
67
|
+
## Innhold på en linje
|
|
68
|
+
- Bruk `<span data-nowrap>` rundt tekst dersom du ønsker å tvinge tekst til en linje
|
|
69
|
+
<Canvas of={stories.Nowrap} />
|
|
70
|
+
|
|
71
|
+
<CssVariables component="chip" />
|