@navikt/ds-react 6.1.1 → 6.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 (438) hide show
  1. package/cjs/accordion/Accordion.d.ts +4 -4
  2. package/cjs/alert/Alert.d.ts +12 -10
  3. package/cjs/alert/Alert.js.map +1 -1
  4. package/cjs/button/Button.d.ts +9 -8
  5. package/cjs/button/Button.js.map +1 -1
  6. package/cjs/chat/Chat.d.ts +6 -6
  7. package/cjs/chips/Chips.d.ts +2 -2
  8. package/cjs/copybutton/CopyButton.d.ts +14 -12
  9. package/cjs/copybutton/CopyButton.js.map +1 -1
  10. package/cjs/date/datepicker/types.d.ts +7 -6
  11. package/cjs/date/hooks/useDatepicker.d.ts +4 -3
  12. package/cjs/date/hooks/useDatepicker.js.map +1 -1
  13. package/cjs/date/hooks/useMonthPicker.d.ts +4 -3
  14. package/cjs/date/hooks/useMonthPicker.js.map +1 -1
  15. package/cjs/date/monthpicker/types.d.ts +2 -1
  16. package/cjs/date/parts/DateInput.d.ts +1 -1
  17. package/cjs/expansion-card/ExpansionCardTitle.d.ts +1 -1
  18. package/cjs/form/checkbox/CheckboxGroup.d.ts +3 -3
  19. package/cjs/form/checkbox/types.d.ts +4 -4
  20. package/cjs/form/combobox/ComboboxProvider.js +5 -1
  21. package/cjs/form/combobox/ComboboxProvider.js.map +1 -1
  22. package/cjs/form/combobox/FilteredOptions/FilteredOptions.js +14 -12
  23. package/cjs/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
  24. package/cjs/form/combobox/FilteredOptions/filtered-options-util.d.ts +3 -3
  25. package/cjs/form/combobox/FilteredOptions/filtered-options-util.js +1 -3
  26. package/cjs/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
  27. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +8 -5
  28. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +8 -13
  29. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  30. package/cjs/form/combobox/Input/Input.js +9 -7
  31. package/cjs/form/combobox/Input/Input.js.map +1 -1
  32. package/cjs/form/combobox/SelectedOptions/SelectedOptions.d.ts +2 -1
  33. package/cjs/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
  34. package/cjs/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
  35. package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +10 -7
  36. package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +6 -8
  37. package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
  38. package/cjs/form/combobox/combobox-utils.d.ts +10 -0
  39. package/cjs/form/combobox/combobox-utils.js +27 -0
  40. package/cjs/form/combobox/combobox-utils.js.map +1 -0
  41. package/cjs/form/combobox/customOptionsContext.d.ts +5 -4
  42. package/cjs/form/combobox/customOptionsContext.js +1 -1
  43. package/cjs/form/combobox/customOptionsContext.js.map +1 -1
  44. package/cjs/form/combobox/types.d.ts +33 -22
  45. package/cjs/form/error-summary/ErrorSummary.d.ts +5 -5
  46. package/cjs/form/file-upload/FileUpload.context.d.ts +8 -0
  47. package/cjs/form/file-upload/FileUpload.context.js +7 -0
  48. package/cjs/form/file-upload/FileUpload.context.js.map +1 -0
  49. package/cjs/form/file-upload/FileUpload.d.ts +118 -0
  50. package/cjs/form/file-upload/FileUpload.js +73 -0
  51. package/cjs/form/file-upload/FileUpload.js.map +1 -0
  52. package/cjs/form/file-upload/FileUpload.types.d.ts +55 -0
  53. package/cjs/form/file-upload/FileUpload.types.js +8 -0
  54. package/cjs/form/file-upload/FileUpload.types.js.map +1 -0
  55. package/cjs/form/file-upload/i18n/get.d.ts +2 -0
  56. package/cjs/form/file-upload/i18n/get.js +38 -0
  57. package/cjs/form/file-upload/i18n/get.js.map +1 -0
  58. package/cjs/form/file-upload/i18n/i18n.context.d.ts +11 -0
  59. package/cjs/form/file-upload/i18n/i18n.context.js +39 -0
  60. package/cjs/form/file-upload/i18n/i18n.context.js.map +1 -0
  61. package/cjs/form/file-upload/i18n/i18n.types.d.ts +13 -0
  62. package/cjs/form/file-upload/i18n/i18n.types.js +3 -0
  63. package/cjs/form/file-upload/i18n/i18n.types.js.map +1 -0
  64. package/cjs/form/file-upload/i18n/locales/nb.json +20 -0
  65. package/cjs/form/file-upload/i18n/merge.d.ts +2 -0
  66. package/cjs/form/file-upload/i18n/merge.js +29 -0
  67. package/cjs/form/file-upload/i18n/merge.js.map +1 -0
  68. package/cjs/form/file-upload/index.d.ts +7 -0
  69. package/cjs/form/file-upload/index.js +16 -0
  70. package/cjs/form/file-upload/index.js.map +1 -0
  71. package/cjs/form/file-upload/parts/Trigger.d.ts +7 -0
  72. package/cjs/form/file-upload/parts/Trigger.js +43 -0
  73. package/cjs/form/file-upload/parts/Trigger.js.map +1 -0
  74. package/cjs/form/file-upload/parts/dropzone/Dropzone.d.ts +4 -0
  75. package/cjs/form/file-upload/parts/dropzone/Dropzone.js +106 -0
  76. package/cjs/form/file-upload/parts/dropzone/Dropzone.js.map +1 -0
  77. package/cjs/form/file-upload/parts/dropzone/dropzone.types.d.ts +18 -0
  78. package/cjs/form/file-upload/parts/dropzone/dropzone.types.js +3 -0
  79. package/cjs/form/file-upload/parts/dropzone/dropzone.types.js.map +1 -0
  80. package/cjs/form/file-upload/parts/dropzone/useDropzone.d.ts +13 -0
  81. package/cjs/form/file-upload/parts/dropzone/useDropzone.js +34 -0
  82. package/cjs/form/file-upload/parts/dropzone/useDropzone.js.map +1 -0
  83. package/cjs/form/file-upload/parts/item/Item.d.ts +55 -0
  84. package/cjs/form/file-upload/parts/item/Item.js +79 -0
  85. package/cjs/form/file-upload/parts/item/Item.js.map +1 -0
  86. package/cjs/form/file-upload/parts/item/Item.types.d.ts +5 -0
  87. package/cjs/form/file-upload/parts/item/Item.types.js +3 -0
  88. package/cjs/form/file-upload/parts/item/Item.types.js.map +1 -0
  89. package/cjs/form/file-upload/parts/item/ItemButton.d.ts +12 -0
  90. package/cjs/form/file-upload/parts/item/ItemButton.js +22 -0
  91. package/cjs/form/file-upload/parts/item/ItemButton.js.map +1 -0
  92. package/cjs/form/file-upload/parts/item/ItemIcon.d.ts +9 -0
  93. package/cjs/form/file-upload/parts/item/ItemIcon.js +51 -0
  94. package/cjs/form/file-upload/parts/item/ItemIcon.js.map +1 -0
  95. package/cjs/form/file-upload/parts/item/ItemName.d.ts +9 -0
  96. package/cjs/form/file-upload/parts/item/ItemName.js +32 -0
  97. package/cjs/form/file-upload/parts/item/ItemName.js.map +1 -0
  98. package/cjs/form/file-upload/parts/item/utils/download-file.d.ts +1 -0
  99. package/cjs/form/file-upload/parts/item/utils/download-file.js +13 -0
  100. package/cjs/form/file-upload/parts/item/utils/download-file.js.map +1 -0
  101. package/cjs/form/file-upload/parts/item/utils/file-type-checker.d.ts +2 -0
  102. package/cjs/form/file-upload/parts/item/utils/file-type-checker.js +6 -0
  103. package/cjs/form/file-upload/parts/item/utils/file-type-checker.js.map +1 -0
  104. package/cjs/form/file-upload/parts/item/utils/format-file-size.d.ts +2 -0
  105. package/cjs/form/file-upload/parts/item/utils/format-file-size.js +24 -0
  106. package/cjs/form/file-upload/parts/item/utils/format-file-size.js.map +1 -0
  107. package/cjs/form/file-upload/useFileUpload.d.ts +12 -0
  108. package/cjs/form/file-upload/useFileUpload.js +33 -0
  109. package/cjs/form/file-upload/useFileUpload.js.map +1 -0
  110. package/cjs/form/file-upload/utils/is-accepted-file-type.d.ts +1 -0
  111. package/cjs/form/file-upload/utils/is-accepted-file-type.js +26 -0
  112. package/cjs/form/file-upload/utils/is-accepted-file-type.js.map +1 -0
  113. package/cjs/form/file-upload/utils/is-accepted-size.d.ts +1 -0
  114. package/cjs/form/file-upload/utils/is-accepted-size.js +11 -0
  115. package/cjs/form/file-upload/utils/is-accepted-size.js.map +1 -0
  116. package/cjs/form/file-upload/utils/validate-files.d.ts +8 -0
  117. package/cjs/form/file-upload/utils/validate-files.js +48 -0
  118. package/cjs/form/file-upload/utils/validate-files.js.map +1 -0
  119. package/cjs/form/radio/RadioGroup.d.ts +1 -1
  120. package/cjs/form/search/Search.d.ts +3 -2
  121. package/cjs/form/search/Search.js.map +1 -1
  122. package/cjs/form/select/Select.d.ts +9 -9
  123. package/cjs/form/switch/Switch.d.ts +5 -5
  124. package/cjs/form/textarea/Textarea.d.ts +5 -4
  125. package/cjs/form/textarea/Textarea.js.map +1 -1
  126. package/cjs/form/useFormField.d.ts +10 -8
  127. package/cjs/form/useFormField.js.map +1 -1
  128. package/cjs/index.d.ts +1 -0
  129. package/cjs/index.js +3 -1
  130. package/cjs/index.js.map +1 -1
  131. package/cjs/layout/bleed/Bleed.d.ts +9 -1
  132. package/cjs/layout/bleed/Bleed.js.map +1 -1
  133. package/cjs/layout/box/Box.d.ts +5 -5
  134. package/cjs/layout/grid/HGrid.d.ts +1 -3
  135. package/cjs/layout/grid/HGrid.js.map +1 -1
  136. package/cjs/layout/page/Page.d.ts +2 -2
  137. package/cjs/layout/responsive/Responsive.d.ts +2 -4
  138. package/cjs/layout/responsive/Responsive.js.map +1 -1
  139. package/cjs/layout/stack/Stack.d.ts +18 -4
  140. package/cjs/layout/stack/Stack.js.map +1 -1
  141. package/cjs/list/types.d.ts +1 -1
  142. package/cjs/loader/Loader.d.ts +0 -6
  143. package/cjs/loader/Loader.js.map +1 -1
  144. package/cjs/modal/Modal.js +2 -2
  145. package/cjs/modal/types.d.ts +8 -8
  146. package/cjs/pagination/Pagination.d.ts +3 -2
  147. package/cjs/pagination/Pagination.js.map +1 -1
  148. package/cjs/pagination/PaginationItem.d.ts +1 -1
  149. package/cjs/popover/Popover.d.ts +2 -1
  150. package/cjs/popover/Popover.js.map +1 -1
  151. package/cjs/read-more/ReadMore.d.ts +7 -7
  152. package/cjs/stepper/Step.d.ts +4 -4
  153. package/cjs/stepper/Stepper.d.ts +7 -5
  154. package/cjs/stepper/Stepper.js.map +1 -1
  155. package/cjs/table/AnimateHeight.d.ts +1 -1
  156. package/cjs/table/DataCell.d.ts +1 -3
  157. package/cjs/table/DataCell.js.map +1 -1
  158. package/cjs/tabs/TabList.d.ts +1 -1
  159. package/cjs/tabs/Tabs.d.ts +7 -7
  160. package/cjs/timeline/Timeline.d.ts +6 -3
  161. package/cjs/timeline/Timeline.js +2 -1
  162. package/cjs/timeline/Timeline.js.map +1 -1
  163. package/cjs/timeline/period/index.d.ts +3 -2
  164. package/cjs/timeline/period/index.js.map +1 -1
  165. package/cjs/tooltip/Tooltip.d.ts +19 -12
  166. package/cjs/tooltip/Tooltip.js.map +1 -1
  167. package/cjs/util/create-context.d.ts +1 -0
  168. package/cjs/util/create-context.js.map +1 -1
  169. package/cjs/util/hooks/useEventListener.d.ts +1 -1
  170. package/cjs/util/hooks/useMergeRefs.d.ts +1 -1
  171. package/esm/accordion/Accordion.d.ts +4 -4
  172. package/esm/alert/Alert.d.ts +12 -10
  173. package/esm/alert/Alert.js.map +1 -1
  174. package/esm/button/Button.d.ts +9 -8
  175. package/esm/button/Button.js.map +1 -1
  176. package/esm/chat/Chat.d.ts +6 -6
  177. package/esm/chips/Chips.d.ts +2 -2
  178. package/esm/copybutton/CopyButton.d.ts +14 -12
  179. package/esm/copybutton/CopyButton.js.map +1 -1
  180. package/esm/date/datepicker/types.d.ts +7 -6
  181. package/esm/date/hooks/useDatepicker.d.ts +4 -3
  182. package/esm/date/hooks/useDatepicker.js.map +1 -1
  183. package/esm/date/hooks/useMonthPicker.d.ts +4 -3
  184. package/esm/date/hooks/useMonthPicker.js.map +1 -1
  185. package/esm/date/monthpicker/types.d.ts +2 -1
  186. package/esm/date/parts/DateInput.d.ts +1 -1
  187. package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
  188. package/esm/form/checkbox/CheckboxGroup.d.ts +3 -3
  189. package/esm/form/checkbox/types.d.ts +4 -4
  190. package/esm/form/combobox/ComboboxProvider.js +5 -1
  191. package/esm/form/combobox/ComboboxProvider.js.map +1 -1
  192. package/esm/form/combobox/FilteredOptions/FilteredOptions.js +14 -12
  193. package/esm/form/combobox/FilteredOptions/FilteredOptions.js.map +1 -1
  194. package/esm/form/combobox/FilteredOptions/filtered-options-util.d.ts +3 -3
  195. package/esm/form/combobox/FilteredOptions/filtered-options-util.js +1 -3
  196. package/esm/form/combobox/FilteredOptions/filtered-options-util.js.map +1 -1
  197. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.d.ts +8 -5
  198. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +8 -13
  199. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  200. package/esm/form/combobox/Input/Input.js +9 -7
  201. package/esm/form/combobox/Input/Input.js.map +1 -1
  202. package/esm/form/combobox/SelectedOptions/SelectedOptions.d.ts +2 -1
  203. package/esm/form/combobox/SelectedOptions/SelectedOptions.js +3 -3
  204. package/esm/form/combobox/SelectedOptions/SelectedOptions.js.map +1 -1
  205. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.d.ts +10 -7
  206. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +6 -8
  207. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
  208. package/esm/form/combobox/combobox-utils.d.ts +10 -0
  209. package/esm/form/combobox/combobox-utils.js +22 -0
  210. package/esm/form/combobox/combobox-utils.js.map +1 -0
  211. package/esm/form/combobox/customOptionsContext.d.ts +5 -4
  212. package/esm/form/combobox/customOptionsContext.js +1 -1
  213. package/esm/form/combobox/customOptionsContext.js.map +1 -1
  214. package/esm/form/combobox/types.d.ts +33 -22
  215. package/esm/form/error-summary/ErrorSummary.d.ts +5 -5
  216. package/esm/form/file-upload/FileUpload.context.d.ts +8 -0
  217. package/esm/form/file-upload/FileUpload.context.js +3 -0
  218. package/esm/form/file-upload/FileUpload.context.js.map +1 -0
  219. package/esm/form/file-upload/FileUpload.d.ts +118 -0
  220. package/esm/form/file-upload/FileUpload.js +44 -0
  221. package/esm/form/file-upload/FileUpload.js.map +1 -0
  222. package/esm/form/file-upload/FileUpload.types.d.ts +55 -0
  223. package/esm/form/file-upload/FileUpload.types.js +5 -0
  224. package/esm/form/file-upload/FileUpload.types.js.map +1 -0
  225. package/esm/form/file-upload/i18n/get.d.ts +2 -0
  226. package/esm/form/file-upload/i18n/get.js +34 -0
  227. package/esm/form/file-upload/i18n/get.js.map +1 -0
  228. package/esm/form/file-upload/i18n/i18n.context.d.ts +11 -0
  229. package/esm/form/file-upload/i18n/i18n.context.js +32 -0
  230. package/esm/form/file-upload/i18n/i18n.context.js.map +1 -0
  231. package/esm/form/file-upload/i18n/i18n.types.d.ts +13 -0
  232. package/esm/form/file-upload/i18n/i18n.types.js +2 -0
  233. package/esm/form/file-upload/i18n/i18n.types.js.map +1 -0
  234. package/esm/form/file-upload/i18n/locales/nb.json +20 -0
  235. package/esm/form/file-upload/i18n/merge.d.ts +2 -0
  236. package/esm/form/file-upload/i18n/merge.js +25 -0
  237. package/esm/form/file-upload/i18n/merge.js.map +1 -0
  238. package/esm/form/file-upload/index.d.ts +7 -0
  239. package/esm/form/file-upload/index.js +6 -0
  240. package/esm/form/file-upload/index.js.map +1 -0
  241. package/esm/form/file-upload/parts/Trigger.d.ts +7 -0
  242. package/esm/form/file-upload/parts/Trigger.js +18 -0
  243. package/esm/form/file-upload/parts/Trigger.js.map +1 -0
  244. package/esm/form/file-upload/parts/dropzone/Dropzone.d.ts +4 -0
  245. package/esm/form/file-upload/parts/dropzone/Dropzone.js +78 -0
  246. package/esm/form/file-upload/parts/dropzone/Dropzone.js.map +1 -0
  247. package/esm/form/file-upload/parts/dropzone/dropzone.types.d.ts +18 -0
  248. package/esm/form/file-upload/parts/dropzone/dropzone.types.js +2 -0
  249. package/esm/form/file-upload/parts/dropzone/dropzone.types.js.map +1 -0
  250. package/esm/form/file-upload/parts/dropzone/useDropzone.d.ts +13 -0
  251. package/esm/form/file-upload/parts/dropzone/useDropzone.js +30 -0
  252. package/esm/form/file-upload/parts/dropzone/useDropzone.js.map +1 -0
  253. package/esm/form/file-upload/parts/item/Item.d.ts +55 -0
  254. package/esm/form/file-upload/parts/item/Item.js +50 -0
  255. package/esm/form/file-upload/parts/item/Item.js.map +1 -0
  256. package/esm/form/file-upload/parts/item/Item.types.d.ts +5 -0
  257. package/esm/form/file-upload/parts/item/Item.types.js +2 -0
  258. package/esm/form/file-upload/parts/item/Item.types.js.map +1 -0
  259. package/esm/form/file-upload/parts/item/ItemButton.d.ts +12 -0
  260. package/esm/form/file-upload/parts/item/ItemButton.js +17 -0
  261. package/esm/form/file-upload/parts/item/ItemButton.js.map +1 -0
  262. package/esm/form/file-upload/parts/item/ItemIcon.d.ts +9 -0
  263. package/esm/form/file-upload/parts/item/ItemIcon.js +46 -0
  264. package/esm/form/file-upload/parts/item/ItemIcon.js.map +1 -0
  265. package/esm/form/file-upload/parts/item/ItemName.d.ts +9 -0
  266. package/esm/form/file-upload/parts/item/ItemName.js +27 -0
  267. package/esm/form/file-upload/parts/item/ItemName.js.map +1 -0
  268. package/esm/form/file-upload/parts/item/utils/download-file.d.ts +1 -0
  269. package/esm/form/file-upload/parts/item/utils/download-file.js +9 -0
  270. package/esm/form/file-upload/parts/item/utils/download-file.js.map +1 -0
  271. package/esm/form/file-upload/parts/item/utils/file-type-checker.d.ts +2 -0
  272. package/esm/form/file-upload/parts/item/utils/file-type-checker.js +2 -0
  273. package/esm/form/file-upload/parts/item/utils/file-type-checker.js.map +1 -0
  274. package/esm/form/file-upload/parts/item/utils/format-file-size.d.ts +2 -0
  275. package/esm/form/file-upload/parts/item/utils/format-file-size.js +20 -0
  276. package/esm/form/file-upload/parts/item/utils/format-file-size.js.map +1 -0
  277. package/esm/form/file-upload/useFileUpload.d.ts +12 -0
  278. package/esm/form/file-upload/useFileUpload.js +29 -0
  279. package/esm/form/file-upload/useFileUpload.js.map +1 -0
  280. package/esm/form/file-upload/utils/is-accepted-file-type.d.ts +1 -0
  281. package/esm/form/file-upload/utils/is-accepted-file-type.js +22 -0
  282. package/esm/form/file-upload/utils/is-accepted-file-type.js.map +1 -0
  283. package/esm/form/file-upload/utils/is-accepted-size.d.ts +1 -0
  284. package/esm/form/file-upload/utils/is-accepted-size.js +7 -0
  285. package/esm/form/file-upload/utils/is-accepted-size.js.map +1 -0
  286. package/esm/form/file-upload/utils/validate-files.d.ts +8 -0
  287. package/esm/form/file-upload/utils/validate-files.js +44 -0
  288. package/esm/form/file-upload/utils/validate-files.js.map +1 -0
  289. package/esm/form/radio/RadioGroup.d.ts +1 -1
  290. package/esm/form/search/Search.d.ts +3 -2
  291. package/esm/form/search/Search.js.map +1 -1
  292. package/esm/form/select/Select.d.ts +9 -9
  293. package/esm/form/switch/Switch.d.ts +5 -5
  294. package/esm/form/textarea/Textarea.d.ts +5 -4
  295. package/esm/form/textarea/Textarea.js.map +1 -1
  296. package/esm/form/useFormField.d.ts +10 -8
  297. package/esm/form/useFormField.js.map +1 -1
  298. package/esm/index.d.ts +1 -0
  299. package/esm/index.js +1 -0
  300. package/esm/index.js.map +1 -1
  301. package/esm/layout/bleed/Bleed.d.ts +9 -1
  302. package/esm/layout/bleed/Bleed.js.map +1 -1
  303. package/esm/layout/box/Box.d.ts +5 -5
  304. package/esm/layout/grid/HGrid.d.ts +1 -3
  305. package/esm/layout/grid/HGrid.js.map +1 -1
  306. package/esm/layout/page/Page.d.ts +2 -2
  307. package/esm/layout/responsive/Responsive.d.ts +2 -4
  308. package/esm/layout/responsive/Responsive.js.map +1 -1
  309. package/esm/layout/stack/Stack.d.ts +18 -4
  310. package/esm/layout/stack/Stack.js.map +1 -1
  311. package/esm/list/types.d.ts +1 -1
  312. package/esm/loader/Loader.d.ts +0 -6
  313. package/esm/loader/Loader.js.map +1 -1
  314. package/esm/modal/Modal.js +2 -2
  315. package/esm/modal/types.d.ts +8 -8
  316. package/esm/pagination/Pagination.d.ts +3 -2
  317. package/esm/pagination/Pagination.js.map +1 -1
  318. package/esm/pagination/PaginationItem.d.ts +1 -1
  319. package/esm/popover/Popover.d.ts +2 -1
  320. package/esm/popover/Popover.js.map +1 -1
  321. package/esm/read-more/ReadMore.d.ts +7 -7
  322. package/esm/stepper/Step.d.ts +4 -4
  323. package/esm/stepper/Stepper.d.ts +7 -5
  324. package/esm/stepper/Stepper.js.map +1 -1
  325. package/esm/table/AnimateHeight.d.ts +1 -1
  326. package/esm/table/DataCell.d.ts +1 -3
  327. package/esm/table/DataCell.js.map +1 -1
  328. package/esm/tabs/TabList.d.ts +1 -1
  329. package/esm/tabs/Tabs.d.ts +7 -7
  330. package/esm/timeline/Timeline.d.ts +6 -3
  331. package/esm/timeline/Timeline.js +2 -1
  332. package/esm/timeline/Timeline.js.map +1 -1
  333. package/esm/timeline/period/index.d.ts +3 -2
  334. package/esm/timeline/period/index.js.map +1 -1
  335. package/esm/tooltip/Tooltip.d.ts +19 -12
  336. package/esm/tooltip/Tooltip.js.map +1 -1
  337. package/esm/util/create-context.d.ts +1 -0
  338. package/esm/util/create-context.js.map +1 -1
  339. package/esm/util/hooks/useEventListener.d.ts +1 -1
  340. package/esm/util/hooks/useMergeRefs.d.ts +1 -1
  341. package/package.json +13 -3
  342. package/src/accordion/Accordion.tsx +4 -4
  343. package/src/accordion/accordion.stories.tsx +0 -2
  344. package/src/alert/Alert.tsx +12 -10
  345. package/src/button/Button.tsx +9 -8
  346. package/src/chat/Chat.tsx +6 -6
  347. package/src/chips/Chips.tsx +2 -2
  348. package/src/copybutton/CopyButton.tsx +14 -12
  349. package/src/date/datepicker/datepicker.stories.tsx +0 -1
  350. package/src/date/datepicker/types.ts +7 -6
  351. package/src/date/hooks/useDatepicker.tsx +4 -3
  352. package/src/date/hooks/useMonthPicker.tsx +4 -3
  353. package/src/date/monthpicker/types.ts +2 -1
  354. package/src/date/parts/DateInput.tsx +1 -1
  355. package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
  356. package/src/form/checkbox/CheckboxGroup.tsx +3 -3
  357. package/src/form/checkbox/types.ts +4 -4
  358. package/src/form/combobox/ComboboxProvider.tsx +7 -3
  359. package/src/form/combobox/FilteredOptions/FilteredOptions.tsx +22 -15
  360. package/src/form/combobox/FilteredOptions/filtered-options-util.ts +5 -10
  361. package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +19 -29
  362. package/src/form/combobox/Input/Input.tsx +14 -8
  363. package/src/form/combobox/SelectedOptions/SelectedOptions.tsx +8 -5
  364. package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +24 -25
  365. package/src/form/combobox/combobox-utils.test.ts +67 -0
  366. package/src/form/combobox/combobox-utils.ts +32 -0
  367. package/src/form/combobox/combobox.stories.tsx +67 -32
  368. package/src/form/combobox/combobox.test.tsx +32 -1
  369. package/src/form/combobox/customOptionsContext.tsx +9 -8
  370. package/src/form/combobox/types.ts +34 -22
  371. package/src/form/error-summary/ErrorSummary.tsx +5 -5
  372. package/src/form/file-upload/FileUpload.context.tsx +9 -0
  373. package/src/form/file-upload/FileUpload.tsx +142 -0
  374. package/src/form/file-upload/FileUpload.types.ts +57 -0
  375. package/src/form/file-upload/file-upload-dropzone.stories.tsx +123 -0
  376. package/src/form/file-upload/file-upload-item.stories.tsx +136 -0
  377. package/src/form/file-upload/file-upload.stories.tsx +236 -0
  378. package/src/form/file-upload/i18n/get.ts +48 -0
  379. package/src/form/file-upload/i18n/i18n.context.test.tsx +92 -0
  380. package/src/form/file-upload/i18n/i18n.context.ts +67 -0
  381. package/src/form/file-upload/i18n/i18n.types.ts +20 -0
  382. package/src/form/file-upload/i18n/locales/nb.json +20 -0
  383. package/src/form/file-upload/i18n/merge.ts +35 -0
  384. package/src/form/file-upload/index.ts +21 -0
  385. package/src/form/file-upload/parts/Trigger.tsx +48 -0
  386. package/src/form/file-upload/parts/dropzone/Dropzone.tsx +180 -0
  387. package/src/form/file-upload/parts/dropzone/dropzone.types.ts +22 -0
  388. package/src/form/file-upload/parts/dropzone/useDropzone.ts +43 -0
  389. package/src/form/file-upload/parts/item/Item.tsx +165 -0
  390. package/src/form/file-upload/parts/item/Item.types.ts +6 -0
  391. package/src/form/file-upload/parts/item/ItemButton.tsx +52 -0
  392. package/src/form/file-upload/parts/item/ItemIcon.tsx +74 -0
  393. package/src/form/file-upload/parts/item/ItemName.tsx +58 -0
  394. package/src/form/file-upload/parts/item/utils/download-file.ts +9 -0
  395. package/src/form/file-upload/parts/item/utils/file-type-checker.ts +4 -0
  396. package/src/form/file-upload/parts/item/utils/format-file-size.test.ts +76 -0
  397. package/src/form/file-upload/parts/item/utils/format-file-size.ts +25 -0
  398. package/src/form/file-upload/useFileUpload.ts +54 -0
  399. package/src/form/file-upload/utils/is-accepted-file-type.test.ts +69 -0
  400. package/src/form/file-upload/utils/is-accepted-file-type.ts +25 -0
  401. package/src/form/file-upload/utils/is-accepted-size.test.ts +26 -0
  402. package/src/form/file-upload/utils/is-accepted-size.ts +7 -0
  403. package/src/form/file-upload/utils/validate-files.test.ts +132 -0
  404. package/src/form/file-upload/utils/validate-files.ts +62 -0
  405. package/src/form/radio/RadioGroup.tsx +1 -1
  406. package/src/form/search/Search.tsx +3 -2
  407. package/src/form/select/Select.tsx +9 -9
  408. package/src/form/select/select.stories.tsx +32 -37
  409. package/src/form/switch/Switch.tsx +5 -5
  410. package/src/form/textarea/Textarea.tsx +5 -4
  411. package/src/form/useFormField.ts +10 -8
  412. package/src/index.ts +14 -0
  413. package/src/internal-header/header.stories.tsx +8 -5
  414. package/src/layout/bleed/Bleed.tsx +9 -1
  415. package/src/layout/box/Box.tsx +5 -5
  416. package/src/layout/grid/HGrid.tsx +1 -3
  417. package/src/layout/page/Page.tsx +2 -2
  418. package/src/layout/responsive/Responsive.tsx +2 -4
  419. package/src/layout/stack/Stack.tsx +18 -4
  420. package/src/list/types.ts +1 -1
  421. package/src/loader/Loader.tsx +0 -6
  422. package/src/modal/Modal.tsx +2 -2
  423. package/src/modal/types.ts +8 -8
  424. package/src/pagination/Pagination.tsx +3 -2
  425. package/src/pagination/PaginationItem.tsx +1 -1
  426. package/src/popover/Popover.tsx +2 -1
  427. package/src/read-more/ReadMore.tsx +7 -7
  428. package/src/stepper/Step.tsx +4 -4
  429. package/src/stepper/Stepper.tsx +7 -5
  430. package/src/table/AnimateHeight.tsx +1 -1
  431. package/src/table/DataCell.tsx +1 -6
  432. package/src/tabs/TabList.tsx +1 -1
  433. package/src/tabs/Tabs.tsx +7 -7
  434. package/src/timeline/Timeline.tsx +6 -3
  435. package/src/timeline/period/index.tsx +3 -2
  436. package/src/tooltip/Tooltip.tsx +19 -12
  437. package/src/util/create-context.tsx +1 -0
  438. package/src/util/hooks/useMergeRefs.ts +1 -1
@@ -0,0 +1,132 @@
1
+ import { validateFiles } from "./validate-files";
2
+
3
+ const createTxtFile = (name: string = "foo.txt") =>
4
+ new File(["foo"], name, {
5
+ type: "text/plain",
6
+ });
7
+ const createCsvFile = (name: string = "bar.csv") =>
8
+ new File(["abc,123"], name, {
9
+ type: "text/csv",
10
+ });
11
+
12
+ describe("partitionFiles", () => {
13
+ test("accepts all files when accept parameter is undefined", () => {
14
+ const files = [createTxtFile(), createCsvFile()];
15
+ const {
16
+ partitionedFiles: { accepted, rejected },
17
+ } = validateFiles(files);
18
+
19
+ expect(accepted.length).toBe(2);
20
+ expect(rejected.length).toBe(0);
21
+ });
22
+
23
+ test("accepts all files when accept parameter is empty", () => {
24
+ const files = [createTxtFile(), createCsvFile()];
25
+ const {
26
+ partitionedFiles: { accepted, rejected },
27
+ } = validateFiles(files, "");
28
+
29
+ expect(accepted.length).toBe(2);
30
+ expect(rejected.length).toBe(0);
31
+ });
32
+
33
+ test("rejects file that does not match accept parameter", () => {
34
+ const txtFileName = "foo.txt";
35
+ const csvFileName = "bar.csv";
36
+ const files = [createTxtFile(txtFileName), createCsvFile(csvFileName)];
37
+ const {
38
+ partitionedFiles: { accepted, rejected },
39
+ } = validateFiles(files, ".txt");
40
+
41
+ expect(accepted.length).toBe(1);
42
+ expect(rejected.length).toBe(1);
43
+ expect(accepted[0].name).toBe(txtFileName);
44
+ expect(rejected[0].file.name).toBe(csvFileName);
45
+ });
46
+
47
+ test("rejects file that does not pass validator", () => {
48
+ const txtFileName = "foo.txt";
49
+ const csvFileName = "bar.csv";
50
+ const csvFile = createCsvFile(csvFileName);
51
+ const txtFile = createTxtFile(txtFileName);
52
+ const files = [txtFile, csvFile];
53
+ const validator = (file: File) => {
54
+ if (file.name === txtFile.name) {
55
+ return true;
56
+ }
57
+ return "custom validation error";
58
+ };
59
+ const {
60
+ partitionedFiles: { accepted, rejected },
61
+ } = validateFiles(files, undefined, validator);
62
+
63
+ expect(accepted.length).toBe(1);
64
+ expect(rejected.length).toBe(1);
65
+ expect(accepted[0].name).toBe(txtFileName);
66
+ expect(rejected[0].file.name).toBe(csvFileName);
67
+ expect(rejected[0].reasons).toEqual(["custom validation error"]);
68
+ });
69
+
70
+ test("rejects file that passes accept parameter but does not pass validator", () => {
71
+ const txtFileName = "foo.txt";
72
+ const csvFileName = "bar.csv";
73
+ const csvFile = createCsvFile(csvFileName);
74
+ const txtFile = createTxtFile(txtFileName);
75
+ const files = [txtFile, csvFile];
76
+ const validator = (file: File) => {
77
+ if (file.name === txtFile.name) {
78
+ return true;
79
+ }
80
+ return "custom validation error";
81
+ };
82
+ const {
83
+ partitionedFiles: { accepted, rejected },
84
+ } = validateFiles(files, ".txt, .csv", validator);
85
+
86
+ expect(accepted.length).toBe(1);
87
+ expect(rejected.length).toBe(1);
88
+ expect(accepted[0].name).toBe(txtFileName);
89
+ expect(rejected[0].file.name).toBe(csvFileName);
90
+ });
91
+
92
+ test("rejects file that passes validator but does not pass accept parameter", () => {
93
+ const txtFileName = "foo.txt";
94
+ const csvFileName = "bar.csv";
95
+ const csvFile = createCsvFile(csvFileName);
96
+ const txtFile = createTxtFile(txtFileName);
97
+ const files = [txtFile, csvFile];
98
+ const validator = (file: File) => {
99
+ if (file.name === csvFile.name || file.name === txtFile.name) {
100
+ return true;
101
+ }
102
+ return "custom validation error";
103
+ };
104
+ const {
105
+ partitionedFiles: { accepted, rejected },
106
+ } = validateFiles(files, ".csv", validator);
107
+
108
+ expect(accepted.length).toBe(1);
109
+ expect(rejected.length).toBe(1);
110
+ expect(accepted[0].name).toBe(csvFileName);
111
+ expect(rejected[0].file.name).toBe(txtFileName);
112
+ expect(rejected[0].reasons).toEqual(["fileType"]);
113
+ });
114
+
115
+ test("rejects file that is too large", () => {
116
+ const txtFileName = "foo.txt";
117
+ const csvFileName = "bar.csv";
118
+ const csvFile = createCsvFile(csvFileName);
119
+ const txtFile = createTxtFile(txtFileName);
120
+ const files = [txtFile, csvFile];
121
+ const maxSizeInBytes = 5;
122
+ const {
123
+ partitionedFiles: { accepted, rejected },
124
+ } = validateFiles(files, undefined, undefined, maxSizeInBytes);
125
+
126
+ expect(accepted.length).toBe(1);
127
+ expect(rejected.length).toBe(1);
128
+ expect(accepted[0].name).toBe(txtFileName);
129
+ expect(rejected[0].file.name).toBe(csvFileName);
130
+ expect(rejected[0].reasons).toEqual(["fileSize"]);
131
+ });
132
+ });
@@ -0,0 +1,62 @@
1
+ import {
2
+ FileObject,
3
+ FileUploadBaseProps,
4
+ FilesPartitioned,
5
+ fileRejectionReason,
6
+ } from "../FileUpload.types";
7
+ import { isAcceptedFileType } from "./is-accepted-file-type";
8
+ import { isAcceptedSize } from "./is-accepted-size";
9
+
10
+ export const validateFiles = (
11
+ files: File[],
12
+ accept?: string,
13
+ validator?: FileUploadBaseProps["validator"],
14
+ maxSizeInBytes: number = -1,
15
+ ) => {
16
+ const allFiles: FileObject[] = [];
17
+ const accepted: File[] = [];
18
+ const rejected: FilesPartitioned["rejected"] = [];
19
+
20
+ files.forEach((file) => {
21
+ const acceptedFileType = isAcceptedFileType(file, accept);
22
+ const acceptedFileSize = isAcceptedSize(file, maxSizeInBytes);
23
+ const customValidation = validator ? validator(file) : true;
24
+
25
+ const reasons: FilesPartitioned["rejected"][0]["reasons"] = [];
26
+ if (customValidation !== true) {
27
+ reasons.push(customValidation);
28
+ }
29
+
30
+ if (!acceptedFileType) {
31
+ reasons.push(fileRejectionReason.FileType);
32
+ }
33
+
34
+ if (!acceptedFileSize) {
35
+ reasons.push(fileRejectionReason.FileSize);
36
+ }
37
+
38
+ allFiles.push({
39
+ file,
40
+ error: reasons.length > 0,
41
+ reasons,
42
+ });
43
+
44
+ if (reasons.length === 0) {
45
+ accepted.push(file);
46
+ return;
47
+ }
48
+
49
+ rejected.push({
50
+ file,
51
+ reasons,
52
+ });
53
+ });
54
+
55
+ return {
56
+ files: allFiles,
57
+ partitionedFiles: {
58
+ accepted,
59
+ rejected,
60
+ },
61
+ };
62
+ };
@@ -21,7 +21,7 @@ export interface RadioGroupProps
21
21
  "onChange" | "errorPropagation" | "defaultValue"
22
22
  > {
23
23
  /**
24
- * Collection of <Radio />-elements
24
+ * Collection of `<Radio />`-elements
25
25
  */
26
26
  children: React.ReactNode;
27
27
  /**
@@ -26,8 +26,9 @@ export interface SearchProps
26
26
  Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "type"> {
27
27
  children?: React.ReactNode;
28
28
  /**
29
- * Search label
30
- * @note Will be hidden by default, is required for accessibility reasons.
29
+ * Search label.
30
+ *
31
+ * Will be hidden by default, is required for accessibility reasons.
31
32
  */
32
33
  label: React.ReactNode;
33
34
  /**
@@ -8,27 +8,27 @@ import { FormFieldProps, useFormField } from "../useFormField";
8
8
 
9
9
  export interface SelectProps
10
10
  extends FormFieldProps,
11
- Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
11
+ Omit<SelectHTMLAttributes<HTMLSelectElement>, "size" | "multiple"> {
12
12
  /**
13
- * Collection of <option />-elements
13
+ * Collection of <option />-elements.
14
14
  */
15
15
  children: React.ReactNode;
16
16
  /**
17
- * Exposes the HTML size attribute
17
+ * Exposes the HTML size attribute.
18
18
  */
19
19
  htmlSize?: number;
20
20
  /**
21
- * Label for select
21
+ * Sets inline-style on select wrapper.
22
22
  */
23
- label: React.ReactNode;
23
+ style?: React.CSSProperties;
24
24
  /**
25
- * If enabled shows the label and description for screenreaders only
25
+ * Label for select.
26
26
  */
27
- hideLabel?: boolean;
27
+ label: React.ReactNode;
28
28
  /**
29
- * Sets inline-style on select wrapper
29
+ * Shows label and description for screenreaders only.
30
30
  */
31
- style?: React.CSSProperties;
31
+ hideLabel?: boolean;
32
32
  }
33
33
 
34
34
  /**
@@ -1,36 +1,15 @@
1
- import { Meta, StoryObj } from "@storybook/react";
1
+ import { Meta, StoryFn, StoryObj } from "@storybook/react";
2
2
  import React from "react";
3
- import Select from "./Select";
3
+ import Select, { SelectProps } from "./Select";
4
4
 
5
- export default {
5
+ const meta: Meta<typeof Select> = {
6
6
  title: "ds-react/Select",
7
7
  component: Select,
8
- argTypes: {
9
- size: {
10
- control: {
11
- type: "radio",
12
- options: ["medium", "small"],
13
- },
14
- },
15
- description: {
16
- type: "string",
17
- },
18
- error: {
19
- type: "string",
20
- },
21
- hideLabel: {
22
- type: "boolean",
23
- },
24
- disabled: {
25
- type: "boolean",
26
- },
27
- },
28
8
  parameters: {
29
9
  chromatic: { disable: true },
30
10
  },
31
- } as Meta;
32
-
33
- type Story = StoryObj<typeof Select>;
11
+ };
12
+ export default meta;
34
13
 
35
14
  const content = (
36
15
  <>
@@ -40,16 +19,32 @@ const content = (
40
19
  </>
41
20
  );
42
21
 
43
- export const Default = {
44
- render: (props) => {
45
- return (
46
- <Select {...props} label="Ipsum enim quis culpa">
47
- {content}
48
- </Select>
49
- );
22
+ export const Default: StoryFn<Omit<SelectProps, "children">> = (props) => (
23
+ <Select {...props}>{content}</Select>
24
+ );
25
+ Default.args = {
26
+ label: "Ipsum enim quis culpa",
27
+ };
28
+ Default.argTypes = {
29
+ description: {
30
+ type: "string",
31
+ },
32
+ size: {
33
+ control: { type: "radio" },
34
+ options: ["medium", "small"],
35
+ },
36
+ error: {
37
+ type: "string",
38
+ },
39
+ hideLabel: {
40
+ type: "boolean",
41
+ },
42
+ disabled: {
43
+ type: "boolean",
44
+ },
45
+ readOnly: {
46
+ type: "boolean",
50
47
  },
51
-
52
- args: {},
53
48
  };
54
49
 
55
50
  export const Small = () => {
@@ -138,12 +133,12 @@ export const Readonly = () => {
138
133
  );
139
134
  };
140
135
 
141
- export const Chromatic: Story = {
136
+ export const Chromatic: StoryObj<typeof Select> = {
142
137
  render: () => (
143
138
  <div>
144
139
  <div>
145
140
  <h2>Default</h2>
146
- {Default.render?.({ label: "Ipsum enim quis culpa" })}
141
+ <Default label="Ipsum enim quis culpa" />
147
142
  </div>
148
143
  <div>
149
144
  <h2>Small</h2>
@@ -36,24 +36,24 @@ export interface SwitchProps
36
36
  extends Omit<FormFieldProps, "error" | "errorId">,
37
37
  Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
38
38
  /**
39
- * Switch-label
39
+ * Switch-label.
40
40
  */
41
41
  children: React.ReactNode;
42
42
  /**
43
- * If enabled shows the label and description for screenreaders only
43
+ * If enabled shows the label and description for screenreaders only.
44
44
  */
45
45
  hideLabel?: boolean;
46
46
  /**
47
- * Toggles loading state with loader-component on switch
47
+ * Toggles loading state with loader-component on switch.
48
48
  */
49
49
  loading?: boolean;
50
50
  /**
51
- * Positions switch on left/right side of label
51
+ * Positions switch on left/right side of label.
52
52
  * @default "left"
53
53
  */
54
54
  position?: "left" | "right";
55
55
  /**
56
- * Adds a description to extend labling of Switch
56
+ * Adds a description to extend labling of Switch.
57
57
  */
58
58
  description?: string;
59
59
  }
@@ -17,7 +17,8 @@ export interface TextareaProps
17
17
  React.TextareaHTMLAttributes<HTMLTextAreaElement> {
18
18
  /**
19
19
  * Allowed character-count for content
20
- * @note This is just a visual indicator! You will need to handle actual character-limits/validation if needed
20
+ *
21
+ * This is just a visual indicator! You will still need to handle actual character-limits/validation if needed.
21
22
  */
22
23
  maxLength?: number;
23
24
  /**
@@ -37,15 +38,15 @@ export interface TextareaProps
37
38
  */
38
39
  minRows?: number;
39
40
  /**
40
- * Textarea label
41
+ * Textarea label.
41
42
  */
42
43
  label: React.ReactNode;
43
44
  /**
44
- * If enabled shows the label and description for screenreaders only
45
+ * If enabled shows the label and description for screenreaders only.
45
46
  */
46
47
  hideLabel?: boolean;
47
48
  /**
48
- * Enables resizing of field
49
+ * Enables resizing of field.
49
50
  */
50
51
  resize?: boolean | "vertical" | "horizontal";
51
52
  /**
@@ -5,32 +5,34 @@ import { FieldsetContext } from "./fieldset/context";
5
5
 
6
6
  export interface FormFieldProps {
7
7
  /**
8
- * Error message for element
8
+ * Adds a description to extend labling of the field.
9
+ * Error message for element.
9
10
  */
10
11
  error?: React.ReactNode;
11
12
  /**
12
- * Override internal errorId
13
+ * Override internal errorId.
13
14
  */
14
15
  errorId?: string;
15
16
  /**
16
- * Changes font-size, padding and gaps
17
+ * Changes font-size, padding and gaps.
17
18
  */
18
19
  size?: "medium" | "small";
19
20
  /**
20
- * Disables element
21
- * @note Avoid using if possible for accessibility purposes
21
+ * **Avoid using if possible for accessibility purposes**.
22
+ *
23
+ * Disables element.
22
24
  */
23
25
  disabled?: boolean;
24
26
  /**
25
- * Adds a description to extend labling of a field
27
+ * Adds a description to extend labling of a field.
26
28
  */
27
29
  description?: React.ReactNode;
28
30
  /**
29
- * Override internal id
31
+ * Override internal id.
30
32
  */
31
33
  id?: string;
32
34
  /**
33
- * Read only-state
35
+ * Read-only state.
34
36
  */
35
37
  readOnly?: boolean;
36
38
  }
package/src/index.ts CHANGED
@@ -136,6 +136,20 @@ export { Select, type SelectProps } from "./form/select";
136
136
  export { Switch, type SwitchProps } from "./form/switch";
137
137
  export { Textarea, type TextareaProps } from "./form/textarea";
138
138
  export { TextField, type TextFieldProps } from "./form/textfield";
139
+ export {
140
+ UNSAFE_FileUpload,
141
+ type FileUploadDropzoneProps,
142
+ type FileUploadTriggerProps,
143
+ type FileObject,
144
+ type FileRejected,
145
+ type FileAccepted,
146
+ type FileRejectedPartitioned,
147
+ type FilesPartitioned,
148
+ type FileRejectionReason,
149
+ type FileUploadItemProps,
150
+ type FileItem,
151
+ type FileMetadata,
152
+ } from "./form/file-upload";
139
153
 
140
154
  /**
141
155
  * @deprecated
@@ -2,10 +2,12 @@ import { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
  import {
4
4
  ChevronDownIcon,
5
+ CogIcon,
5
6
  ExternalLinkIcon,
7
+ LeaveIcon,
6
8
  MenuGridIcon,
7
9
  } from "@navikt/aksel-icons";
8
- import { BodyLong, BodyShort, Detail } from "@navikt/ds-react";
10
+ import { BodyLong, BodyShort, Detail, Spacer } from "@navikt/ds-react";
9
11
  import { Dropdown } from "../dropdown";
10
12
  import InternalHeader from "./InternalHeader";
11
13
 
@@ -102,10 +104,11 @@ export const Default = {
102
104
  <Dropdown.Menu.Divider />
103
105
  <Dropdown.Menu.List>
104
106
  <Dropdown.Menu.List.Item as="a" href="/#settings">
105
- Innstillinger
107
+ Innstillinger <Spacer />{" "}
108
+ <CogIcon aria-hidden fontSize="1.5rem" />
106
109
  </Dropdown.Menu.List.Item>
107
110
  <Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
108
- Logg ut
111
+ Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
109
112
  </Dropdown.Menu.List.Item>
110
113
  </Dropdown.Menu.List>
111
114
  </Dropdown.Menu>
@@ -180,10 +183,10 @@ export const UserWithMenu = () => (
180
183
  <Dropdown.Menu.Divider />
181
184
  <Dropdown.Menu.List>
182
185
  <Dropdown.Menu.List.Item as="a" href="/#settings">
183
- Innstillinger
186
+ Innstillinger <Spacer /> <CogIcon aria-hidden fontSize="1.5rem" />
184
187
  </Dropdown.Menu.List.Item>
185
188
  <Dropdown.Menu.List.Item onClick={() => console.log("logg ut")}>
186
- Logg ut
189
+ Logg ut <Spacer /> <LeaveIcon aria-hidden fontSize="1.5rem" />
187
190
  </Dropdown.Menu.List.Item>
188
191
  </Dropdown.Menu.List>
189
192
  </Dropdown.Menu>
@@ -9,7 +9,11 @@ export type BleedSpacingBlock = "0" | "px" | SpacingScale;
9
9
 
10
10
  export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
11
11
  /** **Negative** horizontal margin around children.
12
- * Accepts a spacing token or an object of spacing tokens for different breakpoints.
12
+ * Accepts a spacing token or an object of spacing tokens for different breakpoints.
13
+ *
14
+ * The `px` value is useful to nudge by just 1px.
15
+ * The `full` value is used to extend the margin to the full width of the parent.
16
+ *
13
17
  * @example
14
18
  * marginInline='4'
15
19
  * marginInline='4 5'
@@ -20,6 +24,10 @@ export interface BleedProps extends React.HTMLAttributes<HTMLDivElement> {
20
24
  >;
21
25
  /** **Negative** vertical margin around children.
22
26
  * Accepts a spacing token or an object of spacing tokens for different breakpoints.
27
+ *
28
+ * The `px` value is useful to nudge by just 1px.
29
+ * This prop does **not** accept the `full` value.
30
+ *
23
31
  * @example
24
32
  * marginBlock='4'
25
33
  * marginBlock='4 5'
@@ -13,11 +13,11 @@ import {
13
13
  } from "../utilities/types";
14
14
 
15
15
  export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
16
- /** Background color. Accepts a color token. */
16
+ /** CSS `background-color` property. Accepts a color token. */
17
17
  background?: BackgroundToken;
18
- /** Border color. Accepts a color token. */
18
+ /** CSS `border-color` property. Accepts a color token. */
19
19
  borderColor?: BorderColorToken;
20
- /** Border radius. Accepts a radius token, or an object of radius tokens for different breakpoints.
20
+ /** CSS `border-radius` property. Accepts a radius token, or an object of radius tokens for different breakpoints.
21
21
  * @example
22
22
  * borderRadius='full'
23
23
  * borderRadius='0 full large small'
@@ -25,13 +25,13 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  */
26
26
  borderRadius?: ResponsiveProp<SpaceDelimitedAttribute<BorderRadiiToken>>;
27
27
  /**
28
- * Border-width. If this is not set there will be no border.
28
+ * CSS `border-width` property. If this is not set there will be no border.
29
29
  * @example
30
30
  * borderWidth='2'
31
31
  * borderWidth='1 2 3 4'
32
32
  */
33
33
  borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
34
- /** Spacing around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
34
+ /** Padding around children. Accepts a spacing token or an object of spacing tokens for different breakpoints.
35
35
  * @example
36
36
  * padding='4'
37
37
  * padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
@@ -6,13 +6,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
6
6
  export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
7
7
  children: React.ReactNode;
8
8
  /**
9
- * Number of columns to display. Can be a number, a string with a unit or tokens for spesific breakpoints.
9
+ * Number of columns to display. Can be a number, a string with a unit, or tokens for specific breakpoints.
10
10
  * Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
11
11
  * @example
12
12
  * columns={{ sm: 1, md: 1, lg: "1fr auto", xl: "1fr auto"}}
13
- * @example
14
13
  * columns={3}
15
- * @example
16
14
  * columns="repeat(3, minmax(0, 1fr))"
17
15
  */
18
16
  columns?: ResponsiveProp<number | string>;
@@ -12,7 +12,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
12
12
  as?: "div" | "body";
13
13
  /**
14
14
  * Background color. Accepts a color token.
15
- * @default bg-default
15
+ * @default "bg-default"
16
16
  */
17
17
  background?: keyof typeof bgColors.a | "surface-subtle";
18
18
  /**
@@ -25,7 +25,7 @@ export interface PageProps extends React.HTMLAttributes<HTMLElement> {
25
25
  footerPosition?: "belowFold";
26
26
  /**
27
27
  * Adds a standardised padding of 4rem between content and footer
28
- * @default block-end
28
+ * @default "end"
29
29
  */
30
30
  contentBlockPadding?: "end" | "none";
31
31
  }
@@ -6,13 +6,11 @@ import { BreakpointsAlias } from "../utilities/types";
6
6
  export interface ResponsiveProps extends HTMLAttributes<HTMLDivElement> {
7
7
  children: React.ReactNode;
8
8
  /**
9
- * @example
10
- * above='md'
9
+ * Will show/hide element above breakpoint (inclusive)
11
10
  */
12
11
  above?: Exclude<BreakpointsAlias, "xs">;
13
12
  /**
14
- * @example
15
- * below='md'
13
+ * Will show/hide element below breakpoint (inclusive)
16
14
  */
17
15
  below?: Exclude<BreakpointsAlias, "xs">;
18
16
  /**
@@ -7,7 +7,11 @@ import { ResponsiveProp, SpacingScale } from "../utilities/types";
7
7
  export interface StackProps extends HTMLAttributes<HTMLDivElement> {
8
8
  children: React.ReactNode;
9
9
  /**
10
- * Justify-content
10
+ * CSS `justify-content` property.
11
+ *
12
+ * @example
13
+ * justify='center'
14
+ * justify={{xs: 'start', sm: 'center', md: 'end', lg: 'space-around', xl: 'space-between'}}
11
15
  */
12
16
  justify?: ResponsiveProp<
13
17
  | "start"
@@ -18,22 +22,32 @@ export interface StackProps extends HTMLAttributes<HTMLDivElement> {
18
22
  | "space-evenly"
19
23
  >;
20
24
  /**
21
- * Align-items
25
+ * CSS `align-items` property.
26
+ *
27
+ * @example
28
+ * align='center'
29
+ * align={{xs: 'start', sm: 'center', md: 'end', lg: 'baseline', xl: 'stretch'}}
22
30
  */
23
31
  align?: ResponsiveProp<"start" | "center" | "end" | "baseline" | "stretch">;
24
32
  /**
25
- * flex-wrap
33
+ * Sets the CSS `flex-wrap` property.
26
34
  */
27
35
  wrap?: boolean;
28
36
  /**
37
+ * CSS `gap` property.
38
+ *
29
39
  * @example
30
40
  * gap='4'
31
41
  * gap={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
32
42
  */
33
43
  gap?: ResponsiveProp<SpacingScale>;
34
44
  /**
35
- * flex-direction
45
+ * CSS `flex-direction` property.
36
46
  * @default "row"
47
+ *
48
+ * @example
49
+ * direction='row'
50
+ * direction={{xs: 'row', sm: 'column'}}
37
51
  */
38
52
  direction?: ResponsiveProp<"row" | "column">;
39
53
  }