@navikt/ds-react 0.19.25 → 1.0.0-rc.3

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 (430) hide show
  1. package/README.md +43 -0
  2. package/_docs.json +364 -520
  3. package/cjs/accordion/Accordion.js +2 -2
  4. package/cjs/accordion/AccordionContent.js +5 -9
  5. package/cjs/accordion/AccordionHeader.js +5 -10
  6. package/cjs/accordion/AccordionItem.js +3 -7
  7. package/cjs/alert/Alert.js +2 -2
  8. package/cjs/button/Button.js +9 -7
  9. package/cjs/{speech-bubble → chat}/Bubble.js +7 -4
  10. package/cjs/{speech-bubble/SpeechBubble.js → chat/Chat.js} +11 -10
  11. package/cjs/{menu → chat}/index.js +3 -3
  12. package/cjs/chat/package.json +6 -0
  13. package/cjs/form/ConfirmationPanel.js +3 -3
  14. package/cjs/form/Fieldset/Fieldset.js +6 -6
  15. package/cjs/form/Select.js +6 -6
  16. package/cjs/form/Switch.js +4 -4
  17. package/cjs/form/TextField.js +6 -6
  18. package/cjs/form/Textarea.js +14 -14
  19. package/cjs/form/checkbox/Checkbox.js +3 -3
  20. package/cjs/form/checkbox/CheckboxGroup.js +2 -2
  21. package/cjs/form/error-summary/ErrorSummary.js +3 -3
  22. package/cjs/form/error-summary/ErrorSummaryItem.js +2 -2
  23. package/cjs/form/radio/Radio.js +2 -2
  24. package/cjs/form/radio/RadioGroup.js +2 -2
  25. package/cjs/form/search/Search.js +6 -7
  26. package/cjs/form/search/SearchButton.js +2 -4
  27. package/cjs/form/useFormField.js +2 -2
  28. package/cjs/grid/Cell.js +2 -2
  29. package/cjs/grid/ContentContainer.js +2 -2
  30. package/cjs/grid/Grid.js +2 -2
  31. package/cjs/guide-panel/Guide.js +3 -3
  32. package/cjs/guide-panel/GuidePanel.js +2 -2
  33. package/cjs/help-text/HelpText.js +5 -5
  34. package/cjs/index.js +1 -6
  35. package/cjs/link/Link.js +2 -2
  36. package/cjs/link-panel/LinkPanel.js +2 -2
  37. package/cjs/link-panel/LinkPanelDescription.js +2 -2
  38. package/cjs/link-panel/LinkPanelTitle.js +2 -2
  39. package/cjs/loader/Loader.js +2 -2
  40. package/cjs/modal/Modal.js +5 -7
  41. package/cjs/modal/ModalContent.js +2 -2
  42. package/cjs/pagination/Pagination.js +18 -23
  43. package/cjs/{menu/MenuItem.js → pagination/PaginationItem.js} +5 -4
  44. package/cjs/panel/Panel.js +2 -2
  45. package/cjs/popover/Popover.js +55 -45
  46. package/cjs/popover/PopoverContent.js +2 -2
  47. package/cjs/read-more/ReadMore.js +7 -11
  48. package/cjs/stepper/Step.js +2 -2
  49. package/cjs/stepper/Stepper.js +3 -3
  50. package/cjs/table/Body.js +2 -2
  51. package/cjs/table/DataCell.js +2 -2
  52. package/cjs/table/ExpandableRow.js +9 -12
  53. package/cjs/table/Header.js +2 -2
  54. package/cjs/table/HeaderCell.js +2 -2
  55. package/cjs/table/Row.js +2 -2
  56. package/cjs/table/Table.js +2 -2
  57. package/cjs/tabs/Tab.js +4 -4
  58. package/cjs/tabs/TabList.js +8 -7
  59. package/cjs/tabs/TabPanel.js +2 -2
  60. package/cjs/tabs/Tabs.js +5 -3
  61. package/cjs/tag/Tag.js +2 -2
  62. package/cjs/toggle-group/ToggleGroup.js +5 -5
  63. package/cjs/toggle-group/ToggleItem.js +2 -2
  64. package/cjs/tooltip/Tooltip.js +45 -92
  65. package/cjs/typography/BodyLong.js +2 -2
  66. package/cjs/typography/BodyShort.js +2 -2
  67. package/cjs/typography/Detail.js +2 -2
  68. package/cjs/typography/ErrorMessage.js +2 -2
  69. package/cjs/typography/Heading.js +2 -2
  70. package/cjs/typography/Ingress.js +2 -2
  71. package/cjs/typography/Label.js +2 -2
  72. package/cjs/util/AnimateHeight.js +204 -0
  73. package/cjs/util/TextareaAutoSize.js +174 -0
  74. package/cjs/util/debounce.js +18 -0
  75. package/cjs/util/index.js +14 -1
  76. package/cjs/util/mergeRefs.js +16 -0
  77. package/cjs/util/useId.js +60 -17
  78. package/esm/accordion/Accordion.js +1 -1
  79. package/esm/accordion/Accordion.js.map +1 -1
  80. package/esm/accordion/AccordionContent.d.ts +0 -2
  81. package/esm/accordion/AccordionContent.js +5 -9
  82. package/esm/accordion/AccordionContent.js.map +1 -1
  83. package/esm/accordion/AccordionHeader.js +5 -10
  84. package/esm/accordion/AccordionHeader.js.map +1 -1
  85. package/esm/accordion/AccordionItem.d.ts +0 -8
  86. package/esm/accordion/AccordionItem.js +2 -6
  87. package/esm/accordion/AccordionItem.js.map +1 -1
  88. package/esm/alert/Alert.d.ts +1 -1
  89. package/esm/alert/Alert.js +1 -1
  90. package/esm/alert/Alert.js.map +1 -1
  91. package/esm/button/Button.d.ts +10 -1
  92. package/esm/button/Button.js +10 -8
  93. package/esm/button/Button.js.map +1 -1
  94. package/esm/{speech-bubble → chat}/Bubble.d.ts +7 -3
  95. package/esm/{speech-bubble → chat}/Bubble.js +7 -4
  96. package/esm/chat/Bubble.js.map +1 -0
  97. package/esm/chat/Chat.d.ts +38 -0
  98. package/esm/chat/Chat.js +28 -0
  99. package/esm/chat/Chat.js.map +1 -0
  100. package/esm/chat/index.d.ts +1 -0
  101. package/esm/chat/index.js +2 -0
  102. package/esm/chat/index.js.map +1 -0
  103. package/esm/form/ConfirmationPanel.d.ts +1 -1
  104. package/esm/form/ConfirmationPanel.js +3 -3
  105. package/esm/form/ConfirmationPanel.js.map +1 -1
  106. package/esm/form/Fieldset/Fieldset.js +1 -1
  107. package/esm/form/Fieldset/Fieldset.js.map +1 -1
  108. package/esm/form/Select.js +1 -1
  109. package/esm/form/Select.js.map +1 -1
  110. package/esm/form/Switch.js +1 -1
  111. package/esm/form/Switch.js.map +1 -1
  112. package/esm/form/TextField.js +1 -1
  113. package/esm/form/TextField.js.map +1 -1
  114. package/esm/form/Textarea.js +6 -6
  115. package/esm/form/Textarea.js.map +1 -1
  116. package/esm/form/checkbox/Checkbox.js +1 -1
  117. package/esm/form/checkbox/Checkbox.js.map +1 -1
  118. package/esm/form/checkbox/CheckboxGroup.js +1 -1
  119. package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
  120. package/esm/form/error-summary/ErrorSummary.js +3 -3
  121. package/esm/form/error-summary/ErrorSummary.js.map +1 -1
  122. package/esm/form/error-summary/ErrorSummaryItem.js +1 -1
  123. package/esm/form/error-summary/ErrorSummaryItem.js.map +1 -1
  124. package/esm/form/radio/Radio.js +1 -1
  125. package/esm/form/radio/Radio.js.map +1 -1
  126. package/esm/form/radio/RadioGroup.js +1 -1
  127. package/esm/form/radio/RadioGroup.js.map +1 -1
  128. package/esm/form/search/Search.js +4 -5
  129. package/esm/form/search/Search.js.map +1 -1
  130. package/esm/form/search/SearchButton.d.ts +1 -1
  131. package/esm/form/search/SearchButton.js +2 -4
  132. package/esm/form/search/SearchButton.js.map +1 -1
  133. package/esm/form/useFormField.js +1 -1
  134. package/esm/form/useFormField.js.map +1 -1
  135. package/esm/grid/Cell.js +1 -1
  136. package/esm/grid/Cell.js.map +1 -1
  137. package/esm/grid/ContentContainer.js +1 -1
  138. package/esm/grid/ContentContainer.js.map +1 -1
  139. package/esm/grid/Grid.js +1 -1
  140. package/esm/grid/Grid.js.map +1 -1
  141. package/esm/guide-panel/Guide.js +1 -1
  142. package/esm/guide-panel/Guide.js.map +1 -1
  143. package/esm/guide-panel/GuidePanel.js +1 -1
  144. package/esm/guide-panel/GuidePanel.js.map +1 -1
  145. package/esm/help-text/HelpText.d.ts +1 -2
  146. package/esm/help-text/HelpText.js +7 -7
  147. package/esm/help-text/HelpText.js.map +1 -1
  148. package/esm/index.d.ts +1 -5
  149. package/esm/index.js +1 -6
  150. package/esm/index.js.map +1 -1
  151. package/esm/link/Link.js +1 -1
  152. package/esm/link/Link.js.map +1 -1
  153. package/esm/link-panel/LinkPanel.js +1 -1
  154. package/esm/link-panel/LinkPanel.js.map +1 -1
  155. package/esm/link-panel/LinkPanelDescription.js +1 -1
  156. package/esm/link-panel/LinkPanelDescription.js.map +1 -1
  157. package/esm/link-panel/LinkPanelTitle.js +1 -1
  158. package/esm/link-panel/LinkPanelTitle.js.map +1 -1
  159. package/esm/loader/Loader.js +1 -1
  160. package/esm/loader/Loader.js.map +1 -1
  161. package/esm/modal/Modal.js +5 -7
  162. package/esm/modal/Modal.js.map +1 -1
  163. package/esm/modal/ModalContent.js +1 -1
  164. package/esm/modal/ModalContent.js.map +1 -1
  165. package/esm/pagination/Pagination.d.ts +12 -3
  166. package/esm/pagination/Pagination.js +17 -22
  167. package/esm/pagination/Pagination.js.map +1 -1
  168. package/esm/pagination/PaginationItem.d.ts +22 -0
  169. package/esm/{menu/MenuItem.js → pagination/PaginationItem.js} +6 -5
  170. package/esm/pagination/PaginationItem.js.map +1 -0
  171. package/esm/pagination/index.d.ts +1 -2
  172. package/esm/pagination/index.js.map +1 -1
  173. package/esm/panel/Panel.js +1 -1
  174. package/esm/panel/Panel.js.map +1 -1
  175. package/esm/popover/Popover.d.ts +2 -3
  176. package/esm/popover/Popover.js +56 -46
  177. package/esm/popover/Popover.js.map +1 -1
  178. package/esm/popover/PopoverContent.js +1 -1
  179. package/esm/popover/PopoverContent.js.map +1 -1
  180. package/esm/read-more/ReadMore.d.ts +0 -5
  181. package/esm/read-more/ReadMore.js +7 -11
  182. package/esm/read-more/ReadMore.js.map +1 -1
  183. package/esm/stepper/Step.js +1 -1
  184. package/esm/stepper/Step.js.map +1 -1
  185. package/esm/stepper/Stepper.js +1 -1
  186. package/esm/stepper/Stepper.js.map +1 -1
  187. package/esm/table/Body.js +1 -1
  188. package/esm/table/Body.js.map +1 -1
  189. package/esm/table/DataCell.js +1 -1
  190. package/esm/table/DataCell.js.map +1 -1
  191. package/esm/table/ExpandableRow.js +7 -10
  192. package/esm/table/ExpandableRow.js.map +1 -1
  193. package/esm/table/Header.js +1 -1
  194. package/esm/table/Header.js.map +1 -1
  195. package/esm/table/HeaderCell.js +1 -1
  196. package/esm/table/HeaderCell.js.map +1 -1
  197. package/esm/table/Row.js +1 -1
  198. package/esm/table/Row.js.map +1 -1
  199. package/esm/table/Table.js +1 -1
  200. package/esm/table/Table.js.map +1 -1
  201. package/esm/tabs/Tab.d.ts +0 -5
  202. package/esm/tabs/Tab.js +5 -5
  203. package/esm/tabs/Tab.js.map +1 -1
  204. package/esm/tabs/TabList.d.ts +0 -4
  205. package/esm/tabs/TabList.js +7 -6
  206. package/esm/tabs/TabList.js.map +1 -1
  207. package/esm/tabs/TabPanel.js +1 -1
  208. package/esm/tabs/TabPanel.js.map +1 -1
  209. package/esm/tabs/Tabs.d.ts +12 -0
  210. package/esm/tabs/Tabs.js +4 -2
  211. package/esm/tabs/Tabs.js.map +1 -1
  212. package/esm/tag/Tag.js +1 -1
  213. package/esm/tag/Tag.js.map +1 -1
  214. package/esm/toggle-group/ToggleGroup.js +3 -3
  215. package/esm/toggle-group/ToggleGroup.js.map +1 -1
  216. package/esm/toggle-group/ToggleItem.js +1 -1
  217. package/esm/toggle-group/ToggleItem.js.map +1 -1
  218. package/esm/tooltip/Tooltip.js +44 -91
  219. package/esm/tooltip/Tooltip.js.map +1 -1
  220. package/esm/typography/BodyLong.js +1 -1
  221. package/esm/typography/BodyLong.js.map +1 -1
  222. package/esm/typography/BodyShort.js +1 -1
  223. package/esm/typography/BodyShort.js.map +1 -1
  224. package/esm/typography/Detail.js +1 -1
  225. package/esm/typography/Detail.js.map +1 -1
  226. package/esm/typography/ErrorMessage.js +1 -1
  227. package/esm/typography/ErrorMessage.js.map +1 -1
  228. package/esm/typography/Heading.js +1 -1
  229. package/esm/typography/Heading.js.map +1 -1
  230. package/esm/typography/Ingress.js +1 -1
  231. package/esm/typography/Ingress.js.map +1 -1
  232. package/esm/typography/Label.js +1 -1
  233. package/esm/typography/Label.js.map +1 -1
  234. package/esm/util/AnimateHeight.d.ts +10 -0
  235. package/esm/util/AnimateHeight.js +180 -0
  236. package/esm/util/AnimateHeight.js.map +1 -0
  237. package/esm/util/TextareaAutoSize.d.ts +14 -0
  238. package/esm/util/TextareaAutoSize.js +150 -0
  239. package/esm/util/TextareaAutoSize.js.map +1 -0
  240. package/esm/util/debounce.d.ts +4 -0
  241. package/esm/util/debounce.js +16 -0
  242. package/esm/util/debounce.js.map +1 -0
  243. package/esm/util/index.d.ts +4 -0
  244. package/esm/util/index.js +9 -1
  245. package/esm/util/index.js.map +1 -1
  246. package/esm/util/mergeRefs.d.ts +2 -0
  247. package/esm/util/mergeRefs.js +14 -0
  248. package/esm/util/mergeRefs.js.map +1 -0
  249. package/esm/util/useId.d.ts +7 -3
  250. package/esm/util/useId.js +36 -16
  251. package/esm/util/useId.js.map +1 -1
  252. package/package.json +13 -15
  253. package/src/accordion/Accordion.tsx +1 -1
  254. package/src/accordion/AccordionContent.tsx +13 -19
  255. package/src/accordion/AccordionHeader.tsx +11 -18
  256. package/src/accordion/AccordionItem.tsx +2 -23
  257. package/src/accordion/accordion.stories.tsx +30 -31
  258. package/src/alert/Alert.tsx +2 -2
  259. package/src/alert/alert.stories.tsx +7 -0
  260. package/src/button/Button.tsx +39 -14
  261. package/src/button/button.stories.tsx +55 -28
  262. package/src/chat/Bubble.tsx +52 -0
  263. package/src/chat/Chat.tsx +96 -0
  264. package/src/chat/chat.stories.tsx +202 -0
  265. package/src/chat/index.ts +1 -0
  266. package/src/form/ConfirmationPanel.tsx +9 -4
  267. package/src/form/Fieldset/Fieldset.tsx +1 -1
  268. package/src/form/Select.tsx +1 -1
  269. package/src/form/Switch.tsx +1 -1
  270. package/src/form/TextField.tsx +1 -1
  271. package/src/form/Textarea.tsx +6 -6
  272. package/src/form/checkbox/Checkbox.test.tsx +20 -17
  273. package/src/form/checkbox/Checkbox.tsx +1 -1
  274. package/src/form/checkbox/CheckboxGroup.tsx +1 -1
  275. package/src/form/error-summary/ErrorSummary.tsx +3 -3
  276. package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
  277. package/src/form/radio/Radio.tsx +1 -1
  278. package/src/form/radio/RadioGroup.tsx +1 -1
  279. package/src/form/search/Search.tsx +11 -4
  280. package/src/form/search/SearchButton.tsx +8 -4
  281. package/src/form/useFormField.ts +1 -1
  282. package/src/grid/Cell.tsx +1 -1
  283. package/src/grid/ContentContainer.tsx +1 -1
  284. package/src/grid/Grid.tsx +1 -1
  285. package/src/grid/grid.stories.tsx +68 -0
  286. package/src/guide-panel/Guide.tsx +1 -1
  287. package/src/guide-panel/GuidePanel.tsx +1 -1
  288. package/src/help-text/HelpText.tsx +22 -8
  289. package/src/help-text/help-text.stories.tsx +12 -16
  290. package/src/index.ts +1 -7
  291. package/src/link/Link.tsx +1 -1
  292. package/src/link-panel/LinkPanel.tsx +1 -1
  293. package/src/link-panel/LinkPanelDescription.tsx +1 -1
  294. package/src/link-panel/LinkPanelTitle.tsx +1 -1
  295. package/src/loader/Loader.tsx +1 -1
  296. package/src/modal/Modal.tsx +6 -8
  297. package/src/modal/ModalContent.tsx +1 -1
  298. package/src/pagination/Pagination.tsx +87 -72
  299. package/src/pagination/PaginationItem.tsx +56 -0
  300. package/src/pagination/index.ts +1 -2
  301. package/src/pagination/pagination.stories.tsx +90 -16
  302. package/src/panel/Panel.tsx +1 -1
  303. package/src/popover/Popover.test.tsx +143 -0
  304. package/src/popover/Popover.tsx +107 -73
  305. package/src/popover/PopoverContent.tsx +1 -1
  306. package/src/popover/popover.stories.tsx +22 -27
  307. package/src/read-more/ReadMore.tsx +19 -30
  308. package/src/read-more/readmore.stories.tsx +3 -10
  309. package/src/stepper/Step.tsx +1 -1
  310. package/src/stepper/Stepper.tsx +1 -1
  311. package/src/table/Body.tsx +1 -1
  312. package/src/table/DataCell.tsx +1 -1
  313. package/src/table/ExpandableRow.tsx +12 -13
  314. package/src/table/Header.tsx +1 -1
  315. package/src/table/HeaderCell.tsx +1 -1
  316. package/src/table/Row.tsx +1 -1
  317. package/src/table/Table.tsx +1 -1
  318. package/src/tabs/Tab.tsx +6 -19
  319. package/src/tabs/TabList.tsx +14 -9
  320. package/src/tabs/TabPanel.tsx +1 -1
  321. package/src/tabs/Tabs.stories.tsx +94 -117
  322. package/src/tabs/Tabs.tsx +17 -1
  323. package/src/tag/Tag.tsx +1 -1
  324. package/src/toggle-group/ToggleGroup.tsx +3 -3
  325. package/src/toggle-group/ToggleItem.tsx +1 -1
  326. package/src/tooltip/Tooltip.test.tsx +167 -0
  327. package/src/tooltip/Tooltip.tsx +106 -173
  328. package/src/tooltip/tooltip.stories.tsx +15 -1
  329. package/src/typography/BodyLong.tsx +1 -1
  330. package/src/typography/BodyShort.tsx +1 -1
  331. package/src/typography/Detail.tsx +1 -1
  332. package/src/typography/ErrorMessage.tsx +1 -1
  333. package/src/typography/Heading.tsx +1 -1
  334. package/src/typography/Ingress.tsx +1 -1
  335. package/src/typography/Label.tsx +1 -1
  336. package/src/util/AnimateHeight.tsx +240 -0
  337. package/src/util/TextareaAutoSize.tsx +224 -0
  338. package/src/util/debounce.ts +17 -0
  339. package/src/util/index.ts +14 -2
  340. package/src/util/mergeRefs.tsx +14 -0
  341. package/src/util/useId.ts +37 -20
  342. package/cjs/card/MicroCard.js +0 -47
  343. package/cjs/card/index.js +0 -8
  344. package/cjs/card/package.json +0 -6
  345. package/cjs/menu/Menu.js +0 -53
  346. package/cjs/menu/MenuCollapse.js +0 -65
  347. package/cjs/menu/MenuItems.js +0 -23
  348. package/cjs/menu/package.json +0 -6
  349. package/cjs/page-header/PageHeader.js +0 -51
  350. package/cjs/page-header/index.js +0 -8
  351. package/cjs/page-header/package.json +0 -6
  352. package/cjs/speech-bubble/index.js +0 -8
  353. package/cjs/speech-bubble/package.json +0 -6
  354. package/cjs/step-indicator/Step.js +0 -67
  355. package/cjs/step-indicator/StepIndicator.js +0 -80
  356. package/cjs/step-indicator/index.js +0 -8
  357. package/cjs/step-indicator/package.json +0 -6
  358. package/esm/card/MicroCard.d.ts +0 -10
  359. package/esm/card/MicroCard.js +0 -19
  360. package/esm/card/MicroCard.js.map +0 -1
  361. package/esm/card/index.d.ts +0 -2
  362. package/esm/card/index.js +0 -2
  363. package/esm/card/index.js.map +0 -1
  364. package/esm/menu/Menu.d.ts +0 -12
  365. package/esm/menu/Menu.js +0 -25
  366. package/esm/menu/Menu.js.map +0 -1
  367. package/esm/menu/MenuCollapse.d.ts +0 -12
  368. package/esm/menu/MenuCollapse.js +0 -37
  369. package/esm/menu/MenuCollapse.js.map +0 -1
  370. package/esm/menu/MenuItem.d.ts +0 -13
  371. package/esm/menu/MenuItem.js.map +0 -1
  372. package/esm/menu/MenuItems.d.ts +0 -6
  373. package/esm/menu/MenuItems.js +0 -19
  374. package/esm/menu/MenuItems.js.map +0 -1
  375. package/esm/menu/index.d.ts +0 -3
  376. package/esm/menu/index.js +0 -2
  377. package/esm/menu/index.js.map +0 -1
  378. package/esm/page-header/PageHeader.d.ts +0 -27
  379. package/esm/page-header/PageHeader.js +0 -24
  380. package/esm/page-header/PageHeader.js.map +0 -1
  381. package/esm/page-header/index.d.ts +0 -2
  382. package/esm/page-header/index.js +0 -2
  383. package/esm/page-header/index.js.map +0 -1
  384. package/esm/speech-bubble/Bubble.js.map +0 -1
  385. package/esm/speech-bubble/SpeechBubble.d.ts +0 -34
  386. package/esm/speech-bubble/SpeechBubble.js +0 -27
  387. package/esm/speech-bubble/SpeechBubble.js.map +0 -1
  388. package/esm/speech-bubble/index.d.ts +0 -1
  389. package/esm/speech-bubble/index.js +0 -2
  390. package/esm/speech-bubble/index.js.map +0 -1
  391. package/esm/step-indicator/Step.d.ts +0 -23
  392. package/esm/step-indicator/Step.js +0 -39
  393. package/esm/step-indicator/Step.js.map +0 -1
  394. package/esm/step-indicator/StepIndicator.d.ts +0 -41
  395. package/esm/step-indicator/StepIndicator.js +0 -52
  396. package/esm/step-indicator/StepIndicator.js.map +0 -1
  397. package/esm/step-indicator/index.d.ts +0 -1
  398. package/esm/step-indicator/index.js +0 -2
  399. package/esm/step-indicator/index.js.map +0 -1
  400. package/src/card/MicroCard.tsx +0 -32
  401. package/src/card/index.ts +0 -2
  402. package/src/card/stories/card.stories.mdx +0 -26
  403. package/src/card/stories/card.stories.tsx +0 -16
  404. package/src/grid/stories/grid.stories.mdx +0 -79
  405. package/src/grid/stories/grid.stories.tsx +0 -51
  406. package/src/grid/stories/styles.css +0 -21
  407. package/src/menu/Menu.tsx +0 -36
  408. package/src/menu/MenuCollapse.tsx +0 -80
  409. package/src/menu/MenuItem.tsx +0 -39
  410. package/src/menu/MenuItems.tsx +0 -21
  411. package/src/menu/index.ts +0 -3
  412. package/src/menu/stories/menu.stories.mdx +0 -93
  413. package/src/menu/stories/menu.stories.tsx +0 -139
  414. package/src/page-header/PageHeader.tsx +0 -72
  415. package/src/page-header/index.ts +0 -2
  416. package/src/page-header/stories/header.stories.mdx +0 -81
  417. package/src/page-header/stories/header.stories.tsx +0 -61
  418. package/src/page-header/stories/pictogram.tsx +0 -14
  419. package/src/speech-bubble/Bubble.tsx +0 -48
  420. package/src/speech-bubble/SpeechBubble.tsx +0 -93
  421. package/src/speech-bubble/index.ts +0 -1
  422. package/src/speech-bubble/stories/illustration.tsx +0 -66
  423. package/src/speech-bubble/stories/speechbubble.stories.mdx +0 -184
  424. package/src/speech-bubble/stories/speechbubble.stories.tsx +0 -104
  425. package/src/step-indicator/Step.tsx +0 -81
  426. package/src/step-indicator/StepIndicator.tsx +0 -148
  427. package/src/step-indicator/index.ts +0 -1
  428. package/src/step-indicator/stories/Example.tsx +0 -23
  429. package/src/step-indicator/stories/step-indicator.stories.mdx +0 -122
  430. package/src/step-indicator/stories/step-indicator.stories.tsx +0 -104
@@ -0,0 +1,96 @@
1
+ import React, { forwardRef, HTMLAttributes } from "react";
2
+ import cl from "clsx";
3
+ import Bubble, { BubbleType } from "./Bubble";
4
+ import { BodyLong, BodyShort } from "..";
5
+
6
+ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
7
+ /**
8
+ * Children of type <Chat.Bubble />
9
+ */
10
+ children: React.ReactNode;
11
+ /**
12
+ * Chat-message name
13
+ */
14
+ name: string;
15
+ /**
16
+ * Timestamp for sent message
17
+ */
18
+ timestamp?: string;
19
+ /**
20
+ * Avatar for messenger. Regular text for initials works to
21
+ */
22
+ avatar: React.ReactNode;
23
+ /**
24
+ * Background color on bubbles
25
+ */
26
+ backgroundColor?: string;
27
+ /**
28
+ * Background color for avatar
29
+ */
30
+ avatarBgColor?: string;
31
+ /**
32
+ * Positions avatar and Bubbles
33
+ * @default "left"
34
+ */
35
+ position?: "left" | "right";
36
+ }
37
+
38
+ interface ChatComponent
39
+ extends React.ForwardRefExoticComponent<
40
+ ChatProps & React.RefAttributes<HTMLDivElement>
41
+ > {
42
+ Bubble: BubbleType;
43
+ }
44
+
45
+ export const Chat = forwardRef<HTMLDivElement, ChatProps>(
46
+ (
47
+ {
48
+ children,
49
+ className,
50
+ name,
51
+ timestamp,
52
+ avatar,
53
+ position = "left",
54
+ avatarBgColor,
55
+ backgroundColor,
56
+ ...rest
57
+ },
58
+ ref
59
+ ) => {
60
+ return (
61
+ <div
62
+ ref={ref}
63
+ className={cl("navds-chat", className, `navds-chat--${position}`)}
64
+ {...rest}
65
+ >
66
+ <BodyShort
67
+ as="div"
68
+ className="navds-chat__avatar"
69
+ style={{ backgroundColor: avatarBgColor }}
70
+ >
71
+ {avatar}
72
+ </BodyShort>
73
+ <ol className="navds-chat__bubble-wrapper">
74
+ {React.Children.map(children, (child, i) => {
75
+ if (React.isValidElement(child)) {
76
+ return (
77
+ <BodyLong as="li">
78
+ {React.cloneElement(child, {
79
+ name: name && i === 0 ? name : undefined,
80
+ timestamp: timestamp && i === 0 ? timestamp : undefined,
81
+ backgroundColor,
82
+ ...child.props,
83
+ })}
84
+ </BodyLong>
85
+ );
86
+ }
87
+ })}
88
+ </ol>
89
+ </div>
90
+ );
91
+ }
92
+ ) as ChatComponent;
93
+
94
+ Chat.Bubble = Bubble;
95
+
96
+ export default Chat;
@@ -0,0 +1,202 @@
1
+ import React from "react";
2
+ import { Chat } from "../index";
3
+ import { Meta } from "@storybook/react/types-6-0";
4
+
5
+ export default {
6
+ title: "ds-react/Chat",
7
+ component: Chat,
8
+ argTypes: {
9
+ backgroundColor: {
10
+ control: {
11
+ type: "text",
12
+ },
13
+ },
14
+ avatarBgColor: {
15
+ control: {
16
+ type: "text",
17
+ },
18
+ },
19
+ },
20
+ } as Meta;
21
+
22
+ export const Default = (props) => {
23
+ return (
24
+ <Chat
25
+ avatar={props?.avatar ?? "ON"}
26
+ name={props?.name ?? "Ola Normann"}
27
+ timestamp={props?.timestamp ?? "01.01.21 14:00"}
28
+ avatarBgColor={props?.avatarBgColor}
29
+ backgroundColor={props?.backgroundColor}
30
+ >
31
+ <Chat.Bubble>
32
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
33
+ </Chat.Bubble>
34
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
35
+ <Chat.Bubble>
36
+ Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
37
+ labore nisi ut.
38
+ </Chat.Bubble>
39
+ </Chat>
40
+ );
41
+ };
42
+
43
+ Default.args = {
44
+ name: "Ola Normann",
45
+ timestamp: "01.01.21 14:00",
46
+ avatar: "ON",
47
+ };
48
+
49
+ export const Farger = () => {
50
+ return (
51
+ <Chat
52
+ avatar={"ON"}
53
+ name={"Ola Normann"}
54
+ timestamp={"01.01.21 14:00"}
55
+ avatarBgColor={"var(--navds-global-color-lightblue-200)"}
56
+ backgroundColor={"var(--navds-global-color-lightblue-100)"}
57
+ >
58
+ <Chat.Bubble>
59
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
60
+ </Chat.Bubble>
61
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
62
+ <Chat.Bubble>
63
+ Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
64
+ labore nisi ut.
65
+ </Chat.Bubble>
66
+ </Chat>
67
+ );
68
+ };
69
+
70
+ export const Position = () => {
71
+ return (
72
+ <div className="colgap">
73
+ <Chat
74
+ avatar={"ON"}
75
+ name={"Ola Normann"}
76
+ timestamp={"01.01.21 14:00"}
77
+ backgroundColor="rgba(255, 249, 240, 1)"
78
+ avatarBgColor="rgba(255, 236, 204, 1)"
79
+ >
80
+ <Chat.Bubble>
81
+ Adipisicing laborum est eu laborum est sit in commodo enim sint
82
+ laboris labore nisi ut.
83
+ </Chat.Bubble>
84
+ </Chat>
85
+ <Chat
86
+ avatar={"KH"}
87
+ name={"Kari Høyli"}
88
+ timestamp={"01.01.21 14:32"}
89
+ position="right"
90
+ backgroundColor="rgba(230, 240, 255, 1)"
91
+ avatarBgColor="rgba(204, 225, 255, 1)"
92
+ >
93
+ <Chat.Bubble>
94
+ Reprehenderit pariatur officia exercitation laboris.
95
+ </Chat.Bubble>
96
+ <Chat.Bubble>
97
+ Enim velit deserunt do quis. Eu fugiat magna esse dolore ad sunt sit
98
+ est dolore incididunt. Occaecat cupidatat magna.
99
+ </Chat.Bubble>
100
+ </Chat>
101
+ <Chat
102
+ avatar={"ON"}
103
+ name={"Ola Normann"}
104
+ timestamp={"01.01.21 15:00"}
105
+ backgroundColor="rgba(255, 249, 240, 1)"
106
+ avatarBgColor="rgba(255, 236, 204, 1)"
107
+ >
108
+ <Chat.Bubble>
109
+ Exercitation irure Lorem cupidatat culpa anim cillum esse ullamco qui
110
+ dolore laborum et Lorem. Labore sunt duis id Lorem voluptate commodo
111
+ ea esse. Dolore esse aliqua proident ea ad commodo ut dolore voluptate
112
+ labore sunt aute.
113
+ </Chat.Bubble>
114
+ </Chat>
115
+ </div>
116
+ );
117
+ };
118
+
119
+ export const Avatar = () => {
120
+ return (
121
+ <Chat
122
+ avatar={<Illustration />}
123
+ name={"Ola Normann"}
124
+ timestamp={"01.01.21 14:00"}
125
+ >
126
+ <Chat.Bubble>
127
+ Aute minim nisi sunt mollit duis sunt nulla minim non proident.
128
+ </Chat.Bubble>
129
+ <Chat.Bubble>Tempor fugiat amet eu sint in in ullamco.</Chat.Bubble>
130
+ <Chat.Bubble>
131
+ Adipisicing laborum est eu laborum est sit in commodo enim sint laboris
132
+ labore nisi ut.
133
+ </Chat.Bubble>
134
+ </Chat>
135
+ );
136
+ };
137
+
138
+ const Illustration = () => (
139
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 93">
140
+ <path
141
+ fill="#e7e5e2"
142
+ 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"
143
+ />
144
+ <path
145
+ fill="#5c4378"
146
+ 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"
147
+ />
148
+ <path
149
+ fill="#d2242a"
150
+ 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"
151
+ />
152
+ <path
153
+ fill="#fff"
154
+ 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"
155
+ />
156
+ <path
157
+ fill="#c52d35"
158
+ 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"
159
+ />
160
+ <path
161
+ fill="#c52d35"
162
+ 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"
163
+ />
164
+ <path
165
+ fill="#c52d35"
166
+ 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"
167
+ />
168
+ <path
169
+ fill="#c52d35"
170
+ 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"
171
+ />
172
+ <path
173
+ fill="#5a1f57"
174
+ 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"
175
+ />
176
+ <path fill="#c2b5cf" d="M38.7 66.5h.9V64h-.9v2.5z" />
177
+ <path
178
+ fill="#e7e5e2"
179
+ 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"
180
+ />
181
+ <path
182
+ fill="#635e59"
183
+ 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"
184
+ />
185
+ <path
186
+ fill="#d1bfa3"
187
+ 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"
188
+ />
189
+ <path
190
+ fill="#593a32"
191
+ 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"
192
+ />
193
+ <path
194
+ fill="#f6b873"
195
+ 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"
196
+ />
197
+ <path
198
+ fill="#f6b873"
199
+ 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"
200
+ />
201
+ </svg>
202
+ );
@@ -0,0 +1 @@
1
+ export { default as Chat, ChatProps } from "./Chat";
@@ -1,5 +1,5 @@
1
- import cl from "classnames";
2
1
  import React, { forwardRef } from "react";
2
+ import cl from "clsx";
3
3
  import { BodyLong, Checkbox, CheckboxProps, ErrorMessage } from "..";
4
4
  import { useFormField } from "./useFormField";
5
5
 
@@ -27,7 +27,7 @@ export interface ConfirmationPanelProps
27
27
  }
28
28
 
29
29
  export const ConfirmationPanel = forwardRef<
30
- HTMLDivElement,
30
+ HTMLInputElement,
31
31
  ConfirmationPanelProps
32
32
  >(({ className, children, label, ...props }, ref) => {
33
33
  const { errorId, showErrorMsg, hasError, size, inputProps } = useFormField(
@@ -37,7 +37,6 @@ export const ConfirmationPanel = forwardRef<
37
37
 
38
38
  return (
39
39
  <div
40
- ref={ref}
41
40
  className={cl("navds-confirmation-panel", "navds-form-field", className, {
42
41
  "navds-confirmation-panel--small": size === "small",
43
42
  "navds-confirmation-panel--error": hasError,
@@ -53,7 +52,13 @@ export const ConfirmationPanel = forwardRef<
53
52
  {children}
54
53
  </BodyLong>
55
54
  )}
56
- <Checkbox {...props} {...inputProps} error={hasError} size={size}>
55
+ <Checkbox
56
+ ref={ref}
57
+ {...props}
58
+ {...inputProps}
59
+ error={hasError}
60
+ size={size}
61
+ >
57
62
  {label}
58
63
  </Checkbox>
59
64
  </div>
@@ -1,4 +1,4 @@
1
- import cl from "classnames";
1
+ import cl from "clsx";
2
2
  import React, { FieldsetHTMLAttributes, forwardRef, useContext } from "react";
3
3
  import { BodyShort, Detail, Label, ErrorMessage, omit } from "../..";
4
4
  import { FormFieldProps } from "../useFormField";
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, SelectHTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { Expand } from "@navikt/ds-icons";
4
4
  import { BodyShort, Label, ErrorMessage, omit, Detail } from "..";
5
5
  import { FormFieldProps, useFormField } from "./useFormField";
@@ -1,4 +1,4 @@
1
- import cl from "classnames";
1
+ import cl from "clsx";
2
2
  import React, {
3
3
  forwardRef,
4
4
  InputHTMLAttributes,
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, InputHTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { BodyShort, Detail, Label, ErrorMessage, omit } from "..";
4
4
  import { FormFieldProps, useFormField } from "./useFormField";
5
5
 
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef, useState } from "react";
2
- import cl from "classnames";
3
- import TextareaAutosize from "@material-ui/core/TextareaAutosize";
2
+ import cl from "clsx";
4
3
  import { BodyShort, Label, ErrorMessage, omit, Detail } from "..";
5
4
  import { FormFieldProps, useFormField } from "./useFormField";
6
5
  import { useId } from "..";
6
+ import TextareaAutosize from "../util/TextareaAutoSize";
7
7
 
8
8
  /**
9
9
  * TODO: Mulighet for lokalisering av sr-only/counter text
@@ -68,7 +68,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
68
68
  ...rest
69
69
  } = props;
70
70
 
71
- const maxLengthId = `TextareaMaxLength-${useId()}`;
71
+ const maxLengthId = useId();
72
72
  const hasMaxLength = maxLength !== undefined && maxLength > 0;
73
73
 
74
74
  const [controlledValue, setControlledValue] = useState<string>(
@@ -76,9 +76,9 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
76
76
  );
77
77
 
78
78
  const getMinRows = () => {
79
- let rows = rest?.minRows && rest?.minRows >= 3 ? rest?.minRows : 3;
79
+ let rows = rest?.minRows ? rest?.minRows : 3;
80
80
  if (size === "small") {
81
- rows = rest?.minRows && rest?.minRows >= 2 ? rest?.minRows : 2;
81
+ rows = rest?.minRows ? rest?.minRows : 2;
82
82
  }
83
83
  return rows;
84
84
  };
@@ -153,7 +153,7 @@ export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
153
153
  }
154
154
  )}
155
155
  aria-describedby={cl(inputProps["aria-describedby"], {
156
- [maxLengthId]: hasMaxLength,
156
+ [maxLengthId ?? ""]: hasMaxLength,
157
157
  })}
158
158
  />
159
159
  {hasMaxLength && (
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import { render, screen } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
2
+ import { act, fireEvent, render, screen } from "@testing-library/react";
4
3
  import faker from "faker";
5
4
  import { Checkbox, CheckboxGroup } from ".";
6
5
 
@@ -15,9 +14,8 @@ test("checkbox group chains onChange calls", async () => {
15
14
  const onChange = jest.fn();
16
15
  const value = faker.datatype.string();
17
16
  const label = faker.datatype.string();
18
- const user = userEvent.setup();
19
17
 
20
- render(
18
+ const { getByLabelText } = render(
21
19
  <CheckboxGroup legend="legend" onChange={onGroupChange}>
22
20
  <Checkbox onChange={onChange} value={value}>
23
21
  {label}
@@ -25,7 +23,9 @@ test("checkbox group chains onChange calls", async () => {
25
23
  </CheckboxGroup>
26
24
  );
27
25
 
28
- await user.click(screen.getByLabelText(label));
26
+ await act(async () => {
27
+ fireEvent.click(getByLabelText(label));
28
+ });
29
29
 
30
30
  expect(onGroupChange).toBeCalledTimes(1);
31
31
  expect(onGroupChange).toBeCalledWith([value]);
@@ -42,10 +42,14 @@ describe("Checkbox handles controlled-state correctly", () => {
42
42
  );
43
43
 
44
44
  test("Checkbox is still checked after click when controlled", async () => {
45
- const user = userEvent.setup();
46
- render(<CheckboxComponent value={["value1", "value2"]} />);
47
- await user.click(screen.getByLabelText("label1"));
48
- await user.click(screen.getByLabelText("label2"));
45
+ const { getByLabelText } = render(
46
+ <CheckboxComponent value={["value1", "value2"]} />
47
+ );
48
+
49
+ await act(async () => {
50
+ fireEvent.click(getByLabelText("label1"));
51
+ fireEvent.click(getByLabelText("label2"));
52
+ });
49
53
 
50
54
  expect((screen.getByLabelText("label1") as HTMLInputElement).checked).toBe(
51
55
  true
@@ -58,22 +62,21 @@ describe("Checkbox handles controlled-state correctly", () => {
58
62
 
59
63
  test("onChange called with expected values", async () => {
60
64
  const onGroupChange = jest.fn();
61
- const user = userEvent.setup();
62
65
 
63
- render(
66
+ const { getByLabelText } = render(
64
67
  <CheckboxComponent
65
68
  onChange={onGroupChange}
66
69
  value={["value1", "value2"]}
67
70
  />
68
71
  );
69
72
 
70
- await user.click(screen.getByLabelText("label1"));
71
-
72
- expect(onGroupChange).lastCalledWith(["value2"]);
73
-
74
- await user.click(screen.getByLabelText("label2"));
73
+ await act(async () => {
74
+ fireEvent.click(getByLabelText("label1"));
75
+ expect(onGroupChange).lastCalledWith(["value2"]);
75
76
 
76
- expect(onGroupChange).lastCalledWith(["value1"]);
77
+ fireEvent.click(getByLabelText("label2"));
78
+ expect(onGroupChange).lastCalledWith(["value1"]);
79
+ });
77
80
  });
78
81
 
79
82
  test("Checkboxes updates after value-prop change", () => {
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, InputHTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import useCheckbox from "./useCheckbox";
4
4
  import { FormFieldProps } from "../useFormField";
5
5
  import { BodyShort, Detail, omit } from "../..";
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, forwardRef, useContext, useState } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { Fieldset, FieldsetProps, FieldsetContext } from "..";
4
4
 
5
5
  export interface CheckboxGroupState {
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, HTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { Heading, BodyShort } from "../..";
4
4
  import ErrorSummaryItem, { ErrorSummaryItemType } from "./ErrorSummaryItem";
5
5
  import { useId } from "../../util";
@@ -58,13 +58,13 @@ export const ErrorSummary = forwardRef<HTMLDivElement, ErrorSummaryProps>(
58
58
  tabIndex={-1}
59
59
  aria-live="polite"
60
60
  aria-relevant="all"
61
- aria-labelledby={`error-summary-${headingId}`}
61
+ aria-labelledby={headingId}
62
62
  >
63
63
  <Heading
64
64
  className="navds-error-summary__heading"
65
65
  as={headingTag}
66
66
  size="small"
67
- id={`error-summary-${headingId}`}
67
+ id={headingId}
68
68
  >
69
69
  {heading}
70
70
  </Heading>
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { OverridableComponent } from "../..";
4
4
 
5
5
  export interface ErrorSummaryItemProps
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, InputHTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { BodyShort, Detail, omit } from "../..";
4
4
  import { FormFieldProps } from "../useFormField";
5
5
  import { useRadio } from "./useRadio";
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, useContext } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { Fieldset, FieldsetContext, FieldsetProps } from "..";
4
4
  import { useId } from "../..";
5
5
 
@@ -1,14 +1,21 @@
1
1
  import { Close, Search as SearchIcon } from "@navikt/ds-icons";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import React, {
4
4
  forwardRef,
5
5
  InputHTMLAttributes,
6
6
  useCallback,
7
+ useMemo,
7
8
  useRef,
8
9
  useState,
9
10
  } from "react";
10
- import mergeRefs from "react-merge-refs";
11
- import { BodyShort, ErrorMessage, Label, omit, useEventListener } from "../..";
11
+ import {
12
+ BodyShort,
13
+ ErrorMessage,
14
+ Label,
15
+ mergeRefs,
16
+ omit,
17
+ useEventListener,
18
+ } from "../..";
12
19
  import { FormFieldProps, useFormField } from "../useFormField";
13
20
  import SearchButton, { SearchButtonType } from "./SearchButton";
14
21
 
@@ -103,7 +110,7 @@ export const Search = forwardRef<HTMLInputElement, SearchProps>(
103
110
  } = props;
104
111
 
105
112
  const searchRef = useRef<HTMLInputElement | null>(null);
106
- const mergedRef = mergeRefs([searchRef, ref]);
113
+ const mergedRef = useMemo(() => mergeRefs([searchRef, ref]), [ref]);
107
114
  const [wrapperRef, setWrapperRef] = useState<HTMLDivElement | null>(null);
108
115
 
109
116
  const [internalValue, setInternalValue] = useState(defaultValue ?? "");
@@ -1,5 +1,5 @@
1
1
  import { Search } from "@navikt/ds-icons";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import React, { forwardRef, useContext } from "react";
4
4
  import { Button, ButtonProps } from "../..";
5
5
  import { SearchContext } from "./Search";
@@ -7,7 +7,7 @@ import { SearchContext } from "./Search";
7
7
  export interface SearchButtonProps
8
8
  extends Omit<ButtonProps, "size" | "children" | "variant"> {
9
9
  /**
10
- * Text set before <Search/> icon
10
+ * Text set after <Search/> icon
11
11
  */
12
12
  children?: React.ReactNode;
13
13
  }
@@ -36,9 +36,13 @@ const SearchButton: SearchButtonType = forwardRef(
36
36
  variant={variant === "secondary" ? "secondary" : "primary"}
37
37
  className={cl("navds-search__button-search", className)}
38
38
  disabled={context?.disabled ?? disabled}
39
+ icon={
40
+ <Search
41
+ {...(children ? { "aria-hidden": true } : { title: "Søk" })}
42
+ />
43
+ }
39
44
  >
40
- <Search aria-hidden />
41
- {children ? children : <span className="navds-sr-only">Søk</span>}
45
+ {children}
42
46
  </Button>
43
47
  );
44
48
  }
@@ -1,5 +1,5 @@
1
1
  import { useContext } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
  import { FieldsetContext } from "./index";
4
4
  import { useId } from "../index";
5
5
 
package/src/grid/Cell.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, HTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
 
4
4
  type Column = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
5
5
  export interface CellProps extends HTMLAttributes<HTMLDivElement> {
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, HTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
 
4
4
  export interface ContentContainerProps extends HTMLAttributes<HTMLDivElement> {
5
5
  /**
package/src/grid/Grid.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, HTMLAttributes } from "react";
2
- import cl from "classnames";
2
+ import cl from "clsx";
3
3
 
4
4
  export interface GridProps extends HTMLAttributes<HTMLDivElement> {
5
5
  /**