@navikt/ds-react 5.13.0 → 5.15.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 (359) hide show
  1. package/_docs.json +206 -135
  2. package/cjs/accordion/AccordionHeader.js +2 -4
  3. package/cjs/button/Button.js +11 -12
  4. package/cjs/chips/Removable.js +3 -6
  5. package/cjs/copybutton/CopyButton.js +4 -5
  6. package/cjs/date/datepicker/DatePicker.js +4 -2
  7. package/cjs/date/datepicker/parts/WeekRow.js +2 -2
  8. package/cjs/date/monthpicker/MonthPicker.js +4 -3
  9. package/cjs/date/parts/DateWrapper.js +2 -2
  10. package/cjs/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
  11. package/cjs/dropdown/Menu/List/Item.js +3 -6
  12. package/cjs/dropdown/Toggle.js +6 -5
  13. package/cjs/form/ConfirmationPanel.js +2 -2
  14. package/cjs/form/Textarea.js +2 -1
  15. package/cjs/form/checkbox/Checkbox.js +3 -2
  16. package/cjs/form/combobox/Combobox.js +2 -2
  17. package/cjs/form/combobox/FilteredOptions/filteredOptionsContext.js +3 -4
  18. package/cjs/form/combobox/Input/inputContext.js +2 -2
  19. package/cjs/form/combobox/SelectedOptions/selectedOptionsContext.js +2 -5
  20. package/cjs/form/error-summary/ErrorSummary.js +2 -2
  21. package/cjs/form/radio/Radio.js +3 -2
  22. package/cjs/form/radio/RadioGroup.js +2 -2
  23. package/cjs/form/search/Search.js +2 -1
  24. package/cjs/form/search/SearchButton.js +2 -4
  25. package/cjs/form/useFormField.js +2 -2
  26. package/cjs/guide-panel/Illustration.js +2 -2
  27. package/cjs/help-text/HelpText.js +5 -7
  28. package/cjs/help-text/HelpTextIcon.js +2 -2
  29. package/cjs/list/List.js +2 -2
  30. package/cjs/loader/Loader.js +2 -1
  31. package/cjs/modal/Modal.js +21 -18
  32. package/cjs/modal/dialog-polyfill.js +2 -2
  33. package/cjs/popover/Popover.js +6 -5
  34. package/cjs/read-more/ReadMore.js +2 -4
  35. package/cjs/stepper/Step.js +6 -6
  36. package/cjs/{util → table}/AnimateHeight.js +4 -5
  37. package/cjs/table/DataCell.js +2 -2
  38. package/cjs/table/ExpandableRow.js +9 -9
  39. package/cjs/table/HeaderCell.js +2 -1
  40. package/cjs/tabs/TabList.js +2 -1
  41. package/cjs/tag/Tag.js +4 -2
  42. package/cjs/timeline/Pin.js +2 -2
  43. package/cjs/timeline/period/ClickablePeriod.js +2 -2
  44. package/cjs/toggle-group/ToggleGroup.js +2 -2
  45. package/cjs/tooltip/Tooltip.js +6 -5
  46. package/cjs/util/Slot.js +2 -5
  47. package/cjs/util/TextareaAutoSize.js +7 -5
  48. package/cjs/util/composeEventHandlers.js +17 -0
  49. package/cjs/util/hooks/index.js +19 -0
  50. package/cjs/util/hooks/package.json +6 -0
  51. package/cjs/util/hooks/useClientLayoutEffect.js +7 -0
  52. package/cjs/util/hooks/useMergeRefs.js +37 -0
  53. package/cjs/util/{usePrevious.js → hooks/usePrevious.js} +2 -1
  54. package/cjs/util/index.js +7 -7
  55. package/cjs/util/types/index.js +2 -0
  56. package/cjs/util/types/package.json +6 -0
  57. package/esm/accordion/AccordionHeader.js +2 -4
  58. package/esm/accordion/AccordionHeader.js.map +1 -1
  59. package/esm/button/Button.d.ts +1 -1
  60. package/esm/button/Button.js +12 -13
  61. package/esm/button/Button.js.map +1 -1
  62. package/esm/chips/Chips.d.ts +1 -1
  63. package/esm/chips/Removable.js +3 -6
  64. package/esm/chips/Removable.js.map +1 -1
  65. package/esm/chips/Toggle.d.ts +1 -1
  66. package/esm/copybutton/CopyButton.js +4 -5
  67. package/esm/copybutton/CopyButton.js.map +1 -1
  68. package/esm/date/datepicker/DatePicker.js +5 -3
  69. package/esm/date/datepicker/DatePicker.js.map +1 -1
  70. package/esm/date/datepicker/parts/WeekRow.js +1 -1
  71. package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
  72. package/esm/date/monthpicker/MonthPicker.js +4 -3
  73. package/esm/date/monthpicker/MonthPicker.js.map +1 -1
  74. package/esm/date/parts/DateWrapper.js +1 -1
  75. package/esm/date/parts/DateWrapper.js.map +1 -1
  76. package/esm/date/utils/dates-disabled.d.ts +1 -1
  77. package/esm/date/utils/dates-disabled.js.map +1 -1
  78. package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
  79. package/esm/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
  80. package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
  81. package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
  82. package/esm/dropdown/Menu/List/Item.d.ts +1 -1
  83. package/esm/dropdown/Menu/List/Item.js +3 -6
  84. package/esm/dropdown/Menu/List/Item.js.map +1 -1
  85. package/esm/dropdown/Menu/List/index.d.ts +1 -1
  86. package/esm/dropdown/Toggle.js +6 -5
  87. package/esm/dropdown/Toggle.js.map +1 -1
  88. package/esm/expansion-card/ExpansionCard.d.ts +1 -1
  89. package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
  90. package/esm/form/ConfirmationPanel.js +1 -1
  91. package/esm/form/ConfirmationPanel.js.map +1 -1
  92. package/esm/form/Textarea.js +2 -1
  93. package/esm/form/Textarea.js.map +1 -1
  94. package/esm/form/checkbox/Checkbox.js +2 -1
  95. package/esm/form/checkbox/Checkbox.js.map +1 -1
  96. package/esm/form/combobox/Combobox.js +3 -3
  97. package/esm/form/combobox/Combobox.js.map +1 -1
  98. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +1 -2
  99. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  100. package/esm/form/combobox/FilteredOptions/useVirtualFocus.js.map +1 -1
  101. package/esm/form/combobox/Input/inputContext.js +1 -1
  102. package/esm/form/combobox/Input/inputContext.js.map +1 -1
  103. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +1 -1
  104. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
  105. package/esm/form/error-summary/ErrorSummary.js +1 -1
  106. package/esm/form/error-summary/ErrorSummary.js.map +1 -1
  107. package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
  108. package/esm/form/radio/Radio.js +2 -1
  109. package/esm/form/radio/Radio.js.map +1 -1
  110. package/esm/form/radio/RadioGroup.js +1 -1
  111. package/esm/form/radio/RadioGroup.js.map +1 -1
  112. package/esm/form/search/Search.js +4 -3
  113. package/esm/form/search/Search.js.map +1 -1
  114. package/esm/form/search/SearchButton.js +2 -4
  115. package/esm/form/search/SearchButton.js.map +1 -1
  116. package/esm/form/useFormField.js +1 -1
  117. package/esm/form/useFormField.js.map +1 -1
  118. package/esm/guide-panel/Illustration.js +1 -1
  119. package/esm/guide-panel/Illustration.js.map +1 -1
  120. package/esm/help-text/HelpText.d.ts +0 -5
  121. package/esm/help-text/HelpText.js +6 -8
  122. package/esm/help-text/HelpText.js.map +1 -1
  123. package/esm/help-text/HelpTextIcon.js +1 -1
  124. package/esm/internal-header/InternalHeader.d.ts +1 -1
  125. package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
  126. package/esm/internal-header/InternalHeaderTitle.d.ts +1 -1
  127. package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -1
  128. package/esm/layout/box/Box.d.ts +1 -1
  129. package/esm/layout/page/parts/PageBlock.d.ts +1 -1
  130. package/esm/layout/stack/HStack.d.ts +1 -1
  131. package/esm/layout/stack/Stack.d.ts +1 -1
  132. package/esm/layout/stack/VStack.d.ts +1 -1
  133. package/esm/link/Link.d.ts +1 -1
  134. package/esm/link-panel/LinkPanel.d.ts +1 -1
  135. package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
  136. package/esm/list/List.js +1 -1
  137. package/esm/loader/Loader.js +2 -1
  138. package/esm/loader/Loader.js.map +1 -1
  139. package/esm/modal/Modal.js +21 -18
  140. package/esm/modal/Modal.js.map +1 -1
  141. package/esm/modal/dialog-polyfill.js +2 -2
  142. package/esm/modal/dialog-polyfill.js.map +1 -1
  143. package/esm/modal/types.d.ts +1 -1
  144. package/esm/pagination/PaginationItem.d.ts +1 -1
  145. package/esm/panel/Panel.d.ts +1 -1
  146. package/esm/popover/Popover.d.ts +1 -1
  147. package/esm/popover/Popover.js +4 -3
  148. package/esm/popover/Popover.js.map +1 -1
  149. package/esm/read-more/ReadMore.js +2 -4
  150. package/esm/read-more/ReadMore.js.map +1 -1
  151. package/esm/stepper/Step.d.ts +1 -1
  152. package/esm/stepper/Step.js +6 -6
  153. package/esm/stepper/Step.js.map +1 -1
  154. package/esm/{util → table}/AnimateHeight.js +4 -5
  155. package/esm/table/AnimateHeight.js.map +1 -0
  156. package/esm/table/DataCell.d.ts +4 -0
  157. package/esm/table/DataCell.js +2 -2
  158. package/esm/table/DataCell.js.map +1 -1
  159. package/esm/table/ExpandableRow.js +8 -8
  160. package/esm/table/ExpandableRow.js.map +1 -1
  161. package/esm/table/HeaderCell.d.ts +4 -0
  162. package/esm/table/HeaderCell.js +2 -1
  163. package/esm/table/HeaderCell.js.map +1 -1
  164. package/esm/tabs/Tab.d.ts +1 -1
  165. package/esm/tabs/TabList.js +3 -2
  166. package/esm/tabs/TabList.js.map +1 -1
  167. package/esm/tabs/Tabs.d.ts +1 -1
  168. package/esm/tag/Tag.d.ts +4 -0
  169. package/esm/tag/Tag.js +4 -2
  170. package/esm/tag/Tag.js.map +1 -1
  171. package/esm/timeline/Pin.js +3 -3
  172. package/esm/timeline/Pin.js.map +1 -1
  173. package/esm/timeline/period/ClickablePeriod.js +3 -3
  174. package/esm/timeline/period/ClickablePeriod.js.map +1 -1
  175. package/esm/toggle-group/ToggleGroup.js +1 -1
  176. package/esm/toggle-group/ToggleGroup.js.map +1 -1
  177. package/esm/tooltip/Tooltip.js +6 -5
  178. package/esm/tooltip/Tooltip.js.map +1 -1
  179. package/esm/typography/BodyLong.d.ts +1 -1
  180. package/esm/typography/BodyShort.d.ts +1 -1
  181. package/esm/typography/Detail.d.ts +1 -1
  182. package/esm/typography/ErrorMessage.d.ts +1 -1
  183. package/esm/typography/Heading.d.ts +1 -1
  184. package/esm/typography/Ingress.d.ts +1 -1
  185. package/esm/typography/Label.d.ts +1 -1
  186. package/esm/util/Slot.js +1 -1
  187. package/esm/util/Slot.js.map +1 -1
  188. package/esm/util/TextareaAutoSize.js +5 -3
  189. package/esm/util/TextareaAutoSize.js.map +1 -1
  190. package/esm/util/composeEventHandlers.d.ts +8 -0
  191. package/esm/util/composeEventHandlers.js +14 -0
  192. package/esm/util/composeEventHandlers.js.map +1 -0
  193. package/esm/util/hooks/index.d.ts +8 -0
  194. package/esm/util/hooks/index.js +9 -0
  195. package/esm/util/hooks/index.js.map +1 -0
  196. package/esm/util/hooks/useClientLayoutEffect.js +5 -0
  197. package/esm/util/hooks/useClientLayoutEffect.js.map +1 -0
  198. package/esm/util/{useEventListener.d.ts → hooks/useEventListener.d.ts} +1 -1
  199. package/esm/util/hooks/useEventListener.js.map +1 -0
  200. package/esm/util/hooks/useId.js.map +1 -0
  201. package/esm/util/hooks/useMedia.js.map +1 -0
  202. package/esm/util/hooks/useMergeRefs.d.ts +15 -0
  203. package/esm/util/hooks/useMergeRefs.js +30 -0
  204. package/esm/util/hooks/useMergeRefs.js.map +1 -0
  205. package/esm/util/hooks/usePrevious.d.ts +1 -0
  206. package/esm/util/{usePrevious.js → hooks/usePrevious.js} +1 -2
  207. package/esm/util/hooks/usePrevious.js.map +1 -0
  208. package/esm/util/index.d.ts +4 -5
  209. package/esm/util/index.js +3 -5
  210. package/esm/util/index.js.map +1 -1
  211. package/esm/util/types/OverridableComponent.js.map +1 -0
  212. package/esm/util/types/index.d.ts +1 -0
  213. package/esm/util/types/index.js +2 -0
  214. package/esm/util/types/index.js.map +1 -0
  215. package/package.json +3 -3
  216. package/src/accordion/AccordionHeader.tsx +2 -4
  217. package/src/accordion/AccordionItem.tsx +2 -2
  218. package/src/alert/alert.stories.tsx +1 -2
  219. package/src/button/Button.tsx +14 -19
  220. package/src/button/button.stories.tsx +2 -2
  221. package/src/chips/Chips.tsx +1 -1
  222. package/src/chips/Removable.tsx +3 -4
  223. package/src/chips/Toggle.tsx +1 -1
  224. package/src/copybutton/CopyButton.tsx +4 -5
  225. package/src/copybutton/copy-button.stories.tsx +1 -1
  226. package/src/date/datepicker/DatePicker.tsx +5 -3
  227. package/src/date/datepicker/parts/WeekRow.tsx +1 -1
  228. package/src/date/monthpicker/MonthPicker.tsx +4 -3
  229. package/src/date/parts/DateWrapper.tsx +1 -1
  230. package/src/date/utils/dates-disabled.ts +1 -1
  231. package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +23 -23
  232. package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
  233. package/src/dropdown/Menu/List/Item.tsx +23 -23
  234. package/src/dropdown/Menu/List/index.tsx +1 -1
  235. package/src/dropdown/Toggle.tsx +10 -6
  236. package/src/expansion-card/ExpansionCard.tsx +1 -1
  237. package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
  238. package/src/form/ConfirmationPanel.tsx +1 -1
  239. package/src/form/Textarea.tsx +2 -1
  240. package/src/form/checkbox/Checkbox.tsx +2 -1
  241. package/src/form/combobox/Combobox.tsx +3 -6
  242. package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +1 -2
  243. package/src/form/combobox/FilteredOptions/useVirtualFocus.ts +1 -1
  244. package/src/form/combobox/Input/inputContext.tsx +1 -1
  245. package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +1 -1
  246. package/src/form/combobox/combobox.stories.tsx +10 -11
  247. package/src/form/error-summary/ErrorSummary.tsx +1 -1
  248. package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
  249. package/src/form/radio/Radio.tsx +2 -1
  250. package/src/form/radio/RadioGroup.tsx +1 -1
  251. package/src/form/search/Search.tsx +3 -3
  252. package/src/form/search/SearchButton.tsx +2 -4
  253. package/src/form/useFormField.ts +1 -1
  254. package/src/guide-panel/Illustration.tsx +1 -1
  255. package/src/help-text/HelpText.tsx +7 -25
  256. package/src/help-text/HelpTextIcon.tsx +1 -1
  257. package/src/help-text/help-text.stories.tsx +58 -68
  258. package/src/internal-header/InternalHeader.tsx +1 -1
  259. package/src/internal-header/InternalHeaderButton.tsx +1 -1
  260. package/src/internal-header/InternalHeaderTitle.tsx +1 -1
  261. package/src/internal-header/InternalHeaderUserButton.tsx +1 -1
  262. package/src/layout/box/Box.tsx +1 -1
  263. package/src/layout/page/parts/PageBlock.tsx +1 -1
  264. package/src/layout/stack/HStack.tsx +1 -1
  265. package/src/layout/stack/Stack.tsx +1 -1
  266. package/src/layout/stack/VStack.tsx +1 -1
  267. package/src/link/Link.tsx +1 -1
  268. package/src/link/{link.stories.tsx → stories/link.stories.tsx} +2 -2
  269. package/src/link-panel/LinkPanel.tsx +1 -1
  270. package/src/link-panel/LinkPanelTitle.tsx +1 -1
  271. package/src/list/List.tsx +1 -1
  272. package/src/loader/Loader.tsx +2 -1
  273. package/src/modal/Modal.tsx +30 -30
  274. package/src/modal/dialog-polyfill.ts +2 -2
  275. package/src/modal/types.ts +1 -1
  276. package/src/pagination/PaginationItem.tsx +1 -1
  277. package/src/panel/Panel.tsx +1 -1
  278. package/src/popover/Popover.tsx +4 -7
  279. package/src/read-more/ReadMore.tsx +2 -4
  280. package/src/stepper/Step.tsx +8 -5
  281. package/src/{util → table}/AnimateHeight.tsx +5 -9
  282. package/src/table/DataCell.tsx +6 -1
  283. package/src/table/ExpandableRow.tsx +11 -6
  284. package/src/table/HeaderCell.tsx +6 -1
  285. package/src/table/stories/table.stories.tsx +43 -29
  286. package/src/table/stories/tests/table.stories.tsx +2 -3
  287. package/src/tabs/Tab.tsx +1 -1
  288. package/src/tabs/TabList.tsx +4 -2
  289. package/src/tabs/Tabs.tsx +1 -1
  290. package/src/tag/Tag.tsx +9 -2
  291. package/src/tag/tag.stories.tsx +27 -1
  292. package/src/timeline/Pin.tsx +3 -6
  293. package/src/timeline/period/ClickablePeriod.tsx +3 -6
  294. package/src/toggle-group/ToggleGroup.tsx +1 -1
  295. package/src/tooltip/Tooltip.tsx +11 -22
  296. package/src/typography/BodyLong.tsx +1 -1
  297. package/src/typography/BodyShort.tsx +1 -1
  298. package/src/typography/Detail.tsx +1 -1
  299. package/src/typography/ErrorMessage.tsx +1 -1
  300. package/src/typography/Heading.tsx +1 -1
  301. package/src/typography/Ingress.tsx +1 -1
  302. package/src/typography/Label.tsx +1 -1
  303. package/src/typography/stories/bodylong.stories.tsx +1 -2
  304. package/src/typography/stories/bodyshort.stories.tsx +1 -2
  305. package/src/typography/stories/detail.stories.tsx +1 -2
  306. package/src/typography/stories/error-message.stories.tsx +1 -2
  307. package/src/typography/stories/heading.stories.tsx +1 -2
  308. package/src/typography/stories/ingress.stories.tsx +1 -2
  309. package/src/typography/stories/label.stories.tsx +1 -2
  310. package/src/util/Slot.tsx +1 -1
  311. package/src/util/TextareaAutoSize.tsx +7 -3
  312. package/src/util/__tests__/useMedia.test.tsx +1 -1
  313. package/src/util/composeEventHandlers.ts +19 -0
  314. package/src/util/hooks/index.ts +8 -0
  315. package/src/util/hooks/useCallbackRef.ts +1 -1
  316. package/src/util/hooks/useClientLayoutEffect.ts +5 -0
  317. package/src/util/hooks/useControllableState.ts +1 -1
  318. package/src/util/hooks/useMergeRefs.ts +32 -0
  319. package/src/util/{usePrevious.ts → hooks/usePrevious.ts} +1 -4
  320. package/src/util/index.ts +4 -5
  321. package/src/util/types/index.ts +1 -0
  322. package/cjs/util/RandomIcon.js +0 -38
  323. package/cjs/util/mergeRefs.js +0 -16
  324. package/cjs/util/useClientLayoutEffect.js +0 -10
  325. package/esm/util/AnimateHeight.js.map +0 -1
  326. package/esm/util/OverridableComponent.js.map +0 -1
  327. package/esm/util/RandomIcon.d.ts +0 -2
  328. package/esm/util/RandomIcon.js +0 -9
  329. package/esm/util/RandomIcon.js.map +0 -1
  330. package/esm/util/mergeRefs.d.ts +0 -2
  331. package/esm/util/mergeRefs.js +0 -14
  332. package/esm/util/mergeRefs.js.map +0 -1
  333. package/esm/util/useClientLayoutEffect.js +0 -8
  334. package/esm/util/useClientLayoutEffect.js.map +0 -1
  335. package/esm/util/useEventListener.js.map +0 -1
  336. package/esm/util/useId.js.map +0 -1
  337. package/esm/util/useMedia.js.map +0 -1
  338. package/esm/util/usePrevious.d.ts +0 -2
  339. package/esm/util/usePrevious.js.map +0 -1
  340. package/src/util/mergeRefs.tsx +0 -16
  341. package/src/util/useClientLayoutEffect.ts +0 -11
  342. /package/cjs/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
  343. /package/cjs/util/{useId.js → hooks/useId.js} +0 -0
  344. /package/cjs/util/{useMedia.js → hooks/useMedia.js} +0 -0
  345. /package/cjs/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
  346. /package/esm/{util → table}/AnimateHeight.d.ts +0 -0
  347. /package/esm/util/{useClientLayoutEffect.d.ts → hooks/useClientLayoutEffect.d.ts} +0 -0
  348. /package/esm/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
  349. /package/esm/util/{useId.d.ts → hooks/useId.d.ts} +0 -0
  350. /package/esm/util/{useId.js → hooks/useId.js} +0 -0
  351. /package/esm/util/{useMedia.d.ts → hooks/useMedia.d.ts} +0 -0
  352. /package/esm/util/{useMedia.js → hooks/useMedia.js} +0 -0
  353. /package/esm/util/{OverridableComponent.d.ts → types/OverridableComponent.d.ts} +0 -0
  354. /package/esm/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
  355. /package/src/{util → link/stories}/RandomIcon.tsx +0 -0
  356. /package/src/util/{useEventListener.ts → hooks/useEventListener.ts} +0 -0
  357. /package/src/util/{useId.ts → hooks/useId.ts} +0 -0
  358. /package/src/util/{useMedia.ts → hooks/useMedia.ts} +0 -0
  359. /package/src/util/{OverridableComponent.ts → types/OverridableComponent.ts} +0 -0
package/_docs.json CHANGED
@@ -4172,27 +4172,6 @@
4172
4172
  "name": "string"
4173
4173
  }
4174
4174
  },
4175
- "placement": {
4176
- "defaultValue": {
4177
- "value": "top"
4178
- },
4179
- "description": "Default dialog-placement on open",
4180
- "name": "placement",
4181
- "parent": {
4182
- "fileName": "src/help-text/HelpText.tsx",
4183
- "name": "HelpTextProps"
4184
- },
4185
- "declarations": [
4186
- {
4187
- "fileName": "src/help-text/HelpText.tsx",
4188
- "name": "HelpTextProps"
4189
- }
4190
- ],
4191
- "required": false,
4192
- "type": {
4193
- "name": "\"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\""
4194
- }
4195
- },
4196
4175
  "wrapperClassName": {
4197
4176
  "defaultValue": null,
4198
4177
  "description": "Classname for wrapper",
@@ -4252,6 +4231,27 @@
4252
4231
  "name": "\"absolute\" | \"fixed\""
4253
4232
  }
4254
4233
  },
4234
+ "placement": {
4235
+ "defaultValue": {
4236
+ "value": "\"top\""
4237
+ },
4238
+ "description": "Default orientation of popover\n@note Try to keep general usage to \"top\", \"bottom\", \"left\", \"right\"",
4239
+ "name": "placement",
4240
+ "parent": {
4241
+ "fileName": "react/src/popover/Popover.tsx",
4242
+ "name": "PopoverProps"
4243
+ },
4244
+ "declarations": [
4245
+ {
4246
+ "fileName": "react/src/popover/Popover.tsx",
4247
+ "name": "PopoverProps"
4248
+ }
4249
+ ],
4250
+ "required": false,
4251
+ "type": {
4252
+ "name": "\"top\" | \"bottom\" | \"right\" | \"left\" | \"top-start\" | \"top-end\" | \"bottom-start\" | \"bottom-end\" | \"right-start\" | \"right-end\" | \"left-start\" | \"left-end\""
4253
+ }
4254
+ },
4255
4255
  "ref": {
4256
4256
  "defaultValue": null,
4257
4257
  "description": "Allows getting a ref to the component instance.\nOnce the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).\n@see https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom",
@@ -5024,7 +5024,7 @@
5024
5024
  ],
5025
5025
  "required": false,
5026
5026
  "type": {
5027
- "name": "ElementType<any>"
5027
+ "name": "ElementType<any, keyof IntrinsicElements>"
5028
5028
  }
5029
5029
  },
5030
5030
  "size": {
@@ -5422,7 +5422,7 @@
5422
5422
  },
5423
5423
  "onCancel": {
5424
5424
  "defaultValue": null,
5425
- "description": "*Sometimes** called when the user presses the Esc key, unless you return `false` in `onBeforeClose()`.\n@warning *Some browsers does not always trigger this event. Chrome only triggers it if you have\ninteracted with the modal, and will not trigger it a second time if you press Esc twice in a row.",
5425
+ "description": "*Sometimes** called when the user presses the Esc key.\n@warning *Some browsers does not always trigger this event. Chrome only triggers it if you have\ninteracted with the modal, and will not trigger it a second time if you press Esc twice in a row.",
5426
5426
  "name": "onCancel",
5427
5427
  "parent": {
5428
5428
  "fileName": "react/src/modal/types.ts",
@@ -6357,7 +6357,7 @@
6357
6357
  "defaultValue": {
6358
6358
  "value": "\"top\""
6359
6359
  },
6360
- "description": "Orientation for popover\n@note Try to keep general usage to \"top\", \"bottom\", \"left\", \"right\"",
6360
+ "description": "Default orientation of popover\n@note Try to keep general usage to \"top\", \"bottom\", \"left\", \"right\"",
6361
6361
  "name": "placement",
6362
6362
  "parent": {
6363
6363
  "fileName": "src/popover/Popover.tsx",
@@ -7122,6 +7122,111 @@
7122
7122
  }
7123
7123
  }
7124
7124
  },
7125
+ {
7126
+ "filePath": "src/table/AnimateHeight.tsx",
7127
+ "displayName": "AnimateHeight",
7128
+ "props": {
7129
+ "duration": {
7130
+ "defaultValue": {
7131
+ "value": "250ms"
7132
+ },
7133
+ "description": "",
7134
+ "name": "duration",
7135
+ "parent": {
7136
+ "fileName": "src/table/AnimateHeight.tsx",
7137
+ "name": "AnimateHeightProps"
7138
+ },
7139
+ "declarations": [
7140
+ {
7141
+ "fileName": "src/table/AnimateHeight.tsx",
7142
+ "name": "AnimateHeightProps"
7143
+ }
7144
+ ],
7145
+ "required": false,
7146
+ "type": {
7147
+ "name": "number"
7148
+ }
7149
+ },
7150
+ "easing": {
7151
+ "defaultValue": {
7152
+ "value": "ease"
7153
+ },
7154
+ "description": "",
7155
+ "name": "easing",
7156
+ "parent": {
7157
+ "fileName": "src/table/AnimateHeight.tsx",
7158
+ "name": "AnimateHeightProps"
7159
+ },
7160
+ "declarations": [
7161
+ {
7162
+ "fileName": "src/table/AnimateHeight.tsx",
7163
+ "name": "AnimateHeightProps"
7164
+ }
7165
+ ],
7166
+ "required": false,
7167
+ "type": {
7168
+ "name": "string"
7169
+ }
7170
+ },
7171
+ "height": {
7172
+ "defaultValue": null,
7173
+ "description": "",
7174
+ "name": "height",
7175
+ "parent": {
7176
+ "fileName": "src/table/AnimateHeight.tsx",
7177
+ "name": "AnimateHeightProps"
7178
+ },
7179
+ "declarations": [
7180
+ {
7181
+ "fileName": "src/table/AnimateHeight.tsx",
7182
+ "name": "AnimateHeightProps"
7183
+ }
7184
+ ],
7185
+ "required": true,
7186
+ "type": {
7187
+ "name": "Height"
7188
+ }
7189
+ },
7190
+ "innerClassName": {
7191
+ "defaultValue": null,
7192
+ "description": "",
7193
+ "name": "innerClassName",
7194
+ "parent": {
7195
+ "fileName": "src/table/AnimateHeight.tsx",
7196
+ "name": "AnimateHeightProps"
7197
+ },
7198
+ "declarations": [
7199
+ {
7200
+ "fileName": "src/table/AnimateHeight.tsx",
7201
+ "name": "AnimateHeightProps"
7202
+ }
7203
+ ],
7204
+ "required": false,
7205
+ "type": {
7206
+ "name": "string"
7207
+ }
7208
+ },
7209
+ "className": {
7210
+ "defaultValue": null,
7211
+ "description": "",
7212
+ "name": "className",
7213
+ "parent": {
7214
+ "fileName": "aksel/node_modules/@types/react/index.d.ts",
7215
+ "name": "HTMLAttributes"
7216
+ },
7217
+ "declarations": [
7218
+ {
7219
+ "fileName": "aksel/node_modules/@types/react/index.d.ts",
7220
+ "name": "HTMLAttributes"
7221
+ }
7222
+ ],
7223
+ "required": false,
7224
+ "type": {
7225
+ "name": "string"
7226
+ }
7227
+ }
7228
+ }
7229
+ },
7125
7230
  {
7126
7231
  "filePath": "src/table/Body.tsx",
7127
7232
  "displayName": "Body",
@@ -7250,6 +7355,25 @@
7250
7355
  "name": "\"left\" | \"center\" | \"right\""
7251
7356
  }
7252
7357
  },
7358
+ "textSize": {
7359
+ "defaultValue": null,
7360
+ "description": "Adjusts font-size",
7361
+ "name": "textSize",
7362
+ "parent": {
7363
+ "fileName": "react/src/table/HeaderCell.tsx",
7364
+ "name": "HeaderCellProps"
7365
+ },
7366
+ "declarations": [
7367
+ {
7368
+ "fileName": "react/src/table/HeaderCell.tsx",
7369
+ "name": "HeaderCellProps"
7370
+ }
7371
+ ],
7372
+ "required": false,
7373
+ "type": {
7374
+ "name": "\"medium\" | \"small\""
7375
+ }
7376
+ },
7253
7377
  "className": {
7254
7378
  "defaultValue": null,
7255
7379
  "description": "",
@@ -7315,6 +7439,25 @@
7315
7439
  "name": "\"left\" | \"center\" | \"right\""
7316
7440
  }
7317
7441
  },
7442
+ "textSize": {
7443
+ "defaultValue": null,
7444
+ "description": "Adjusts font-size",
7445
+ "name": "textSize",
7446
+ "parent": {
7447
+ "fileName": "src/table/DataCell.tsx",
7448
+ "name": "DataCellProps"
7449
+ },
7450
+ "declarations": [
7451
+ {
7452
+ "fileName": "src/table/DataCell.tsx",
7453
+ "name": "DataCellProps"
7454
+ }
7455
+ ],
7456
+ "required": false,
7457
+ "type": {
7458
+ "name": "\"medium\" | \"small\""
7459
+ }
7460
+ },
7318
7461
  "className": {
7319
7462
  "defaultValue": null,
7320
7463
  "description": "",
@@ -7691,6 +7834,25 @@
7691
7834
  "name": "\"left\" | \"center\" | \"right\""
7692
7835
  }
7693
7836
  },
7837
+ "textSize": {
7838
+ "defaultValue": null,
7839
+ "description": "Adjusts font-size",
7840
+ "name": "textSize",
7841
+ "parent": {
7842
+ "fileName": "src/table/HeaderCell.tsx",
7843
+ "name": "HeaderCellProps"
7844
+ },
7845
+ "declarations": [
7846
+ {
7847
+ "fileName": "src/table/HeaderCell.tsx",
7848
+ "name": "HeaderCellProps"
7849
+ }
7850
+ ],
7851
+ "required": false,
7852
+ "type": {
7853
+ "name": "\"medium\" | \"small\""
7854
+ }
7855
+ },
7694
7856
  "className": {
7695
7857
  "defaultValue": null,
7696
7858
  "description": "",
@@ -8416,6 +8578,25 @@
8416
8578
  "name": "\"medium\" | \"small\" | \"xsmall\""
8417
8579
  }
8418
8580
  },
8581
+ "icon": {
8582
+ "defaultValue": null,
8583
+ "description": "Tag Icon",
8584
+ "name": "icon",
8585
+ "parent": {
8586
+ "fileName": "src/tag/Tag.tsx",
8587
+ "name": "TagProps"
8588
+ },
8589
+ "declarations": [
8590
+ {
8591
+ "fileName": "src/tag/Tag.tsx",
8592
+ "name": "TagProps"
8593
+ }
8594
+ ],
8595
+ "required": false,
8596
+ "type": {
8597
+ "name": "ReactNode"
8598
+ }
8599
+ },
8419
8600
  "className": {
8420
8601
  "defaultValue": null,
8421
8602
  "description": "",
@@ -10313,111 +10494,6 @@
10313
10494
  }
10314
10495
  }
10315
10496
  },
10316
- {
10317
- "filePath": "src/util/AnimateHeight.tsx",
10318
- "displayName": "AnimateHeight",
10319
- "props": {
10320
- "duration": {
10321
- "defaultValue": {
10322
- "value": "250ms"
10323
- },
10324
- "description": "",
10325
- "name": "duration",
10326
- "parent": {
10327
- "fileName": "src/util/AnimateHeight.tsx",
10328
- "name": "AnimateHeightProps"
10329
- },
10330
- "declarations": [
10331
- {
10332
- "fileName": "src/util/AnimateHeight.tsx",
10333
- "name": "AnimateHeightProps"
10334
- }
10335
- ],
10336
- "required": false,
10337
- "type": {
10338
- "name": "number"
10339
- }
10340
- },
10341
- "easing": {
10342
- "defaultValue": {
10343
- "value": "ease"
10344
- },
10345
- "description": "",
10346
- "name": "easing",
10347
- "parent": {
10348
- "fileName": "src/util/AnimateHeight.tsx",
10349
- "name": "AnimateHeightProps"
10350
- },
10351
- "declarations": [
10352
- {
10353
- "fileName": "src/util/AnimateHeight.tsx",
10354
- "name": "AnimateHeightProps"
10355
- }
10356
- ],
10357
- "required": false,
10358
- "type": {
10359
- "name": "string"
10360
- }
10361
- },
10362
- "height": {
10363
- "defaultValue": null,
10364
- "description": "",
10365
- "name": "height",
10366
- "parent": {
10367
- "fileName": "src/util/AnimateHeight.tsx",
10368
- "name": "AnimateHeightProps"
10369
- },
10370
- "declarations": [
10371
- {
10372
- "fileName": "src/util/AnimateHeight.tsx",
10373
- "name": "AnimateHeightProps"
10374
- }
10375
- ],
10376
- "required": true,
10377
- "type": {
10378
- "name": "Height"
10379
- }
10380
- },
10381
- "innerClassName": {
10382
- "defaultValue": null,
10383
- "description": "",
10384
- "name": "innerClassName",
10385
- "parent": {
10386
- "fileName": "src/util/AnimateHeight.tsx",
10387
- "name": "AnimateHeightProps"
10388
- },
10389
- "declarations": [
10390
- {
10391
- "fileName": "src/util/AnimateHeight.tsx",
10392
- "name": "AnimateHeightProps"
10393
- }
10394
- ],
10395
- "required": false,
10396
- "type": {
10397
- "name": "string"
10398
- }
10399
- },
10400
- "className": {
10401
- "defaultValue": null,
10402
- "description": "",
10403
- "name": "className",
10404
- "parent": {
10405
- "fileName": "aksel/node_modules/@types/react/index.d.ts",
10406
- "name": "HTMLAttributes"
10407
- },
10408
- "declarations": [
10409
- {
10410
- "fileName": "aksel/node_modules/@types/react/index.d.ts",
10411
- "name": "HTMLAttributes"
10412
- }
10413
- ],
10414
- "required": false,
10415
- "type": {
10416
- "name": "string"
10417
- }
10418
- }
10419
- }
10420
- },
10421
10497
  {
10422
10498
  "filePath": "src/util/Slot.tsx",
10423
10499
  "displayName": "Slot",
@@ -10565,11 +10641,6 @@
10565
10641
  }
10566
10642
  }
10567
10643
  },
10568
- {
10569
- "filePath": "src/util/mergeRefs.tsx",
10570
- "displayName": "mergeRefs",
10571
- "props": {}
10572
- },
10573
10644
  {
10574
10645
  "filePath": "src/date/context/useSharedMonthContext.tsx",
10575
10646
  "displayName": "SharedMonthProvider",
@@ -15884,7 +15955,7 @@
15884
15955
  ],
15885
15956
  "required": false,
15886
15957
  "type": {
15887
- "name": "ElementType<any>"
15958
+ "name": "ElementType<any, keyof IntrinsicElements>"
15888
15959
  }
15889
15960
  },
15890
15961
  "className": {
@@ -41,6 +41,7 @@ const clsx_1 = __importDefault(require("clsx"));
41
41
  const react_1 = __importStar(require("react"));
42
42
  const aksel_icons_1 = require("@navikt/aksel-icons");
43
43
  const typography_1 = require("../typography");
44
+ const composeEventHandlers_1 = require("../util/composeEventHandlers");
44
45
  const AccordionContext_1 = require("./AccordionContext");
45
46
  const AccordionItem_1 = require("./AccordionItem");
46
47
  const AccordionHeader = (0, react_1.forwardRef)((_a, ref) => {
@@ -52,10 +53,7 @@ const AccordionHeader = (0, react_1.forwardRef)((_a, ref) => {
52
53
  console.error("<Accordion.Header> has to be used within an <Accordion.Item>, which in turn must be within an <Accordion>");
53
54
  return null;
54
55
  }
55
- return (react_1.default.createElement("button", Object.assign({ ref: ref }, rest, { className: (0, clsx_1.default)("navds-accordion__header", className), onClick: (e) => {
56
- itemContext.toggleOpen();
57
- onClick && onClick(e);
58
- }, "aria-expanded": itemContext.open, type: "button" }),
56
+ return (react_1.default.createElement("button", Object.assign({ ref: ref }, rest, { className: (0, clsx_1.default)("navds-accordion__header", className), onClick: (0, composeEventHandlers_1.composeEventHandlers)(onClick, itemContext.toggleOpen), "aria-expanded": itemContext.open, type: "button" }),
59
57
  react_1.default.createElement("span", { className: "navds-accordion__icon-wrapper" },
60
58
  react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { className: "navds-accordion__header-chevron", title: "Vis mer", "aria-hidden": true })),
61
59
  react_1.default.createElement(typography_1.Heading, { size: (_b = accordionContext === null || accordionContext === void 0 ? void 0 : accordionContext.headingSize) !== null && _b !== void 0 ? _b : "small", as: "span", className: "navds-accordion__header-content" }, children)));
@@ -43,6 +43,9 @@ const react_1 = __importStar(require("react"));
43
43
  const loader_1 = require("../loader");
44
44
  const typography_1 = require("../typography");
45
45
  const util_1 = require("../util");
46
+ const composeEventHandlers_1 = require("../util/composeEventHandlers");
47
+ const hooks_1 = require("../util/hooks");
48
+ const useMergeRefs_1 = require("../util/hooks/useMergeRefs");
46
49
  /**
47
50
  * A button component
48
51
  * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/button)
@@ -57,8 +60,8 @@ exports.Button = (0, react_1.forwardRef)((_a, ref) => {
57
60
  var { as: Component = "button", variant = "primary", className, children, size = "medium", loading = false, disabled, style, icon, iconPosition = "left" } = _a, rest = __rest(_a, ["as", "variant", "className", "children", "size", "loading", "disabled", "style", "icon", "iconPosition"]);
58
61
  const buttonRef = (0, react_1.useRef)(null);
59
62
  const [widthOverride, setWidthOverride] = (0, react_1.useState)();
60
- const mergedRef = (0, react_1.useMemo)(() => (0, util_1.mergeRefs)([buttonRef, ref]), [ref]);
61
- (0, util_1.useClientLayoutEffect)(() => {
63
+ const mergedRef = (0, useMergeRefs_1.useMergeRefs)(buttonRef, ref);
64
+ (0, hooks_1.useClientLayoutEffect)(() => {
62
65
  if (loading) {
63
66
  const requestID = window.requestAnimationFrame(() => {
64
67
  var _a, _b;
@@ -71,16 +74,12 @@ exports.Button = (0, react_1.forwardRef)((_a, ref) => {
71
74
  }
72
75
  }, [loading, children]);
73
76
  const filterProps = (disabled !== null && disabled !== void 0 ? disabled : widthOverride) ? (0, util_1.omit)(rest, ["href"]) : rest;
74
- return (react_1.default.createElement(Component, Object.assign({}, (Component !== "button" ? { role: "button" } : {}), filterProps, { ref: mergedRef, onKeyUp: (e) => {
75
- var _a;
76
- (_a = filterProps.onKeyUp) === null || _a === void 0 ? void 0 : _a.call(filterProps, e);
77
- if (e.key === " " &&
78
- !disabled &&
79
- !widthOverride &&
80
- !e.isDefaultPrevented()) {
81
- e.currentTarget.click();
82
- }
83
- }, className: (0, clsx_1.default)(className, "navds-button", `navds-button--${variant}`, `navds-button--${size}`, {
77
+ const handleKeyUp = (e) => {
78
+ if (e.key === " " && !disabled && !widthOverride) {
79
+ e.currentTarget.click();
80
+ }
81
+ };
82
+ return (react_1.default.createElement(Component, Object.assign({}, (Component !== "button" ? { role: "button" } : {}), filterProps, { ref: mergedRef, onKeyUp: (0, composeEventHandlers_1.composeEventHandlers)(filterProps.onKeyUp, handleKeyUp), className: (0, clsx_1.default)(className, "navds-button", `navds-button--${variant}`, `navds-button--${size}`, {
84
83
  "navds-button--loading": widthOverride,
85
84
  "navds-button--icon-only": !!icon && !children,
86
85
  "navds-button--disabled": disabled !== null && disabled !== void 0 ? disabled : widthOverride,
@@ -41,13 +41,10 @@ exports.RemovableChips = void 0;
41
41
  const clsx_1 = __importDefault(require("clsx"));
42
42
  const react_1 = __importStar(require("react"));
43
43
  const aksel_icons_1 = require("@navikt/aksel-icons");
44
+ const composeEventHandlers_1 = require("../util/composeEventHandlers");
44
45
  exports.RemovableChips = (0, react_1.forwardRef)((_a, ref) => {
45
- var { className, children, variant = "action", removeLabel = "slett", onDelete, type = "button" } = _a, rest = __rest(_a, ["className", "children", "variant", "removeLabel", "onDelete", "type"]);
46
- return (react_1.default.createElement("button", Object.assign({}, rest, { ref: ref, type: type, className: (0, clsx_1.default)("navds-chips__chip navds-chips__removable navds-chips--icon-right", className, `navds-chips__removable--${variant}`), "aria-label": `${children} ${removeLabel}`, onClick: (e) => {
47
- var _a;
48
- onDelete === null || onDelete === void 0 ? void 0 : onDelete();
49
- (_a = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, e);
50
- } }),
46
+ var { className, children, variant = "action", removeLabel = "slett", onDelete, type = "button", onClick } = _a, rest = __rest(_a, ["className", "children", "variant", "removeLabel", "onDelete", "type", "onClick"]);
47
+ return (react_1.default.createElement("button", Object.assign({}, rest, { ref: ref, type: type, className: (0, clsx_1.default)("navds-chips__chip navds-chips__removable navds-chips--icon-right", className, `navds-chips__removable--${variant}`), "aria-label": `${children} ${removeLabel}`, onClick: (0, composeEventHandlers_1.composeEventHandlers)(onClick, onDelete) }),
51
48
  react_1.default.createElement("span", { className: "navds-chips__chip-text" }, children),
52
49
  react_1.default.createElement("span", { className: "navds-chips__removable-icon" },
53
50
  react_1.default.createElement(aksel_icons_1.XMarkIcon, { "aria-hidden": true }))));
@@ -42,6 +42,7 @@ const clsx_1 = __importDefault(require("clsx"));
42
42
  const react_1 = __importStar(require("react"));
43
43
  const aksel_icons_1 = require("@navikt/aksel-icons");
44
44
  const typography_1 = require("../typography");
45
+ const composeEventHandlers_1 = require("../util/composeEventHandlers");
45
46
  const copy_1 = __importDefault(require("../util/copy"));
46
47
  /**
47
48
  * A button component that copies text to the clipboard when clicked.
@@ -55,7 +56,7 @@ const copy_1 = __importDefault(require("../util/copy"));
55
56
  * ```
56
57
  */
57
58
  exports.CopyButton = (0, react_1.forwardRef)((_a, ref) => {
58
- var { className, copyText, text, activeText = "Kopiert!", variant = "neutral", size = "medium", onActiveChange, icon, activeIcon, activeDuration = 2000, title = "Kopier", activeTitle = "Kopiert", iconPosition = "left" } = _a, rest = __rest(_a, ["className", "copyText", "text", "activeText", "variant", "size", "onActiveChange", "icon", "activeIcon", "activeDuration", "title", "activeTitle", "iconPosition"]);
59
+ var { className, copyText, text, activeText = "Kopiert!", variant = "neutral", size = "medium", onActiveChange, icon, activeIcon, activeDuration = 2000, title = "Kopier", activeTitle = "Kopiert", iconPosition = "left", onClick } = _a, rest = __rest(_a, ["className", "copyText", "text", "activeText", "variant", "size", "onActiveChange", "icon", "activeIcon", "activeDuration", "title", "activeTitle", "iconPosition", "onClick"]);
59
60
  const [active, setActive] = (0, react_1.useState)(false);
60
61
  const timeoutRef = (0, react_1.useRef)();
61
62
  (0, react_1.useEffect)(() => {
@@ -63,13 +64,11 @@ exports.CopyButton = (0, react_1.forwardRef)((_a, ref) => {
63
64
  timeoutRef.current && clearTimeout(timeoutRef.current);
64
65
  };
65
66
  }, []);
66
- const handleClick = (event) => {
67
- var _a;
67
+ const handleClick = () => {
68
68
  timeoutRef.current && clearTimeout(timeoutRef.current);
69
69
  (0, copy_1.default)(copyText);
70
70
  setActive(true);
71
71
  onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(true);
72
- (_a = rest.onClick) === null || _a === void 0 ? void 0 : _a.call(rest, event);
73
72
  timeoutRef.current = window.setTimeout(() => {
74
73
  setActive(false);
75
74
  onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(false);
@@ -82,7 +81,7 @@ exports.CopyButton = (0, react_1.forwardRef)((_a, ref) => {
82
81
  "navds-copybutton--icon-only": !text,
83
82
  "navds-copybutton--icon-right": iconPosition === "right",
84
83
  "navds-copybutton--active": active,
85
- }), onClick: handleClick }),
84
+ }), onClick: (0, composeEventHandlers_1.composeEventHandlers)(onClick, handleClick) }),
86
85
  react_1.default.createElement("span", { className: "navds-copybutton__content" },
87
86
  iconPosition === "left" && copyIcon,
88
87
  text &&
@@ -43,6 +43,8 @@ const isWeekend_1 = __importDefault(require("date-fns/isWeekend"));
43
43
  const react_1 = __importStar(require("react"));
44
44
  const react_day_picker_1 = require("react-day-picker");
45
45
  const util_1 = require("../../util");
46
+ const hooks_1 = require("../../util/hooks");
47
+ const useMergeRefs_1 = require("../../util/hooks/useMergeRefs");
46
48
  const context_1 = require("../context");
47
49
  const DateInput_1 = require("../parts/DateInput");
48
50
  const DateWrapper_1 = require("../parts/DateWrapper");
@@ -80,10 +82,10 @@ const WeekNumber_1 = __importDefault(require("./parts/WeekNumber"));
80
82
  exports.DatePicker = (0, react_1.forwardRef)((_a, ref) => {
81
83
  var _b;
82
84
  var { children, locale = "nb", dropdownCaption, disabled = [], disableWeekends = false, showWeekNumber = false, selected, id, defaultSelected, className, wrapperClassName, open: _open, onClose, onOpenToggle, strategy, onWeekNumberClick } = _a, rest = __rest(_a, ["children", "locale", "dropdownCaption", "disabled", "disableWeekends", "showWeekNumber", "selected", "id", "defaultSelected", "className", "wrapperClassName", "open", "onClose", "onOpenToggle", "strategy", "onWeekNumberClick"]);
83
- const ariaId = (0, util_1.useId)(id);
85
+ const ariaId = (0, hooks_1.useId)(id);
84
86
  const [open, setOpen] = (0, react_1.useState)(_open !== null && _open !== void 0 ? _open : false);
85
87
  const wrapperRef = (0, react_1.useRef)(null);
86
- const mergedRef = (0, react_1.useMemo)(() => (0, util_1.mergeRefs)([wrapperRef, ref]), [ref]);
88
+ const mergedRef = (0, useMergeRefs_1.useMergeRefs)(wrapperRef, ref);
87
89
  const [selectedDates, setSelectedDates] = react_1.default.useState(defaultSelected);
88
90
  const mode = (_b = rest.mode) !== null && _b !== void 0 ? _b : "single";
89
91
  /**
@@ -7,13 +7,13 @@ const react_1 = __importDefault(require("react"));
7
7
  const react_day_picker_1 = require("react-day-picker");
8
8
  const responsive_1 = require("../../../layout/responsive");
9
9
  const typography_1 = require("../../../typography");
10
- const util_1 = require("../../../util");
10
+ const hooks_1 = require("../../../util/hooks");
11
11
  const get_month_weeks_1 = require("../../utils/get-month-weeks");
12
12
  const labels_1 = require("../../utils/labels");
13
13
  const WeekNumber_1 = __importDefault(require("./WeekNumber"));
14
14
  const WeekRow = ({ displayMonth }) => {
15
15
  const { locale, fixedWeeks, onWeekNumberClick } = (0, react_day_picker_1.useDayPicker)();
16
- const labelId = (0, util_1.useId)();
16
+ const labelId = (0, hooks_1.useId)();
17
17
  if (!onWeekNumberClick) {
18
18
  return null;
19
19
  }
@@ -30,7 +30,8 @@ exports.MonthPicker = void 0;
30
30
  const clsx_1 = __importDefault(require("clsx"));
31
31
  const react_1 = __importStar(require("react"));
32
32
  const react_day_picker_1 = require("react-day-picker");
33
- const util_1 = require("../../util");
33
+ const hooks_1 = require("../../util/hooks");
34
+ const useMergeRefs_1 = require("../../util/hooks/useMergeRefs");
34
35
  const context_1 = require("../context");
35
36
  const DateInput_1 = require("../parts/DateInput");
36
37
  const DateWrapper_1 = require("../parts/DateWrapper");
@@ -61,10 +62,10 @@ const MonthSelector_1 = __importDefault(require("./MonthSelector"));
61
62
  * ```
62
63
  */
63
64
  exports.MonthPicker = (0, react_1.forwardRef)(({ children, dropdownCaption = false, fromDate, toDate, disabled = [], selected, open: _open, id, onClose, onOpenToggle, locale = "nb", onMonthSelect, className, wrapperClassName, defaultSelected, year, onYearChange, strategy = "absolute", }, ref) => {
64
- const ariaId = (0, util_1.useId)(id);
65
+ const ariaId = (0, hooks_1.useId)(id);
65
66
  const [open, setOpen] = (0, react_1.useState)(_open !== null && _open !== void 0 ? _open : false);
66
67
  const wrapperRef = (0, react_1.useRef)(null);
67
- const mergedRef = (0, react_1.useMemo)(() => (0, util_1.mergeRefs)([wrapperRef, ref]), [ref]);
68
+ const mergedRef = (0, useMergeRefs_1.useMergeRefs)(wrapperRef, ref);
68
69
  const [selectedMonth, setSelectedMonth] = (0, react_1.useState)(defaultSelected);
69
70
  const handleSelect = (month) => {
70
71
  var _a;
@@ -33,12 +33,12 @@ const button_1 = require("../../button");
33
33
  const modal_1 = require("../../modal");
34
34
  const ModalContext_1 = require("../../modal/ModalContext");
35
35
  const popover_1 = require("../../popover");
36
- const useMedia_1 = require("../../util/useMedia");
36
+ const hooks_1 = require("../../util/hooks");
37
37
  const labels_1 = require("../utils/labels");
38
38
  const DateWrapper = ({ open, children, onClose, anchor, locale, variant, popoverProps, }) => {
39
39
  const modalRef = (0, react_1.useRef)(null);
40
40
  const isInModal = (0, react_1.useContext)(ModalContext_1.ModalContext) !== null;
41
- const hideModal = (0, useMedia_1.useMedia)("screen and (min-width: 768px)", true) && !isInModal;
41
+ const hideModal = (0, hooks_1.useMedia)("screen and (min-width: 768px)", true) && !isInModal;
42
42
  if (hideModal) {
43
43
  return (react_1.default.createElement(popover_1.Popover, Object.assign({ arrow: false, anchorEl: anchor, open: open, onClose: onClose, placement: "bottom-start", role: "dialog", className: (0, clsx_1.default)("navds-date__popover", {
44
44
  "navds-date": variant === "month",
@@ -40,15 +40,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.GroupedItem = void 0;
41
41
  const clsx_1 = __importDefault(require("clsx"));
42
42
  const react_1 = __importStar(require("react"));
43
+ const composeEventHandlers_1 = require("../../../util/composeEventHandlers");
43
44
  const context_1 = require("../../context");
44
45
  exports.GroupedItem = (0, react_1.forwardRef)((_a, ref) => {
45
- var { as: Component = "button", className } = _a, rest = __rest(_a, ["as", "className"]);
46
+ var { as: Component = "button", className, onClick } = _a, rest = __rest(_a, ["as", "className", "onClick"]);
46
47
  const context = (0, react_1.useContext)(context_1.DropdownContext);
47
48
  return (react_1.default.createElement("dd", { className: "navds-dropdown__list-item" },
48
- react_1.default.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (event) => {
49
- var _a, _b;
50
- (_a = context === null || context === void 0 ? void 0 : context.onSelect) === null || _a === void 0 ? void 0 : _a.call(context, event);
51
- (_b = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _b === void 0 ? void 0 : _b.call(rest, event);
52
- }, ref: ref, className: (0, clsx_1.default)("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
49
+ react_1.default.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (0, composeEventHandlers_1.composeEventHandlers)(onClick, context === null || context === void 0 ? void 0 : context.onSelect), ref: ref, className: (0, clsx_1.default)("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
53
50
  });
54
51
  exports.default = exports.GroupedItem;