@digdir/designsystemet-react 0.61.0 → 0.63.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 (240) hide show
  1. package/dist/cjs/components/Accordion/Accordion.js +2 -2
  2. package/dist/cjs/components/Accordion/AccordionContent/AccordionContent.js +2 -2
  3. package/dist/cjs/components/Accordion/AccordionHeader/AccordionHeader.js +2 -2
  4. package/dist/cjs/components/Accordion/AccordionItem/AccordionItem.js +2 -2
  5. package/dist/cjs/components/Alert/Alert.js +5 -3
  6. package/dist/cjs/components/Box/Box.js +4 -1
  7. package/dist/cjs/components/Chip/Group/Group.js +5 -1
  8. package/dist/cjs/components/Chip/Removable/Removable.js +3 -1
  9. package/dist/cjs/components/Chip/Toggle/Toggle.js +3 -1
  10. package/dist/cjs/components/Divider/Divider.js +2 -2
  11. package/dist/cjs/components/DropdownMenu/DropdownMenu.js +4 -2
  12. package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +3 -3
  13. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.js +2 -2
  14. package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  15. package/dist/cjs/components/HelpText/HelpText.js +5 -3
  16. package/dist/cjs/components/List/ListHeading.js +3 -3
  17. package/dist/cjs/components/List/ListItem.js +2 -2
  18. package/dist/cjs/components/List/ListRoot.js +4 -2
  19. package/dist/cjs/components/List/Lists.js +3 -3
  20. package/dist/cjs/components/Modal/ModalDialog.js +1 -1
  21. package/dist/cjs/components/Modal/ModalHeader.js +1 -1
  22. package/dist/cjs/components/Pagination/Pagination.js +6 -4
  23. package/dist/cjs/components/Pagination/PaginationRoot.js +4 -2
  24. package/dist/cjs/components/Popover/Popover.js +4 -2
  25. package/dist/cjs/components/Popover/PopoverContent.js +6 -6
  26. package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
  27. package/dist/cjs/components/Skeleton/Circle/Circle.js +2 -2
  28. package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +2 -2
  29. package/dist/cjs/components/Skeleton/Text/Text.js +2 -2
  30. package/dist/cjs/components/SkipLink/SkipLink.js +2 -2
  31. package/dist/cjs/components/Spinner/Spinner.js +9 -7
  32. package/dist/cjs/components/Table/Table.js +3 -1
  33. package/dist/cjs/components/Tabs/Tab/Tab.js +3 -3
  34. package/dist/cjs/components/Tabs/Tab/useTab.js +1 -3
  35. package/dist/cjs/components/Tabs/TabList/TabList.js +2 -2
  36. package/dist/cjs/components/Tabs/Tabs.js +5 -2
  37. package/dist/cjs/components/Tag/Tag.js +3 -1
  38. package/dist/cjs/components/ToggleGroup/ToggleGroup.js +3 -1
  39. package/dist/cjs/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +3 -3
  40. package/dist/cjs/components/Tooltip/Tooltip.js +9 -9
  41. package/dist/cjs/components/Typography/ErrorMessage/ErrorMessage.js +5 -3
  42. package/dist/cjs/components/Typography/Heading/Heading.js +5 -3
  43. package/dist/cjs/components/Typography/Ingress/Ingress.js +5 -3
  44. package/dist/cjs/components/Typography/Label/Label.js +5 -3
  45. package/dist/cjs/components/Typography/Paragraph/Paragraph.js +5 -3
  46. package/dist/cjs/components/form/Checkbox/Checkbox.js +3 -3
  47. package/dist/cjs/components/form/Checkbox/Group/Group.js +1 -1
  48. package/dist/cjs/components/form/Combobox/Combobox.js +18 -16
  49. package/dist/cjs/components/form/Combobox/Custom.js +1 -1
  50. package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +4 -3
  51. package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +4 -3
  52. package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +3 -3
  53. package/dist/cjs/components/form/Combobox/useCombobox.js +22 -6
  54. package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +2 -2
  55. package/dist/cjs/components/form/Fieldset/Fieldset.js +2 -2
  56. package/dist/cjs/components/form/NativeSelect/NativeSelect.js +3 -3
  57. package/dist/cjs/components/form/NativeSelect/useNativeSelect.js +3 -1
  58. package/dist/cjs/components/form/Radio/Group/Group.js +3 -3
  59. package/dist/cjs/components/form/Radio/Radio.js +3 -3
  60. package/dist/cjs/components/form/Search/Search.js +5 -5
  61. package/dist/cjs/components/form/Search/useSearch.js +3 -7
  62. package/dist/cjs/components/form/Switch/Switch.js +2 -2
  63. package/dist/cjs/components/form/Textarea/Textarea.js +4 -4
  64. package/dist/cjs/components/form/Textarea/useTextarea.js +3 -1
  65. package/dist/cjs/components/form/Textfield/Textfield.js +6 -6
  66. package/dist/cjs/components/form/Textfield/useTextfield.js +3 -1
  67. package/dist/cjs/components/form/useFormField.js +5 -7
  68. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +3 -3
  69. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
  70. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
  71. package/dist/cjs/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
  72. package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +2 -2
  73. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  74. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  75. package/dist/cjs/utilities/getSize.js +2 -0
  76. package/dist/esm/components/Accordion/Accordion.js +1 -1
  77. package/dist/esm/components/Accordion/AccordionContent/AccordionContent.js +2 -2
  78. package/dist/esm/components/Accordion/AccordionHeader/AccordionHeader.js +2 -2
  79. package/dist/esm/components/Accordion/AccordionItem/AccordionItem.js +1 -1
  80. package/dist/esm/components/Alert/Alert.js +4 -2
  81. package/dist/esm/components/Box/Box.js +4 -1
  82. package/dist/esm/components/Chip/Group/Group.js +5 -1
  83. package/dist/esm/components/Chip/Removable/Removable.js +3 -1
  84. package/dist/esm/components/Chip/Toggle/Toggle.js +3 -1
  85. package/dist/esm/components/Divider/Divider.js +1 -1
  86. package/dist/esm/components/DropdownMenu/DropdownMenu.js +4 -2
  87. package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
  88. package/dist/esm/components/DropdownMenu/DropdownMenuItem.js +2 -2
  89. package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  90. package/dist/esm/components/HelpText/HelpText.js +4 -2
  91. package/dist/esm/components/List/ListHeading.js +3 -3
  92. package/dist/esm/components/List/ListItem.js +1 -1
  93. package/dist/esm/components/List/ListRoot.js +4 -2
  94. package/dist/esm/components/List/Lists.js +1 -1
  95. package/dist/esm/components/Modal/ModalDialog.js +1 -1
  96. package/dist/esm/components/Modal/ModalHeader.js +1 -1
  97. package/dist/esm/components/Pagination/Pagination.js +6 -4
  98. package/dist/esm/components/Pagination/PaginationRoot.js +4 -2
  99. package/dist/esm/components/Popover/Popover.js +4 -2
  100. package/dist/esm/components/Popover/PopoverContent.js +4 -4
  101. package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
  102. package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
  103. package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
  104. package/dist/esm/components/Skeleton/Text/Text.js +1 -1
  105. package/dist/esm/components/SkipLink/SkipLink.js +1 -1
  106. package/dist/esm/components/Spinner/Spinner.js +9 -7
  107. package/dist/esm/components/Table/Table.js +3 -1
  108. package/dist/esm/components/Tabs/Tab/Tab.js +3 -3
  109. package/dist/esm/components/Tabs/Tab/useTab.js +1 -3
  110. package/dist/esm/components/Tabs/TabList/TabList.js +1 -1
  111. package/dist/esm/components/Tabs/Tabs.js +5 -2
  112. package/dist/esm/components/Tag/Tag.js +3 -1
  113. package/dist/esm/components/ToggleGroup/ToggleGroup.js +3 -1
  114. package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +2 -2
  115. package/dist/esm/components/Tooltip/Tooltip.js +9 -9
  116. package/dist/esm/components/Typography/ErrorMessage/ErrorMessage.js +4 -2
  117. package/dist/esm/components/Typography/Heading/Heading.js +4 -2
  118. package/dist/esm/components/Typography/Ingress/Ingress.js +4 -2
  119. package/dist/esm/components/Typography/Label/Label.js +4 -2
  120. package/dist/esm/components/Typography/Paragraph/Paragraph.js +4 -2
  121. package/dist/esm/components/form/Checkbox/Checkbox.js +3 -3
  122. package/dist/esm/components/form/Checkbox/Group/Group.js +1 -1
  123. package/dist/esm/components/form/Combobox/Combobox.js +19 -17
  124. package/dist/esm/components/form/Combobox/Custom.js +1 -1
  125. package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +4 -3
  126. package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +4 -3
  127. package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +3 -3
  128. package/dist/esm/components/form/Combobox/useCombobox.js +21 -7
  129. package/dist/esm/components/form/Combobox/useFloatingCombobox.js +2 -2
  130. package/dist/esm/components/form/Fieldset/Fieldset.js +2 -2
  131. package/dist/esm/components/form/NativeSelect/NativeSelect.js +3 -3
  132. package/dist/esm/components/form/NativeSelect/useNativeSelect.js +3 -1
  133. package/dist/esm/components/form/Radio/Group/Group.js +2 -2
  134. package/dist/esm/components/form/Radio/Radio.js +3 -3
  135. package/dist/esm/components/form/Search/Search.js +3 -3
  136. package/dist/esm/components/form/Search/useSearch.js +3 -7
  137. package/dist/esm/components/form/Switch/Switch.js +2 -2
  138. package/dist/esm/components/form/Textarea/Textarea.js +3 -3
  139. package/dist/esm/components/form/Textarea/useTextarea.js +3 -1
  140. package/dist/esm/components/form/Textfield/Textfield.js +4 -4
  141. package/dist/esm/components/form/Textfield/useTextfield.js +3 -1
  142. package/dist/esm/components/form/useFormField.js +5 -7
  143. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +4 -4
  144. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
  145. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
  146. package/dist/esm/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
  147. package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +1 -1
  148. package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  149. package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  150. package/dist/esm/utilities/getSize.js +2 -0
  151. package/dist/types/components/Alert/Alert.d.ts +13 -6
  152. package/dist/types/components/Alert/Alert.d.ts.map +1 -1
  153. package/dist/types/components/Box/Box.d.ts +7 -4
  154. package/dist/types/components/Box/Box.d.ts.map +1 -1
  155. package/dist/types/components/Chip/Group/Group.d.ts +9 -3
  156. package/dist/types/components/Chip/Group/Group.d.ts.map +1 -1
  157. package/dist/types/components/Chip/Removable/Removable.d.ts +9 -6
  158. package/dist/types/components/Chip/Removable/Removable.d.ts.map +1 -1
  159. package/dist/types/components/Chip/Toggle/Toggle.d.ts +9 -6
  160. package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
  161. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +7 -4
  162. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  163. package/dist/types/components/HelpText/HelpText.d.ts +4 -3
  164. package/dist/types/components/HelpText/HelpText.d.ts.map +1 -1
  165. package/dist/types/components/List/ListHeading.d.ts +1 -1
  166. package/dist/types/components/List/ListRoot.d.ts +15 -9
  167. package/dist/types/components/List/ListRoot.d.ts.map +1 -1
  168. package/dist/types/components/Pagination/Pagination.d.ts +12 -4
  169. package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
  170. package/dist/types/components/Pagination/PaginationNextPrev.d.ts +2 -2
  171. package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +1 -1
  172. package/dist/types/components/Pagination/PaginationRoot.d.ts +7 -4
  173. package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
  174. package/dist/types/components/Popover/Popover.d.ts +8 -4
  175. package/dist/types/components/Popover/Popover.d.ts.map +1 -1
  176. package/dist/types/components/Spinner/Spinner.d.ts +10 -3
  177. package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
  178. package/dist/types/components/Table/Table.d.ts +8 -4
  179. package/dist/types/components/Table/Table.d.ts.map +1 -1
  180. package/dist/types/components/Tabs/Tab/Tab.d.ts.map +1 -1
  181. package/dist/types/components/Tabs/Tab/useTab.d.ts +1 -3
  182. package/dist/types/components/Tabs/Tab/useTab.d.ts.map +1 -1
  183. package/dist/types/components/Tabs/Tabs.d.ts +14 -4
  184. package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
  185. package/dist/types/components/Tag/Tag.d.ts +9 -5
  186. package/dist/types/components/Tag/Tag.d.ts.map +1 -1
  187. package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +14 -5
  188. package/dist/types/components/ToggleGroup/ToggleGroup.d.ts.map +1 -1
  189. package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts +2 -1
  190. package/dist/types/components/ToggleGroup/ToggleGroupItem/useToggleGroupitem.d.ts.map +1 -1
  191. package/dist/types/components/Tooltip/Tooltip.d.ts +14 -3
  192. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  193. package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts +14 -4
  194. package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts.map +1 -1
  195. package/dist/types/components/Typography/Heading/Heading.d.ts +10 -4
  196. package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
  197. package/dist/types/components/Typography/Ingress/Ingress.d.ts +8 -4
  198. package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
  199. package/dist/types/components/Typography/Label/Label.d.ts +15 -4
  200. package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
  201. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +18 -4
  202. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
  203. package/dist/types/components/form/CharacterCounter.d.ts +2 -1
  204. package/dist/types/components/form/CharacterCounter.d.ts.map +1 -1
  205. package/dist/types/components/form/Checkbox/Checkbox.d.ts.map +1 -1
  206. package/dist/types/components/form/Checkbox/Group/Group.d.ts.map +1 -1
  207. package/dist/types/components/form/Combobox/Combobox.d.ts +2 -2
  208. package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
  209. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -1
  210. package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
  211. package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
  212. package/dist/types/components/form/Combobox/useCombobox.d.ts +7 -0
  213. package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
  214. package/dist/types/components/form/Fieldset/useFieldset.d.ts +1 -1
  215. package/dist/types/components/form/NativeSelect/NativeSelect.d.ts +10 -6
  216. package/dist/types/components/form/NativeSelect/NativeSelect.d.ts.map +1 -1
  217. package/dist/types/components/form/NativeSelect/useNativeSelect.d.ts.map +1 -1
  218. package/dist/types/components/form/Search/Search.d.ts +12 -6
  219. package/dist/types/components/form/Search/Search.d.ts.map +1 -1
  220. package/dist/types/components/form/Search/useSearch.d.ts +1 -3
  221. package/dist/types/components/form/Search/useSearch.d.ts.map +1 -1
  222. package/dist/types/components/form/Switch/Switch.d.ts.map +1 -1
  223. package/dist/types/components/form/Textarea/Textarea.d.ts +10 -10
  224. package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
  225. package/dist/types/components/form/Textarea/useTextarea.d.ts.map +1 -1
  226. package/dist/types/components/form/Textfield/Textfield.d.ts +14 -4
  227. package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
  228. package/dist/types/components/form/Textfield/useTextfield.d.ts.map +1 -1
  229. package/dist/types/components/form/useFormField.d.ts +8 -2
  230. package/dist/types/components/form/useFormField.d.ts.map +1 -1
  231. package/dist/types/utilities/getSize.d.ts.map +1 -1
  232. package/package.json +2 -2
  233. package/dist/cjs/node_modules/clsx/dist/clsx.js +0 -9
  234. package/dist/esm/node_modules/clsx/dist/clsx.js +0 -4
  235. /package/dist/cjs/node_modules/{@radix-ui/react-slot/node_modules/@babel → @babel}/runtime/helpers/esm/extends.js +0 -0
  236. /package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
  237. /package/dist/cjs/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
  238. /package/dist/esm/node_modules/{@radix-ui/react-slot/node_modules/@babel → @babel}/runtime/helpers/esm/extends.js +0 -0
  239. /package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
  240. /package/dist/esm/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
@@ -3,14 +3,14 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var useTab = require('./useTab.js');
8
8
  var RovingTabindexItem = require('../../../utilities/RovingTabIndex/RovingTabindexItem.js');
9
9
 
10
10
  const Tab = React.forwardRef((props, ref) => {
11
11
  const { children, className, ...rest } = props;
12
- const { active, ...useTabRest } = useTab.useTabItem(props);
13
- return (jsxRuntime.jsx(RovingTabindexItem.RovingTabindexItem, { ...rest, asChild: true, children: jsxRuntime.jsx("button", { ...useTabRest, className: clsx.clsx('fds-tabs__tab', active && 'fds-tabs__tab--active', className), ref: ref, children: children }) }));
12
+ const { ...useTabRest } = useTab.useTabItem(props);
13
+ return (jsxRuntime.jsx(RovingTabindexItem.RovingTabindexItem, { ...rest, asChild: true, children: jsxRuntime.jsx("button", { ...useTabRest, className: lite.clsx('fds-tabs__tab', className), ref: ref, children: children }) }));
14
14
  });
15
15
  Tab.displayName = 'Tab';
16
16
 
@@ -8,13 +8,11 @@ var Tabs = require('../Tabs.js');
8
8
  const useTabItem = (props) => {
9
9
  const { value, ...rest } = props;
10
10
  const tabs = React.useContext(Tabs.TabsContext);
11
- const active = tabs.value == value;
12
11
  const buttonId = `tab-${React.useId()}`;
13
12
  return {
14
13
  ...rest,
15
- active: active,
16
14
  id: buttonId,
17
- 'aria-selected': active,
15
+ 'aria-selected': tabs.value == value,
18
16
  role: 'tab',
19
17
  onClick: () => {
20
18
  tabs.onChange?.(value);
@@ -3,11 +3,11 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var RovingTabindexRoot = require('../../../utilities/RovingTabIndex/RovingTabindexRoot.js');
8
8
 
9
9
  const TabList = React.forwardRef(({ children, className, ...rest }, ref) => {
10
- return (jsxRuntime.jsx(RovingTabindexRoot.RovingTabindexRoot, { role: 'tablist', className: clsx.clsx('fds-tabs__tablist', className), ref: ref, ...rest, children: children }));
10
+ return (jsxRuntime.jsx(RovingTabindexRoot.RovingTabindexRoot, { role: 'tablist', className: lite.clsx('fds-tabs__tablist', className), ref: ref, ...rest, children: children }));
11
11
  });
12
12
  TabList.displayName = 'TabList';
13
13
 
@@ -3,9 +3,12 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
+ var lite = require('../../node_modules/clsx/dist/lite.js');
7
+ var getSize = require('../../utilities/getSize.js');
6
8
 
7
9
  const TabsContext = React.createContext({});
8
- const Tabs = React.forwardRef(({ children, value, defaultValue, onChange, size = 'medium', ...rest }, ref) => {
10
+ const Tabs = React.forwardRef(({ children, value, defaultValue, className, onChange, ...rest }, ref) => {
11
+ const size = getSize.getSize(rest.size || 'md');
9
12
  const isControlled = value !== undefined;
10
13
  const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
11
14
  let onValueChange = onChange;
@@ -20,7 +23,7 @@ const Tabs = React.forwardRef(({ children, value, defaultValue, onChange, size =
20
23
  value,
21
24
  defaultValue,
22
25
  onChange: onValueChange,
23
- }, children: jsxRuntime.jsx("div", { className: `fds-tabs--${size}`, ref: ref, ...rest, children: children }) }));
26
+ }, children: jsxRuntime.jsx("div", { className: lite.clsx(`fds-tabs--${size}`, className), ref: ref, ...rest, children: children }) }));
24
27
  });
25
28
  Tabs.displayName = 'Tabs';
26
29
 
@@ -4,9 +4,11 @@
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 getSize = require('../../utilities/getSize.js');
7
8
  var Paragraph = require('../Typography/Paragraph/Paragraph.js');
8
9
 
9
- const Tag = React.forwardRef(({ children, color = 'neutral', size = 'medium', className, ...rest }, ref) => {
10
+ const Tag = React.forwardRef(({ children, color = 'neutral', className, ...rest }, ref) => {
11
+ const size = getSize.getSize(rest.size || 'md');
10
12
  return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("span", { className: lite.clsx('fds-tag', `fds-tag--${color}`, `fds-tag--${size}`, className), ref: ref, ...rest, children: children }) }));
11
13
  });
12
14
  Tag.displayName = 'Tag';
@@ -4,6 +4,7 @@
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 getSize = require('../../utilities/getSize.js');
7
8
  var RovingTabindexRoot = require('../../utilities/RovingTabIndex/RovingTabindexRoot.js');
8
9
 
9
10
  const ToggleGroupContext = React.createContext({});
@@ -17,7 +18,8 @@ const ToggleGroupContext = React.createContext({});
17
18
  * </ToggleGroup>
18
19
  * ```
19
20
  */
20
- const ToggleGroup = React.forwardRef(({ children, value, defaultValue, onChange, size = 'medium', name, className, ...rest }, ref) => {
21
+ const ToggleGroup = React.forwardRef(({ children, value, defaultValue, onChange, name, className, ...rest }, ref) => {
22
+ const size = getSize.getSize(rest.size || 'md');
21
23
  const nameId = React.useId();
22
24
  const isControlled = value !== undefined;
23
25
  const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
@@ -3,15 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var useToggleGroupitem = require('./useToggleGroupitem.js');
8
8
  var RovingTabindexItem = require('../../../utilities/RovingTabIndex/RovingTabindexItem.js');
9
9
  var Button = require('../../Button/Button.js');
10
10
 
11
11
  const ToggleGroupItem = React.forwardRef((props, ref) => {
12
12
  const { children, icon, className, ...rest } = props;
13
- const { active, size = 'medium', buttonProps } = useToggleGroupitem.useToggleGroupItem(props);
14
- return (jsxRuntime.jsx(RovingTabindexItem.RovingTabindexItem, { asChild: true, value: rest.value, children: jsxRuntime.jsx(Button.Button, { className: clsx.clsx('fds-togglegroup__item', className), icon: icon, color: 'first', variant: active ? 'primary' : 'tertiary', size: size, ref: ref, ...rest, ...buttonProps, children: children }) }));
13
+ const { active, size = 'md', buttonProps } = useToggleGroupitem.useToggleGroupItem(props);
14
+ return (jsxRuntime.jsx(RovingTabindexItem.RovingTabindexItem, { asChild: true, value: rest.value, children: jsxRuntime.jsx(Button.Button, { className: lite.clsx('fds-togglegroup__item', className), icon: icon, color: 'first', variant: active ? 'primary' : 'tertiary', size: size, ref: ref, ...rest, ...buttonProps, children: children }) }));
15
15
  });
16
16
  ToggleGroupItem.displayName = 'ToggleGroupItem';
17
17
 
@@ -4,10 +4,10 @@
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 floatingUi_react = require('../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
8
- var floatingUi_dom = require('../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
7
+ var floatingUi_react = require('../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
8
+ var floatingUi_dom = require('../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
9
9
  var floatingUi_core = require('../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
10
- var floatingUi_reactDom = require('../../packages/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
10
+ var floatingUi_reactDom = require('../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js');
11
11
 
12
12
  function _interopNamespaceDefault(e) {
13
13
  var n = Object.create(null);
@@ -30,7 +30,7 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
30
30
 
31
31
  const ARROW_HEIGHT = 7;
32
32
  const ARROW_GAP = 4;
33
- const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal, inverted, className, style, ...rest }, ref) => {
33
+ const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay = 150, open: userOpen, defaultOpen = false, portal = true, inverted, className, style, ...rest }, ref) => {
34
34
  const [isOpen, setIsOpen] = React.useState(defaultOpen);
35
35
  const Container = portal ? floatingUi_react.FloatingPortal : React__namespace.Fragment;
36
36
  const arrowRef = React__namespace.useRef(null);
@@ -77,11 +77,11 @@ const Tooltip = React.forwardRef(({ children, content, placement = 'top', delay
77
77
  }
78
78
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [React.cloneElement(children, getReferenceProps({
79
79
  ref: childMergedRef,
80
- })), internalOpen && (jsxRuntime.jsx(floatingUi_react.FloatingPortal, { children: jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
81
- className: lite.clsx('fds-tooltip', inverted && 'fds-tooltip--inverted', className),
82
- ref: mergedRef,
83
- ...rest,
84
- }), children: [content, jsxRuntime.jsx(floatingUi_react.FloatingArrow, { ref: arrowRef, context: context, className: 'fds-tooltip__arrow', height: ARROW_HEIGHT })] }) }) }))] }));
80
+ })), internalOpen && (jsxRuntime.jsx(Container, { children: jsxRuntime.jsxs("div", { ref: refs.setFloating, style: { ...floatingStyles, ...animationStyles, ...style }, role: 'tooltip', ...getFloatingProps({
81
+ className: lite.clsx('fds-tooltip', inverted && 'fds-tooltip--inverted', className),
82
+ ref: mergedRef,
83
+ ...rest,
84
+ }), children: [content, jsxRuntime.jsx(floatingUi_react.FloatingArrow, { ref: arrowRef, context: context, className: 'fds-tooltip__arrow', height: ARROW_HEIGHT })] }) }))] }));
85
85
  });
86
86
  Tooltip.displayName = 'Tooltip';
87
87
 
@@ -3,13 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
8
+ var getSize = require('../../../utilities/getSize.js');
8
9
 
9
10
  /** Use `ErrorMessage` to display text as error message. */
10
- const ErrorMessage = React.forwardRef(({ className, size = 'medium', spacing, asChild, error = true, ...rest }, ref) => {
11
+ const ErrorMessage = React.forwardRef(({ className, spacing, asChild, error = true, ...rest }, ref) => {
11
12
  const Component = asChild ? index.Slot : 'div';
12
- return (jsxRuntime.jsx(Component, { ref: ref, className: clsx.clsx('fds-error-message', `fds-error-message--${size}`, spacing && 'fds-error-message--spacing', error && 'fds-error-message--error', className), ...rest }));
13
+ const size = getSize.getSize(rest.size || 'md');
14
+ return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-error-message', `fds-error-message--${size}`, spacing && 'fds-error-message--spacing', error && 'fds-error-message--error', className), ...rest }));
13
15
  });
14
16
  ErrorMessage.displayName = 'ErrorMessage';
15
17
 
@@ -3,13 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
8
+ var getSize = require('../../../utilities/getSize.js');
8
9
 
9
10
  /** Use `Heading` to render h1-6 elements with heading text styles. */
10
- const Heading = React.forwardRef(({ level = 1, size = 'xlarge', spacing = false, className, asChild, ...rest }, ref) => {
11
+ const Heading = React.forwardRef(({ level = 1, spacing = false, className, asChild, ...rest }, ref) => {
11
12
  const Component = asChild ? index.Slot : `h${level ?? 1}`;
12
- return (jsxRuntime.jsx(Component, { ref: ref, className: clsx.clsx('fds-heading', `fds-heading--${size}`, spacing && 'fds-heading--spacing', className), ...rest }));
13
+ const size = getSize.getSize(rest.size || 'xl');
14
+ return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-heading', `fds-heading--${size}`, spacing && 'fds-heading--spacing', className), ...rest }));
13
15
  });
14
16
  Heading.displayName = 'Heading';
15
17
 
@@ -3,13 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
8
+ var getSize = require('../../../utilities/getSize.js');
8
9
 
9
10
  /** Use `Ingress` to display text as ingress. */
10
- const Ingress = React.forwardRef(({ className, size = 'medium', spacing, asChild, ...rest }, ref) => {
11
+ const Ingress = React.forwardRef(({ className, spacing, asChild, ...rest }, ref) => {
11
12
  const Component = asChild ? index.Slot : 'p';
12
- return (jsxRuntime.jsx(Component, { ref: ref, className: clsx.clsx(`fds-ingress`, `fds-ingress--${size}`, spacing && 'fds-ingress--spacing', className), ...rest }));
13
+ const size = getSize.getSize(rest.size || 'md');
14
+ return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx(`fds-ingress`, `fds-ingress--${size}`, spacing && 'fds-ingress--spacing', className), ...rest }));
13
15
  });
14
16
  Ingress.displayName = 'Ingress';
15
17
 
@@ -3,13 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
8
+ var getSize = require('../../../utilities/getSize.js');
8
9
 
9
10
  /** Use `Label` for labels. */
10
- const Label = React.forwardRef(({ className, size = 'medium', spacing, weight = 'medium', asChild, ...rest }, ref) => {
11
+ const Label = React.forwardRef(({ className, spacing, weight = 'medium', asChild, ...rest }, ref) => {
11
12
  const Component = asChild ? index.Slot : 'label';
12
- return (jsxRuntime.jsx(Component, { ref: ref, className: clsx.clsx('fds-label', `fds-label--${size}`, spacing && 'fds-label--spacing', weight && `fds-label--${weight}-weight`, className), ...rest }));
13
+ const size = getSize.getSize(rest.size || 'md');
14
+ return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-label', `fds-label--${size}`, spacing && 'fds-label--spacing', weight && `fds-label--${weight}-weight`, className), ...rest }));
13
15
  });
14
16
  Label.displayName = 'Label';
15
17
 
@@ -3,13 +3,15 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var clsx = require('../../../node_modules/clsx/dist/clsx.js');
6
+ var lite = require('../../../node_modules/clsx/dist/lite.js');
7
7
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
8
+ var getSize = require('../../../utilities/getSize.js');
8
9
 
9
10
  /** Use `Paragraph` to display text with paragraph text styles. */
10
- const Paragraph = React.forwardRef(({ className, size = 'medium', spacing, asChild, variant, ...rest }, ref) => {
11
+ const Paragraph = React.forwardRef(({ className, spacing, asChild, variant, ...rest }, ref) => {
11
12
  const Component = asChild ? index.Slot : 'p';
12
- return (jsxRuntime.jsx(Component, { ref: ref, className: clsx.clsx('fds-paragraph', `fds-paragraph--${size}`, spacing && 'fds-paragraph--spacing', variant && `fds-paragraph--${variant}`, className), ...rest }));
13
+ const size = getSize.getSize(rest.size || 'md');
14
+ return (jsxRuntime.jsx(Component, { ref: ref, className: lite.clsx('fds-paragraph', `fds-paragraph--${size}`, spacing && 'fds-paragraph--spacing', variant && `fds-paragraph--${variant}`, className), ...rest }));
13
15
  });
14
16
  Paragraph.displayName = 'Paragraph';
15
17
 
@@ -4,7 +4,7 @@
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 floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
7
+ var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
8
8
  var useCheckbox = require('./useCheckbox.js');
9
9
  var Paragraph = require('../../Typography/Paragraph/Paragraph.js');
10
10
  var objectUtils = require('../../../utilities/objectUtils.js');
@@ -12,7 +12,7 @@ var Label = require('../../Typography/Label/Label.js');
12
12
 
13
13
  const Checkbox = React.forwardRef((props, ref) => {
14
14
  const { children, description, className, style, ...rest } = props;
15
- const { inputProps, descriptionId, hasError, size = 'medium', readOnly } = useCheckbox.useCheckbox(props);
15
+ const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useCheckbox.useCheckbox(props);
16
16
  const inputRef = floatingUi_react.useMergeRefs([
17
17
  ref,
18
18
  (el) => {
@@ -21,7 +21,7 @@ const Checkbox = React.forwardRef((props, ref) => {
21
21
  }
22
22
  },
23
23
  ]);
24
- return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-checkbox', `fds-checkbox--${size}`, inputProps.disabled && `fds-checkbox--disabled`, hasError && `fds-checkbox--error`, readOnly && `fds-checkbox--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: `fds-checkbox__input`, ref: inputRef, ...objectUtils.omit(['size', 'error', 'indeterminate'], rest), ...inputProps, type: 'checkbox', "aria-checked": rest.indeterminate ? 'mixed' : inputProps.checked }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: `fds-checkbox__label`, htmlFor: inputProps.id, size: size, weight: 'regular', children: jsxRuntime.jsx("span", { children: children }) }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: `fds-checkbox__description`, children: description }) }))] }))] }) }));
24
+ return (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsxs("div", { className: lite.clsx('fds-checkbox', `fds-checkbox--${size}`, hasError && `fds-checkbox--error`, readOnly && `fds-checkbox--readonly`, className), style: style, children: [jsxRuntime.jsx("input", { className: `fds-checkbox__input`, ref: inputRef, ...objectUtils.omit(['size', 'error', 'indeterminate'], rest), ...inputProps, type: 'checkbox', disabled: inputProps.disabled, "aria-checked": rest.indeterminate ? 'mixed' : inputProps.checked }), children && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Label.Label, { className: `fds-checkbox__label`, htmlFor: inputProps.id, size: size, weight: 'regular', children: jsxRuntime.jsx("span", { children: children }) }), description && (jsxRuntime.jsx(Paragraph.Paragraph, { asChild: true, size: size, children: jsxRuntime.jsx("div", { id: descriptionId, className: `fds-checkbox__description`, children: description }) }))] }))] }) }));
25
25
  });
26
26
  Checkbox.displayName = 'Checkbox';
27
27
 
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var Fieldset = require('../../Fieldset/Fieldset.js');
7
7
 
8
8
  const CheckboxGroupContext = React.createContext(null);
9
- const CheckboxGroup = React.forwardRef(({ onChange, children, value, readOnly, defaultValue, size = 'medium', ...rest }, ref) => {
9
+ const CheckboxGroup = React.forwardRef(({ onChange, children, value, readOnly, defaultValue, size = 'md', ...rest }, ref) => {
10
10
  const [internalValue, setInternalValue] = React.useState(defaultValue ?? []);
11
11
  const toggleValue = (checkboxValue) => {
12
12
  const currentValue = value ?? internalValue;
@@ -3,11 +3,12 @@
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
- var floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
6
+ var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
7
7
  var lite = require('../../../node_modules/clsx/dist/lite.js');
8
8
  var index = require('../../../node_modules/@tanstack/react-virtual/dist/esm/index.js');
9
9
  var useFormField = require('../useFormField.js');
10
10
  var useDebounce = require('../../../utilities/useDebounce.js');
11
+ var getSize = require('../../../utilities/getSize.js');
11
12
  var useCombobox = require('./useCombobox.js');
12
13
  var ComboboxInput = require('./internal/ComboboxInput.js');
13
14
  var ComboboxLabel = require('./internal/ComboboxLabel.js');
@@ -22,7 +23,8 @@ var Box = require('../../Box/Box.js');
22
23
  var Spinner = require('../../Spinner/Spinner.js');
23
24
  var objectUtils = require('../../../utilities/objectUtils.js');
24
25
 
25
- const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false, size = 'medium', disabled = false, readOnly = false, hideChips = false, clearButtonLabel = 'Fjern alt', hideClearButton = false, error, errorId, id, name, portal = true, htmlSize = 0, virtual = false, children, style, loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
26
+ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueChange, label, hideLabel = false, description, multiple = false, disabled = false, readOnly = false, hideChips = false, clearButtonLabel = 'Fjern alt', hideClearButton = false, error, errorId, id, name, portal = true, htmlSize = 0, virtual = false, children, style, loading, loadingLabel = 'Laster...', filter, chipSrLabel = (option) => 'Slett ' + option.label, className, ...rest }, forwareddRef) => {
27
+ const size = getSize.getSize(rest.size || 'md');
26
28
  const inputRef = React.useRef(null);
27
29
  const portalRef = React.useRef(null);
28
30
  const listRef = React.useRef([]);
@@ -50,18 +52,18 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
50
52
  // if value is set, set input value to the label of the value
51
53
  React.useEffect(() => {
52
54
  if (value && value.length > 0 && !multiple) {
53
- const option = options[value[0]];
55
+ const option = options[useCombobox.prefix(value[0])];
54
56
  setInputValue(option?.label || '');
55
57
  }
56
58
  }, [multiple, value, options]);
57
59
  React.useEffect(() => {
58
60
  if (value && Object.keys(options).length >= 0) {
59
61
  const updatedSelectedOptions = value.map((option) => {
60
- const value = options[option];
62
+ const value = options[useCombobox.prefix(option)];
61
63
  return value;
62
64
  });
63
65
  setSelectedOptions(updatedSelectedOptions.reduce((acc, value) => {
64
- acc[value.value] = value;
66
+ acc[useCombobox.prefix(value.value)] = value;
65
67
  return acc;
66
68
  }, {}));
67
69
  }
@@ -79,18 +81,18 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
79
81
  return;
80
82
  if (remove) {
81
83
  const newSelectedOptions = { ...selectedOptions };
82
- delete newSelectedOptions[option.value];
84
+ delete newSelectedOptions[useCombobox.prefix(option.value)];
83
85
  setSelectedOptions(newSelectedOptions);
84
- onValueChange?.(Object.keys(newSelectedOptions));
86
+ onValueChange?.(Object.keys(newSelectedOptions).map((key) => useCombobox.removePrefix(key)));
85
87
  return;
86
88
  }
87
89
  const newSelectedOptions = { ...selectedOptions };
88
90
  if (multiple) {
89
- if (newSelectedOptions[option.value]) {
90
- delete newSelectedOptions[option.value];
91
+ if (newSelectedOptions[useCombobox.prefix(option.value)]) {
92
+ delete newSelectedOptions[useCombobox.prefix(option.value)];
91
93
  }
92
94
  else {
93
- newSelectedOptions[option.value] = option;
95
+ newSelectedOptions[useCombobox.prefix(option.value)] = option;
94
96
  }
95
97
  setInputValue('');
96
98
  inputRef.current?.focus();
@@ -100,7 +102,7 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
100
102
  Object.keys(newSelectedOptions).forEach((key) => {
101
103
  delete newSelectedOptions[key];
102
104
  });
103
- newSelectedOptions[option.value] = option;
105
+ newSelectedOptions[useCombobox.prefix(option.value)] = option;
104
106
  setInputValue(option?.label || '');
105
107
  // move cursor to the end of the input
106
108
  setTimeout(() => {
@@ -108,7 +110,7 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
108
110
  }, 0);
109
111
  }
110
112
  setSelectedOptions(newSelectedOptions);
111
- onValueChange?.(Object.keys(newSelectedOptions));
113
+ onValueChange?.(Object.keys(newSelectedOptions).map((key) => useCombobox.removePrefix(key)));
112
114
  !multiple && setOpen(false);
113
115
  refs.domReference.current?.focus();
114
116
  };
@@ -134,7 +136,7 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
134
136
  measureElement: (elem) => {
135
137
  return elem.getBoundingClientRect().height;
136
138
  },
137
- overscan: 1,
139
+ overscan: 7,
138
140
  });
139
141
  return (jsxRuntime.jsxs(ComboboxContext.ComboboxContext.Provider, { value: {
140
142
  size,
@@ -162,14 +164,14 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
162
164
  return;
163
165
  if (disabled)
164
166
  return;
165
- const option = options[value];
167
+ const option = options[useCombobox.prefix(value)];
166
168
  debouncedHandleSelectOption({ option: option });
167
169
  },
168
170
  handleSelectOption: debouncedHandleSelectOption,
169
171
  chipSrLabel,
170
172
  listRef,
171
173
  forwareddRef,
172
- }, children: [jsxRuntime.jsxs(Box.Box, { className: lite.clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsxRuntime.jsx(ComboboxNative.default, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsxRuntime.jsx(ComboboxLabel.default, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsxRuntime.jsx(ComboboxInput.default, { ...objectUtils.omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsxRuntime.jsx(ComboboxError.default, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsxRuntime.jsx(floatingUi_react.FloatingPortal, { root: portal ? null : portalRef, children: jsxRuntime.jsx(floatingUi_react.FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxRuntime.jsxs(Box.Box, { id: listId, shadow: 'medium', borderRadius: 'medium', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
174
+ }, children: [jsxRuntime.jsxs(Box.Box, { className: lite.clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsxRuntime.jsx(ComboboxNative.default, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsxRuntime.jsx(ComboboxLabel.default, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsxRuntime.jsx(ComboboxInput.default, { ...objectUtils.omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsxRuntime.jsx(ComboboxError.default, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsxRuntime.jsx(floatingUi_react.FloatingPortal, { root: portal ? null : portalRef, children: jsxRuntime.jsx(floatingUi_react.FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxRuntime.jsxs(Box.Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
173
175
  ref: refs.setFloating,
174
176
  style: {
175
177
  ...floatingStyles,
@@ -184,7 +186,7 @@ const ComboboxComponent = React.forwardRef(({ value, initialValue = [], onValueC
184
186
  left: 0,
185
187
  width: '100%',
186
188
  transform: `translateY(${virtualRow.start}px)`,
187
- }, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxRuntime.jsxs(Custom.default, { className: 'fds-combobox__loading', children: [jsxRuntime.jsx(Spinner.Spinner, { title: 'Laster', size: 'small' }), loadingLabel] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
189
+ }, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxRuntime.jsxs(Custom.default, { className: 'fds-combobox__loading', children: [jsxRuntime.jsx(Spinner.Spinner, { title: 'Laster', size: 'sm' }), loadingLabel] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
188
190
  });
189
191
  const Combobox = React.forwardRef((props, ref) => (jsxRuntime.jsx(ComboboxIdContext.ComboboxIdProvider, { children: jsxRuntime.jsx(ComboboxComponent, { ...props, ref: ref }) })));
190
192
  Combobox.displayName = 'Combobox';
@@ -7,7 +7,7 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var React = require('react');
8
8
  var lite = require('../../../node_modules/clsx/dist/lite.js');
9
9
  var index = require('../../../node_modules/@radix-ui/react-slot/dist/index.js');
10
- var floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
10
+ var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
11
11
  var ComboboxContext = require('./ComboboxContext.js');
12
12
  var ComboboxIdContext = require('./ComboboxIdContext.js');
13
13
  var objectUtils = require('../../../utilities/objectUtils.js');
@@ -2,10 +2,11 @@
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
5
- var floatingUi_react = require('../../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
5
+ var floatingUi_react = require('../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
6
6
  var ComboboxContext = require('../ComboboxContext.js');
7
7
  var useDebounce = require('../../../../utilities/useDebounce.js');
8
8
  var ComboboxIdContext = require('../ComboboxIdContext.js');
9
+ var useCombobox = require('../useCombobox.js');
9
10
 
10
11
  function useComboboxOption({ id, ref, value, }) {
11
12
  const generatedId = React.useId();
@@ -17,7 +18,7 @@ function useComboboxOption({ id, ref, value, }) {
17
18
  throw new Error('ComboboxOption must be used within a Combobox');
18
19
  }
19
20
  const { selectedOptions, onOptionClick, listRef, customIds, filteredOptions, } = context;
20
- const index = React.useMemo(() => filteredOptions.indexOf(value) + customIds.length, [customIds.length, filteredOptions, value]);
21
+ const index = React.useMemo(() => filteredOptions.indexOf(useCombobox.prefix(String(value))) + customIds.length, [customIds.length, filteredOptions, value]);
21
22
  const combinedRef = floatingUi_react.useMergeRefs([
22
23
  (node) => {
23
24
  listRef.current[index] = node;
@@ -27,7 +28,7 @@ function useComboboxOption({ id, ref, value, }) {
27
28
  if (index === -1) {
28
29
  throw new Error('Internal error: ComboboxOption did not find index');
29
30
  }
30
- const selected = selectedOptions[value];
31
+ const selected = selectedOptions[useCombobox.prefix(value)];
31
32
  const active = activeIndex === index;
32
33
  React.useEffect(() => {
33
34
  if (active) {
@@ -7,9 +7,10 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var React = require('react');
8
8
  var lite = require('../../../../node_modules/clsx/dist/lite.js');
9
9
  var akselIcons = require('@navikt/aksel-icons');
10
- var floatingUi_react = require('../../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
10
+ var floatingUi_react = require('../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
11
11
  var ComboboxContext = require('../ComboboxContext.js');
12
12
  var ComboboxIdContext = require('../ComboboxIdContext.js');
13
+ var useCombobox = require('../useCombobox.js');
13
14
  var ComboboxChips = require('./ComboboxChips.js');
14
15
  var ComboboxClearButton = require('./ComboboxClearButton.js');
15
16
  var Box = require('../../../Box/Box.js');
@@ -32,10 +33,10 @@ const ComboboxInput = ({ hideClearButton, listId, error, hideChips, handleKeyDow
32
33
  setInputValue(value);
33
34
  setActiveIndex(0);
34
35
  // check if input value is the same as a label, if so, select it
35
- const option = options[value.toLowerCase()];
36
+ const option = options[useCombobox.prefix(value.toLowerCase())];
36
37
  if (!option)
37
38
  return;
38
- if (selectedOptions[option.value])
39
+ if (selectedOptions[useCombobox.prefix(option.value)])
39
40
  return;
40
41
  handleSelectOption({ option: option });
41
42
  };
@@ -4,11 +4,11 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var useCombobox = require('../useCombobox.js');
7
8
 
8
9
  const ComboboxNative = ({ selectedOptions, multiple, name, }) => {
9
- return (jsxRuntime.jsx("select", { name: name, multiple: multiple, style: { display: 'none' }, value: multiple
10
- ? Object.keys(selectedOptions)
11
- : Object.keys(selectedOptions)[0], onChange: () => { }, children: Object.keys(selectedOptions).map((value) => (jsxRuntime.jsx("option", { value: value }, value))) }));
10
+ const VALUE = Object.keys(selectedOptions).map((key) => useCombobox.removePrefix(key));
11
+ return (jsxRuntime.jsx("select", { name: name, multiple: multiple, style: { display: 'none' }, value: multiple ? VALUE : VALUE[0], onChange: () => { }, children: VALUE.map((value) => (jsxRuntime.jsx("option", { value: value }, value))) }));
12
12
  };
13
13
  ComboboxNative.displayName = 'ComboboxNative';
14
14
  var ComboboxNative$1 = ComboboxNative;
@@ -17,6 +17,18 @@ function isComboboxCustom(child) {
17
17
  function isInteractiveComboboxCustom(child) {
18
18
  return isComboboxCustom(child) && child.props.interactive === true;
19
19
  }
20
+ const INTERNAL_OPTION_PREFIX = 'internal-option-';
21
+ /**
22
+ * We use this function to prefix the value of the options so we can make sure numbers as strings are not parsed as numbers in objects
23
+ * @param value
24
+ * @returns
25
+ */
26
+ const prefix = (value) => {
27
+ return INTERNAL_OPTION_PREFIX + value;
28
+ };
29
+ const removePrefix = (value) => {
30
+ return value.slice(INTERNAL_OPTION_PREFIX.length);
31
+ };
20
32
  function useCombobox({ children, inputValue, multiple, filter = (inputValue, option) => {
21
33
  return option.label.toLowerCase().startsWith(inputValue.toLowerCase());
22
34
  }, initialValue, }) {
@@ -64,8 +76,8 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
64
76
  });
65
77
  label = childrenLabel;
66
78
  }
67
- allOptions[props.value] = {
68
- value: props.value,
79
+ allOptions[prefix(String(props.value))] = {
80
+ value: String(props.value),
69
81
  label,
70
82
  displayValue: props.displayValue,
71
83
  description: props.description,
@@ -73,7 +85,9 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
73
85
  });
74
86
  return allOptions;
75
87
  }, [optionsChildren]);
76
- const preSelectedOptions = React.useMemo(() => (initialValue || []).reduce((acc, value) => {
88
+ const preSelectedOptions = React.useMemo(() => (initialValue?.map((key) => {
89
+ return prefix(key);
90
+ }) || []).reduce((acc, value) => {
77
91
  const option = options[value];
78
92
  if (isOption(option)) {
79
93
  acc[value] = option;
@@ -86,15 +100,15 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
86
100
  const filteredOptionsChildren = Object.keys(options).map((option, index) => {
87
101
  /* If we have a selected value in single mode and the input matches an option, return all children */
88
102
  if (!multiple && Object.keys(selectedOptions).length === 1) {
89
- filteredOptions.push(options[option].value);
103
+ filteredOptions.push(option);
90
104
  return optionsChildren[index];
91
105
  }
92
106
  if (multiple && selectedOptions[option]) {
93
- filteredOptions.push(options[option].value);
107
+ filteredOptions.push(option);
94
108
  return optionsChildren[index];
95
109
  }
96
110
  if (filter(inputValue, options[option])) {
97
- filteredOptions.push(options[option].value);
111
+ filteredOptions.push(option);
98
112
  return optionsChildren[index];
99
113
  }
100
114
  });
@@ -117,3 +131,5 @@ exports.default = useCombobox;
117
131
  exports.isComboboxCustom = isComboboxCustom;
118
132
  exports.isComboboxOption = isComboboxOption;
119
133
  exports.isInteractiveComboboxCustom = isInteractiveComboboxCustom;
134
+ exports.prefix = prefix;
135
+ exports.removePrefix = removePrefix;
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var floatingUi_react = require('../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js');
4
+ var floatingUi_react = require('../../../node_modules/@floating-ui/react/dist/floating-ui.react.js');
5
5
  var React = require('react');
6
6
  var ReactDOM = require('react-dom');
7
7
  var ComboboxIdContext = require('./ComboboxIdContext.js');
8
- var floatingUi_dom = require('../../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
8
+ var floatingUi_dom = require('../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js');
9
9
  var floatingUi_core = require('../../../node_modules/@floating-ui/core/dist/floating-ui.core.js');
10
10
 
11
11
  const useFloatingCombobox = ({ listRef }) => {