@navikt/ds-react 6.0.0-alpha.7 → 6.0.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 (124) hide show
  1. package/cjs/date/parts/DateWrapper.js +2 -2
  2. package/cjs/date/parts/DateWrapper.js.map +1 -1
  3. package/cjs/form/error-summary/ErrorSummary.d.ts +3 -9
  4. package/cjs/form/error-summary/ErrorSummary.js +9 -4
  5. package/cjs/form/error-summary/ErrorSummary.js.map +1 -1
  6. package/cjs/form/error-summary/ErrorSummaryItem.d.ts +1 -1
  7. package/cjs/form/error-summary/ErrorSummaryItem.js +1 -2
  8. package/cjs/form/error-summary/ErrorSummaryItem.js.map +1 -1
  9. package/cjs/form/search/Search.d.ts +1 -1
  10. package/cjs/form/search/Search.js +1 -1
  11. package/cjs/index.js +1 -0
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/modal/Modal.context.d.ts +9 -0
  14. package/cjs/modal/Modal.context.js +10 -0
  15. package/cjs/modal/Modal.context.js.map +1 -0
  16. package/cjs/modal/Modal.js +3 -6
  17. package/cjs/modal/Modal.js.map +1 -1
  18. package/cjs/modal/ModalHeader.js +2 -6
  19. package/cjs/modal/ModalHeader.js.map +1 -1
  20. package/cjs/modal/types.d.ts +24 -3
  21. package/cjs/panel/Panel.d.ts +9 -16
  22. package/cjs/panel/Panel.js +6 -16
  23. package/cjs/panel/Panel.js.map +1 -1
  24. package/cjs/popover/Popover.js +2 -2
  25. package/cjs/popover/Popover.js.map +1 -1
  26. package/cjs/table/types.d.ts +1 -1
  27. package/cjs/tooltip/Tooltip.js +3 -3
  28. package/cjs/tooltip/Tooltip.js.map +1 -1
  29. package/cjs/util/create-context.d.ts +2 -5
  30. package/cjs/util/create-context.js +9 -5
  31. package/cjs/util/create-context.js.map +1 -1
  32. package/cjs/util/types/OverridableComponent.d.ts +1 -1
  33. package/esm/date/parts/DateWrapper.js +3 -3
  34. package/esm/date/parts/DateWrapper.js.map +1 -1
  35. package/esm/form/error-summary/ErrorSummary.d.ts +3 -9
  36. package/esm/form/error-summary/ErrorSummary.js +10 -5
  37. package/esm/form/error-summary/ErrorSummary.js.map +1 -1
  38. package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
  39. package/esm/form/error-summary/ErrorSummaryItem.js +1 -2
  40. package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
  41. package/esm/form/search/Search.d.ts +1 -1
  42. package/esm/form/search/Search.js +1 -1
  43. package/esm/index.js +1 -0
  44. package/esm/index.js.map +1 -1
  45. package/esm/modal/Modal.context.d.ts +9 -0
  46. package/esm/modal/Modal.context.js +6 -0
  47. package/esm/modal/Modal.context.js.map +1 -0
  48. package/esm/modal/Modal.js +3 -6
  49. package/esm/modal/Modal.js.map +1 -1
  50. package/esm/modal/ModalHeader.js +3 -7
  51. package/esm/modal/ModalHeader.js.map +1 -1
  52. package/esm/modal/types.d.ts +24 -3
  53. package/esm/panel/Panel.d.ts +9 -16
  54. package/esm/panel/Panel.js +6 -16
  55. package/esm/panel/Panel.js.map +1 -1
  56. package/esm/popover/Popover.js +2 -2
  57. package/esm/popover/Popover.js.map +1 -1
  58. package/esm/table/types.d.ts +1 -1
  59. package/esm/tooltip/Tooltip.js +4 -4
  60. package/esm/tooltip/Tooltip.js.map +1 -1
  61. package/esm/util/create-context.d.ts +2 -5
  62. package/esm/util/create-context.js +10 -6
  63. package/esm/util/create-context.js.map +1 -1
  64. package/esm/util/types/OverridableComponent.d.ts +1 -1
  65. package/package.json +6 -6
  66. package/src/accordion/accordion.stories.tsx +121 -135
  67. package/src/button/button.stories.tsx +88 -185
  68. package/src/chat/chat.stories.tsx +285 -186
  69. package/src/date/datepicker/datepicker.stories.tsx +6 -2
  70. package/src/date/monthpicker/monthpicker.stories.tsx +2 -1
  71. package/src/date/parts/DateWrapper.tsx +3 -3
  72. package/src/dropdown/dropdown.stories.tsx +1 -1
  73. package/src/form/error-summary/ErrorSummary.tsx +11 -15
  74. package/src/form/error-summary/ErrorSummaryItem.tsx +8 -10
  75. package/src/form/error-summary/error-summary.stories.tsx +2 -56
  76. package/src/form/search/Search.tsx +4 -4
  77. package/src/form/stories/confirmation-panel.stories.tsx +1 -1
  78. package/src/form/stories/textarea.stories.tsx +1 -1
  79. package/src/help-text/help-text.stories.tsx +2 -1
  80. package/src/index.ts +1 -0
  81. package/src/internal-header/header.stories.tsx +2 -1
  82. package/src/layout/bleed/Bleed.stories.tsx +2 -1
  83. package/src/layout/box/Box.stories.tsx +2 -1
  84. package/src/layout/sidemal-test/navno-sidemal.stories.tsx +4 -1
  85. package/src/link/stories/link.stories.tsx +20 -22
  86. package/src/link-panel/link-panel.stories.tsx +1 -1
  87. package/src/list/list.stories.tsx +2 -1
  88. package/src/loader/loader.stories.tsx +1 -1
  89. package/src/modal/Modal.context.ts +13 -0
  90. package/src/modal/Modal.test.tsx +2 -2
  91. package/src/modal/Modal.tsx +6 -8
  92. package/src/modal/ModalHeader.tsx +3 -7
  93. package/src/modal/modal.stories.tsx +33 -6
  94. package/src/modal/types.ts +21 -4
  95. package/src/panel/Panel.tsx +9 -16
  96. package/src/popover/Popover.tsx +2 -2
  97. package/src/stepper/stepper.stories.tsx +1 -1
  98. package/src/table/stories/{table.stories.tsx → table-1.stories.tsx} +118 -92
  99. package/src/table/stories/{table-expandable.stories.tsx → table-2-expandable.stories.tsx} +10 -34
  100. package/src/table/stories/{table-async.stories.tsx → table-3-async.stories.tsx} +5 -3
  101. package/src/table/stories/tests/table.stories.tsx +4 -1
  102. package/src/table/types.ts +1 -1
  103. package/src/tabs/Tabs.test.tsx +109 -0
  104. package/src/toggle-group/ToggleGroup.test.tsx +54 -0
  105. package/src/tooltip/Tooltip.tsx +4 -10
  106. package/src/tooltip/tooltip.stories.tsx +4 -1
  107. package/src/typography/stories/bodylong.stories.tsx +49 -3
  108. package/src/typography/stories/bodyshort.stories.tsx +50 -4
  109. package/src/typography/stories/detail.stories.tsx +32 -3
  110. package/src/typography/stories/error-message.stories.tsx +34 -3
  111. package/src/typography/stories/heading.stories.tsx +32 -3
  112. package/src/typography/stories/label.stories.tsx +38 -3
  113. package/src/util/create-context.tsx +26 -15
  114. package/src/util/types/OverridableComponent.ts +1 -1
  115. package/_docs.json +0 -20247
  116. package/cjs/modal/ModalContext.d.ts +0 -7
  117. package/cjs/modal/ModalContext.js +0 -9
  118. package/cjs/modal/ModalContext.js.map +0 -1
  119. package/esm/modal/ModalContext.d.ts +0 -7
  120. package/esm/modal/ModalContext.js +0 -3
  121. package/esm/modal/ModalContext.js.map +0 -1
  122. package/src/modal/ModalContext.ts +0 -7
  123. package/src/panel/panel.stories.tsx +0 -63
  124. package/src/typography/stories/ingress.stories.tsx +0 -50
@@ -1,6 +1,6 @@
1
- import { Meta } from "@storybook/react";
1
+ import { Meta, StoryObj } from "@storybook/react";
2
2
  import React from "react";
3
- import { Chat } from "../index";
3
+ import { Chat, VStack } from "../index";
4
4
  import { POSITIONS, SIZES } from "./Chat";
5
5
 
6
6
  export default {
@@ -20,9 +20,14 @@ export default {
20
20
  options: SIZES,
21
21
  },
22
22
  },
23
+ parameters: {
24
+ chromatic: { disable: true },
25
+ },
23
26
  } satisfies Meta<typeof Chat>;
24
27
 
25
- export const Default = {
28
+ type Story = StoryObj<typeof Chat>;
29
+
30
+ export const Controls: Story = {
26
31
  render: (props) => {
27
32
  return (
28
33
  <Chat {...props}>
@@ -45,198 +50,292 @@ export const Default = {
45
50
  },
46
51
  };
47
52
 
48
- export const Small = () => (
49
- <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 14:00" size="small">
50
- <Chat.Bubble>
51
- Aute minim nisi sunt mollit duis sunt nulla minim non proident.
52
- </Chat.Bubble>
53
- <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
54
- <Chat.Bubble>
55
- Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
56
- labore nisi ut.
57
- </Chat.Bubble>
58
- </Chat>
59
- );
53
+ export const Size: Story = {
54
+ render: () => (
55
+ <VStack gap="4">
56
+ <h3>Medium</h3>
57
+ <Chat
58
+ avatar="ON"
59
+ name="Ola Normann"
60
+ timestamp="01.01.21 14:00"
61
+ size="medium"
62
+ >
63
+ <Chat.Bubble>
64
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
65
+ </Chat.Bubble>
66
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
67
+ <Chat.Bubble>
68
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
69
+ laboris labore nisi ut.
70
+ </Chat.Bubble>
71
+ </Chat>
72
+ <h3>Small</h3>
73
+ <Chat
74
+ avatar="ON"
75
+ name="Ola Normann"
76
+ timestamp="01.01.21 14:00"
77
+ size="small"
78
+ >
79
+ <Chat.Bubble>
80
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
81
+ </Chat.Bubble>
82
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
83
+ <Chat.Bubble>
84
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
85
+ laboris labore nisi ut.
86
+ </Chat.Bubble>
87
+ </Chat>
88
+ </VStack>
89
+ ),
90
+ };
91
+
92
+ export const Variants: Story = {
93
+ render: () => (
94
+ <VStack gap="4">
95
+ <h3>Info</h3>
96
+ <Chat avatar="NAV" name="NAV" timestamp="01.01.21 14:00" variant="info">
97
+ <Chat.Bubble>
98
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
99
+ </Chat.Bubble>
100
+ </Chat>
101
+ <h3>Neutral</h3>
102
+ <Chat
103
+ avatar="KN"
104
+ name="Kari Nordmann"
105
+ timestamp="01.01.21 14:03"
106
+ variant="neutral"
107
+ position="right"
108
+ >
109
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
110
+ </Chat>
111
+ <h3>Subtle</h3>
112
+ <Chat
113
+ avatar="ON"
114
+ name="Ola Nordmann"
115
+ timestamp="01.01.21 14:07"
116
+ variant="subtle"
117
+ position="right"
118
+ >
119
+ <Chat.Bubble>
120
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
121
+ laboris labore nisi ut.
122
+ </Chat.Bubble>
123
+ </Chat>
124
+ </VStack>
125
+ ),
126
+ };
127
+
128
+ export const Position: Story = {
129
+ render: () => (
130
+ <VStack gap="4">
131
+ <h3>Default</h3>
132
+ <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 14:00">
133
+ <Chat.Bubble>
134
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
135
+ laboris labore nisi ut.
136
+ </Chat.Bubble>
137
+ </Chat>
138
+ <h3>Right</h3>
139
+ <Chat
140
+ avatar="KH"
141
+ name="Kari Høyli"
142
+ timestamp="01.01.21 14:32"
143
+ position="right"
144
+ variant="info"
145
+ >
146
+ <Chat.Bubble>
147
+ Reprehenderit pariatur officia exercitation laboris.
148
+ </Chat.Bubble>
149
+ <Chat.Bubble>
150
+ Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
151
+ est dolore incididunt. Occaecat cupidatat magna.
152
+ </Chat.Bubble>
153
+ </Chat>
154
+ <h3>Left</h3>
155
+ <Chat
156
+ position="left"
157
+ avatar="ON"
158
+ name="Ola Normann"
159
+ timestamp="01.01.21 15:00"
160
+ >
161
+ <Chat.Bubble>
162
+ Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
163
+ dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo
164
+ ea esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
165
+ labore sunt aute.
166
+ </Chat.Bubble>
167
+ </Chat>
168
+ </VStack>
169
+ ),
170
+ };
171
+
172
+ export const ToptextPosition: Story = {
173
+ render: () => (
174
+ <VStack gap="4">
175
+ <h3>Right</h3>
176
+ <Chat
177
+ avatar="ON"
178
+ name="Ola Normann"
179
+ timestamp="01.01.21 14:00"
180
+ toptextPosition="right"
181
+ >
182
+ <Chat.Bubble>
183
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
184
+ laboris labore nisi ut.
185
+ </Chat.Bubble>
186
+ </Chat>
187
+ <h3>Left</h3>
188
+ <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 15:00">
189
+ <Chat.Bubble toptextPosition="left">
190
+ Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
191
+ dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo
192
+ ea esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
193
+ labore sunt aute.
194
+ </Chat.Bubble>
195
+ </Chat>
196
+ <h3>Left</h3>
197
+ <Chat
198
+ name="Kari Høyli"
199
+ timestamp="01.01.21 14:32"
200
+ position="right"
201
+ toptextPosition="left"
202
+ >
203
+ <Chat.Bubble>
204
+ Reprehenderit pariatur officia exercitation laboris.
205
+ </Chat.Bubble>
206
+ <Chat.Bubble>
207
+ Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
208
+ est dolore incididunt. Occaecat cupidatat magna.
209
+ </Chat.Bubble>
210
+ </Chat>
211
+ <h3>Right</h3>
212
+ <Chat
213
+ name="Kari Høyli"
214
+ timestamp="01.01.21 14:32"
215
+ position="right"
216
+ toptextPosition="right"
217
+ >
218
+ <Chat.Bubble>
219
+ Reprehenderit pariatur officia exercitation laboris.
220
+ </Chat.Bubble>
221
+ <Chat.Bubble>
222
+ Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
223
+ est dolore incididunt. Occaecat cupidatat magna.
224
+ </Chat.Bubble>
225
+ </Chat>
226
+ </VStack>
227
+ ),
228
+ };
60
229
 
61
- export const Variants = () => (
62
- <div className="colgap">
63
- <Chat avatar="NAV" name="NAV" timestamp="01.01.21 14:00" variant="info">
230
+ export const Avatar: Story = {
231
+ render: () => (
232
+ <Chat avatar={<Illustration />}>
64
233
  <Chat.Bubble>
65
234
  Aute minim nisi sunt mollit duis sunt nulla minim non proident.
66
235
  </Chat.Bubble>
67
- </Chat>
68
- <Chat
69
- avatar="KN"
70
- name="Kari Nordmann"
71
- timestamp="01.01.21 14:03"
72
- variant="neutral"
73
- position="right"
74
- >
75
236
  <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
76
- </Chat>
77
- <Chat
78
- avatar="ON"
79
- name="Ola Nordmann"
80
- timestamp="01.01.21 14:07"
81
- variant="subtle"
82
- position="right"
83
- >
84
- <Chat.Bubble>
85
- Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
86
- labore nisi ut.
87
- </Chat.Bubble>
88
- </Chat>
89
- </div>
90
- );
91
-
92
- export const Position = () => (
93
- <div className="colgap">
94
- <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 14:00">
95
237
  <Chat.Bubble>
96
238
  Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
97
239
  labore nisi ut.
98
240
  </Chat.Bubble>
99
241
  </Chat>
100
- <Chat
101
- avatar="KH"
102
- name="Kari Høyli"
103
- timestamp="01.01.21 14:32"
104
- position="right"
105
- variant="info"
106
- >
107
- <Chat.Bubble>
108
- Reprehenderit pariatur officia exercitation laboris.
109
- </Chat.Bubble>
110
- <Chat.Bubble>
111
- Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit est
112
- dolore incididunt. Occaecat cupidatat magna.
113
- </Chat.Bubble>
114
- </Chat>
115
- <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 15:00">
116
- <Chat.Bubble>
117
- Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
118
- dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo ea
119
- esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
120
- labore sunt aute.
121
- </Chat.Bubble>
122
- </Chat>
123
- </div>
124
- );
125
-
126
- export const ToptextPosition = () => (
127
- <div className="colgap">
128
- <Chat
129
- avatar="ON"
130
- name="Ola Normann"
131
- timestamp="01.01.21 14:00"
132
- toptextPosition="right"
133
- >
134
- <Chat.Bubble>
135
- Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
136
- labore nisi ut.
137
- </Chat.Bubble>
138
- </Chat>
139
- <Chat
140
- name="Kari Høyli"
141
- timestamp="01.01.21 14:32"
142
- position="right"
143
- variant="info"
144
- toptextPosition="left"
145
- >
146
- <Chat.Bubble>
147
- Reprehenderit pariatur officia exercitation laboris.
148
- </Chat.Bubble>
149
- <Chat.Bubble>
150
- Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit est
151
- dolore incididunt. Occaecat cupidatat magna.
152
- </Chat.Bubble>
153
- </Chat>
154
- <Chat avatar="ON" name="Ola Normann" timestamp="01.01.21 15:00">
155
- <Chat.Bubble toptextPosition="right">
156
- Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
157
- dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo ea
158
- esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
159
- labore sunt aute.
160
- </Chat.Bubble>
161
- </Chat>
162
- </div>
163
- );
242
+ ),
243
+ };
164
244
 
165
- export const Avatar = () => (
166
- <Chat avatar={<Illustration />} timestamp="01.01.21 14:00">
167
- <Chat.Bubble>
168
- Aute minim nisi sunt mollit duis sunt nulla minim non proident.
169
- </Chat.Bubble>
170
- <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
171
- <Chat.Bubble>
172
- Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
173
- labore nisi ut.
174
- </Chat.Bubble>
175
- </Chat>
176
- );
245
+ function Illustration() {
246
+ return (
247
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 93">
248
+ <path
249
+ fill="#e7e5e2"
250
+ d="M14 50.7C15 52.3 17.9 81 26.5 81S39 51.8 39 50.3c-13.2-7.6-25 .4-25 .4z"
251
+ />
252
+ <path
253
+ fill="#5c4378"
254
+ d="M38.7 50.2c6 2.9 15.3 10.9 15.3 18.3V93H0V68.5c0-7.1 8.5-14.8 14.5-18-.3.2-.5.3-.5.3 1 1.7 3.8 9.2 12.4 9.2C35 60 39 51.9 39 50.4c-.1-.1-.2-.2-.3-.2z"
255
+ />
256
+ <path
257
+ fill="#d2242a"
258
+ d="M46.7 76H31.2c-.7 0-1.3-.6-1.2-1.3v-8.5c0-.7.6-1.3 1.3-1.3h15.5c.7 0 1.3.6 1.3 1.3v8.5c-.1.7-.7 1.3-1.4 1.3"
259
+ />
260
+ <path
261
+ fill="#fff"
262
+ d="M42.9 71c0 2.1-1.7 3.8-3.8 3.8-2.1 0-3.8-1.7-3.8-3.8s1.7-3.8 3.8-3.8c2.1 0 3.8 1.7 3.8 3.8m-8.7 1.7h-.7l.8-1.9h.7l-.8 1.9zm9.3 0H43l.8-1.9h.5l-.8 1.9zm1.2 0h-.2l.8-1.9h.2l-.8 1.9z"
263
+ />
264
+ <path
265
+ fill="#c52d35"
266
+ d="M36.2 72.7h.6s.1 0 .1-.1v-1.8s0-.1-.1-.1h-.6s-.1 0-.1.1l-.2.6v.1h.2l.1 1.2c0-.1 0 0 0 0"
267
+ />
268
+ <path
269
+ fill="#c52d35"
270
+ d="M37.5 72.7h.6s.1 0 .1-.1v-1.8s0-.1-.1-.1h-.9s-.1 0-.1.1l-.2.6-.1.1h.5c.1 0 .2.1.2.2v1c-.1-.1-.1 0 0 0m2.6-1.9h-.6s-.1 0-.1.1v1.8s0 .1.1.1h.6s.1 0 .1-.1l.2-.6V72h-.2l-.1-1.2"
271
+ />
272
+ <path
273
+ fill="#c52d35"
274
+ d="M37.7 72.7h.4s.1 0 .1-.1l.2-.6v-.1h-.2c0 .1-.5.8-.5.8zm3.9-1.9h.7s.1 0 0 .1l-.7 1.8H41l.6-1.9"
275
+ />
276
+ <path
277
+ fill="#c52d35"
278
+ d="M40.8 70.8h-1c-.1 0 .3.1.3.1l.7 1.7s0 .1.1.1h.6l-.7-1.9m-1.3.6v.4s-.1-.4-.3-.4c-.3 0-.3.2-.3.3 0 .1.1.3.2.3h.5l-.3.7H39c-.2 0-.9-.3-.9-.9 0-.6.5-1 .9-1 .2-.1.5.2.5.6 0-.1 0-.1 0 0z"
279
+ />
280
+ <path
281
+ fill="#5a1f57"
282
+ d="M39.9 66.7h-1.6c-.1 0-.2-.1-.2-.2v-.3c0-.1.1-.2.2-.2h1.6c.1 0 .2.1.2.2v.3c0 .2-.1.2-.2.2"
283
+ />
284
+ <path fill="#c2b5cf" d="M38.7 66.5h.9V64h-.9v2.5z" />
285
+ <path
286
+ fill="#e7e5e2"
287
+ d="M47.2 35.3C44.7 45.6 36.6 53.1 27 53.1S9.3 45.6 6.8 35.3c-.2.1-.5.1-.8.1-1.1 0-2-.8-2-1.7v-7c0-1 .9-1.7 2-1.7h.2C7.7 13.1 16.4 4 27 4c10.6 0 19.3 9.1 20.8 21h.2c1.1 0 2 .8 2 1.7v7c0 1-.9 1.7-2 1.7-.3 0-.5 0-.8-.1z"
288
+ />
289
+ <path
290
+ fill="#635e59"
291
+ d="M19 27.6c-1.4.1-1.9-2-1.4-3.4.1-.3.6-1.5 1.4-1.5.8 0 1.2.7 1.3.8.6 1.4.3 4-1.3 4.1m16.2 0c1.4.1 1.9-2 1.4-3.4-.1-.3-.6-1.5-1.4-1.5-.8 0-1.2.7-1.3.8-.6 1.4-.3 4 1.3 4.1"
292
+ />
293
+ <path
294
+ fill="#d1bfa3"
295
+ d="M26.8 34.6c-.4 0-.7-.1-1-.2-.3-.1-.4-.4-.3-.7.1-.3.4-.4.7-.3.5.2 1.5.1 2.2-.4.7-.4 1.1-1 1.2-1.5.1-.4-.1-.9-.4-1.3-.2-.2-.8-.2-1.6-.1-.3 0-.5-.1-.6-.4 0-.3.1-.5.4-.6 1.2-.2 2.1 0 2.6.6.5.7.8 1.4.6 2.1-.1.8-.7 1.6-1.7 2.2-.6.3-1.4.6-2.1.6z"
296
+ />
297
+ <path
298
+ fill="#593a32"
299
+ d="M27.1 42.1h-.3c-5.3-.2-7.3-4.1-7.4-4.3-.1-.3 0-.6.2-.7.2-.1.6 0 .7.2.1.1 1.9 3.6 6.6 3.8 4.7.2 6.4-3.7 6.4-3.7.1-.3.4-.4.7-.3.3.1.4.4.3.7-.1 0-2.1 4.3-7.2 4.3z"
300
+ />
301
+ <path
302
+ fill="#f6b873"
303
+ d="M6.6 30.7c.1-.1.1-.2.1-.3v-2c-.1-5.6 1.8-8.1 3.4-10.1 0 0-1 4.3-.3 3.4 3.8-5 21.4-1.6 25-8.1.5 3.6-4.1 4.6-4.1 4.6 3.7.7 6.9-.8 7.7-2.5.3 1.4-.6 2.4-1.9 3.4 4.5-.9 4.6-4 4.6-4 .6 4.1 5.3 2.5 5.3 9.3v6c0 .3.2.6.5.6h.5c.3 0 .5-.3.5-.6V26c.3-15.6-8.5-26-20.6-26C15.9 0 5 10.4 5 24.1v6.3c0 .4.2.6.5.6h.6c.2 0 .3-.1.5-.3"
304
+ />
305
+ <path
306
+ fill="#f6b873"
307
+ d="M25.9 43.4c-4.4 0-8-1.4-8-3.2s3.6-3.2 8-3.2 8 1.4 8 3.2c0 1.8-3.6 3.2-8 3.2m.8-9.4c-2.9 0-4.7.7-8.8 2.1-12.7 4.6-11.6-14-11.6-14C3.4 46 18.6 52 26.5 52c8.1 0 24.1-8.1 21-30 0 0 .4 17.1-12.9 13.8-3.7-.9-5-1.8-7.9-1.8z"
308
+ />
309
+ </svg>
310
+ );
311
+ }
177
312
 
178
- const Illustration = () => (
179
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 93">
180
- <path
181
- fill="#e7e5e2"
182
- d="M14 50.7C15 52.3 17.9 81 26.5 81S39 51.8 39 50.3c-13.2-7.6-25 .4-25 .4z"
183
- />
184
- <path
185
- fill="#5c4378"
186
- d="M38.7 50.2c6 2.9 15.3 10.9 15.3 18.3V93H0V68.5c0-7.1 8.5-14.8 14.5-18-.3.2-.5.3-.5.3 1 1.7 3.8 9.2 12.4 9.2C35 60 39 51.9 39 50.4c-.1-.1-.2-.2-.3-.2z"
187
- />
188
- <path
189
- fill="#d2242a"
190
- d="M46.7 76H31.2c-.7 0-1.3-.6-1.2-1.3v-8.5c0-.7.6-1.3 1.3-1.3h15.5c.7 0 1.3.6 1.3 1.3v8.5c-.1.7-.7 1.3-1.4 1.3"
191
- />
192
- <path
193
- fill="#fff"
194
- d="M42.9 71c0 2.1-1.7 3.8-3.8 3.8-2.1 0-3.8-1.7-3.8-3.8s1.7-3.8 3.8-3.8c2.1 0 3.8 1.7 3.8 3.8m-8.7 1.7h-.7l.8-1.9h.7l-.8 1.9zm9.3 0H43l.8-1.9h.5l-.8 1.9zm1.2 0h-.2l.8-1.9h.2l-.8 1.9z"
195
- />
196
- <path
197
- fill="#c52d35"
198
- d="M36.2 72.7h.6s.1 0 .1-.1v-1.8s0-.1-.1-.1h-.6s-.1 0-.1.1l-.2.6v.1h.2l.1 1.2c0-.1 0 0 0 0"
199
- />
200
- <path
201
- fill="#c52d35"
202
- d="M37.5 72.7h.6s.1 0 .1-.1v-1.8s0-.1-.1-.1h-.9s-.1 0-.1.1l-.2.6-.1.1h.5c.1 0 .2.1.2.2v1c-.1-.1-.1 0 0 0m2.6-1.9h-.6s-.1 0-.1.1v1.8s0 .1.1.1h.6s.1 0 .1-.1l.2-.6V72h-.2l-.1-1.2"
203
- />
204
- <path
205
- fill="#c52d35"
206
- d="M37.7 72.7h.4s.1 0 .1-.1l.2-.6v-.1h-.2c0 .1-.5.8-.5.8zm3.9-1.9h.7s.1 0 0 .1l-.7 1.8H41l.6-1.9"
207
- />
208
- <path
209
- fill="#c52d35"
210
- d="M40.8 70.8h-1c-.1 0 .3.1.3.1l.7 1.7s0 .1.1.1h.6l-.7-1.9m-1.3.6v.4s-.1-.4-.3-.4c-.3 0-.3.2-.3.3 0 .1.1.3.2.3h.5l-.3.7H39c-.2 0-.9-.3-.9-.9 0-.6.5-1 .9-1 .2-.1.5.2.5.6 0-.1 0-.1 0 0z"
211
- />
212
- <path
213
- fill="#5a1f57"
214
- d="M39.9 66.7h-1.6c-.1 0-.2-.1-.2-.2v-.3c0-.1.1-.2.2-.2h1.6c.1 0 .2.1.2.2v.3c0 .2-.1.2-.2.2"
215
- />
216
- <path fill="#c2b5cf" d="M38.7 66.5h.9V64h-.9v2.5z" />
217
- <path
218
- fill="#e7e5e2"
219
- d="M47.2 35.3C44.7 45.6 36.6 53.1 27 53.1S9.3 45.6 6.8 35.3c-.2.1-.5.1-.8.1-1.1 0-2-.8-2-1.7v-7c0-1 .9-1.7 2-1.7h.2C7.7 13.1 16.4 4 27 4c10.6 0 19.3 9.1 20.8 21h.2c1.1 0 2 .8 2 1.7v7c0 1-.9 1.7-2 1.7-.3 0-.5 0-.8-.1z"
220
- />
221
- <path
222
- fill="#635e59"
223
- d="M19 27.6c-1.4.1-1.9-2-1.4-3.4.1-.3.6-1.5 1.4-1.5.8 0 1.2.7 1.3.8.6 1.4.3 4-1.3 4.1m16.2 0c1.4.1 1.9-2 1.4-3.4-.1-.3-.6-1.5-1.4-1.5-.8 0-1.2.7-1.3.8-.6 1.4-.3 4 1.3 4.1"
224
- />
225
- <path
226
- fill="#d1bfa3"
227
- d="M26.8 34.6c-.4 0-.7-.1-1-.2-.3-.1-.4-.4-.3-.7.1-.3.4-.4.7-.3.5.2 1.5.1 2.2-.4.7-.4 1.1-1 1.2-1.5.1-.4-.1-.9-.4-1.3-.2-.2-.8-.2-1.6-.1-.3 0-.5-.1-.6-.4 0-.3.1-.5.4-.6 1.2-.2 2.1 0 2.6.6.5.7.8 1.4.6 2.1-.1.8-.7 1.6-1.7 2.2-.6.3-1.4.6-2.1.6z"
228
- />
229
- <path
230
- fill="#593a32"
231
- d="M27.1 42.1h-.3c-5.3-.2-7.3-4.1-7.4-4.3-.1-.3 0-.6.2-.7.2-.1.6 0 .7.2.1.1 1.9 3.6 6.6 3.8 4.7.2 6.4-3.7 6.4-3.7.1-.3.4-.4.7-.3.3.1.4.4.3.7-.1 0-2.1 4.3-7.2 4.3z"
232
- />
233
- <path
234
- fill="#f6b873"
235
- d="M6.6 30.7c.1-.1.1-.2.1-.3v-2c-.1-5.6 1.8-8.1 3.4-10.1 0 0-1 4.3-.3 3.4 3.8-5 21.4-1.6 25-8.1.5 3.6-4.1 4.6-4.1 4.6 3.7.7 6.9-.8 7.7-2.5.3 1.4-.6 2.4-1.9 3.4 4.5-.9 4.6-4 4.6-4 .6 4.1 5.3 2.5 5.3 9.3v6c0 .3.2.6.5.6h.5c.3 0 .5-.3.5-.6V26c.3-15.6-8.5-26-20.6-26C15.9 0 5 10.4 5 24.1v6.3c0 .4.2.6.5.6h.6c.2 0 .3-.1.5-.3"
236
- />
237
- <path
238
- fill="#f6b873"
239
- d="M25.9 43.4c-4.4 0-8-1.4-8-3.2s3.6-3.2 8-3.2 8 1.4 8 3.2c0 1.8-3.6 3.2-8 3.2m.8-9.4c-2.9 0-4.7.7-8.8 2.1-12.7 4.6-11.6-14-11.6-14C3.4 46 18.6 52 26.5 52c8.1 0 24.1-8.1 21-30 0 0 .4 17.1-12.9 13.8-3.7-.9-5-1.8-7.9-1.8z"
240
- />
241
- </svg>
242
- );
313
+ export const Chromatic: Story = {
314
+ render: (...props) => (
315
+ <div>
316
+ <div>
317
+ <h2>Size</h2>
318
+ {Size.render?.(...props)}
319
+ </div>
320
+ <div>
321
+ <h2>Variants</h2>
322
+ {Variants.render?.(...props)}
323
+ </div>
324
+ <div>
325
+ <h2>Position</h2>
326
+ {Position.render?.(...props)}
327
+ </div>
328
+ <div>
329
+ <h2>Toptext</h2>
330
+ {ToptextPosition.render?.(...props)}
331
+ </div>
332
+ <div>
333
+ <h2>Avatar</h2>
334
+ {Avatar.render?.(...props)}
335
+ </div>
336
+ </div>
337
+ ),
338
+ parameters: {
339
+ chromatic: { disable: false },
340
+ },
341
+ };
@@ -2,8 +2,12 @@
2
2
  import { Meta, StoryObj } from "@storybook/react";
3
3
  import { isSameDay } from "date-fns";
4
4
  import React, { useId, useState } from "react";
5
- import { useDatepicker, useRangeDatepicker } from "..";
6
- import { BodyLong, Button, HGrid, Modal, VStack } from "../..";
5
+ import { Button } from "../../button";
6
+ import { HGrid } from "../../layout/grid";
7
+ import { VStack } from "../../layout/stack";
8
+ import Modal from "../../modal/Modal";
9
+ import { BodyLong } from "../../typography";
10
+ import { useDatepicker, useRangeDatepicker } from "../hooks";
7
11
  import DatePicker, { DatePickerProps } from "./DatePicker";
8
12
 
9
13
  const disabledDays = [
@@ -1,8 +1,9 @@
1
1
  import { Meta, StoryFn } from "@storybook/react";
2
2
  import { setYear } from "date-fns";
3
3
  import React, { useId, useState } from "react";
4
- import { Button, DateInputProps } from "../..";
4
+ import { Button } from "../../button";
5
5
  import { useMonthpicker } from "../hooks";
6
+ import { DateInputProps } from "../parts/DateInput";
6
7
  import MonthPicker from "./MonthPicker";
7
8
  import { MonthPickerProps } from "./types";
8
9
 
@@ -1,8 +1,8 @@
1
1
  import cl from "clsx";
2
- import React, { useContext, useRef } from "react";
2
+ import React, { useRef } from "react";
3
3
  import { Button } from "../../button";
4
4
  import { Modal } from "../../modal";
5
- import { ModalContext } from "../../modal/ModalContext";
5
+ import { useModalContext } from "../../modal/Modal.context";
6
6
  import { Popover } from "../../popover";
7
7
  import { useMedia } from "../../util/hooks";
8
8
  import { modalCloseButtonLabel, modalLabel } from "../utils/labels";
@@ -30,7 +30,7 @@ export const DateWrapper = ({
30
30
  popoverProps,
31
31
  }: DateWrapperProps) => {
32
32
  const modalRef = useRef<HTMLDialogElement>(null);
33
- const isInModal = useContext(ModalContext) !== null;
33
+ const isInModal = useModalContext(false) !== undefined;
34
34
  const hideModal =
35
35
  useMedia("screen and (min-width: 768px)", true) && !isInModal;
36
36
 
@@ -1,7 +1,7 @@
1
1
  import { Meta } from "@storybook/react";
2
2
  import React, { useState } from "react";
3
- import { Dropdown } from "..";
4
3
  import { Button } from "../button";
4
+ import Dropdown from "./Dropdown";
5
5
 
6
6
  export default {
7
7
  title: "ds-react/Dropdown",
@@ -1,8 +1,8 @@
1
1
  import cl from "clsx";
2
- import React, { HTMLAttributes, forwardRef } from "react";
2
+ import React, { HTMLAttributes, forwardRef, isValidElement } from "react";
3
3
  import { BodyShort, Heading } from "../../typography";
4
4
  import { useId } from "../../util/hooks";
5
- import ErrorSummaryItem from "./ErrorSummaryItem";
5
+ import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
6
6
 
7
7
  export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
8
8
  /**
@@ -17,18 +17,12 @@ export interface ErrorSummaryProps extends HTMLAttributes<HTMLDivElement> {
17
17
  /**
18
18
  * Heading above links
19
19
  */
20
- heading: React.ReactNode;
20
+ heading?: React.ReactNode;
21
21
  /**
22
22
  * Allows setting a different HTML h-tag
23
23
  * @default "h2"
24
24
  */
25
25
  headingTag?: React.ElementType<any>;
26
- /**
27
- * When manually setting focus to `<ErrorSummary />` use the
28
- * `focusTargetRef`-prop and not ref.
29
- * This directs focus to heading, improving screen reader experience
30
- */
31
- focusTargetRef?: React.RefObject<HTMLElement>;
32
26
  }
33
27
 
34
28
  interface ErrorSummaryComponent
@@ -47,7 +41,7 @@ interface ErrorSummaryComponent
47
41
  * </ErrorSummary.Item>
48
42
  * ```
49
43
  */
50
- Item: typeof ErrorSummaryItem;
44
+ Item: ErrorSummaryItemType;
51
45
  }
52
46
 
53
47
  /**
@@ -76,7 +70,6 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
76
70
  size = "medium",
77
71
  headingTag = "h2",
78
72
  heading,
79
- focusTargetRef,
80
73
  ...rest
81
74
  },
82
75
  ref,
@@ -92,7 +85,7 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
92
85
  "navds-error-summary",
93
86
  `navds-error-summary--${size}`,
94
87
  )}
95
- tabIndex={ref ? -1 : undefined}
88
+ tabIndex={-1}
96
89
  aria-live="polite"
97
90
  aria-relevant="all"
98
91
  aria-labelledby={headingId}
@@ -102,13 +95,16 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
102
95
  as={headingTag}
103
96
  size="small"
104
97
  id={headingId}
105
- ref={focusTargetRef}
106
- tabIndex={focusTargetRef ? -1 : undefined}
107
98
  >
108
99
  {heading}
109
100
  </Heading>
110
101
  <BodyShort as="ul" size={size} className="navds-error-summary__list">
111
- {children}
102
+ {React.Children.map(children, (child) => {
103
+ if (!isValidElement(child)) {
104
+ return null;
105
+ }
106
+ return <li key={child.toString()}>{child}</li>;
107
+ })}
112
108
  </BodyShort>
113
109
  </section>
114
110
  );
@@ -14,7 +14,7 @@ export interface ErrorSummaryItemProps
14
14
  href?: string;
15
15
  }
16
16
 
17
- type ErrorSummaryItemType = OverridableComponent<
17
+ export type ErrorSummaryItemType = OverridableComponent<
18
18
  ErrorSummaryItemProps,
19
19
  HTMLAnchorElement
20
20
  >;
@@ -22,15 +22,13 @@ type ErrorSummaryItemType = OverridableComponent<
22
22
  export const ErrorSummaryItem: ErrorSummaryItemType = forwardRef(
23
23
  ({ children, as: Component = "a", className, ...rest }, ref) => {
24
24
  return (
25
- <li>
26
- <Component
27
- {...rest}
28
- ref={ref}
29
- className={cl(className, "navds-error-summary__item", "navds-link")}
30
- >
31
- {children}
32
- </Component>
33
- </li>
25
+ <Component
26
+ {...rest}
27
+ ref={ref}
28
+ className={cl(className, "navds-error-summary__item", "navds-link")}
29
+ >
30
+ {children}
31
+ </Component>
34
32
  );
35
33
  },
36
34
  );