@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.
Files changed (123) hide show
  1. package/mtds/ai/AGENTS.md +892 -0
  2. package/mtds/ai/alert.mdx +63 -0
  3. package/mtds/ai/alert.stories.tsx +128 -0
  4. package/mtds/ai/analytics.mdx +185 -0
  5. package/mtds/ai/app.mdx +60 -0
  6. package/mtds/ai/app.stories.tsx +897 -0
  7. package/mtds/ai/atlas.mdx +82 -0
  8. package/mtds/ai/atlas.stories.tsx +424 -0
  9. package/mtds/ai/avatar.mdx +45 -0
  10. package/mtds/ai/avatar.stories.tsx +109 -0
  11. package/mtds/ai/badge.mdx +70 -0
  12. package/mtds/ai/badge.stories.tsx +122 -0
  13. package/mtds/ai/breadcrumbs.mdx +36 -0
  14. package/mtds/ai/breadcrumbs.stories.tsx +158 -0
  15. package/mtds/ai/button.mdx +179 -0
  16. package/mtds/ai/button.stories.tsx +440 -0
  17. package/mtds/ai/card.mdx +51 -0
  18. package/mtds/ai/card.stories.tsx +469 -0
  19. package/mtds/ai/chart.mdx +67 -0
  20. package/mtds/ai/chart.stories.tsx +519 -0
  21. package/mtds/ai/chip.mdx +71 -0
  22. package/mtds/ai/chip.stories.tsx +211 -0
  23. package/mtds/ai/details.mdx +33 -0
  24. package/mtds/ai/details.stories.tsx +91 -0
  25. package/mtds/ai/dialog.mdx +38 -0
  26. package/mtds/ai/dialog.stories.tsx +373 -0
  27. package/mtds/ai/divider.mdx +19 -0
  28. package/mtds/ai/divider.stories.tsx +50 -0
  29. package/mtds/ai/errorsummary.mdx +26 -0
  30. package/mtds/ai/errorsummary.stories.tsx +137 -0
  31. package/mtds/ai/field.mdx +86 -0
  32. package/mtds/ai/field.stories.tsx +863 -0
  33. package/mtds/ai/fieldset.mdx +126 -0
  34. package/mtds/ai/fieldset.stories.tsx +298 -0
  35. package/mtds/ai/fileupload.mdx +16 -0
  36. package/mtds/ai/fileupload.stories.tsx +126 -0
  37. package/mtds/ai/helptext.mdx +24 -0
  38. package/mtds/ai/helptext.stories.tsx +106 -0
  39. package/mtds/ai/input.mdx +223 -0
  40. package/mtds/ai/input.stories.tsx +352 -0
  41. package/mtds/ai/law.mdx +115 -0
  42. package/mtds/ai/law.stories.tsx +168 -0
  43. package/mtds/ai/layout.mdx +145 -0
  44. package/mtds/ai/layout.stories.tsx +443 -0
  45. package/mtds/ai/link.mdx +45 -0
  46. package/mtds/ai/link.stories.tsx +44 -0
  47. package/mtds/ai/logo.mdx +86 -0
  48. package/mtds/ai/logo.stories.tsx +146 -0
  49. package/mtds/ai/pagination.mdx +136 -0
  50. package/mtds/ai/pagination.stories.tsx +404 -0
  51. package/mtds/ai/popover.mdx +86 -0
  52. package/mtds/ai/popover.stories.tsx +355 -0
  53. package/mtds/ai/print.mdx +96 -0
  54. package/mtds/ai/print.stories.tsx +839 -0
  55. package/mtds/ai/progress.mdx +41 -0
  56. package/mtds/ai/progress.stories.tsx +141 -0
  57. package/mtds/ai/skeleton.mdx +26 -0
  58. package/mtds/ai/skeleton.stories.tsx +131 -0
  59. package/mtds/ai/spinner.mdx +26 -0
  60. package/mtds/ai/spinner.stories.tsx +72 -0
  61. package/mtds/ai/steps.mdx +37 -0
  62. package/mtds/ai/steps.stories.tsx +568 -0
  63. package/mtds/ai/table.mdx +124 -0
  64. package/mtds/ai/table.stories.tsx +1715 -0
  65. package/mtds/ai/tabs.mdx +106 -0
  66. package/mtds/ai/tabs.stories.tsx +159 -0
  67. package/mtds/ai/tag.mdx +49 -0
  68. package/mtds/ai/tag.stories.tsx +111 -0
  69. package/mtds/ai/toast.mdx +67 -0
  70. package/mtds/ai/toast.stories.tsx +215 -0
  71. package/mtds/ai/togglegroup.mdx +75 -0
  72. package/mtds/ai/togglegroup.stories.tsx +96 -0
  73. package/mtds/ai/tooltip.mdx +32 -0
  74. package/mtds/ai/tooltip.stories.tsx +34 -0
  75. package/mtds/ai/typography.mdx +67 -0
  76. package/mtds/ai/typography.stories.tsx +798 -0
  77. package/mtds/ai/validation.mdx +19 -0
  78. package/mtds/ai/validation.stories.tsx +45 -0
  79. package/mtds/app/app-observer.js +1 -1
  80. package/mtds/app/app-toggle.js +26 -10
  81. package/mtds/app/app-toggle.js.map +1 -1
  82. package/mtds/app/app-toggle2.js +10 -26
  83. package/mtds/app/app-toggle2.js.map +1 -1
  84. package/mtds/app/app.js +1 -1
  85. package/mtds/atlas/atlas-element.js +1 -1
  86. package/mtds/breadcrumbs/breadcrumbs.d.ts +1 -1
  87. package/mtds/breadcrumbs/breadcrumbs.js.map +1 -1
  88. package/mtds/chart/chart-lines.js +19 -19
  89. package/mtds/chart/chart-lines.js.map +1 -1
  90. package/mtds/chart/chart.css.js +16 -1
  91. package/mtds/chart/chart.css.js.map +1 -1
  92. package/mtds/chart/chart.stories.d.ts +1 -0
  93. package/mtds/deprecations.js +6 -5
  94. package/mtds/deprecations.js.map +1 -1
  95. package/mtds/errorsummary/errorsummary.d.ts +1 -1
  96. package/mtds/errorsummary/errorsummary.js.map +1 -1
  97. package/mtds/field/field.d.ts +1 -1
  98. package/mtds/field/field.js.map +1 -1
  99. package/mtds/index.d.ts +1 -2
  100. package/mtds/index.iife.js +29 -18
  101. package/mtds/index.js +32 -37
  102. package/mtds/index.js.map +1 -1
  103. package/mtds/package.json.js +1 -1
  104. package/mtds/pagination/pagination.d.ts +1 -1
  105. package/mtds/pagination/pagination.js +9 -8
  106. package/mtds/pagination/pagination.js.map +1 -1
  107. package/mtds/styles.css +1 -1
  108. package/mtds/styles.json +23 -23
  109. package/mtds/styles.module.css.js +33 -33
  110. package/mtds/table/table-observer.js +26 -15
  111. package/mtds/table/table-observer.js.map +1 -1
  112. package/mtds/tabs/tabs.d.ts +1 -1
  113. package/mtds/tabs/tabs.js.map +1 -1
  114. package/mtds/tailwind.css +0 -1
  115. package/mtds/tooltip/tooltip-element.js +7 -6
  116. package/mtds/tooltip/tooltip-element.js.map +1 -1
  117. package/package.json +8 -6
  118. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js +0 -238
  119. package/mtds/external/@u-elements/u-datalist/dist/u-datalist.js.map +0 -1
  120. package/mtds/external/@u-elements/u-details/dist/u-details.js +0 -101
  121. package/mtds/external/@u-elements/u-details/dist/u-details.js.map +0 -1
  122. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js +0 -235
  123. package/mtds/external/@u-elements/u-tabs/dist/u-tabs.js.map +0 -1
@@ -0,0 +1,146 @@
1
+ import { PlantIcon } from "@phosphor-icons/react";
2
+ import type { Meta, StoryObj } from "@storybook/react-vite";
3
+ import { Logo } from "../react";
4
+ import styles from "../styles.module.css";
5
+
6
+ const meta = {
7
+ title: "Designsystem/Logo",
8
+ parameters: {
9
+ layout: "fullscreen",
10
+ },
11
+ decorators: [
12
+ (Story) => (
13
+ <div className={styles.body} style={{ padding: "3em" }}>
14
+ <div className={`${styles.grid} demo-resize`} data-gap="8">
15
+ <Story />
16
+ <style>{`
17
+ html:not(:has(.sbdocs-content)) { background: var(--ds-color-background-default) }
18
+ html:has(.sbdocs-preview)::before { display: none } /* Hide environment bar in Storybook *
19
+ .demo-resize {
20
+ box-sizing: border-box;
21
+ border-radius: 2px;
22
+ box-sizing: border-box;
23
+ outline: 1px dashed transparent;
24
+ outline-offset: 5px;
25
+ overflow: hidden;
26
+ padding: 1em 1em 2em;
27
+ position: relative;
28
+ resize: horizontal;
29
+
30
+ &:active,
31
+ &:hover { outline-color: currentColor }
32
+ &:ative::after,
33
+ &:hover::after { content: "Drag to resize →"; position: absolute; right: 1em; bottom: 0; white-space: nowrap }
34
+ }
35
+ `}</style>
36
+ </div>
37
+ </div>
38
+ ),
39
+ ],
40
+ } satisfies Meta;
41
+
42
+ export default meta;
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Default: Story = {
46
+ render: () => <a className={styles.logo} href="https://mattilsynet.no"></a>,
47
+ };
48
+
49
+ export const React: Story = {
50
+ render: () => (
51
+ <>
52
+ <Logo href="/" />
53
+ <Logo href="/">
54
+ Helse
55
+ <wbr />
56
+ sertifikat
57
+ </Logo>
58
+ <Logo as="h1" />
59
+ <Logo href="/" data-env="test">
60
+ Helse
61
+ <wbr />
62
+ sertifikat
63
+ </Logo>
64
+ <Logo href="/" data-env="test">
65
+ <PlantIcon weight="fill" />
66
+ Digiplant
67
+ </Logo>
68
+ </>
69
+ ),
70
+ };
71
+
72
+ export const WithEnvironment: Story = {
73
+ render: () => <a className={styles.logo} href="/" data-env="test"></a>,
74
+ };
75
+
76
+ export const WithEnvironmentBlue: Story = {
77
+ render: () => (
78
+ <a className={styles.logo} href="/" data-env="dev" data-color="info"></a>
79
+ ),
80
+ };
81
+
82
+ export const WithSubbrand: Story = {
83
+ render: () => (
84
+ <a className={styles.logo} href="/">
85
+ Helse
86
+ <wbr />
87
+ sertifikat
88
+ </a>
89
+ ),
90
+ };
91
+
92
+ export const WithSubbrandEnglish: Story = {
93
+ render: () => (
94
+ <a className={styles.logo} href="/" lang="en">
95
+ Sanitary certificate status
96
+ </a>
97
+ ),
98
+ };
99
+
100
+ export const WithSubbrandEnvironment: Story = {
101
+ render: () => (
102
+ <a className={styles.logo} href="/" lang="en" data-env="test">
103
+ Sanitary certificate status
104
+ </a>
105
+ ),
106
+ };
107
+
108
+ export const WithSubbrandEnvironmentBlue: Story = {
109
+ render: () => (
110
+ <a
111
+ className={styles.logo}
112
+ href="/"
113
+ lang="en"
114
+ data-env="dev"
115
+ data-color="info"
116
+ >
117
+ Sanitary certificate status
118
+ </a>
119
+ ),
120
+ };
121
+
122
+ export const WithAppIcon: Story = {
123
+ render: () => (
124
+ <a className={styles.logo} href="/">
125
+ <PlantIcon weight="fill" />
126
+ Digiplant
127
+ </a>
128
+ ),
129
+ };
130
+
131
+ export const WithAppIconEnvironment: Story = {
132
+ render: () => (
133
+ <a className={styles.logo} href="/" data-env="test">
134
+ <PlantIcon weight="fill" />
135
+ Digiplant
136
+ </a>
137
+ ),
138
+ };
139
+ export const WithAppIconEnvironmentBlue: Story = {
140
+ render: () => (
141
+ <a className={styles.logo} href="/" data-env="dev" data-color="info">
142
+ <PlantIcon weight="fill" />
143
+ Digiplant
144
+ </a>
145
+ ),
146
+ };
@@ -0,0 +1,136 @@
1
+ import { ArgTypes, Meta, Canvas } from '@storybook/addon-docs/blocks';
2
+ import { Example, CssVariables, JumpTo } from '../../.storybook/blocks';
3
+ import { Flex } from '../react';
4
+ import * as stories from './pagination.stories';
5
+ import { Details } from '../react';
6
+ import styles from '../styles.module.css';
7
+
8
+ <Meta of={stories} />
9
+
10
+ # Pagination
11
+
12
+ > Pagination er en liste med knapper som brukes for å navigere mellom ulike sider med innhold, for eksempel søkeresultater eller tabeller.
13
+
14
+ <JumpTo />
15
+
16
+ ## Kode
17
+ - Bruk klassen `pagination` på `<ds-pagination>`
18
+ - Legg `<ul><li>` inni, med `<a class="button">` eller `<button type="button" class="button">`
19
+ - Legg inn tom `<li>` der du ønsker ellipsis (&hellip;)
20
+ - Legg `aria-current="page"` på valgt side
21
+ - Legg `<a aria-disabled="true"` eller `<button disabled` for ugyldig forrige/neste
22
+ <Details>
23
+ <Details.Summary>Se egne parameter for React</Details.Summary>
24
+ <div>
25
+ I React kan du velge å bruke `<Pagination>` med props for automatisk oppsett av elementer:
26
+ <ArgTypes of={stories} />
27
+ </div>
28
+ </Details>
29
+ <Canvas of={stories.WithLinks} />
30
+
31
+ ## Skikk og bruk
32
+ <Flex data-items="700">
33
+
34
+ {/* Navngivning */}
35
+ <Example data-color="success" text="Bruk korte og konsise ord som «Forrige» og «Neste»." zoom="100%">
36
+ <nav aria-label="Sidenavigering" className={styles.pagination}>
37
+ <ul>
38
+ <li>
39
+ <a href="?p=1" className={styles.button} aria-disabled="true">Forrige</a>
40
+ </li>
41
+ <li>
42
+ <a href="?p=1" className={styles.button} aria-current="page">1</a>
43
+ </li>
44
+ <li>
45
+ <a href="?p=2" className={styles.button}>2</a>
46
+ </li>
47
+ <li>
48
+ <a href="?p=3" className={styles.button}>3</a>
49
+ </li>
50
+ <li>
51
+ <a href="?p=4" className={styles.button}>4</a>
52
+ </li>
53
+ <li></li>
54
+ <li>
55
+ <a href="?p=10" className={styles.button}>10</a>
56
+ </li>
57
+ <li>
58
+ <a href="?p=2" className={styles.button}>Neste</a>
59
+ </li>
60
+ </ul>
61
+ </nav>
62
+ </Example>
63
+
64
+ <Example data-color="danger" text="Unngå bruk av «Forrige side», «Neste side», «Gå tilbake», «Gå videre», «Videre» og «Tilbake»." zoom="100%">
65
+ <nav aria-label="Sidenavigering" className={styles.pagination}>
66
+ <ul>
67
+ <li>
68
+ <a href="?p=1" className={styles.button} aria-disabled="true">Forrige side</a>
69
+ </li>
70
+ <li>
71
+ <a href="?p=1" className={styles.button} aria-current="page">1</a>
72
+ </li>
73
+ <li>
74
+ <a href="?p=2" className={styles.button}>2</a>
75
+ </li>
76
+ <li>
77
+ <a href="?p=3" className={styles.button}>3</a>
78
+ </li>
79
+ <li>
80
+ <a href="?p=4" className={styles.button}>4</a>
81
+ </li>
82
+ <li></li>
83
+ <li>
84
+ <a href="?p=10" className={styles.button}>10</a>
85
+ </li>
86
+ <li>
87
+ <a href="?p=2" className={styles.button}>Neste side</a>
88
+ </li>
89
+ </ul>
90
+ </nav>
91
+ </Example>
92
+
93
+ </Flex>
94
+
95
+ ## Knapper
96
+ - Bruk `<button type="button">` istedenfor `<a>` dersom du bygger en SPA
97
+ <Canvas of={stories.WithButtons} />
98
+
99
+ ## Størrelser
100
+ - Bruk `data-size="sm | md | lg"`
101
+ <Canvas of={stories.Sizes} />
102
+
103
+ ## Varianter/farger
104
+ - Bruk `data-variant="secondary | primary"`, hvor `secondary` er default
105
+ - `data-variant="primary"` er nyttig når paginering ligger på grå bakgrunn
106
+ <Canvas of={stories.Variants} />
107
+
108
+
109
+ ## Javascript-hjelper
110
+
111
+ 1. Bruk JS-hjelperen for å generere steg og tilhørende attributter:
112
+ ```tsx
113
+ import { pagination } from '@mattilsynet/design';
114
+
115
+ const { pages, next, prev } = pagination({
116
+ current: 1,
117
+ total: 20,
118
+ show: 7, // Optional, shows all if not proivded
119
+ })
120
+ ```
121
+ 2. Du får et hendig `object` i retur, som kan brukes til å generere HTML:
122
+ ```ts
123
+ {
124
+ prev: number; // Previous page, 0 if no previous
125
+ next: number; // Next page, 0 if no next
126
+ pages: Array<{
127
+ current: 'page' | false; // Value of `aria-current`
128
+ page: number; // Page number or 0 if ellipsis
129
+ key: string; // Unique child key for React/frameworks
130
+ }>
131
+ }
132
+ ```
133
+ 3. Eksempel på bruk i `React`:
134
+ <Canvas of={stories.WithHelper} />
135
+
136
+ <CssVariables component="pagination" />
@@ -0,0 +1,404 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { pagination } from "../";
3
+ import { Button, Pagination } from "../react";
4
+ import styles from "../styles.module.css";
5
+
6
+ const meta = {
7
+ title: "Designsystem/Pagination",
8
+ argTypes: {
9
+ current: {
10
+ description: "Nåværede side",
11
+ table: {
12
+ type: { summary: "number" },
13
+ },
14
+ },
15
+ total: {
16
+ description: "Totalt antall sider",
17
+ table: {
18
+ type: { summary: "number" },
19
+ },
20
+ },
21
+ show: {
22
+ description: "Maks antall tall/dotter som skal vises i paginasjonen",
23
+ table: {
24
+ defaultValue: { summary: "7" },
25
+ type: { summary: "number" },
26
+ },
27
+ },
28
+ props: {
29
+ description:
30
+ "Funksjon som lager props som skal legges på hver lenke/knapp",
31
+ table: {
32
+ type: {
33
+ summary: `({ page: number, type: "prev" | "next" | "page" }) => ({ ...props })`,
34
+ detail: `Eksempel: ({ page }) => ({ href: \`?p=\${page}\` })`,
35
+ },
36
+ },
37
+ },
38
+ },
39
+ decorators: [
40
+ (Story) => (
41
+ <div className={styles.grid} data-justify="center">
42
+ <Story />
43
+ </div>
44
+ ),
45
+ ],
46
+ } satisfies Meta;
47
+
48
+ export default meta;
49
+ type Story = StoryObj<typeof meta>;
50
+
51
+ export const WithLinks: Story = {
52
+ render: () => (
53
+ <ds-pagination aria-label="Sidenavigering" className={styles.pagination}>
54
+ <ul>
55
+ <li>
56
+ <a href="?p=1" className={styles.button} aria-disabled="true">
57
+ Forrige
58
+ </a>
59
+ </li>
60
+ <li>
61
+ <a href="?p=1" className={styles.button} aria-current="page">
62
+ 1
63
+ </a>
64
+ </li>
65
+ <li>
66
+ <a href="?p=2" className={styles.button}>
67
+ 2
68
+ </a>
69
+ </li>
70
+ <li>
71
+ <a href="?p=3" className={styles.button}>
72
+ 3
73
+ </a>
74
+ </li>
75
+ <li>
76
+ <a href="?p=4" className={styles.button}>
77
+ 4
78
+ </a>
79
+ </li>
80
+ <li></li>
81
+ <li>
82
+ <a href="?p=10" className={styles.button}>
83
+ 10
84
+ </a>
85
+ </li>
86
+ <li>
87
+ <a href="?p=2" className={styles.button}>
88
+ Neste
89
+ </a>
90
+ </li>
91
+ </ul>
92
+ </ds-pagination>
93
+ ),
94
+ };
95
+
96
+ export const React: Story = {
97
+ render: () => {
98
+ const { pages, next, prev } = pagination({
99
+ current: 1,
100
+ total: 20,
101
+ show: 7,
102
+ });
103
+
104
+ return (
105
+ <>
106
+ Rendering using separate elements:
107
+ <Pagination>
108
+ <ul>
109
+ <li>
110
+ <Button href="?p=1" aria-disabled="true">
111
+ Forrige
112
+ </Button>
113
+ </li>
114
+ <li>
115
+ <Button href="?p=1" aria-current="page">
116
+ 1
117
+ </Button>
118
+ </li>
119
+ <li>
120
+ <Button href="?p=2">2</Button>
121
+ </li>
122
+ <li>
123
+ <Button href="?p=3">3</Button>
124
+ </li>
125
+ <li>
126
+ <Button href="?p=4">4</Button>
127
+ </li>
128
+ <li></li>
129
+ <li>
130
+ <Button href="?p=10">10</Button>
131
+ </li>
132
+ <li>
133
+ <Button href="?p=2">Neste</Button>
134
+ </li>
135
+ </ul>
136
+ </Pagination>
137
+ <br />
138
+ Rendering using helper-function:
139
+ <Pagination>
140
+ <ul>
141
+ <li>
142
+ <Button
143
+ aria-disabled={!prev}
144
+ href={prev ? `?p=${prev}` : undefined}
145
+ >
146
+ Forrige
147
+ </Button>
148
+ </li>
149
+ {pages.map(({ current, key, page }) => (
150
+ <li key={key}>
151
+ {!!page && (
152
+ <Button aria-current={current} href={`?p=${page}`}>
153
+ {page}
154
+ </Button>
155
+ )}
156
+ </li>
157
+ ))}
158
+ <li>
159
+ <Button
160
+ aria-disabled={!next}
161
+ href={next ? `?p=${next}` : undefined}
162
+ >
163
+ Neste
164
+ </Button>
165
+ </li>
166
+ </ul>
167
+ </Pagination>
168
+ <br />
169
+ Rendering buttons using props:
170
+ <Pagination
171
+ current={1}
172
+ show={7}
173
+ total={20}
174
+ props={({ page }) => ({ onClick: () => alert(page) })}
175
+ />
176
+ <br />
177
+ Rendering links using props:
178
+ <Pagination
179
+ current={1}
180
+ show={7}
181
+ total={20}
182
+ props={({ page }) => ({ href: `?p=${page}` })}
183
+ />
184
+ </>
185
+ );
186
+ },
187
+ };
188
+
189
+ export const WithButtons: Story = {
190
+ render: () => (
191
+ <ds-pagination className={styles.pagination}>
192
+ <ul>
193
+ <li>
194
+ <button type="button" className={styles.button} disabled>
195
+ Forrige
196
+ </button>
197
+ </li>
198
+ <li>
199
+ <button type="button" className={styles.button} aria-current="page">
200
+ 1
201
+ </button>
202
+ </li>
203
+ <li>
204
+ <button type="button" className={styles.button}>
205
+ 2
206
+ </button>
207
+ </li>
208
+ <li>
209
+ <button type="button" className={styles.button}>
210
+ 3
211
+ </button>
212
+ </li>
213
+ <li>
214
+ <button type="button" className={styles.button}>
215
+ 4
216
+ </button>
217
+ </li>
218
+ <li></li>
219
+ <li>
220
+ <button type="button" className={styles.button}>
221
+ 10
222
+ </button>
223
+ </li>
224
+ <li>
225
+ <button type="button" className={styles.button}>
226
+ Neste
227
+ </button>
228
+ </li>
229
+ </ul>
230
+ </ds-pagination>
231
+ ),
232
+ };
233
+
234
+ export const Sizes: Story = {
235
+ render: () => (
236
+ <>
237
+ <ds-pagination data-size="sm" className={styles.pagination}>
238
+ <ul>
239
+ <li>
240
+ <button type="button" className={styles.button} disabled></button>
241
+ </li>
242
+ <li>
243
+ <button type="button" className={styles.button} aria-current="page">
244
+ 1
245
+ </button>
246
+ </li>
247
+ <li>
248
+ <button type="button" className={styles.button}>
249
+ 2
250
+ </button>
251
+ </li>
252
+ <li>
253
+ <button type="button" className={styles.button}>
254
+ 3
255
+ </button>
256
+ </li>
257
+ </ul>
258
+ </ds-pagination>
259
+ <ds-pagination data-size="md" className={styles.pagination}>
260
+ <ul>
261
+ <li>
262
+ <button type="button" className={styles.button} disabled></button>
263
+ </li>
264
+ <li>
265
+ <button type="button" className={styles.button} aria-current="page">
266
+ 1
267
+ </button>
268
+ </li>
269
+ <li>
270
+ <button type="button" className={styles.button}>
271
+ 2
272
+ </button>
273
+ </li>
274
+ <li>
275
+ <button type="button" className={styles.button}>
276
+ 3
277
+ </button>
278
+ </li>
279
+ </ul>
280
+ </ds-pagination>
281
+ <ds-pagination data-size="lg" className={styles.pagination}>
282
+ <ul>
283
+ <li>
284
+ <button type="button" className={styles.button} disabled></button>
285
+ </li>
286
+ <li>
287
+ <button type="button" className={styles.button} aria-current="page">
288
+ 1
289
+ </button>
290
+ </li>
291
+ <li>
292
+ <button type="button" className={styles.button}>
293
+ 2
294
+ </button>
295
+ </li>
296
+ <li>
297
+ <button type="button" className={styles.button}>
298
+ 3
299
+ </button>
300
+ </li>
301
+ </ul>
302
+ </ds-pagination>
303
+ </>
304
+ ),
305
+ };
306
+
307
+ export const Variants: Story = {
308
+ render: () => (
309
+ <>
310
+ <ds-pagination data-variant="secondary" className={styles.pagination}>
311
+ <ul>
312
+ <li>
313
+ <button type="button" className={styles.button} disabled></button>
314
+ </li>
315
+ <li>
316
+ <button type="button" className={styles.button} aria-current="page">
317
+ 1
318
+ </button>
319
+ </li>
320
+ <li>
321
+ <button type="button" className={styles.button}>
322
+ 2
323
+ </button>
324
+ </li>
325
+ <li>
326
+ <button type="button" className={styles.button}>
327
+ 3
328
+ </button>
329
+ </li>
330
+ <li>
331
+ <button type="button" className={styles.button}></button>
332
+ </li>
333
+ </ul>
334
+ </ds-pagination>
335
+ <ds-pagination data-variant="primary" className={styles.pagination}>
336
+ <ul>
337
+ <li>
338
+ <button type="button" className={styles.button} disabled></button>
339
+ </li>
340
+ <li>
341
+ <button type="button" className={styles.button} aria-current="page">
342
+ 1
343
+ </button>
344
+ </li>
345
+ <li>
346
+ <button type="button" className={styles.button}>
347
+ 2
348
+ </button>
349
+ </li>
350
+ <li>
351
+ <button type="button" className={styles.button}>
352
+ 3
353
+ </button>
354
+ </li>
355
+ <li>
356
+ <button type="button" className={styles.button}></button>
357
+ </li>
358
+ </ul>
359
+ </ds-pagination>
360
+ </>
361
+ ),
362
+ };
363
+
364
+ export const WithHelper: Story = {
365
+ render: () => {
366
+ const { pages, next, prev } = pagination({
367
+ current: 1,
368
+ total: 20,
369
+ show: 7,
370
+ });
371
+
372
+ return (
373
+ <Pagination>
374
+ <ul>
375
+ <li>
376
+ <Button
377
+ aria-disabled={!prev}
378
+ href={prev ? `?p=${prev}` : undefined}
379
+ >
380
+ Forrige
381
+ </Button>
382
+ </li>
383
+ {pages.map(({ current, key, page }) => (
384
+ <li key={key}>
385
+ {!!page && (
386
+ <Button aria-current={current} href={`?p=${page}`}>
387
+ {page}
388
+ </Button>
389
+ )}
390
+ </li>
391
+ ))}
392
+ <li>
393
+ <Button
394
+ aria-disabled={!next}
395
+ href={next ? `?p=${next}` : undefined}
396
+ >
397
+ Neste
398
+ </Button>
399
+ </li>
400
+ </ul>
401
+ </Pagination>
402
+ );
403
+ },
404
+ };