@digdir/designsystemet-react 1.0.0-rc.12 → 1.0.0-rc.13

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 (292) hide show
  1. package/dist/cjs/components/Accordion/AccordionContent.js +5 -0
  2. package/dist/cjs/components/Accordion/AccordionHeading.js +5 -0
  3. package/dist/cjs/components/Accordion/AccordionItem.js +8 -0
  4. package/dist/cjs/components/Accordion/AccordionRoot.js +3 -0
  5. package/dist/cjs/components/Accordion/index.js +10 -0
  6. package/dist/cjs/components/Alert/Alert.js +7 -2
  7. package/dist/cjs/components/Button/Button.js +2 -0
  8. package/dist/cjs/components/Card/Card.js +9 -0
  9. package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +2 -2
  10. package/dist/cjs/components/DropdownMenu/DropdownMenuRoot.js +12 -0
  11. package/dist/cjs/components/DropdownMenu/index.js +11 -0
  12. package/dist/cjs/components/ErrorSummary/index.js +9 -0
  13. package/dist/cjs/components/Pagination/PaginationEllipsis.js +0 -4
  14. package/dist/cjs/components/Pagination/PaginationItem.js +0 -4
  15. package/dist/cjs/components/Pagination/PaginationRoot.js +0 -4
  16. package/dist/cjs/components/Pagination/index.js +6 -6
  17. package/dist/cjs/components/Popover/PopoverContent.js +2 -2
  18. package/dist/cjs/components/Skeleton/Circle/Circle.js +1 -1
  19. package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +1 -1
  20. package/dist/cjs/components/Skeleton/Text/Text.js +1 -1
  21. package/dist/cjs/components/Spinner/Spinner.js +1 -1
  22. package/dist/cjs/components/Tabs/Tab.js +7 -2
  23. package/dist/cjs/components/Tabs/TabContent.js +7 -0
  24. package/dist/cjs/components/Tabs/TabList.js +14 -2
  25. package/dist/cjs/components/Tabs/TabsRoot.js +17 -1
  26. package/dist/cjs/components/Tabs/index.js +16 -0
  27. package/dist/cjs/components/Tag/Tag.js +5 -0
  28. package/dist/cjs/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +8 -3
  29. package/dist/cjs/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.js +6 -4
  30. package/dist/cjs/components/ToggleGroup/ToggleGroupRoot.js +4 -5
  31. package/dist/cjs/components/ToggleGroup/index.js +11 -0
  32. package/dist/cjs/components/Tooltip/Tooltip.js +8 -1
  33. package/dist/cjs/components/Typography/Heading/Heading.js +6 -1
  34. package/dist/cjs/components/Typography/Ingress/Ingress.js +6 -1
  35. package/dist/cjs/components/Typography/Label/Label.js +6 -1
  36. package/dist/cjs/components/Typography/Paragraph/Paragraph.js +6 -1
  37. package/dist/cjs/components/form/Checkbox/Checkbox.js +2 -2
  38. package/dist/cjs/components/form/Combobox/Combobox.js +6 -6
  39. package/dist/cjs/components/form/Combobox/Custom.js +2 -6
  40. package/dist/cjs/components/form/Combobox/Empty.js +0 -3
  41. package/dist/cjs/components/form/Combobox/Option/Description.js +1 -4
  42. package/dist/cjs/components/form/Combobox/Option/Option.js +2 -2
  43. package/dist/cjs/components/form/Combobox/Option/SelectedIcon.js +0 -3
  44. package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +4 -4
  45. package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +1 -4
  46. package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +1 -4
  47. package/dist/cjs/components/form/Combobox/internal/ComboboxError.js +2 -5
  48. package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +9 -8
  49. package/dist/cjs/components/form/Combobox/internal/ComboboxLabel.js +1 -4
  50. package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +1 -4
  51. package/dist/cjs/components/form/Combobox/useCombobox.js +11 -4
  52. package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +2 -2
  53. package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +2 -2
  54. package/dist/cjs/components/form/NativeSelect/NativeSelect.js +2 -2
  55. package/dist/cjs/components/form/Radio/Radio.js +2 -2
  56. package/dist/cjs/components/form/Search/Search.js +3 -4
  57. package/dist/cjs/components/form/Switch/Switch.js +2 -2
  58. package/dist/cjs/components/form/Textarea/Textarea.js +2 -2
  59. package/dist/cjs/components/form/Textfield/Textfield.js +2 -2
  60. package/dist/cjs/index.js +15 -5
  61. package/dist/cjs/node_modules/@floating-ui/{react-dom/node_modules/@floating-ui/dom → dom}/dist/floating-ui.dom.js +3 -3
  62. package/dist/cjs/node_modules/@floating-ui/react/dist/floating-ui.react.js +1 -1
  63. package/dist/cjs/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +1 -1
  64. package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +2 -2
  65. package/dist/cjs/utilities/{RovingTabIndex/RovingTabindexItem.js → RovingFocus/RovingFocusItem.js} +6 -6
  66. package/dist/cjs/utilities/{RovingTabIndex/RovingTabindexRoot.js → RovingFocus/RovingFocusRoot.js} +11 -7
  67. package/dist/cjs/utilities/{RovingTabIndex/useRovingTabindex.js → RovingFocus/useRovingFocus.js} +5 -5
  68. package/dist/cjs/utilities/{useDebounce.js → hooks/useDebounceCallback/useDebounceCallback.js} +2 -2
  69. package/dist/cjs/utilities/hooks/useMediaQuery/useMediaQuery.js +49 -0
  70. package/dist/esm/components/Accordion/AccordionContent.js +5 -0
  71. package/dist/esm/components/Accordion/AccordionHeading.js +5 -0
  72. package/dist/esm/components/Accordion/AccordionItem.js +8 -0
  73. package/dist/esm/components/Accordion/AccordionRoot.js +3 -0
  74. package/dist/esm/components/Accordion/index.js +10 -0
  75. package/dist/esm/components/Alert/Alert.js +7 -2
  76. package/dist/esm/components/Button/Button.js +2 -0
  77. package/dist/esm/components/Card/Card.js +9 -0
  78. package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +2 -2
  79. package/dist/esm/components/DropdownMenu/DropdownMenuRoot.js +12 -0
  80. package/dist/esm/components/DropdownMenu/index.js +11 -0
  81. package/dist/esm/components/ErrorSummary/index.js +9 -0
  82. package/dist/esm/components/Pagination/PaginationEllipsis.js +1 -2
  83. package/dist/esm/components/Pagination/PaginationItem.js +1 -2
  84. package/dist/esm/components/Pagination/PaginationRoot.js +1 -2
  85. package/dist/esm/components/Pagination/index.js +3 -3
  86. package/dist/esm/components/Popover/PopoverContent.js +2 -2
  87. package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
  88. package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
  89. package/dist/esm/components/Skeleton/Text/Text.js +1 -1
  90. package/dist/esm/components/Spinner/Spinner.js +1 -1
  91. package/dist/esm/components/Tabs/Tab.js +7 -2
  92. package/dist/esm/components/Tabs/TabContent.js +7 -0
  93. package/dist/esm/components/Tabs/TabList.js +15 -3
  94. package/dist/esm/components/Tabs/TabsRoot.js +17 -1
  95. package/dist/esm/components/Tabs/index.js +16 -0
  96. package/dist/esm/components/Tag/Tag.js +5 -0
  97. package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +8 -3
  98. package/dist/esm/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.js +7 -5
  99. package/dist/esm/components/ToggleGroup/ToggleGroupRoot.js +4 -5
  100. package/dist/esm/components/ToggleGroup/index.js +11 -0
  101. package/dist/esm/components/Tooltip/Tooltip.js +8 -1
  102. package/dist/esm/components/Typography/Heading/Heading.js +6 -1
  103. package/dist/esm/components/Typography/Ingress/Ingress.js +6 -1
  104. package/dist/esm/components/Typography/Label/Label.js +6 -1
  105. package/dist/esm/components/Typography/Paragraph/Paragraph.js +6 -1
  106. package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
  107. package/dist/esm/components/form/Combobox/Combobox.js +5 -5
  108. package/dist/esm/components/form/Combobox/Custom.js +2 -3
  109. package/dist/esm/components/form/Combobox/Empty.js +1 -1
  110. package/dist/esm/components/form/Combobox/Option/Description.js +1 -1
  111. package/dist/esm/components/form/Combobox/Option/Option.js +1 -1
  112. package/dist/esm/components/form/Combobox/Option/SelectedIcon.js +1 -1
  113. package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +4 -4
  114. package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +1 -1
  115. package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +1 -1
  116. package/dist/esm/components/form/Combobox/internal/ComboboxError.js +2 -2
  117. package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +7 -3
  118. package/dist/esm/components/form/Combobox/internal/ComboboxLabel.js +1 -1
  119. package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +1 -1
  120. package/dist/esm/components/form/Combobox/useCombobox.js +12 -5
  121. package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +2 -2
  122. package/dist/esm/components/form/Combobox/useFloatingCombobox.js +2 -2
  123. package/dist/esm/components/form/NativeSelect/NativeSelect.js +1 -1
  124. package/dist/esm/components/form/Radio/Radio.js +1 -1
  125. package/dist/esm/components/form/Search/Search.js +3 -4
  126. package/dist/esm/components/form/Switch/Switch.js +1 -1
  127. package/dist/esm/components/form/Textarea/Textarea.js +1 -1
  128. package/dist/esm/components/form/Textfield/Textfield.js +1 -1
  129. package/dist/esm/index.js +9 -5
  130. package/dist/esm/node_modules/@floating-ui/{react-dom/node_modules/@floating-ui/dom → dom}/dist/floating-ui.dom.js +4 -4
  131. package/dist/esm/node_modules/@floating-ui/react/dist/floating-ui.react.js +2 -2
  132. package/dist/esm/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +2 -2
  133. package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +2 -2
  134. package/dist/esm/utilities/{RovingTabIndex/RovingTabindexItem.js → RovingFocus/RovingFocusItem.js} +6 -6
  135. package/dist/esm/utilities/{RovingTabIndex/RovingTabindexRoot.js → RovingFocus/RovingFocusRoot.js} +11 -7
  136. package/dist/esm/utilities/{RovingTabIndex/useRovingTabindex.js → RovingFocus/useRovingFocus.js} +5 -5
  137. package/dist/esm/utilities/{useDebounce.js → hooks/useDebounceCallback/useDebounceCallback.js} +2 -2
  138. package/dist/esm/utilities/hooks/useMediaQuery/useMediaQuery.js +47 -0
  139. package/dist/types/components/Accordion/AccordionContent.d.ts +8 -9
  140. package/dist/types/components/Accordion/AccordionContent.d.ts.map +1 -1
  141. package/dist/types/components/Accordion/AccordionHeading.d.ts +5 -0
  142. package/dist/types/components/Accordion/AccordionHeading.d.ts.map +1 -1
  143. package/dist/types/components/Accordion/AccordionItem.d.ts +22 -3
  144. package/dist/types/components/Accordion/AccordionItem.d.ts.map +1 -1
  145. package/dist/types/components/Accordion/AccordionRoot.d.ts +15 -4
  146. package/dist/types/components/Accordion/AccordionRoot.d.ts.map +1 -1
  147. package/dist/types/components/Accordion/index.d.ts +10 -0
  148. package/dist/types/components/Accordion/index.d.ts.map +1 -1
  149. package/dist/types/components/Alert/Alert.d.ts +21 -10
  150. package/dist/types/components/Alert/Alert.d.ts.map +1 -1
  151. package/dist/types/components/Button/Button.d.ts +18 -4
  152. package/dist/types/components/Button/Button.d.ts.map +1 -1
  153. package/dist/types/components/Card/Card.d.ts +9 -0
  154. package/dist/types/components/Card/Card.d.ts.map +1 -1
  155. package/dist/types/components/DropdownMenu/DropdownMenuRoot.d.ts +12 -0
  156. package/dist/types/components/DropdownMenu/DropdownMenuRoot.d.ts.map +1 -1
  157. package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +4 -2
  158. package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts.map +1 -1
  159. package/dist/types/components/DropdownMenu/index.d.ts +11 -0
  160. package/dist/types/components/DropdownMenu/index.d.ts.map +1 -1
  161. package/dist/types/components/ErrorSummary/index.d.ts +9 -0
  162. package/dist/types/components/ErrorSummary/index.d.ts.map +1 -1
  163. package/dist/types/components/Modal/ModalTrigger.d.ts +4 -2
  164. package/dist/types/components/Modal/ModalTrigger.d.ts.map +1 -1
  165. package/dist/types/components/Pagination/Pagination.d.ts +2 -1
  166. package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
  167. package/dist/types/components/Pagination/PaginationEllipsis.d.ts +2 -2
  168. package/dist/types/components/Pagination/PaginationEllipsis.d.ts.map +1 -1
  169. package/dist/types/components/Pagination/PaginationItem.d.ts +2 -2
  170. package/dist/types/components/Pagination/PaginationItem.d.ts.map +1 -1
  171. package/dist/types/components/Pagination/PaginationNextPrev.d.ts +3 -2
  172. package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +1 -1
  173. package/dist/types/components/Pagination/PaginationRoot.d.ts +2 -2
  174. package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
  175. package/dist/types/components/Pagination/index.d.ts +7 -7
  176. package/dist/types/components/Pagination/index.d.ts.map +1 -1
  177. package/dist/types/components/Popover/PopoverTrigger.d.ts +4 -2
  178. package/dist/types/components/Popover/PopoverTrigger.d.ts.map +1 -1
  179. package/dist/types/components/Table/index.d.ts +7 -0
  180. package/dist/types/components/Table/index.d.ts.map +1 -1
  181. package/dist/types/components/Tabs/Tab.d.ts +7 -2
  182. package/dist/types/components/Tabs/Tab.d.ts.map +1 -1
  183. package/dist/types/components/Tabs/TabContent.d.ts +7 -0
  184. package/dist/types/components/Tabs/TabContent.d.ts.map +1 -1
  185. package/dist/types/components/Tabs/TabList.d.ts +10 -0
  186. package/dist/types/components/Tabs/TabList.d.ts.map +1 -1
  187. package/dist/types/components/Tabs/TabsRoot.d.ts +14 -13
  188. package/dist/types/components/Tabs/TabsRoot.d.ts.map +1 -1
  189. package/dist/types/components/Tabs/index.d.ts +16 -0
  190. package/dist/types/components/Tabs/index.d.ts.map +1 -1
  191. package/dist/types/components/Tag/Tag.d.ts +9 -2
  192. package/dist/types/components/Tag/Tag.d.ts.map +1 -1
  193. package/dist/types/components/Tag/index.d.ts +1 -2
  194. package/dist/types/components/Tag/index.d.ts.map +1 -1
  195. package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts +13 -2
  196. package/dist/types/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.d.ts.map +1 -1
  197. package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts +2 -1
  198. package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts.map +1 -1
  199. package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts +2 -3
  200. package/dist/types/components/ToggleGroup/ToggleGroupRoot.d.ts.map +1 -1
  201. package/dist/types/components/ToggleGroup/index.d.ts +11 -0
  202. package/dist/types/components/ToggleGroup/index.d.ts.map +1 -1
  203. package/dist/types/components/Tooltip/Tooltip.d.ts +23 -6
  204. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  205. package/dist/types/components/Typography/Heading/Heading.d.ts +14 -3
  206. package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
  207. package/dist/types/components/Typography/Ingress/Ingress.d.ts +6 -1
  208. package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
  209. package/dist/types/components/Typography/Label/Label.d.ts +16 -9
  210. package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
  211. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +10 -5
  212. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
  213. package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
  214. package/dist/types/components/form/Combobox/Custom.d.ts +2 -2
  215. package/dist/types/components/form/Combobox/Custom.d.ts.map +1 -1
  216. package/dist/types/components/form/Combobox/Empty.d.ts +2 -2
  217. package/dist/types/components/form/Combobox/Empty.d.ts.map +1 -1
  218. package/dist/types/components/form/Combobox/Option/Description.d.ts +1 -1
  219. package/dist/types/components/form/Combobox/Option/Description.d.ts.map +1 -1
  220. package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -1
  221. package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
  222. package/dist/types/components/form/Combobox/Option/SelectedIcon.d.ts +2 -2
  223. package/dist/types/components/form/Combobox/Option/SelectedIcon.d.ts.map +1 -1
  224. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -1
  225. package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts +1 -1
  226. package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
  227. package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts +1 -1
  228. package/dist/types/components/form/Combobox/internal/ComboboxClearButton.d.ts.map +1 -1
  229. package/dist/types/components/form/Combobox/internal/ComboboxError.d.ts +2 -2
  230. package/dist/types/components/form/Combobox/internal/ComboboxError.d.ts.map +1 -1
  231. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +1 -1
  232. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
  233. package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts +1 -1
  234. package/dist/types/components/form/Combobox/internal/ComboboxLabel.d.ts.map +1 -1
  235. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +1 -1
  236. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
  237. package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
  238. package/dist/types/components/form/Search/Search.d.ts +2 -2
  239. package/dist/types/components/form/Search/Search.d.ts.map +1 -1
  240. package/dist/types/index.d.ts +1 -1
  241. package/dist/types/index.d.ts.map +1 -1
  242. package/dist/types/types/Portal.d.ts +1 -1
  243. package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts +16 -0
  244. package/dist/types/utilities/RovingFocus/RovingFocusItem.d.ts.map +1 -0
  245. package/dist/types/utilities/{RovingTabIndex/RovingTabindexRoot.d.ts → RovingFocus/RovingFocusRoot.d.ts} +9 -9
  246. package/dist/types/utilities/RovingFocus/RovingFocusRoot.d.ts.map +1 -0
  247. package/dist/types/utilities/RovingFocus/index.d.ts +4 -0
  248. package/dist/types/utilities/RovingFocus/index.d.ts.map +1 -0
  249. package/dist/types/utilities/{RovingTabIndex/useRovingTabindex.d.ts → RovingFocus/useRovingFocus.d.ts} +7 -9
  250. package/dist/types/utilities/RovingFocus/useRovingFocus.d.ts.map +1 -0
  251. package/dist/types/{hooks → utilities/hooks}/index.d.ts +4 -3
  252. package/dist/types/utilities/hooks/index.d.ts.map +1 -0
  253. package/dist/types/utilities/hooks/useDebounceCallback/useDebounceCallback.d.ts +4 -0
  254. package/dist/types/utilities/hooks/useDebounceCallback/useDebounceCallback.d.ts.map +1 -0
  255. package/dist/types/utilities/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +1 -0
  256. package/dist/types/utilities/hooks/useMediaQuery/useMediaQuery.d.ts +7 -0
  257. package/dist/types/utilities/hooks/useMediaQuery/useMediaQuery.d.ts.map +1 -0
  258. package/dist/types/utilities/hooks/usePrevious.d.ts.map +1 -0
  259. package/dist/types/utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts.map +1 -0
  260. package/dist/types/utilities/index.d.ts +3 -1
  261. package/dist/types/utilities/index.d.ts.map +1 -1
  262. package/dist/types/utilities/{objectUtils.d.ts → omit/omit.d.ts} +1 -1
  263. package/dist/types/utilities/omit/omit.d.ts.map +1 -0
  264. package/package.json +9 -5
  265. package/dist/cjs/hooks/useMediaQuery.js +0 -27
  266. package/dist/esm/hooks/useMediaQuery.js +0 -25
  267. package/dist/types/hooks/index.d.ts.map +0 -1
  268. package/dist/types/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts.map +0 -1
  269. package/dist/types/hooks/useMediaQuery.d.ts +0 -2
  270. package/dist/types/hooks/useMediaQuery.d.ts.map +0 -1
  271. package/dist/types/hooks/usePrevious.d.ts.map +0 -1
  272. package/dist/types/hooks/useSynchronizedAnimation/useSynchronizedAnimation.d.ts.map +0 -1
  273. package/dist/types/utilities/RovingTabIndex/RovingTabindexItem.d.ts +0 -16
  274. package/dist/types/utilities/RovingTabIndex/RovingTabindexItem.d.ts.map +0 -1
  275. package/dist/types/utilities/RovingTabIndex/RovingTabindexRoot.d.ts.map +0 -1
  276. package/dist/types/utilities/RovingTabIndex/index.d.ts +0 -4
  277. package/dist/types/utilities/RovingTabIndex/index.d.ts.map +0 -1
  278. package/dist/types/utilities/RovingTabIndex/useRovingTabindex.d.ts.map +0 -1
  279. package/dist/types/utilities/objectUtils.d.ts.map +0 -1
  280. package/dist/types/utilities/useDebounce.d.ts +0 -4
  281. package/dist/types/utilities/useDebounce.d.ts.map +0 -1
  282. /package/dist/cjs/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +0 -0
  283. /package/dist/cjs/{hooks → utilities/hooks}/usePrevious.js +0 -0
  284. /package/dist/cjs/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.js +0 -0
  285. /package/dist/cjs/utilities/{objectUtils.js → omit/omit.js} +0 -0
  286. /package/dist/esm/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +0 -0
  287. /package/dist/esm/{hooks → utilities/hooks}/usePrevious.js +0 -0
  288. /package/dist/esm/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.js +0 -0
  289. /package/dist/esm/utilities/{objectUtils.js → omit/omit.js} +0 -0
  290. /package/dist/types/{hooks → utilities/hooks}/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +0 -0
  291. /package/dist/types/{hooks → utilities/hooks}/usePrevious.d.ts +0 -0
  292. /package/dist/types/{hooks → utilities/hooks}/useSynchronizedAnimation/useSynchronizedAnimation.d.ts +0 -0
@@ -9,7 +9,7 @@ var CharacterCounter = require('../CharacterCounter.js');
9
9
  var useTextfield = require('./useTextfield.js');
10
10
  var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
11
11
  var Label = require('../../Typography/Label/Label.js');
12
- var objectUtils = require('../../../utilities/objectUtils.js');
12
+ var omit = require('../../../utilities/omit/omit.js');
13
13
  var ErrorMessage = require('../../Typography/ErrorMessage/ErrorMessage.js');
14
14
 
15
15
  /** Text input field
@@ -26,7 +26,7 @@ const Textfield = React.forwardRef((props, ref) => {
26
26
  const characterLimitId = `textfield-charactercount-${React.useId()}`;
27
27
  const hasCharacterLimit = characterLimit != null;
28
28
  const describedBy = lite.clsx(inputProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
29
- return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx(`ds-textfield`, `ds-textfield--${size}`, readOnly && `ds-textfield--readonly`, hasError && `ds-textfield--error`, className), children: [label && (jsxRuntime.jsxs(Label.Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: lite.clsx(`ds-textfield__label`, hideLabel && `ds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'ds-textfield__readonly__icon' })), jsxRuntime.jsx("span", { children: label })] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx(`ds-textfield__description`, hideLabel && `ds-sr-only`), children: description }) })), jsxRuntime.jsxs("div", { className: 'ds-textfield__field', children: [prefix && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, variant: 'short', children: jsxRuntime.jsx("div", { className: lite.clsx(`ds-textfield__adornment`, `ds-textfield__prefix`), "aria-hidden": 'true', children: prefix }) })), jsxRuntime.jsx("input", { className: lite.clsx(`ds-textfield__input`, `ds-focus`, prefix && `ds-textfield__input--with-prefix`, suffix && `ds-textfield__input--with-suffix`), ref: ref, type: type, disabled: inputProps.disabled, "aria-describedby": describedBy, size: htmlSize, ...objectUtils.omit(['size', 'error', 'errorId'], rest), ...inputProps, onChange: (e) => {
29
+ return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { style: style, className: lite.clsx(`ds-textfield`, `ds-textfield--${size}`, readOnly && `ds-textfield--readonly`, hasError && `ds-textfield--error`, className), children: [label && (jsxRuntime.jsxs(Label.Label, { size: size, weight: 'medium', htmlFor: inputProps.id, className: lite.clsx(`ds-textfield__label`, hideLabel && `ds-sr-only`), children: [readOnly && (jsxRuntime.jsx(akselIcons.PadlockLockedFillIcon, { "aria-hidden": true, className: 'ds-textfield__readonly__icon' })), jsxRuntime.jsx("span", { children: label })] })), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: lite.clsx(`ds-textfield__description`, hideLabel && `ds-sr-only`), children: description }) })), jsxRuntime.jsxs("div", { className: 'ds-textfield__field', children: [prefix && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, variant: 'short', children: jsxRuntime.jsx("div", { className: lite.clsx(`ds-textfield__adornment`, `ds-textfield__prefix`), "aria-hidden": 'true', children: prefix }) })), jsxRuntime.jsx("input", { className: lite.clsx(`ds-textfield__input`, `ds-focus`, prefix && `ds-textfield__input--with-prefix`, suffix && `ds-textfield__input--with-suffix`), ref: ref, type: type, disabled: inputProps.disabled, "aria-describedby": describedBy, size: htmlSize, ...omit.omit(['size', 'error', 'errorId'], rest), ...inputProps, onChange: (e) => {
30
30
  inputProps?.onChange?.(e);
31
31
  setInputValue(e.target.value);
32
32
  } }), suffix && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, variant: 'short', children: jsxRuntime.jsx("div", { className: lite.clsx(`ds-textfield__adornment`, `ds-textfield__suffix`), "aria-hidden": 'true', children: suffix }) }))] }), hasCharacterLimit && (jsxRuntime.jsx(CharacterCounter.CharacterCounter, { size: size, value: inputValue ? inputValue.toString() : '', id: characterLimitId, ...characterLimit })), jsxRuntime.jsx("div", { className: 'ds-textfield__error-message', id: errorId, "aria-live": 'polite', "aria-relevant": 'additions removals', children: hasError && jsxRuntime.jsx(ErrorMessage.ErrorMessage, { size: size, children: props.error }) })] }) }));
package/dist/cjs/index.js CHANGED
@@ -2,8 +2,12 @@
2
2
  'use strict';
3
3
 
4
4
  var ErrorSummaryList = require('./components/ErrorSummary/ErrorSummaryList.js');
5
- var useSynchronizedAnimation = require('./hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
6
- var useIsomorphicLayoutEffect = require('./hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
5
+ var useSynchronizedAnimation = require('./utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js');
6
+ var useIsomorphicLayoutEffect = require('./utilities/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
7
+ var RovingFocusRoot = require('./utilities/RovingFocus/RovingFocusRoot.js');
8
+ var useRovingFocus = require('./utilities/RovingFocus/useRovingFocus.js');
9
+ var RovingFocusItem = require('./utilities/RovingFocus/RovingFocusItem.js');
10
+ var omit = require('./utilities/omit/omit.js');
7
11
  var Button = require('./components/Button/Button.js');
8
12
  var HelpText = require('./components/HelpText/HelpText.js');
9
13
  var Spinner = require('./components/Spinner/Spinner.js');
@@ -103,6 +107,12 @@ var ErrorSummaryHeading = require('./components/ErrorSummary/ErrorSummaryHeading
103
107
  exports.ErrorSummaryList = ErrorSummaryList;
104
108
  exports.useSynchronizedAnimation = useSynchronizedAnimation.useSynchronizedAnimation;
105
109
  exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect.useIsomorphicLayoutEffect;
110
+ exports.RovingFocusRoot = RovingFocusRoot.RovingFocusRoot;
111
+ exports.useRovingFocus = useRovingFocus.useRovingFocus;
112
+ exports.RovingFocusItem = RovingFocusItem.RovingFocusItem;
113
+ exports.getNextFocusableValue = RovingFocusItem.getNextFocusableValue;
114
+ exports.getPrevFocusableValue = RovingFocusItem.getPrevFocusableValue;
115
+ exports.omit = omit.omit;
106
116
  exports.Button = Button.Button;
107
117
  exports.HelpText = HelpText.HelpText;
108
118
  exports.Spinner = Spinner.Spinner;
@@ -132,11 +142,11 @@ exports.ChipRemovable = Removable.RemovableChip;
132
142
  exports.ChipToggle = Toggle.ToggleChip;
133
143
  exports.usePagination = usePagination.usePagination;
134
144
  exports.Pagination = index$3.Pagination;
135
- exports.PaginationRoot = PaginationRoot.default;
145
+ exports.PaginationRoot = PaginationRoot.PaginationRoot;
136
146
  exports.PaginationContent = PaginationContent.PaginationContent;
137
- exports.PaginationItem = PaginationItem.default;
147
+ exports.PaginationItem = PaginationItem.PaginationItem;
138
148
  exports.PaginationButton = PaginationButton.PaginationButton;
139
- exports.PaginationEllipsis = PaginationEllipsis.default;
149
+ exports.PaginationEllipsis = PaginationEllipsis.PaginationEllipsis;
140
150
  exports.PaginationNext = PaginationNextPrev.PaginationNext;
141
151
  exports.PaginationPrevious = PaginationNextPrev.PaginationPrevious;
142
152
  exports.SkipLink = SkipLink.SkipLink;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var floatingUi_core = require('../../../../../core/dist/floating-ui.core.js');
5
- var floatingUi_utils = require('../../../../../utils/dist/floating-ui.utils.js');
6
- var floatingUi_utils_dom = require('../../../../../utils/dist/floating-ui.utils.dom.js');
4
+ var floatingUi_core = require('../../core/dist/floating-ui.core.js');
5
+ var floatingUi_utils = require('../../utils/dist/floating-ui.utils.js');
6
+ var floatingUi_utils_dom = require('../../utils/dist/floating-ui.utils.dom.js');
7
7
 
8
8
  function getCssDimensions(element) {
9
9
  const css = floatingUi_utils_dom.getComputedStyle(element);
@@ -8,7 +8,7 @@ var floatingUi_reactDom = require('../../react-dom/dist/floating-ui.react-dom.js
8
8
  var floatingUi_utils_dom = require('../../utils/dist/floating-ui.utils.dom.js');
9
9
  var index_esm = require('../../../tabbable/dist/index.esm.js');
10
10
  var ReactDOM = require('react-dom');
11
- var floatingUi_dom = require('../../react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
11
+ var floatingUi_dom = require('../../dom/dist/floating-ui.dom.js');
12
12
 
13
13
  function _interopNamespaceDefault(e) {
14
14
  var n = Object.create(null);
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var floatingUi_dom = require('../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
4
+ var floatingUi_dom = require('../../dom/dist/floating-ui.dom.js');
5
5
  var React = require('react');
6
6
  var ReactDOM = require('react-dom');
7
7
 
@@ -4,8 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var lite = require('../../node_modules/clsx/dist/lite.js');
7
- var usePrevious = require('../../hooks/usePrevious.js');
8
- var useMediaQuery = require('../../hooks/useMediaQuery.js');
7
+ var usePrevious = require('../hooks/usePrevious.js');
8
+ var useMediaQuery = require('../hooks/useMediaQuery/useMediaQuery.js');
9
9
 
10
10
  const transitionDurationInMilliseconds = 250;
11
11
  /**
@@ -5,22 +5,22 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
7
7
  var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
8
- var useRovingTabindex = require('./useRovingTabindex.js');
8
+ var useRovingFocus = require('./useRovingFocus.js');
9
9
 
10
- /** Get the next focusable RovingTabindexItem */
10
+ /** Get the next focusable RovingFocusItem */
11
11
  function getNextFocusableValue(items, value) {
12
12
  const currIndex = items.findIndex((item) => item.value === value);
13
13
  return items.at(currIndex === items.length - 1 ? 0 : currIndex + 1);
14
14
  }
15
- /** Get the previous focusable RovingTabindexItem */
15
+ /** Get the previous focusable RovingFocusItem */
16
16
  function getPrevFocusableValue(items, value) {
17
17
  const currIndex = items.findIndex((item) => item.value === value);
18
18
  return items.at(currIndex === 0 ? -1 : currIndex - 1);
19
19
  }
20
- const RovingTabindexItem = React.forwardRef(({ value, asChild, ...rest }, ref) => {
20
+ const RovingFocusItem = React.forwardRef(({ value, asChild, ...rest }, ref) => {
21
21
  const Component = asChild ? index.Slot : 'div';
22
22
  const focusValue = value ?? (typeof rest.children == 'string' ? rest.children : '');
23
- const { getOrderedItems, getRovingProps } = useRovingTabindex.useRovingTabindex(focusValue);
23
+ const { getOrderedItems, getRovingProps } = useRovingFocus.useRovingFocus(focusValue);
24
24
  const rovingProps = getRovingProps({
25
25
  onKeyDown: (e) => {
26
26
  rest?.onKeyDown?.(e);
@@ -39,6 +39,6 @@ const RovingTabindexItem = React.forwardRef(({ value, asChild, ...rest }, ref) =
39
39
  return (jsxRuntime.jsx(Component, { ...rest, ...rovingProps, ref: mergedRefs, children: rest.children }));
40
40
  });
41
41
 
42
- exports.RovingTabindexItem = RovingTabindexItem;
42
+ exports.RovingFocusItem = RovingFocusItem;
43
43
  exports.getNextFocusableValue = getNextFocusableValue;
44
44
  exports.getPrevFocusableValue = getPrevFocusableValue;
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
7
7
  var index = require('../../node_modules/@radix-ui/react-slot/dist/index.js');
8
8
 
9
- const RovingTabindexContext = React.createContext({
9
+ const RovingFocusContext = React.createContext({
10
10
  elements: { current: new Map() },
11
11
  getOrderedItems: () => [],
12
12
  setFocusableValue: () => {
@@ -17,7 +17,7 @@ const RovingTabindexContext = React.createContext({
17
17
  },
18
18
  focusableValue: null,
19
19
  });
20
- const RovingTabindexRoot = React.forwardRef(({ valueId, asChild, onBlur, onFocus, ...rest }, ref) => {
20
+ const RovingFocusRoot = React.forwardRef(({ activeValue, asChild, onBlur, onFocus, ...rest }, ref) => {
21
21
  const Component = asChild ? index.Slot : 'div';
22
22
  const [focusableValue, setFocusableValue] = React.useState(null);
23
23
  const [isShiftTabbing, setIsShiftTabbing] = React.useState(false);
@@ -32,7 +32,10 @@ const RovingTabindexRoot = React.forwardRef(({ valueId, asChild, onBlur, onFocus
32
32
  .sort((a, b) => elementsFromDOM.indexOf(a[1]) - elementsFromDOM.indexOf(b[1]))
33
33
  .map(([value, element]) => ({ value, element }));
34
34
  };
35
- return (jsxRuntime.jsx(RovingTabindexContext.Provider, { value: {
35
+ React.useEffect(() => {
36
+ setFocusableValue(activeValue ?? null);
37
+ }, [activeValue]);
38
+ return (jsxRuntime.jsx(RovingFocusContext.Provider, { value: {
36
39
  elements,
37
40
  getOrderedItems,
38
41
  focusableValue,
@@ -43,6 +46,7 @@ const RovingTabindexRoot = React.forwardRef(({ valueId, asChild, onBlur, onFocus
43
46
  }, children: jsxRuntime.jsx(Component, { ...rest, tabIndex: isShiftTabbing ? -1 : 0, onBlur: (e) => {
44
47
  onBlur?.(e);
45
48
  setIsShiftTabbing(false);
49
+ setFocusableValue(activeValue ?? null);
46
50
  }, onFocus: (e) => {
47
51
  onFocus?.(e);
48
52
  if (e.target !== e.currentTarget)
@@ -53,8 +57,8 @@ const RovingTabindexRoot = React.forwardRef(({ valueId, asChild, onBlur, onFocus
53
57
  if (focusableValue != null) {
54
58
  elements.current.get(focusableValue)?.focus();
55
59
  }
56
- else if (valueId != null) {
57
- elements.current.get(valueId)?.focus();
60
+ else if (activeValue != null) {
61
+ elements.current.get(activeValue)?.focus();
58
62
  }
59
63
  else {
60
64
  orderedItems.at(0)?.element.focus();
@@ -62,5 +66,5 @@ const RovingTabindexRoot = React.forwardRef(({ valueId, asChild, onBlur, onFocus
62
66
  }, ref: refs }) }));
63
67
  });
64
68
 
65
- exports.RovingTabindexContext = RovingTabindexContext;
66
- exports.RovingTabindexRoot = RovingTabindexRoot;
69
+ exports.RovingFocusContext = RovingFocusContext;
70
+ exports.RovingFocusRoot = RovingFocusRoot;
@@ -2,13 +2,13 @@
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
5
- var RovingTabindexRoot = require('./RovingTabindexRoot.js');
5
+ var RovingFocusRoot = require('./RovingFocusRoot.js');
6
6
 
7
7
  // Logic from: https://www.joshuawootonn.com/react-roving-tabindex
8
8
  // Inspired by: https://github.com/radix-ui/primitives/tree/main/packages/react/roving-focus/src
9
- /** Handles props for `RovingTabIndex` in context with `RovingTabIndexRoot` */
10
- const useRovingTabindex = (value) => {
11
- const { elements, getOrderedItems, setFocusableValue, focusableValue, onShiftTab, } = React.useContext(RovingTabindexRoot.RovingTabindexContext);
9
+ /** Handles props for `RovingFocus` in context with `RovingFocusRoot` */
10
+ const useRovingFocus = (value) => {
11
+ const { elements, getOrderedItems, setFocusableValue, focusableValue, onShiftTab, } = React.useContext(RovingFocusRoot.RovingFocusContext);
12
12
  return {
13
13
  getOrderedItems,
14
14
  isFocusable: focusableValue === value,
@@ -39,4 +39,4 @@ const useRovingTabindex = (value) => {
39
39
  };
40
40
  };
41
41
 
42
- exports.useRovingTabindex = useRovingTabindex;
42
+ exports.useRovingFocus = useRovingFocus;
@@ -3,7 +3,7 @@
3
3
 
4
4
  var React = require('react');
5
5
 
6
- function useDebounce(callback, delay = 50) {
6
+ function useDebounceCallback(callback, delay = 50) {
7
7
  const timeoutRef = React.useRef(null);
8
8
  React.useEffect(() => {
9
9
  // Cleanup the previous timeout on re-render
@@ -24,4 +24,4 @@ function useDebounce(callback, delay = 50) {
24
24
  return debouncedCallback;
25
25
  }
26
26
 
27
- module.exports = useDebounce;
27
+ exports.useDebounceCallback = useDebounceCallback;
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var useIsomorphicLayoutEffect = require('../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js');
6
+
7
+ // from https://usehooks-ts.com/react-hook/use-media-query
8
+ const IS_SERVER = typeof window === 'undefined';
9
+ function useMediaQuery(query, { defaultValue = false, initializeWithValue = true, } = {}) {
10
+ const getMatches = (query) => {
11
+ if (IS_SERVER) {
12
+ return defaultValue;
13
+ }
14
+ return window.matchMedia(query).matches;
15
+ };
16
+ const [matches, setMatches] = React.useState(() => {
17
+ if (initializeWithValue) {
18
+ return getMatches(query);
19
+ }
20
+ return defaultValue;
21
+ });
22
+ // Handles the change event of the media query.
23
+ function handleChange() {
24
+ setMatches(getMatches(query));
25
+ }
26
+ useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
27
+ const matchMedia = window.matchMedia(query);
28
+ // Triggered at the first client-side load and if query changes
29
+ handleChange();
30
+ // Use deprecated `addListener` and `removeListener` to support Safari < 14 (#135)
31
+ if (matchMedia.addListener) {
32
+ matchMedia.addListener(handleChange);
33
+ }
34
+ else {
35
+ matchMedia.addEventListener('change', handleChange);
36
+ }
37
+ return () => {
38
+ if (matchMedia.removeListener) {
39
+ matchMedia.removeListener(handleChange);
40
+ }
41
+ else {
42
+ matchMedia.removeEventListener('change', handleChange);
43
+ }
44
+ };
45
+ }, [query]);
46
+ return matches;
47
+ }
48
+
49
+ exports.useMediaQuery = useMediaQuery;
@@ -6,6 +6,11 @@ import { AccordionItemContext } from './AccordionItem.js';
6
6
  import { AnimateHeight } from '../../utilities/AnimateHeight/AnimateHeight.js';
7
7
  import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
8
8
 
9
+ /**
10
+ * Accordion content component, contains the content of the accordion item.
11
+ * @example
12
+ * <AccordionContent>Content</AccordionContent>
13
+ */
9
14
  const AccordionContent = forwardRef(({ children, className, ...rest }, ref) => {
10
15
  const context = useContext(AccordionItemContext);
11
16
  if (context === null) {
@@ -7,6 +7,11 @@ import { AccordionItemContext } from './AccordionItem.js';
7
7
  import { Heading } from '../Typography/Heading/Heading.js';
8
8
  import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
9
9
 
10
+ /**
11
+ * Accordion header component, contains a button to toggle the content.
12
+ * @example
13
+ * <AccordionHeader>Header</AccordionHeader>
14
+ */
10
15
  const AccordionHeading = forwardRef(({ level = 1, children, className, onHeaderClick, ...rest }, ref) => {
11
16
  const context = useContext(AccordionItemContext);
12
17
  if (context === null) {
@@ -4,6 +4,14 @@ import { clsx } from '../../node_modules/clsx/dist/lite.js';
4
4
  import { createContext, forwardRef, useState, useId } from 'react';
5
5
 
6
6
  const AccordionItemContext = createContext(null);
7
+ /**
8
+ * Accordion item component, contains `Accordion.Header` and `Accordion.Content` components.
9
+ * @example
10
+ * <AccordionItem>
11
+ * <AccordionHeader>Header</AccordionHeader>
12
+ * <AccordionContent>Content</AccordionContent>
13
+ * </AccordionItem>
14
+ */
7
15
  const AccordionItem = forwardRef(({ children, className, open, defaultOpen = false, ...rest }, ref) => {
8
16
  const [internalOpen, setInternalOpen] = useState(defaultOpen);
9
17
  const contentId = useId();
@@ -3,6 +3,9 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
5
5
 
6
+ /**
7
+ * Accordion root component, contains `Accordion.Item` components.
8
+ */
6
9
  const AccordionRoot = forwardRef(({ border = false, color = 'neutral', className, ...rest }, ref) => {
7
10
  return (jsx("div", { className: clsx('ds-accordion', border && 'ds-accordion--border', color && `ds-accordion--${color}`, className), ref: ref, ...rest }));
8
11
  });
@@ -4,6 +4,16 @@ import { AccordionItem } from './AccordionItem.js';
4
4
  import { AccordionContent } from './AccordionContent.js';
5
5
  import { AccordionHeading } from './AccordionHeading.js';
6
6
 
7
+ /**
8
+ * Accordions are used to toggle the visibility of content.
9
+ * @example
10
+ * <Accordion.Root>
11
+ * <Accordion.Item>
12
+ * <Accordion.Heading>Heading 1</Accordion.Heading>
13
+ * <Accordion.Content>Content 1</Accordion.Content>
14
+ * </Accordion.Item>
15
+ * <Accordion.Item>
16
+ */
7
17
  const Accordion = {};
8
18
  Accordion.Root = AccordionRoot;
9
19
  Accordion.Heading = AccordionHeading;
@@ -17,9 +17,14 @@ const icons = {
17
17
  title: 'Feil',
18
18
  },
19
19
  };
20
- const Alert = forwardRef(({ severity = 'info', elevated, iconTitle, children, size = 'md', className, ...rest }, ref) => {
20
+ /**
21
+ * Alerts are used to inform users about important information, warnings, errors, or success.
22
+ * @example
23
+ * <Alert severity='info'>Dette er en informasjonsmelding</Alert>
24
+ */
25
+ const Alert = forwardRef(({ severity = 'info', iconTitle, children, size = 'md', className, ...rest }, ref) => {
21
26
  const { Icon, title } = icons[severity];
22
- return (jsx("div", { ref: ref, className: clsx('ds-alert', `ds-alert--${size}`, `ds-alert--${severity}`, elevated && `ds-alert--elevated`, className), ...rest, children: jsxs(Fragment, { children: [jsx(Icon, { title: iconTitle || title, className: 'ds-alert__icon' }), jsx(Paragraph, { asChild: true, size: size, className: 'ds-alert__content', children: jsx("span", { children: children }) })] }) }));
27
+ return (jsx("div", { ref: ref, className: clsx('ds-alert', `ds-alert--${size}`, `ds-alert--${severity}`, className), ...rest, children: jsxs(Fragment, { children: [jsx(Icon, { title: iconTitle || title, className: 'ds-alert__icon' }), jsx(Paragraph, { asChild: true, size: size, className: 'ds-alert__content', children: jsx("span", { children: children }) })] }) }));
23
28
  });
24
29
  Alert.displayName = 'Alert';
25
30
 
@@ -7,6 +7,8 @@ import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
7
7
 
8
8
  /**
9
9
  * Button used for interaction
10
+ * @example
11
+ * <Button>Click me</Button>
10
12
  */
11
13
  const Button = forwardRef(({ children, variant = 'primary', color = 'accent', fullWidth = false, icon = false, type = 'button', size = 'md', asChild, className, ...rest }, ref) => {
12
14
  const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'button';
@@ -4,6 +4,15 @@ import { forwardRef } from 'react';
4
4
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
5
5
  import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
6
6
 
7
+ /**
8
+ * Card component to present content in a structured way.
9
+ * @example
10
+ * <Card>
11
+ * <Card.Header>Header</Card.Header>
12
+ * <Card.Content>Content</Card.Content>
13
+ * <Card.Footer>Footer</Card.Footer>
14
+ * </Card>
15
+ */
7
16
  const Card = forwardRef(({ isLink = false, asChild = false, color = 'neutral', className, ...rest }, ref) => {
8
17
  const Component = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : 'div';
9
18
  return (jsx(Component, { ref: ref, className: clsx(`ds-card`, `ds-card--${color}`, isLink && `ds-card--link`, isLink && `ds-focus`, className), ...rest }));
@@ -5,9 +5,9 @@ import { forwardRef, useContext, useRef } from 'react';
5
5
  import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingFocusManager, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
6
6
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
7
7
  import { DropdownMenuContext } from './DropdownMenuRoot.js';
8
- import { autoUpdate, shift } from '../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
8
+ import { autoUpdate, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
9
9
  import { offset } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
10
- import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
10
+ import { useIsomorphicLayoutEffect } from '../../utilities/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
11
11
 
12
12
  const GAP = 4;
13
13
  const DropdownMenuContent = forwardRef(({ className, children, ...rest }, ref) => {
@@ -2,6 +2,18 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useEffect, createContext } from 'react';
4
4
 
5
+ /**
6
+ * DropdownMenuRoot is the root component for the DropdownMenu component.
7
+ * @example
8
+ * <DropdownMenu.Root>
9
+ * <DropdownMenu.Trigger>Dropdown</DropdownMenu.Trigger>
10
+ * <DropdownMenu.Content>
11
+ * <DropdownMenu.Group heading='Heading'>
12
+ * <DropdownMenu.Item>Button 1</DropdownMenu.Item>
13
+ * </DropdownMenu.Group>
14
+ * </DropdownMenu.Content>
15
+ * </DropdownMenu.Root>
16
+ */
5
17
  const DropdownMenuRoot = ({ open, onClose, placement = 'bottom-end', portal, size = 'md', children, }) => {
6
18
  const triggerRef = useRef(null);
7
19
  const [internalOpen, setInternalOpen] = useState(open ?? false);
@@ -5,6 +5,17 @@ import { DropdownMenuItem } from './DropdownMenuItem.js';
5
5
  import { DropdownMenuTrigger } from './DropdownMenuTrigger.js';
6
6
  import { DropdownMenuContent } from './DropdownMenuContent.js';
7
7
 
8
+ /**
9
+ * @example
10
+ * <DropdownMenu.Root>
11
+ * <DropdownMenu.Trigger>Dropdown</DropdownMenu.Trigger>
12
+ * <DropdownMenu.Content>
13
+ * <DropdownMenu.Group heading='Heading'>
14
+ * <DropdownMenu.Item>Button 1</DropdownMenu.Item>
15
+ * </DropdownMenu.Group>
16
+ * </DropdownMenu.Content>
17
+ * </DropdownMenu.Root>
18
+ */
8
19
  const DropdownMenu = {};
9
20
  DropdownMenu.Root = DropdownMenuRoot;
10
21
  DropdownMenu.Content = DropdownMenuContent;
@@ -4,6 +4,15 @@ import { ErrorSummaryHeading } from './ErrorSummaryHeading.js';
4
4
  import { ErrorSummaryItem } from './ErrorSummaryItem.js';
5
5
  import ErrorSummaryList from './ErrorSummaryList.js';
6
6
 
7
+ /**
8
+ * @example
9
+ * <ErrorSummary.Root>
10
+ * <ErrorSummary.Heading>Heading</ErrorSummary.Heading>
11
+ * <ErrorSummary.List>
12
+ * <ErrorSummary.Item>Item 1</ErrorSummary.Item>
13
+ * </ErrorSummary.List>
14
+ * </ErrorSummary.Root>
15
+ */
7
16
  const ErrorSummary = {};
8
17
  ErrorSummary.Root = ErrorSummaryRoot;
9
18
  ErrorSummary.Item = ErrorSummaryItem;
@@ -10,6 +10,5 @@ const PaginationEllipsis = forwardRef(({ className, ...rest }, ref) => {
10
10
  return (jsx(Paragraph, { ref: ref, className: clsx('ds-pagination__ellipsis', className), size: size, ...rest, children: "\u2026" }));
11
11
  });
12
12
  PaginationEllipsis.displayName = 'PaginationEllipsis';
13
- var PaginationEllipsis$1 = PaginationEllipsis;
14
13
 
15
- export { PaginationEllipsis, PaginationEllipsis$1 as default };
14
+ export { PaginationEllipsis };
@@ -11,6 +11,5 @@ const PaginationItem = forwardRef(({ asChild, className, ...rest }, ref) => {
11
11
  return (jsx(Component, { ref: ref, className: clsx('ds-pagination__item', `ds-pagination--${size}`, compact && 'ds-pagination--compact', className), ...rest }));
12
12
  });
13
13
  PaginationItem.displayName = 'PaginationItem';
14
- var PaginationItem$1 = PaginationItem;
15
14
 
16
- export { PaginationItem, PaginationItem$1 as default };
15
+ export { PaginationItem };
@@ -12,6 +12,5 @@ const PaginationRoot = forwardRef(({ asChild, compact = false, size = 'md', ...r
12
12
  return (jsx(PaginationContext.Provider, { value: { size, compact }, children: jsx(Component, { ref: ref, "aria-label": 'Pagination', ...rest }) }));
13
13
  });
14
14
  PaginationRoot.displayName = 'PaginationRoot';
15
- var PaginationRoot$1 = PaginationRoot;
16
15
 
17
- export { PaginationContext, PaginationRoot, PaginationRoot$1 as default };
16
+ export { PaginationContext, PaginationRoot };
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { Pagination as Pagination$1 } from './Pagination.js';
3
3
  import { PaginationContent } from './PaginationContent.js';
4
- import PaginationEllipsis from './PaginationEllipsis.js';
5
- import PaginationItem from './PaginationItem.js';
4
+ import { PaginationEllipsis } from './PaginationEllipsis.js';
5
+ import { PaginationItem } from './PaginationItem.js';
6
6
  import { PaginationButton } from './PaginationButton.js';
7
7
  import { PaginationPrevious, PaginationNext } from './PaginationNextPrev.js';
8
- import PaginationRoot from './PaginationRoot.js';
8
+ import { PaginationRoot } from './PaginationRoot.js';
9
9
 
10
10
  const Pagination = Pagination$1;
11
11
  Pagination.Root = PaginationRoot;
@@ -5,10 +5,10 @@ import { forwardRef, useContext, useRef, useEffect, useMemo } from 'react';
5
5
  import { useFloating, useInteractions, useFocus, useClick, useDismiss, useRole, useMergeRefs, FloatingPortal } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
6
6
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
7
7
  import { PopoverContext } from './PopoverRoot.js';
8
- import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/react-dom/node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
8
+ import { autoUpdate, flip, shift } from '../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
9
9
  import { offset } from '../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
10
10
  import { arrow } from '../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js';
11
- import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
11
+ import { useIsomorphicLayoutEffect } from '../../utilities/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js';
12
12
  import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
13
13
 
14
14
  const ARROW_HEIGHT = 7;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { clsx } from '../../../node_modules/clsx/dist/lite.js';
4
- import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
4
+ import { useSynchronizedAnimation } from '../../../utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
5
5
 
6
6
  /** Skeleton component used for indicating loading elements of circular shape */
7
7
  const Circle = ({ width, height, className, children, style, ...rest }) => {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { clsx } from '../../../node_modules/clsx/dist/lite.js';
4
- import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
4
+ import { useSynchronizedAnimation } from '../../../utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
5
5
 
6
6
  /** Skeleton component used for indicating loading elements of rectangle shape */
7
7
  const Rectangle = ({ width, height, className, children, style, ...rest }) => {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { clsx } from '../../../node_modules/clsx/dist/lite.js';
4
- import { useSynchronizedAnimation } from '../../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
4
+ import { useSynchronizedAnimation } from '../../../utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
5
5
 
6
6
  /** Skeleton component used for indicating loading elements of text */
7
7
  const Text = ({ width, height, className, style, children, ...rest }) => {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
4
- import { useSynchronizedAnimation } from '../../hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
4
+ import { useSynchronizedAnimation } from '../../utilities/hooks/useSynchronizedAnimation/useSynchronizedAnimation.js';
5
5
 
6
6
  const sizeMap = {
7
7
  '2xs': 13,
@@ -3,13 +3,18 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
  import { clsx } from '../../node_modules/clsx/dist/lite.js';
5
5
  import { useTabItem } from './useTab.js';
6
- import { RovingTabindexItem } from '../../utilities/RovingTabIndex/RovingTabindexItem.js';
6
+ import { RovingFocusItem } from '../../utilities/RovingFocus/RovingFocusItem.js';
7
7
  import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
8
8
 
9
+ /**
10
+ * A single item in a Tabs component.
11
+ * @example
12
+ * <Tabs.Tab value='1'>Tab 1</Tabs.Tab>
13
+ */
9
14
  const Tab = forwardRef((props, ref) => {
10
15
  const { children, className, ...rest } = props;
11
16
  const { size, ...useTabRest } = useTabItem(props);
12
- return (jsx(RovingTabindexItem, { ...rest, asChild: true, children: jsx(Paragraph, { asChild: true, variant: 'short', size: size, children: jsx("button", { ...useTabRest, type: 'button', className: clsx('ds-tabs__tab', 'ds-focus', className), ref: ref, children: children }) }) }));
17
+ return (jsx(RovingFocusItem, { ...rest, asChild: true, children: jsx(Paragraph, { asChild: true, variant: 'short', size: size, children: jsx("button", { ...useTabRest, type: 'button', className: clsx('ds-tabs__tab', 'ds-focus', className), ref: ref, children: children }) }) }));
13
18
  });
14
19
  Tab.displayName = 'Tab';
15
20
 
@@ -5,6 +5,13 @@ import { clsx } from '../../node_modules/clsx/dist/lite.js';
5
5
  import { TabsContext } from './TabsRoot.js';
6
6
  import { Paragraph } from '../Typography/Paragraph/Paragraph.js';
7
7
 
8
+ /**
9
+ * A single content item in a Tabs component.
10
+ * @example
11
+ * ```tsx
12
+ * <Tabs.Content value='1'>content 1</Tabs.Content>
13
+ * ```
14
+ */
8
15
  const TabContent = forwardRef(({ children, value, className, ...rest }, ref) => {
9
16
  const { value: tabsValue, size } = useContext(TabsContext);
10
17
  const active = value == tabsValue;