@navikt/ds-react 5.13.0 → 5.14.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 (349) 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/popover/Popover.js +6 -5
  33. package/cjs/read-more/ReadMore.js +2 -4
  34. package/cjs/stepper/Step.js +6 -6
  35. package/cjs/table/DataCell.js +2 -2
  36. package/cjs/table/ExpandableRow.js +9 -9
  37. package/cjs/table/HeaderCell.js +2 -1
  38. package/cjs/tabs/TabList.js +2 -1
  39. package/cjs/tag/Tag.js +4 -2
  40. package/cjs/timeline/Pin.js +2 -2
  41. package/cjs/timeline/period/ClickablePeriod.js +2 -2
  42. package/cjs/toggle-group/ToggleGroup.js +2 -2
  43. package/cjs/tooltip/Tooltip.js +6 -5
  44. package/cjs/util/Slot.js +2 -5
  45. package/cjs/util/TextareaAutoSize.js +7 -5
  46. package/cjs/util/composeEventHandlers.js +17 -0
  47. package/cjs/util/hooks/index.js +19 -0
  48. package/cjs/util/hooks/package.json +6 -0
  49. package/cjs/util/hooks/useClientLayoutEffect.js +7 -0
  50. package/cjs/util/hooks/useMergeRefs.js +37 -0
  51. package/cjs/util/{usePrevious.js → hooks/usePrevious.js} +2 -1
  52. package/cjs/util/index.js +7 -7
  53. package/cjs/util/types/index.js +2 -0
  54. package/cjs/util/types/package.json +6 -0
  55. package/esm/accordion/AccordionHeader.js +2 -4
  56. package/esm/accordion/AccordionHeader.js.map +1 -1
  57. package/esm/button/Button.d.ts +1 -1
  58. package/esm/button/Button.js +12 -13
  59. package/esm/button/Button.js.map +1 -1
  60. package/esm/chips/Chips.d.ts +1 -1
  61. package/esm/chips/Removable.js +3 -6
  62. package/esm/chips/Removable.js.map +1 -1
  63. package/esm/chips/Toggle.d.ts +1 -1
  64. package/esm/copybutton/CopyButton.js +4 -5
  65. package/esm/copybutton/CopyButton.js.map +1 -1
  66. package/esm/date/datepicker/DatePicker.js +5 -3
  67. package/esm/date/datepicker/DatePicker.js.map +1 -1
  68. package/esm/date/datepicker/parts/WeekRow.js +1 -1
  69. package/esm/date/datepicker/parts/WeekRow.js.map +1 -1
  70. package/esm/date/monthpicker/MonthPicker.js +4 -3
  71. package/esm/date/monthpicker/MonthPicker.js.map +1 -1
  72. package/esm/date/parts/DateWrapper.js +1 -1
  73. package/esm/date/parts/DateWrapper.js.map +1 -1
  74. package/esm/dropdown/Menu/GroupedList/GroupedItem.d.ts +1 -1
  75. package/esm/dropdown/Menu/GroupedList/GroupedItem.js +3 -6
  76. package/esm/dropdown/Menu/GroupedList/GroupedItem.js.map +1 -1
  77. package/esm/dropdown/Menu/GroupedList/index.d.ts +1 -1
  78. package/esm/dropdown/Menu/List/Item.d.ts +1 -1
  79. package/esm/dropdown/Menu/List/Item.js +3 -6
  80. package/esm/dropdown/Menu/List/Item.js.map +1 -1
  81. package/esm/dropdown/Menu/List/index.d.ts +1 -1
  82. package/esm/dropdown/Toggle.js +6 -5
  83. package/esm/dropdown/Toggle.js.map +1 -1
  84. package/esm/expansion-card/ExpansionCard.d.ts +1 -1
  85. package/esm/expansion-card/ExpansionCardTitle.d.ts +1 -1
  86. package/esm/form/ConfirmationPanel.js +1 -1
  87. package/esm/form/ConfirmationPanel.js.map +1 -1
  88. package/esm/form/Textarea.js +2 -1
  89. package/esm/form/Textarea.js.map +1 -1
  90. package/esm/form/checkbox/Checkbox.js +2 -1
  91. package/esm/form/checkbox/Checkbox.js.map +1 -1
  92. package/esm/form/combobox/Combobox.js +3 -3
  93. package/esm/form/combobox/Combobox.js.map +1 -1
  94. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js +1 -2
  95. package/esm/form/combobox/FilteredOptions/filteredOptionsContext.js.map +1 -1
  96. package/esm/form/combobox/Input/inputContext.js +1 -1
  97. package/esm/form/combobox/Input/inputContext.js.map +1 -1
  98. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js +1 -1
  99. package/esm/form/combobox/SelectedOptions/selectedOptionsContext.js.map +1 -1
  100. package/esm/form/error-summary/ErrorSummary.js +1 -1
  101. package/esm/form/error-summary/ErrorSummary.js.map +1 -1
  102. package/esm/form/error-summary/ErrorSummaryItem.d.ts +1 -1
  103. package/esm/form/radio/Radio.js +2 -1
  104. package/esm/form/radio/Radio.js.map +1 -1
  105. package/esm/form/radio/RadioGroup.js +1 -1
  106. package/esm/form/radio/RadioGroup.js.map +1 -1
  107. package/esm/form/search/Search.js +4 -3
  108. package/esm/form/search/Search.js.map +1 -1
  109. package/esm/form/search/SearchButton.js +2 -4
  110. package/esm/form/search/SearchButton.js.map +1 -1
  111. package/esm/form/useFormField.js +1 -1
  112. package/esm/form/useFormField.js.map +1 -1
  113. package/esm/guide-panel/Illustration.js +1 -1
  114. package/esm/guide-panel/Illustration.js.map +1 -1
  115. package/esm/help-text/HelpText.d.ts +0 -5
  116. package/esm/help-text/HelpText.js +6 -8
  117. package/esm/help-text/HelpText.js.map +1 -1
  118. package/esm/help-text/HelpTextIcon.js +1 -1
  119. package/esm/internal-header/InternalHeader.d.ts +1 -1
  120. package/esm/internal-header/InternalHeaderButton.d.ts +1 -1
  121. package/esm/internal-header/InternalHeaderTitle.d.ts +1 -1
  122. package/esm/internal-header/InternalHeaderUserButton.d.ts +1 -1
  123. package/esm/layout/box/Box.d.ts +1 -1
  124. package/esm/layout/page/parts/PageBlock.d.ts +1 -1
  125. package/esm/layout/stack/HStack.d.ts +1 -1
  126. package/esm/layout/stack/Stack.d.ts +1 -1
  127. package/esm/layout/stack/VStack.d.ts +1 -1
  128. package/esm/link/Link.d.ts +1 -1
  129. package/esm/link-panel/LinkPanel.d.ts +1 -1
  130. package/esm/link-panel/LinkPanelTitle.d.ts +1 -1
  131. package/esm/list/List.js +1 -1
  132. package/esm/loader/Loader.js +2 -1
  133. package/esm/loader/Loader.js.map +1 -1
  134. package/esm/modal/Modal.js +21 -18
  135. package/esm/modal/Modal.js.map +1 -1
  136. package/esm/modal/types.d.ts +1 -1
  137. package/esm/pagination/PaginationItem.d.ts +1 -1
  138. package/esm/panel/Panel.d.ts +1 -1
  139. package/esm/popover/Popover.d.ts +1 -1
  140. package/esm/popover/Popover.js +4 -3
  141. package/esm/popover/Popover.js.map +1 -1
  142. package/esm/read-more/ReadMore.js +2 -4
  143. package/esm/read-more/ReadMore.js.map +1 -1
  144. package/esm/stepper/Step.d.ts +1 -1
  145. package/esm/stepper/Step.js +6 -6
  146. package/esm/stepper/Step.js.map +1 -1
  147. package/esm/table/AnimateHeight.js.map +1 -0
  148. package/esm/table/DataCell.d.ts +4 -0
  149. package/esm/table/DataCell.js +2 -2
  150. package/esm/table/DataCell.js.map +1 -1
  151. package/esm/table/ExpandableRow.js +8 -8
  152. package/esm/table/ExpandableRow.js.map +1 -1
  153. package/esm/table/HeaderCell.d.ts +4 -0
  154. package/esm/table/HeaderCell.js +2 -1
  155. package/esm/table/HeaderCell.js.map +1 -1
  156. package/esm/tabs/Tab.d.ts +1 -1
  157. package/esm/tabs/TabList.js +3 -2
  158. package/esm/tabs/TabList.js.map +1 -1
  159. package/esm/tabs/Tabs.d.ts +1 -1
  160. package/esm/tag/Tag.d.ts +4 -0
  161. package/esm/tag/Tag.js +4 -2
  162. package/esm/tag/Tag.js.map +1 -1
  163. package/esm/timeline/Pin.js +3 -3
  164. package/esm/timeline/Pin.js.map +1 -1
  165. package/esm/timeline/period/ClickablePeriod.js +3 -3
  166. package/esm/timeline/period/ClickablePeriod.js.map +1 -1
  167. package/esm/toggle-group/ToggleGroup.js +1 -1
  168. package/esm/toggle-group/ToggleGroup.js.map +1 -1
  169. package/esm/tooltip/Tooltip.js +6 -5
  170. package/esm/tooltip/Tooltip.js.map +1 -1
  171. package/esm/typography/BodyLong.d.ts +1 -1
  172. package/esm/typography/BodyShort.d.ts +1 -1
  173. package/esm/typography/Detail.d.ts +1 -1
  174. package/esm/typography/ErrorMessage.d.ts +1 -1
  175. package/esm/typography/Heading.d.ts +1 -1
  176. package/esm/typography/Ingress.d.ts +1 -1
  177. package/esm/typography/Label.d.ts +1 -1
  178. package/esm/util/Slot.js +1 -1
  179. package/esm/util/Slot.js.map +1 -1
  180. package/esm/util/TextareaAutoSize.js +5 -3
  181. package/esm/util/TextareaAutoSize.js.map +1 -1
  182. package/esm/util/composeEventHandlers.d.ts +8 -0
  183. package/esm/util/composeEventHandlers.js +14 -0
  184. package/esm/util/composeEventHandlers.js.map +1 -0
  185. package/esm/util/hooks/index.d.ts +8 -0
  186. package/esm/util/hooks/index.js +9 -0
  187. package/esm/util/hooks/index.js.map +1 -0
  188. package/esm/util/hooks/useClientLayoutEffect.js +5 -0
  189. package/esm/util/hooks/useClientLayoutEffect.js.map +1 -0
  190. package/esm/util/{useEventListener.d.ts → hooks/useEventListener.d.ts} +1 -1
  191. package/esm/util/hooks/useEventListener.js.map +1 -0
  192. package/esm/util/hooks/useId.js.map +1 -0
  193. package/esm/util/hooks/useMedia.js.map +1 -0
  194. package/esm/util/hooks/useMergeRefs.d.ts +15 -0
  195. package/esm/util/hooks/useMergeRefs.js +30 -0
  196. package/esm/util/hooks/useMergeRefs.js.map +1 -0
  197. package/esm/util/hooks/usePrevious.d.ts +1 -0
  198. package/esm/util/{usePrevious.js → hooks/usePrevious.js} +1 -2
  199. package/esm/util/hooks/usePrevious.js.map +1 -0
  200. package/esm/util/index.d.ts +4 -5
  201. package/esm/util/index.js +3 -5
  202. package/esm/util/index.js.map +1 -1
  203. package/esm/util/types/OverridableComponent.js.map +1 -0
  204. package/esm/util/types/index.d.ts +1 -0
  205. package/esm/util/types/index.js +2 -0
  206. package/esm/util/types/index.js.map +1 -0
  207. package/package.json +3 -3
  208. package/src/accordion/AccordionHeader.tsx +2 -4
  209. package/src/accordion/AccordionItem.tsx +2 -2
  210. package/src/alert/alert.stories.tsx +1 -2
  211. package/src/button/Button.tsx +14 -19
  212. package/src/chips/Chips.tsx +1 -1
  213. package/src/chips/Removable.tsx +3 -4
  214. package/src/chips/Toggle.tsx +1 -1
  215. package/src/copybutton/CopyButton.tsx +4 -5
  216. package/src/copybutton/copy-button.stories.tsx +1 -1
  217. package/src/date/datepicker/DatePicker.tsx +5 -3
  218. package/src/date/datepicker/parts/WeekRow.tsx +1 -1
  219. package/src/date/monthpicker/MonthPicker.tsx +4 -3
  220. package/src/date/parts/DateWrapper.tsx +1 -1
  221. package/src/dropdown/Menu/GroupedList/GroupedItem.tsx +23 -23
  222. package/src/dropdown/Menu/GroupedList/index.tsx +1 -1
  223. package/src/dropdown/Menu/List/Item.tsx +23 -23
  224. package/src/dropdown/Menu/List/index.tsx +1 -1
  225. package/src/dropdown/Toggle.tsx +10 -6
  226. package/src/expansion-card/ExpansionCard.tsx +1 -1
  227. package/src/expansion-card/ExpansionCardTitle.tsx +1 -1
  228. package/src/form/ConfirmationPanel.tsx +1 -1
  229. package/src/form/Textarea.tsx +2 -1
  230. package/src/form/checkbox/Checkbox.tsx +2 -1
  231. package/src/form/combobox/Combobox.tsx +3 -6
  232. package/src/form/combobox/FilteredOptions/filteredOptionsContext.tsx +1 -2
  233. package/src/form/combobox/Input/inputContext.tsx +1 -1
  234. package/src/form/combobox/SelectedOptions/selectedOptionsContext.tsx +1 -1
  235. package/src/form/combobox/combobox.stories.tsx +10 -11
  236. package/src/form/error-summary/ErrorSummary.tsx +1 -1
  237. package/src/form/error-summary/ErrorSummaryItem.tsx +1 -1
  238. package/src/form/radio/Radio.tsx +2 -1
  239. package/src/form/radio/RadioGroup.tsx +1 -1
  240. package/src/form/search/Search.tsx +3 -3
  241. package/src/form/search/SearchButton.tsx +2 -4
  242. package/src/form/useFormField.ts +1 -1
  243. package/src/guide-panel/Illustration.tsx +1 -1
  244. package/src/help-text/HelpText.tsx +7 -25
  245. package/src/help-text/HelpTextIcon.tsx +1 -1
  246. package/src/help-text/help-text.stories.tsx +58 -68
  247. package/src/internal-header/InternalHeader.tsx +1 -1
  248. package/src/internal-header/InternalHeaderButton.tsx +1 -1
  249. package/src/internal-header/InternalHeaderTitle.tsx +1 -1
  250. package/src/internal-header/InternalHeaderUserButton.tsx +1 -1
  251. package/src/layout/box/Box.tsx +1 -1
  252. package/src/layout/page/parts/PageBlock.tsx +1 -1
  253. package/src/layout/stack/HStack.tsx +1 -1
  254. package/src/layout/stack/Stack.tsx +1 -1
  255. package/src/layout/stack/VStack.tsx +1 -1
  256. package/src/link/Link.tsx +1 -1
  257. package/src/link/{link.stories.tsx → stories/link.stories.tsx} +2 -2
  258. package/src/link-panel/LinkPanel.tsx +1 -1
  259. package/src/link-panel/LinkPanelTitle.tsx +1 -1
  260. package/src/list/List.tsx +1 -1
  261. package/src/loader/Loader.tsx +2 -1
  262. package/src/modal/Modal.tsx +30 -30
  263. package/src/modal/types.ts +1 -1
  264. package/src/pagination/PaginationItem.tsx +1 -1
  265. package/src/panel/Panel.tsx +1 -1
  266. package/src/popover/Popover.tsx +4 -7
  267. package/src/read-more/ReadMore.tsx +2 -4
  268. package/src/stepper/Step.tsx +8 -5
  269. package/src/table/DataCell.tsx +6 -1
  270. package/src/table/ExpandableRow.tsx +11 -6
  271. package/src/table/HeaderCell.tsx +6 -1
  272. package/src/table/stories/table.stories.tsx +43 -29
  273. package/src/table/stories/tests/table.stories.tsx +2 -3
  274. package/src/tabs/Tab.tsx +1 -1
  275. package/src/tabs/TabList.tsx +4 -2
  276. package/src/tabs/Tabs.tsx +1 -1
  277. package/src/tag/Tag.tsx +9 -2
  278. package/src/tag/tag.stories.tsx +27 -1
  279. package/src/timeline/Pin.tsx +3 -6
  280. package/src/timeline/period/ClickablePeriod.tsx +3 -6
  281. package/src/toggle-group/ToggleGroup.tsx +1 -1
  282. package/src/tooltip/Tooltip.tsx +11 -22
  283. package/src/typography/BodyLong.tsx +1 -1
  284. package/src/typography/BodyShort.tsx +1 -1
  285. package/src/typography/Detail.tsx +1 -1
  286. package/src/typography/ErrorMessage.tsx +1 -1
  287. package/src/typography/Heading.tsx +1 -1
  288. package/src/typography/Ingress.tsx +1 -1
  289. package/src/typography/Label.tsx +1 -1
  290. package/src/typography/stories/bodylong.stories.tsx +1 -2
  291. package/src/typography/stories/bodyshort.stories.tsx +1 -2
  292. package/src/typography/stories/detail.stories.tsx +1 -2
  293. package/src/typography/stories/error-message.stories.tsx +1 -2
  294. package/src/typography/stories/heading.stories.tsx +1 -2
  295. package/src/typography/stories/ingress.stories.tsx +1 -2
  296. package/src/typography/stories/label.stories.tsx +1 -2
  297. package/src/util/Slot.tsx +1 -1
  298. package/src/util/TextareaAutoSize.tsx +7 -3
  299. package/src/util/__tests__/useMedia.test.tsx +1 -1
  300. package/src/util/composeEventHandlers.ts +19 -0
  301. package/src/util/hooks/index.ts +8 -0
  302. package/src/util/hooks/useCallbackRef.ts +1 -1
  303. package/src/util/hooks/useClientLayoutEffect.ts +5 -0
  304. package/src/util/hooks/useControllableState.ts +1 -1
  305. package/src/util/hooks/useMergeRefs.ts +32 -0
  306. package/src/util/{usePrevious.ts → hooks/usePrevious.ts} +1 -4
  307. package/src/util/index.ts +4 -5
  308. package/src/util/types/index.ts +1 -0
  309. package/cjs/util/RandomIcon.js +0 -38
  310. package/cjs/util/mergeRefs.js +0 -16
  311. package/cjs/util/useClientLayoutEffect.js +0 -10
  312. package/esm/util/AnimateHeight.js.map +0 -1
  313. package/esm/util/OverridableComponent.js.map +0 -1
  314. package/esm/util/RandomIcon.d.ts +0 -2
  315. package/esm/util/RandomIcon.js +0 -9
  316. package/esm/util/RandomIcon.js.map +0 -1
  317. package/esm/util/mergeRefs.d.ts +0 -2
  318. package/esm/util/mergeRefs.js +0 -14
  319. package/esm/util/mergeRefs.js.map +0 -1
  320. package/esm/util/useClientLayoutEffect.js +0 -8
  321. package/esm/util/useClientLayoutEffect.js.map +0 -1
  322. package/esm/util/useEventListener.js.map +0 -1
  323. package/esm/util/useId.js.map +0 -1
  324. package/esm/util/useMedia.js.map +0 -1
  325. package/esm/util/usePrevious.d.ts +0 -2
  326. package/esm/util/usePrevious.js.map +0 -1
  327. package/src/util/mergeRefs.tsx +0 -16
  328. package/src/util/useClientLayoutEffect.ts +0 -11
  329. /package/cjs/{util → table}/AnimateHeight.js +0 -0
  330. /package/cjs/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
  331. /package/cjs/util/{useId.js → hooks/useId.js} +0 -0
  332. /package/cjs/util/{useMedia.js → hooks/useMedia.js} +0 -0
  333. /package/cjs/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
  334. /package/esm/{util → table}/AnimateHeight.d.ts +0 -0
  335. /package/esm/{util → table}/AnimateHeight.js +0 -0
  336. /package/esm/util/{useClientLayoutEffect.d.ts → hooks/useClientLayoutEffect.d.ts} +0 -0
  337. /package/esm/util/{useEventListener.js → hooks/useEventListener.js} +0 -0
  338. /package/esm/util/{useId.d.ts → hooks/useId.d.ts} +0 -0
  339. /package/esm/util/{useId.js → hooks/useId.js} +0 -0
  340. /package/esm/util/{useMedia.d.ts → hooks/useMedia.d.ts} +0 -0
  341. /package/esm/util/{useMedia.js → hooks/useMedia.js} +0 -0
  342. /package/esm/util/{OverridableComponent.d.ts → types/OverridableComponent.d.ts} +0 -0
  343. /package/esm/util/{OverridableComponent.js → types/OverridableComponent.js} +0 -0
  344. /package/src/{util → link/stories}/RandomIcon.tsx +0 -0
  345. /package/src/{util → table}/AnimateHeight.tsx +0 -0
  346. /package/src/util/{useEventListener.ts → hooks/useEventListener.ts} +0 -0
  347. /package/src/util/{useId.ts → hooks/useId.ts} +0 -0
  348. /package/src/util/{useMedia.ts → hooks/useMedia.ts} +0 -0
  349. /package/src/util/{OverridableComponent.ts → types/OverridableComponent.ts} +0 -0
@@ -18,14 +18,14 @@ import React, {
18
18
  cloneElement,
19
19
  forwardRef,
20
20
  useContext,
21
- useMemo,
22
21
  useRef,
23
22
  } from "react";
24
23
  import { ModalContext } from "../modal/ModalContext";
25
24
  import { useProvider } from "../provider";
26
25
  import { Detail } from "../typography";
27
- import { mergeRefs, useId } from "../util";
26
+ import { useId } from "../util/hooks";
28
27
  import { useControllableState } from "../util/hooks/useControllableState";
28
+ import { useMergeRefs } from "../util/hooks/useMergeRefs";
29
29
 
30
30
  export interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
31
31
  /**
@@ -113,7 +113,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
113
113
  maxChar = 80,
114
114
  ...rest
115
115
  },
116
- ref
116
+ ref,
117
117
  ) => {
118
118
  const [_open, _setOpen] = useControllableState({
119
119
  defaultValue: defaultOpen,
@@ -166,14 +166,8 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
166
166
 
167
167
  const ariaId = useId(id);
168
168
 
169
- const mergedRef = useMemo(
170
- () => mergeRefs([ref, refs.setFloating]),
171
- [refs.setFloating, ref]
172
- );
173
- const childMergedRef = useMemo(
174
- () => mergeRefs([(children as any).ref, refs.setReference]),
175
- [children, refs.setReference]
176
- );
169
+ const mergedRef = useMergeRefs(ref, refs.setFloating);
170
+ const childMergedRef = useMergeRefs(children.ref, refs.setReference);
177
171
 
178
172
  if (
179
173
  !children ||
@@ -181,7 +175,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
181
175
  (children as any) === React.Fragment
182
176
  ) {
183
177
  console.error(
184
- "<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>"
178
+ "<Tooltip> children needs to be a single ReactElement and not: <React.Fragment/> | <></>",
185
179
  );
186
180
  return null;
187
181
  }
@@ -189,7 +183,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
189
183
  if (content?.length > maxChar) {
190
184
  _open &&
191
185
  console.warn(
192
- `Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}`
186
+ `Because of strict accessibility concers we encourage all Tooltips to have less than 80 characters. Can be overwritten with the maxChar-prop\n\nLength:${content.length}\nTooltip-content: ${content}`,
193
187
  );
194
188
  }
195
189
 
@@ -203,7 +197,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
203
197
  "aria-describedby": _open
204
198
  ? cl(ariaId, children?.props["aria-describedby"])
205
199
  : children?.props["aria-describedby"],
206
- })
200
+ }),
207
201
  )}
208
202
  <FloatingPortal root={rootElement}>
209
203
  {_open && (
@@ -222,7 +216,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
222
216
  className: cl(
223
217
  "navds-tooltip",
224
218
  "navds-detail navds-detail--small",
225
- className
219
+ className,
226
220
  ),
227
221
  })}
228
222
  data-side={placement}
@@ -231,12 +225,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
231
225
  {keys && (
232
226
  <span className="navds-tooltip__keys">
233
227
  {keys.map((key) => (
234
- <Detail
235
- size="small"
236
- as="kbd"
237
- key={key}
238
- className="navds-tooltip__key"
239
- >
228
+ <Detail as="kbd" key={key} className="navds-tooltip__key">
240
229
  {key}
241
230
  </Detail>
242
231
  ))}
@@ -267,7 +256,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
267
256
  </FloatingPortal>
268
257
  </>
269
258
  );
270
- }
259
+ },
271
260
  );
272
261
 
273
262
  export default Tooltip;
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
 
5
5
  export interface IngressProps
6
6
  extends React.HTMLAttributes<HTMLParagraphElement> {
@@ -1,6 +1,6 @@
1
1
  import cl from "clsx";
2
2
  import React, { forwardRef } from "react";
3
- import { OverridableComponent } from "../util/OverridableComponent";
3
+ import { OverridableComponent } from "../util/types";
4
4
  import { TypoProps } from "./types";
5
5
  import { typoClassNames } from "./util";
6
6
 
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { BodyLong } from "..";
6
5
  import { VStack } from "../..";
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { BodyShort } from "..";
6
5
  import { VStack } from "../..";
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { Detail } from "..";
6
5
  import { VStack } from "../..";
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { ErrorMessage } from "..";
6
5
  import { VStack } from "../..";
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import { default as React } from "react";
5
4
  import { Heading } from "..";
6
5
  import { VStack } from "../..";
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { Ingress } from "..";
6
5
 
@@ -1,6 +1,5 @@
1
- import { expect } from "@storybook/jest";
2
1
  import type { Meta, StoryObj } from "@storybook/react";
3
- import { within } from "@storybook/testing-library";
2
+ import { expect, within } from "@storybook/test";
4
3
  import React from "react";
5
4
  import { Label } from "..";
6
5
  import { VStack } from "../..";
package/src/util/Slot.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  // https://github.com/radix-ui/primitives/blob/main/packages/react/slot/src/Slot.tsx
2
2
  import * as React from "react";
3
- import mergeRefs from "./mergeRefs";
3
+ import { mergeRefs } from "./hooks/useMergeRefs";
4
4
 
5
5
  interface SlotProps extends React.HTMLAttributes<HTMLElement> {
6
6
  children?: React.ReactNode;
@@ -1,7 +1,9 @@
1
1
  /* https://github.com/mui/material-ui/blob/master/packages/mui-base/src/TextareaAutosize/TextareaAutosize.tsx */
2
- import React, { forwardRef, useEffect, useMemo, useRef, useState } from "react";
2
+ import React, { forwardRef, useEffect, useRef, useState } from "react";
3
3
  import ReactDOM from "react-dom";
4
- import { debounce, mergeRefs, useClientLayoutEffect } from "../util";
4
+ import { useClientLayoutEffect } from "../util/hooks";
5
+ import debounce from "./debounce";
6
+ import { useMergeRefs } from "./hooks/useMergeRefs";
5
7
 
6
8
  type State = {
7
9
  outerHeightStyle: number;
@@ -90,7 +92,9 @@ const TextareaAutosize = forwardRef<HTMLTextAreaElement, TextareaAutosizeProps>(
90
92
  ) => {
91
93
  const { current: isControlled } = useRef(value != null);
92
94
  const inputRef = useRef<HTMLTextAreaElement>(null);
93
- const handleRef = useMemo(() => mergeRefs([inputRef, ref]), [ref]);
95
+
96
+ const handleRef = useMergeRefs(inputRef, ref);
97
+
94
98
  const shadowRef = useRef<HTMLTextAreaElement>(null);
95
99
  const renders = useRef(0);
96
100
  const [state, setState] = useState<State>({ outerHeightStyle: 0 });
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from "@testing-library/react";
2
2
  import React from "react";
3
- import { useMedia } from "../useMedia";
3
+ import { useMedia } from "../hooks";
4
4
 
5
5
  function TestComponent({ fallback }: { fallback?: boolean }) {
6
6
  const media = useMedia("screen and (min-width: 1024px)", fallback);
@@ -0,0 +1,19 @@
1
+ /* https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L1 */
2
+
3
+ /**
4
+ * Utility to consistently call original eventhandler, often from props and internal eventhandler
5
+ * @internal
6
+ */
7
+ export function composeEventHandlers<T extends React.SyntheticEvent>(
8
+ originalEventHandler?: (event: T) => void,
9
+ ourEventHandler?: (event: T) => void,
10
+ { checkForDefaultPrevented = true } = {},
11
+ ) {
12
+ return function handleEvent(event: T) {
13
+ originalEventHandler?.(event);
14
+
15
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
16
+ return ourEventHandler?.(event);
17
+ }
18
+ };
19
+ }
@@ -0,0 +1,8 @@
1
+ export { useCallbackRef } from "./useCallbackRef";
2
+ export { useClientLayoutEffect } from "./useClientLayoutEffect";
3
+ export { useControllableState } from "./useControllableState";
4
+ export { useMergeRefs } from "./useMergeRefs";
5
+ export { useEventListener } from "./useEventListener";
6
+ export { useId } from "./useId";
7
+ export { useMedia } from "./useMedia";
8
+ export { usePrevious } from "./usePrevious";
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from "react";
7
7
  */
8
8
  export function useCallbackRef<T extends (...args: any[]) => any>(
9
9
  callback: T | undefined,
10
- deps: React.DependencyList = []
10
+ deps: React.DependencyList = [],
11
11
  ) {
12
12
  const callbackRef = useRef(callback);
13
13
 
@@ -0,0 +1,5 @@
1
+ import { useLayoutEffect } from "react";
2
+
3
+ export const useClientLayoutEffect = globalThis?.document
4
+ ? useLayoutEffect
5
+ : () => {};
@@ -33,7 +33,7 @@ export function useControllableState<T>({
33
33
 
34
34
  onChangeProp(nextValue);
35
35
  },
36
- [controlled, onChangeProp, value]
36
+ [controlled, onChangeProp, value],
37
37
  );
38
38
 
39
39
  return [value, setValue] as const;
@@ -0,0 +1,32 @@
1
+ /* https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/composeRefs.tsx */
2
+ import React from "react";
3
+
4
+ type PossibleRef<T> = React.Ref<T> | undefined;
5
+
6
+ // https://github.com/gregberge/react-merge-refs
7
+ /**
8
+ * Use `useMergeRefs`
9
+ * @internal
10
+ */
11
+ export function mergeRefs<T>(refs: PossibleRef<T>[]): React.RefCallback<T> {
12
+ return (value) => {
13
+ refs.forEach((ref) => {
14
+ if (typeof ref === "function") {
15
+ ref(value);
16
+ } else if (ref !== null && ref !== undefined) {
17
+ (ref as React.MutableRefObject<T | null>).current = value;
18
+ }
19
+ });
20
+ };
21
+ }
22
+
23
+ /**
24
+ * Merges refs within useCallback
25
+ * @internal
26
+ * @param ...refs: React.Ref<T> | undefined
27
+ * @returns React.useCallback(mergeRefs(refs), refs)
28
+ */
29
+ export function useMergeRefs<T>(...refs: PossibleRef<T>[]) {
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ return React.useCallback(mergeRefs(refs), refs);
32
+ }
@@ -7,13 +7,10 @@ import { useEffect, useRef } from "react";
7
7
  * https://usehooks.com/usePrevious/
8
8
  * https://blog.logrocket.com/accessing-previous-props-state-react-hooks/
9
9
  */
10
-
11
- const usePrevious = <T>(value: T): T | undefined => {
10
+ export const usePrevious = <T>(value: T): T | undefined => {
12
11
  const ref = useRef<T>(value);
13
12
  useEffect(() => {
14
13
  ref.current = value;
15
14
  }, [value]);
16
15
  return ref.current;
17
16
  };
18
-
19
- export default usePrevious;
package/src/util/index.ts CHANGED
@@ -1,7 +1,6 @@
1
- export * from "./OverridableComponent";
1
+ export type * from "./types";
2
2
  export { default as debounce } from "./debounce";
3
- export { default as mergeRefs } from "./mergeRefs";
4
3
  export * from "./omit";
5
- export * from "./useClientLayoutEffect";
6
- export * from "./useEventListener";
7
- export * from "./useId";
4
+ export { useClientLayoutEffect } from "./hooks/useClientLayoutEffect";
5
+ export { useEventListener } from "./hooks/useEventListener";
6
+ export { useId } from "./hooks/useId";
@@ -0,0 +1 @@
1
+ export type { OverridableComponent } from "./OverridableComponent";
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RandomIcon = void 0;
30
- const react_1 = __importDefault(require("react"));
31
- const AllIcons = __importStar(require("@navikt/aksel-icons"));
32
- // eslint-disable-next-line import/namespace
33
- const icons = Object.keys(AllIcons).map((key) => AllIcons[key]);
34
- const RandomIcon = () => {
35
- const Icon = icons[Math.floor(Math.random() * icons.length)];
36
- return react_1.default.createElement(Icon, null);
37
- };
38
- exports.RandomIcon = RandomIcon;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // https://github.com/gregberge/react-merge-refs
4
- function mergeRefs(refs) {
5
- return (value) => {
6
- refs.forEach((ref) => {
7
- if (typeof ref === "function") {
8
- ref(value);
9
- }
10
- else if (ref !== null && ref !== undefined) {
11
- ref.current = value;
12
- }
13
- });
14
- };
15
- }
16
- exports.default = mergeRefs;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useClientLayoutEffect = void 0;
4
- const react_1 = require("react");
5
- const canUseDOM = () => {
6
- return (typeof window !== "undefined" &&
7
- typeof window.document !== "undefined" &&
8
- typeof window.document.createElement !== "undefined");
9
- };
10
- exports.useClientLayoutEffect = canUseDOM() ? react_1.useLayoutEffect : () => { };
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnimateHeight.js","sourceRoot":"","sources":["../../src/util/AnimateHeight.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,0EAA0E;AAC1E,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ1E,6BAA6B;AAE7B,SAAS,QAAQ,CAAC,CAAS;IACzB,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,oBAAoB;IACpB,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;QACjC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC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QACH,CAAC;QAED,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC;QAE5B,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,SAAS,CAAC,OAAkB,CAAC,CAAC;YAC3C,YAAY,CAAC,yBAAyB,CAAC,OAAkB,CAAC,CAAC;QAC7D,CAAC,CAAC;QAEF,sDAAsD;QACtD,uDAAuD;IACzD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,4BAA4B;IAE5B,MAAM,cAAc,GAAkB;QACpC,MAAM,EAAE,aAAa;QACrB,QAAQ;KACT,CAAC;IAEF,IAAI,cAAc,EAAE,CAAC;QACnB,cAAc,CAAC,UAAU,GAAG,UAAU,QAAQ,MAAM,MAAM,MAAM,CAAC;QAEjE,8DAA8D;QAC9D,cAAc,CAAC,gBAAgB,GAAG,cAAc,CAAC,UAAU,CAAC;IAC9D,CAAC;IAED,wCAAwC;IACxC,MAAM,iBAAiB,GAAG,OAAO,KAAK,CAAC,aAAa,CAAC,KAAK,WAAW,CAAC;IACtE,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAE3E,OAAO,CACL,6CAAS,KAAK,IAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,cAAc;QACzD,4CACe,UAAU,EACvB,SAAS,EAAE,cAAc,EACzB,GAAG,EAAE,cAAc,IAElB,QAAQ,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"OverridableComponent.js","sourceRoot":"","sources":["../../src/util/OverridableComponent.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export declare const RandomIcon: () => React.JSX.Element;
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import * as AllIcons from "@navikt/aksel-icons";
3
- // eslint-disable-next-line import/namespace
4
- const icons = Object.keys(AllIcons).map((key) => AllIcons[key]);
5
- export const RandomIcon = () => {
6
- const Icon = icons[Math.floor(Math.random() * icons.length)];
7
- return React.createElement(Icon, null);
8
- };
9
- //# sourceMappingURL=RandomIcon.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RandomIcon.js","sourceRoot":"","sources":["../../src/util/RandomIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,4CAA4C;AAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,oBAAC,IAAI,OAAG,CAAC;AAClB,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import React from "react";
2
- export default function mergeRefs<T>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
@@ -1,14 +0,0 @@
1
- // https://github.com/gregberge/react-merge-refs
2
- export default function mergeRefs(refs) {
3
- return (value) => {
4
- refs.forEach((ref) => {
5
- if (typeof ref === "function") {
6
- ref(value);
7
- }
8
- else if (ref !== null && ref !== undefined) {
9
- ref.current = value;
10
- }
11
- });
12
- };
13
- }
14
- //# sourceMappingURL=mergeRefs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeRefs.js","sourceRoot":"","sources":["../../src/util/mergeRefs.tsx"],"names":[],"mappings":"AAEA,gDAAgD;AAChD,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,IAA2D;IAE3D,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;gBAC9B,GAAG,CAAC,KAAK,CAAC,CAAC;YACb,CAAC;iBAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;gBAC5C,GAAwC,CAAC,OAAO,GAAG,KAAK,CAAC;YAC5D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- import { useLayoutEffect } from "react";
2
- const canUseDOM = () => {
3
- return (typeof window !== "undefined" &&
4
- typeof window.document !== "undefined" &&
5
- typeof window.document.createElement !== "undefined");
6
- };
7
- export const useClientLayoutEffect = canUseDOM() ? useLayoutEffect : () => { };
8
- //# sourceMappingURL=useClientLayoutEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useClientLayoutEffect.js","sourceRoot":"","sources":["../../src/util/useClientLayoutEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,SAAS,GAAG,GAAY,EAAE;IAC9B,OAAO,CACL,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;QACtC,OAAO,MAAM,CAAC,QAAQ,CAAC,aAAa,KAAK,WAAW,CACrD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEventListener.js","sourceRoot":"","sources":["../../src/util/useEventListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBlC,wEAAwE;AACxE,MAAM,CAAC,MAAM,gB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ACV,cAAc,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- declare const usePrevious: <T>(value: T) => T | undefined;
2
- export default usePrevious;
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../src/util/usePrevious.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;;;GAMG;AAEH,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAiB,EAAE;IACjD,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,16 +0,0 @@
1
- import React from "react";
2
-
3
- // https://github.com/gregberge/react-merge-refs
4
- export default function mergeRefs<T>(
5
- refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>,
6
- ): React.RefCallback<T> {
7
- return (value) => {
8
- refs.forEach((ref) => {
9
- if (typeof ref === "function") {
10
- ref(value);
11
- } else if (ref !== null && ref !== undefined) {
12
- (ref as React.MutableRefObject<T | null>).current = value;
13
- }
14
- });
15
- };
16
- }
@@ -1,11 +0,0 @@
1
- import { useLayoutEffect } from "react";
2
-
3
- const canUseDOM = (): boolean => {
4
- return (
5
- typeof window !== "undefined" &&
6
- typeof window.document !== "undefined" &&
7
- typeof window.document.createElement !== "undefined"
8
- );
9
- };
10
-
11
- export const useClientLayoutEffect = canUseDOM() ? useLayoutEffect : () => {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes