@digdir/designsystemet-react 0.60.0 → 0.62.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 (245) 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/Button/Button.js +3 -1
  8. package/dist/cjs/components/Chip/Group/Group.js +5 -1
  9. package/dist/cjs/components/Chip/Removable/Removable.js +3 -1
  10. package/dist/cjs/components/Chip/Toggle/Toggle.js +3 -1
  11. package/dist/cjs/components/Divider/Divider.js +2 -2
  12. package/dist/cjs/components/DropdownMenu/DropdownMenu.js +4 -2
  13. package/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +4 -4
  14. package/dist/cjs/components/DropdownMenu/DropdownMenuItem.js +2 -2
  15. package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  16. package/dist/cjs/components/HelpText/HelpText.js +5 -3
  17. package/dist/cjs/components/List/ListHeading.js +3 -3
  18. package/dist/cjs/components/List/ListItem.js +2 -2
  19. package/dist/cjs/components/List/ListRoot.js +4 -2
  20. package/dist/cjs/components/List/Lists.js +3 -3
  21. package/dist/cjs/components/Modal/ModalDialog.js +1 -1
  22. package/dist/cjs/components/Modal/ModalHeader.js +1 -1
  23. package/dist/cjs/components/Pagination/Pagination.js +6 -4
  24. package/dist/cjs/components/Pagination/PaginationRoot.js +4 -2
  25. package/dist/cjs/components/Popover/Popover.js +4 -2
  26. package/dist/cjs/components/Popover/PopoverContent.js +7 -7
  27. package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
  28. package/dist/cjs/components/Skeleton/Circle/Circle.js +2 -2
  29. package/dist/cjs/components/Skeleton/Rectangle/Rectangle.js +2 -2
  30. package/dist/cjs/components/Skeleton/Text/Text.js +2 -2
  31. package/dist/cjs/components/SkipLink/SkipLink.js +2 -2
  32. package/dist/cjs/components/Spinner/Spinner.js +9 -7
  33. package/dist/cjs/components/Table/Table.js +3 -1
  34. package/dist/cjs/components/Tabs/Tab/Tab.js +3 -3
  35. package/dist/cjs/components/Tabs/Tab/useTab.js +1 -3
  36. package/dist/cjs/components/Tabs/TabList/TabList.js +2 -2
  37. package/dist/cjs/components/Tabs/Tabs.js +5 -2
  38. package/dist/cjs/components/Tag/Tag.js +3 -1
  39. package/dist/cjs/components/ToggleGroup/ToggleGroup.js +3 -1
  40. package/dist/cjs/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +3 -3
  41. package/dist/cjs/components/Tooltip/Tooltip.js +10 -10
  42. package/dist/cjs/components/Typography/ErrorMessage/ErrorMessage.js +5 -3
  43. package/dist/cjs/components/Typography/Heading/Heading.js +5 -3
  44. package/dist/cjs/components/Typography/Ingress/Ingress.js +5 -3
  45. package/dist/cjs/components/Typography/Label/Label.js +5 -3
  46. package/dist/cjs/components/Typography/Paragraph/Paragraph.js +5 -3
  47. package/dist/cjs/components/form/Checkbox/Checkbox.js +2 -2
  48. package/dist/cjs/components/form/Checkbox/Group/Group.js +1 -1
  49. package/dist/cjs/components/form/Combobox/Combobox.js +10 -5
  50. package/dist/cjs/components/form/Combobox/Custom.js +1 -1
  51. package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +1 -1
  52. package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +1 -1
  53. package/dist/cjs/components/form/Combobox/useCombobox.js +7 -4
  54. package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +3 -3
  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 +1 -1
  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/core/dist/floating-ui.core.js +1 -1
  69. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
  70. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
  71. package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
  72. package/dist/cjs/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
  73. package/dist/cjs/utilities/AnimateHeight/AnimateHeight.js +2 -2
  74. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  75. package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  76. package/dist/cjs/utilities/getSize.js +31 -0
  77. package/dist/esm/components/Accordion/Accordion.js +1 -1
  78. package/dist/esm/components/Accordion/AccordionContent/AccordionContent.js +2 -2
  79. package/dist/esm/components/Accordion/AccordionHeader/AccordionHeader.js +2 -2
  80. package/dist/esm/components/Accordion/AccordionItem/AccordionItem.js +1 -1
  81. package/dist/esm/components/Alert/Alert.js +4 -2
  82. package/dist/esm/components/Box/Box.js +4 -1
  83. package/dist/esm/components/Button/Button.js +3 -1
  84. package/dist/esm/components/Chip/Group/Group.js +5 -1
  85. package/dist/esm/components/Chip/Removable/Removable.js +3 -1
  86. package/dist/esm/components/Chip/Toggle/Toggle.js +3 -1
  87. package/dist/esm/components/Divider/Divider.js +1 -1
  88. package/dist/esm/components/DropdownMenu/DropdownMenu.js +4 -2
  89. package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +4 -4
  90. package/dist/esm/components/DropdownMenu/DropdownMenuItem.js +2 -2
  91. package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
  92. package/dist/esm/components/HelpText/HelpText.js +4 -2
  93. package/dist/esm/components/List/ListHeading.js +3 -3
  94. package/dist/esm/components/List/ListItem.js +1 -1
  95. package/dist/esm/components/List/ListRoot.js +4 -2
  96. package/dist/esm/components/List/Lists.js +1 -1
  97. package/dist/esm/components/Modal/ModalDialog.js +1 -1
  98. package/dist/esm/components/Modal/ModalHeader.js +1 -1
  99. package/dist/esm/components/Pagination/Pagination.js +6 -4
  100. package/dist/esm/components/Pagination/PaginationRoot.js +4 -2
  101. package/dist/esm/components/Popover/Popover.js +4 -2
  102. package/dist/esm/components/Popover/PopoverContent.js +5 -5
  103. package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
  104. package/dist/esm/components/Skeleton/Circle/Circle.js +1 -1
  105. package/dist/esm/components/Skeleton/Rectangle/Rectangle.js +1 -1
  106. package/dist/esm/components/Skeleton/Text/Text.js +1 -1
  107. package/dist/esm/components/SkipLink/SkipLink.js +1 -1
  108. package/dist/esm/components/Spinner/Spinner.js +9 -7
  109. package/dist/esm/components/Table/Table.js +3 -1
  110. package/dist/esm/components/Tabs/Tab/Tab.js +3 -3
  111. package/dist/esm/components/Tabs/Tab/useTab.js +1 -3
  112. package/dist/esm/components/Tabs/TabList/TabList.js +1 -1
  113. package/dist/esm/components/Tabs/Tabs.js +5 -2
  114. package/dist/esm/components/Tag/Tag.js +3 -1
  115. package/dist/esm/components/ToggleGroup/ToggleGroup.js +3 -1
  116. package/dist/esm/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.js +2 -2
  117. package/dist/esm/components/Tooltip/Tooltip.js +10 -10
  118. package/dist/esm/components/Typography/ErrorMessage/ErrorMessage.js +4 -2
  119. package/dist/esm/components/Typography/Heading/Heading.js +4 -2
  120. package/dist/esm/components/Typography/Ingress/Ingress.js +4 -2
  121. package/dist/esm/components/Typography/Label/Label.js +4 -2
  122. package/dist/esm/components/Typography/Paragraph/Paragraph.js +4 -2
  123. package/dist/esm/components/form/Checkbox/Checkbox.js +2 -2
  124. package/dist/esm/components/form/Checkbox/Group/Group.js +1 -1
  125. package/dist/esm/components/form/Combobox/Combobox.js +10 -5
  126. package/dist/esm/components/form/Combobox/Custom.js +1 -1
  127. package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +1 -1
  128. package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +1 -1
  129. package/dist/esm/components/form/Combobox/useCombobox.js +7 -4
  130. package/dist/esm/components/form/Combobox/useFloatingCombobox.js +3 -3
  131. package/dist/esm/components/form/Fieldset/Fieldset.js +1 -1
  132. package/dist/esm/components/form/NativeSelect/NativeSelect.js +2 -2
  133. package/dist/esm/components/form/NativeSelect/useNativeSelect.js +3 -1
  134. package/dist/esm/components/form/Radio/Group/Group.js +2 -2
  135. package/dist/esm/components/form/Radio/Radio.js +2 -2
  136. package/dist/esm/components/form/Search/Search.js +3 -3
  137. package/dist/esm/components/form/Search/useSearch.js +3 -7
  138. package/dist/esm/components/form/Switch/Switch.js +1 -1
  139. package/dist/esm/components/form/Textarea/Textarea.js +2 -2
  140. package/dist/esm/components/form/Textarea/useTextarea.js +3 -1
  141. package/dist/esm/components/form/Textfield/Textfield.js +3 -3
  142. package/dist/esm/components/form/Textfield/useTextfield.js +3 -1
  143. package/dist/esm/components/form/useFormField.js +5 -7
  144. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/core/dist/floating-ui.core.js +1 -1
  145. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +2 -2
  146. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.js +2 -2
  147. package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react/dist/floating-ui.react.utils.js +1 -1
  148. package/dist/esm/node_modules/@radix-ui/react-slot/dist/index.js +1 -1
  149. package/dist/esm/utilities/AnimateHeight/AnimateHeight.js +1 -1
  150. package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
  151. package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
  152. package/dist/esm/utilities/getSize.js +29 -0
  153. package/dist/types/components/Alert/Alert.d.ts +13 -6
  154. package/dist/types/components/Alert/Alert.d.ts.map +1 -1
  155. package/dist/types/components/Box/Box.d.ts +7 -4
  156. package/dist/types/components/Box/Box.d.ts.map +1 -1
  157. package/dist/types/components/Button/Button.d.ts +14 -4
  158. package/dist/types/components/Button/Button.d.ts.map +1 -1
  159. package/dist/types/components/Chip/Group/Group.d.ts +9 -3
  160. package/dist/types/components/Chip/Group/Group.d.ts.map +1 -1
  161. package/dist/types/components/Chip/Removable/Removable.d.ts +9 -6
  162. package/dist/types/components/Chip/Removable/Removable.d.ts.map +1 -1
  163. package/dist/types/components/Chip/Toggle/Toggle.d.ts +9 -6
  164. package/dist/types/components/Chip/Toggle/Toggle.d.ts.map +1 -1
  165. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +7 -4
  166. package/dist/types/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  167. package/dist/types/components/DropdownMenu/DropdownMenuTrigger.d.ts +1 -1
  168. package/dist/types/components/HelpText/HelpText.d.ts +4 -3
  169. package/dist/types/components/HelpText/HelpText.d.ts.map +1 -1
  170. package/dist/types/components/List/ListHeading.d.ts +1 -1
  171. package/dist/types/components/List/ListRoot.d.ts +15 -9
  172. package/dist/types/components/List/ListRoot.d.ts.map +1 -1
  173. package/dist/types/components/Modal/ModalTrigger.d.ts +1 -1
  174. package/dist/types/components/Pagination/Pagination.d.ts +12 -4
  175. package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
  176. package/dist/types/components/Pagination/PaginationButton.d.ts +1 -1
  177. package/dist/types/components/Pagination/PaginationNextPrev.d.ts +2 -2
  178. package/dist/types/components/Pagination/PaginationNextPrev.d.ts.map +1 -1
  179. package/dist/types/components/Pagination/PaginationRoot.d.ts +7 -4
  180. package/dist/types/components/Pagination/PaginationRoot.d.ts.map +1 -1
  181. package/dist/types/components/Popover/Popover.d.ts +8 -4
  182. package/dist/types/components/Popover/Popover.d.ts.map +1 -1
  183. package/dist/types/components/Popover/PopoverTrigger.d.ts +1 -1
  184. package/dist/types/components/Spinner/Spinner.d.ts +10 -3
  185. package/dist/types/components/Spinner/Spinner.d.ts.map +1 -1
  186. package/dist/types/components/Table/Table.d.ts +8 -4
  187. package/dist/types/components/Table/Table.d.ts.map +1 -1
  188. package/dist/types/components/Tabs/Tab/Tab.d.ts.map +1 -1
  189. package/dist/types/components/Tabs/Tab/useTab.d.ts +1 -3
  190. package/dist/types/components/Tabs/Tab/useTab.d.ts.map +1 -1
  191. package/dist/types/components/Tabs/Tabs.d.ts +14 -4
  192. package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
  193. package/dist/types/components/Tag/Tag.d.ts +9 -5
  194. package/dist/types/components/Tag/Tag.d.ts.map +1 -1
  195. package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +14 -5
  196. package/dist/types/components/ToggleGroup/ToggleGroup.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/Tooltip/Tooltip.d.ts +14 -3
  200. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  201. package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts +14 -4
  202. package/dist/types/components/Typography/ErrorMessage/ErrorMessage.d.ts.map +1 -1
  203. package/dist/types/components/Typography/Heading/Heading.d.ts +10 -4
  204. package/dist/types/components/Typography/Heading/Heading.d.ts.map +1 -1
  205. package/dist/types/components/Typography/Ingress/Ingress.d.ts +8 -4
  206. package/dist/types/components/Typography/Ingress/Ingress.d.ts.map +1 -1
  207. package/dist/types/components/Typography/Label/Label.d.ts +15 -4
  208. package/dist/types/components/Typography/Label/Label.d.ts.map +1 -1
  209. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts +18 -4
  210. package/dist/types/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
  211. package/dist/types/components/form/CharacterCounter.d.ts +2 -1
  212. package/dist/types/components/form/CharacterCounter.d.ts.map +1 -1
  213. package/dist/types/components/form/Checkbox/Checkbox.d.ts.map +1 -1
  214. package/dist/types/components/form/Checkbox/Group/Group.d.ts.map +1 -1
  215. package/dist/types/components/form/Combobox/Combobox.d.ts +2 -2
  216. package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
  217. package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +1 -1
  218. package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
  219. package/dist/types/components/form/Fieldset/useFieldset.d.ts +1 -1
  220. package/dist/types/components/form/NativeSelect/NativeSelect.d.ts +10 -6
  221. package/dist/types/components/form/NativeSelect/NativeSelect.d.ts.map +1 -1
  222. package/dist/types/components/form/NativeSelect/useNativeSelect.d.ts.map +1 -1
  223. package/dist/types/components/form/Search/Search.d.ts +12 -6
  224. package/dist/types/components/form/Search/Search.d.ts.map +1 -1
  225. package/dist/types/components/form/Search/useSearch.d.ts +1 -3
  226. package/dist/types/components/form/Search/useSearch.d.ts.map +1 -1
  227. package/dist/types/components/form/Textarea/Textarea.d.ts +10 -10
  228. package/dist/types/components/form/Textarea/Textarea.d.ts.map +1 -1
  229. package/dist/types/components/form/Textarea/useTextarea.d.ts.map +1 -1
  230. package/dist/types/components/form/Textfield/Textfield.d.ts +14 -4
  231. package/dist/types/components/form/Textfield/Textfield.d.ts.map +1 -1
  232. package/dist/types/components/form/Textfield/useTextfield.d.ts.map +1 -1
  233. package/dist/types/components/form/useFormField.d.ts +8 -2
  234. package/dist/types/components/form/useFormField.d.ts.map +1 -1
  235. package/dist/types/utilities/getSize.d.ts +2 -0
  236. package/dist/types/utilities/getSize.d.ts.map +1 -0
  237. package/package.json +2 -5
  238. package/dist/cjs/node_modules/clsx/dist/clsx.js +0 -9
  239. package/dist/esm/node_modules/clsx/dist/clsx.js +0 -4
  240. /package/dist/cjs/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
  241. /package/dist/cjs/node_modules/{@babel → @radix-ui/react-slot/node_modules/@babel}/runtime/helpers/esm/extends.js +0 -0
  242. /package/dist/cjs/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
  243. /package/dist/esm/{packages/react/node_modules → node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -0
  244. /package/dist/esm/node_modules/{@babel → @radix-ui/react-slot/node_modules/@babel}/runtime/helpers/esm/extends.js +0 -0
  245. /package/dist/esm/{packages/react/node_modules → node_modules}/tabbable/dist/index.esm.js +0 -0
@@ -1,11 +1,12 @@
1
1
  'use client';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { forwardRef, useRef, useId, useState, useEffect } from 'react';
4
- import { FloatingPortal, FloatingFocusManager } from '../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
+ import { FloatingPortal, FloatingFocusManager } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
5
5
  import { clsx } from '../../../node_modules/clsx/dist/lite.js';
6
6
  import { useVirtualizer } from '../../../node_modules/@tanstack/react-virtual/dist/esm/index.js';
7
7
  import { useFormField } from '../useFormField.js';
8
8
  import useDebounce from '../../../utilities/useDebounce.js';
9
+ import { getSize } from '../../../utilities/getSize.js';
9
10
  import useCombobox from './useCombobox.js';
10
11
  import ComboboxInput from './internal/ComboboxInput.js';
11
12
  import ComboboxLabel from './internal/ComboboxLabel.js';
@@ -20,7 +21,8 @@ import { Box } from '../../Box/Box.js';
20
21
  import { Spinner } from '../../Spinner/Spinner.js';
21
22
  import { omit } from '../../../utilities/objectUtils.js';
22
23
 
23
- const ComboboxComponent = 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) => {
24
+ const ComboboxComponent = 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) => {
25
+ const size = getSize(rest.size || 'md');
24
26
  const inputRef = useRef(null);
25
27
  const portalRef = useRef(null);
26
28
  const listRef = useRef([]);
@@ -94,6 +96,10 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
94
96
  inputRef.current?.focus();
95
97
  }
96
98
  else {
99
+ /* clear newSelectedOptions */
100
+ Object.keys(newSelectedOptions).forEach((key) => {
101
+ delete newSelectedOptions[key];
102
+ });
97
103
  newSelectedOptions[option.value] = option;
98
104
  setInputValue(option?.label || '');
99
105
  // move cursor to the end of the input
@@ -102,7 +108,6 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
102
108
  }, 0);
103
109
  }
104
110
  setSelectedOptions(newSelectedOptions);
105
- console.log('calling new value with: ', Object.keys(newSelectedOptions));
106
111
  onValueChange?.(Object.keys(newSelectedOptions));
107
112
  !multiple && setOpen(false);
108
113
  refs.domReference.current?.focus();
@@ -164,7 +169,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
164
169
  chipSrLabel,
165
170
  listRef,
166
171
  forwareddRef,
167
- }, children: [jsxs(Box, { className: clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: 'medium', borderRadius: 'medium', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
172
+ }, children: [jsxs(Box, { className: clsx('fds-combobox', `fds-combobox--${size}`, disabled && 'fds-combobox__disabled', className), style: style, ref: portalRef, children: [name && (jsx(ComboboxNative, { name: name, selectedOptions: selectedOptions, multiple: multiple })), jsx(ComboboxLabel, { label: label, description: description, size: size, readOnly: readOnly, hideLabel: hideLabel, formFieldProps: formFieldProps }), jsx(ComboboxInput, { ...omit(['inputValue'], rest), hideClearButton: hideClearButton, listId: listId, error: error, hideChips: hideChips, handleKeyDown: handleKeyDown, "aria-busy": loading }), jsx(ComboboxError, { size: size, error: error, formFieldProps: formFieldProps })] }), open && (jsx(FloatingPortal, { root: portal ? null : portalRef, children: jsx(FloatingFocusManager, { context: context, initialFocus: -1, visuallyHiddenDismiss: true, children: jsxs(Box, { id: listId, shadow: 'md', borderRadius: 'md', borderColor: 'default', "aria-labelledby": formFieldProps.inputProps.id, "aria-autocomplete": 'list', tabIndex: -1, ...getFloatingProps({
168
173
  ref: refs.setFloating,
169
174
  style: {
170
175
  ...floatingStyles,
@@ -179,7 +184,7 @@ const ComboboxComponent = forwardRef(({ value, initialValue = [], onValueChange,
179
184
  left: 0,
180
185
  width: '100%',
181
186
  transform: `translateY(${virtualRow.start}px)`,
182
- }, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxs(ComboboxCustom, { className: 'fds-combobox__loading', children: [jsx(Spinner, { title: 'Laster', size: 'small' }), loadingLabel] })) : (jsxs(Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
187
+ }, children: filteredOptionsChildren[virtualRow.index] }, virtualRow.index))) })), loading ? (jsxs(ComboboxCustom, { className: 'fds-combobox__loading', children: [jsx(Spinner, { title: 'Laster', size: 'sm' }), loadingLabel] })) : (jsxs(Fragment, { children: [restChildren, !virtual && filteredOptionsChildren] }))] }) }) }))] }));
183
188
  });
184
189
  const Combobox = forwardRef((props, ref) => (jsx(ComboboxIdProvider, { children: jsx(ComboboxComponent, { ...props, ref: ref }) })));
185
190
  Combobox.displayName = 'Combobox';
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef, useId, useContext, useMemo } 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
- import { useMergeRefs } from '../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
6
+ import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
7
7
  import { ComboboxContext } from './ComboboxContext.js';
8
8
  import { useComboboxId } from './ComboboxIdContext.js';
9
9
  import { omit } from '../../../utilities/objectUtils.js';
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useId, useContext, useMemo, useEffect } from 'react';
3
- import { useMergeRefs } from '../../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
3
+ import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
4
  import { ComboboxContext } from '../ComboboxContext.js';
5
5
  import useDebounce from '../../../../utilities/useDebounce.js';
6
6
  import { useComboboxId, useComboboxIdDispatch } from '../ComboboxIdContext.js';
@@ -3,7 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useContext } from 'react';
4
4
  import { clsx } from '../../../../node_modules/clsx/dist/lite.js';
5
5
  import { ChevronUpIcon, ChevronDownIcon } from '@navikt/aksel-icons';
6
- import { useMergeRefs } from '../../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
6
+ import { useMergeRefs } from '../../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
7
7
  import { ComboboxContext } from '../ComboboxContext.js';
8
8
  import { useComboboxIdDispatch } from '../ComboboxIdContext.js';
9
9
  import ComboboxChips from './ComboboxChips.js';
@@ -79,8 +79,12 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
79
79
  const [selectedOptions, setSelectedOptions] = useState(preSelectedOptions);
80
80
  const { filteredOptions, filteredOptionsChildren } = useMemo(() => {
81
81
  const filteredOptions = [];
82
- const filteredOptionsChildren = Object.keys(options)
83
- .map((option, index) => {
82
+ const filteredOptionsChildren = Object.keys(options).map((option, index) => {
83
+ /* If we have a selected value in single mode and the input matches an option, return all children */
84
+ if (!multiple && Object.keys(selectedOptions).length === 1) {
85
+ filteredOptions.push(options[option].value);
86
+ return optionsChildren[index];
87
+ }
84
88
  if (multiple && selectedOptions[option]) {
85
89
  filteredOptions.push(options[option].value);
86
90
  return optionsChildren[index];
@@ -89,8 +93,7 @@ function useCombobox({ children, inputValue, multiple, filter = (inputValue, opt
89
93
  filteredOptions.push(options[option].value);
90
94
  return optionsChildren[index];
91
95
  }
92
- })
93
- .filter((child) => child);
96
+ });
94
97
  return { filteredOptions, filteredOptionsChildren };
95
98
  // eslint-disable-next-line react-hooks/exhaustive-deps
96
99
  }, [inputValue, multiple, options, optionsChildren, selectedOptions]);
@@ -1,10 +1,10 @@
1
1
  'use client';
2
- import { useFloating, useRole, useDismiss, useListNavigation, useInteractions } from '../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
2
+ import { useFloating, useRole, useDismiss, useListNavigation, useInteractions } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
3
3
  import { useState } from 'react';
4
4
  import { flushSync } from 'react-dom';
5
5
  import { useComboboxId, useComboboxIdDispatch } from './ComboboxIdContext.js';
6
- import { autoUpdate, flip, size } from '../../../packages/react/node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
7
- import { offset } from '../../../packages/react/node_modules/@floating-ui/core/dist/floating-ui.core.js';
6
+ import { autoUpdate, flip, size } from '../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js';
7
+ import { offset } from '../../../node_modules/@floating-ui/core/dist/floating-ui.core.js';
8
8
 
9
9
  const useFloatingCombobox = ({ listRef }) => {
10
10
  const [open, setOpen] = useState(false);
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef, useContext } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
6
6
  import { useFieldset } from './useFieldset.js';
7
7
  import { FieldsetContext } from './FieldsetContext.js';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
6
6
  import { useNativeSelect } from './useNativeSelect.js';
7
7
  import { Label } from '../../Typography/Label/Label.js';
@@ -11,7 +11,7 @@ import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
11
11
 
12
12
  const NativeSelect = forwardRef((props, ref) => {
13
13
  const { children, disabled = false, label, description, hideLabel = false, error, className, htmlSize = 0, ...rest } = props;
14
- const { selectProps, descriptionId, errorId, readOnly = false, size = 'medium', } = useNativeSelect(props);
14
+ const { selectProps, descriptionId, errorId, readOnly = false, size = 'md', } = useNativeSelect(props);
15
15
  return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('fds-native-select--container', disabled && 'fds-native-select--disabled', readOnly && 'fds-native-select--readonly', error && 'fds-native-select--error'), children: [label && (jsxs(Label, { weight: 'medium', size: size, htmlFor: selectProps.id, className: clsx('fds-native-select__label', hideLabel && 'fds-sr-only'), children: [readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: 'fds-native-select__readonly__icon' })), label] })), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: clsx(`fds-native-select__description`, hideLabel && `fds-sr-only`), children: description }) })), jsx("select", { disabled: disabled || readOnly, ref: ref, size: htmlSize, className: clsx('fds-native-select', `fds-native-select--${size}`, `fds-focus`, props.multiple && 'fds-native-select--multiple', className), ...omit(['size', 'error', 'errorId'], rest), ...omit(['readOnly', 'disabled'], selectProps), children: children }), error && (jsx("div", { id: errorId, className: 'fds-native-select__error-message', "aria-live": 'polite', "aria-relevant": 'additions removals', children: jsx(ErrorMessage, { size: size, children: error }) }))] }) }));
16
16
  });
17
17
  NativeSelect.displayName = 'NativeSelect';
@@ -2,15 +2,17 @@
2
2
  import { useContext } from 'react';
3
3
  import { useFormField } from '../useFormField.js';
4
4
  import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
5
+ import { getSize } from '../../../utilities/getSize.js';
5
6
 
6
7
  /** Handles props for `NativeSelect` in context with `Fieldset` */
7
8
  const useNativeSelect = (props) => {
8
9
  const fieldset = useContext(FieldsetContext);
9
10
  const { inputProps: selectProps, readOnly, ...rest } = useFormField(props, 'select');
11
+ const size = getSize(fieldset?.size ?? props.size ?? 'md');
10
12
  return {
11
13
  ...rest,
12
14
  readOnly,
13
- size: fieldset?.size ?? props.size,
15
+ size,
14
16
  selectProps: {
15
17
  ...selectProps,
16
18
  readOnly,
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { createContext, forwardRef, useId } from 'react';
4
- import { clsx } from '../../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../../node_modules/clsx/dist/lite.js';
5
5
  import { Fieldset } from '../../Fieldset/Fieldset.js';
6
6
 
7
7
  const RadioGroupContext = createContext(null);
8
- const RadioGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, name, size = 'medium', required, inline, className, ...rest }, ref) => {
8
+ const RadioGroup = forwardRef(({ onChange, children, value, readOnly, defaultValue, name, size = 'md', required, inline, className, ...rest }, ref) => {
9
9
  const nameId = useId();
10
10
  return (jsx(Fieldset, { readOnly: readOnly, size: size, className: className, ref: ref, ...rest, children: jsx(RadioGroupContext.Provider, { value: {
11
11
  value,
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { useRadio } from './useRadio.js';
6
6
  import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
7
7
  import { omit } from '../../../utilities/objectUtils.js';
@@ -9,7 +9,7 @@ import { Label } from '../../Typography/Label/Label.js';
9
9
 
10
10
  const Radio = forwardRef((props, ref) => {
11
11
  const { children, description, className, style, ...rest } = props;
12
- const { inputProps, descriptionId, hasError, size = 'medium', readOnly, } = useRadio(props);
12
+ const { inputProps, descriptionId, hasError, size = 'md', readOnly, } = useRadio(props);
13
13
  return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx('fds-radio', `fds-radio--${size}`, inputProps.disabled && `fds-radio--disabled`, hasError && `fds-radio--error`, readOnly && `fds-radio--readonly`, className), style: style, children: [jsx("input", { className: 'fds-radio__input', ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), children && (jsxs(Fragment, { children: [jsx(Label, { className: 'fds-radio__label', htmlFor: inputProps.id, size: size, weight: 'regular', children: jsx("span", { children: children }) }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: 'fds-radio__description', children: description }) }))] }))] }) }));
14
14
  });
15
15
  Radio.displayName = 'Radio';
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef, useRef, useState, useCallback } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { MagnifyingGlassIcon, XMarkIcon } from '@navikt/aksel-icons';
6
- import { useMergeRefs } from '../../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
6
+ import { useMergeRefs } from '../../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
7
7
  import { useSearch } from './useSearch.js';
8
8
  import { Button } from '../../Button/Button.js';
9
9
  import { Paragraph } from '../../Typography/Paragraph/Paragraph.js';
@@ -20,7 +20,7 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
20
20
  */
21
21
  const Search = forwardRef((props, ref) => {
22
22
  const { label, style, hideLabel = true, variant = 'simple', searchButtonLabel = 'Søk', clearButtonLabel = 'Tøm', defaultValue, value, onChange, onClear, disabled, onSearchClick, htmlSize = 27, className, ...rest } = props;
23
- const { inputProps, hasError, errorId, size = 'medium' } = useSearch(props);
23
+ const { inputProps, hasError, errorId, size = 'md' } = useSearch(props);
24
24
  const inputRef = useRef();
25
25
  const mergedRef = useMergeRefs([ref, inputRef]);
26
26
  const [internalValue, setInternalValue] = useState(defaultValue ?? '');
@@ -2,21 +2,17 @@
2
2
  import { useContext } from 'react';
3
3
  import { useFormField } from '../useFormField.js';
4
4
  import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
5
+ import { getSize } from '../../../utilities/getSize.js';
5
6
 
6
- const sizeMap = {
7
- small: 'small',
8
- medium: 'medium',
9
- large: 'large',
10
- };
11
7
  /** Handles props for `Search` in context with `Fieldset` */
12
8
  const useSearch = (props) => {
13
9
  const fieldset = useContext(FieldsetContext);
14
10
  const { inputProps, readOnly, ...rest } = useFormField(props, 'search');
15
- const fieldSetSize = fieldset?.size ? sizeMap[fieldset?.size] : null;
11
+ const size = fieldset?.size ?? getSize(props.size || 'md');
16
12
  return {
17
13
  ...rest,
18
14
  readOnly,
19
- size: fieldSetSize ?? props.size,
15
+ size,
20
16
  inputProps: {
21
17
  ...inputProps,
22
18
  type: 'search',
@@ -10,7 +10,7 @@ import { Label } from '../../Typography/Label/Label.js';
10
10
 
11
11
  const Switch = forwardRef((props, ref) => {
12
12
  const { children, description, position = 'left', className, ...rest } = props;
13
- const { inputProps, descriptionId, size = 'medium', readOnly, } = useSwitch(props);
13
+ const { inputProps, descriptionId, size = 'md', readOnly, } = useSwitch(props);
14
14
  return (jsx(Paragraph, { asChild: true, size: size, children: jsxs("div", { className: clsx(`fds-switch`, `fds-switch--${size}`, inputProps.disabled && `fds-switch--disabled`, readOnly && `fds-switch--readonly`, className), children: [jsx("input", { className: `fds-switch__input`, ref: ref, ...omit(['size', 'error'], rest), ...inputProps }), jsxs(Label, { className: clsx(`fds-switch__label`, position === 'right' && `fds-switch__label--right`), htmlFor: inputProps.id, size: size, weight: 'regular', children: [jsx("span", { className: `fds-switch__track`, children: jsx("span", { className: `fds-switch__thumb` }) }), readOnly && (jsx(PadlockLockedFillIcon, { "aria-hidden": true, className: `fds-switch__readonly__icon` })), children && jsx("span", { children: children })] }), description && (jsx(Paragraph, { asChild: true, size: size, children: jsx("div", { id: descriptionId, className: `fds-switch__description`, children: description }) }))] }) }));
15
15
  });
16
16
  Switch.displayName = 'Switch';
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef, useState } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
6
6
  import { CharacterCounter } from '../CharacterCounter.js';
7
7
  import { useTextarea } from './useTextarea.js';
@@ -19,7 +19,7 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
19
19
  */
20
20
  const Textarea = forwardRef((props, ref) => {
21
21
  const { label, description, style, characterLimit, hideLabel, className, ...rest } = props;
22
- const { textareaProps, descriptionId, hasError, errorId, size = 'medium', readOnly, } = useTextarea(props);
22
+ const { textareaProps, descriptionId, hasError, errorId, size = 'md', readOnly, } = useTextarea(props);
23
23
  const [value, setValue] = useState(props.defaultValue);
24
24
  const characterLimitId = `${textareaProps.id}-charactercount}`;
25
25
  const hasCharacterLimit = characterLimit != null;
@@ -2,15 +2,17 @@
2
2
  import { useContext } from 'react';
3
3
  import { useFormField } from '../useFormField.js';
4
4
  import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
5
+ import { getSize } from '../../../utilities/getSize.js';
5
6
 
6
7
  /** Handles props for `Textarea` in context with `Fieldset` */
7
8
  const useTextarea = (props) => {
8
9
  const fieldset = useContext(FieldsetContext);
9
10
  const { inputProps, readOnly, ...rest } = useFormField(props, 'textarea');
11
+ const size = fieldset?.size ?? getSize(props.size ?? 'md');
10
12
  return {
11
13
  ...rest,
12
14
  readOnly,
13
- size: fieldset?.size ?? props.size,
15
+ size,
14
16
  textareaProps: {
15
17
  ...inputProps,
16
18
  readOnly,
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef, useState, useId } from 'react';
4
- import { clsx } from '../../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../../node_modules/clsx/dist/lite.js';
5
5
  import { PadlockLockedFillIcon } from '@navikt/aksel-icons';
6
6
  import { CharacterCounter } from '../CharacterCounter.js';
7
7
  import { useTextfield } from './useTextfield.js';
@@ -19,8 +19,8 @@ import { ErrorMessage } from '../../Typography/ErrorMessage/ErrorMessage.js';
19
19
  */
20
20
  const Textfield = forwardRef((props, ref) => {
21
21
  const { label, description, suffix, prefix, style, characterLimit, hideLabel, type = 'text', htmlSize = 20, className, ...rest } = props;
22
- const { inputProps, descriptionId, hasError, errorId, size = 'medium', readOnly, } = useTextfield(props);
23
- const [inputValue, setInputValue] = useState(props.defaultValue);
22
+ const { inputProps, descriptionId, hasError, errorId, size = 'md', readOnly, } = useTextfield(props);
23
+ const [inputValue, setInputValue] = useState(props.value || props.defaultValue);
24
24
  const characterLimitId = `textfield-charactercount-${useId()}`;
25
25
  const hasCharacterLimit = characterLimit != null;
26
26
  const describedBy = clsx(inputProps['aria-describedby'], hasCharacterLimit && characterLimitId) || undefined;
@@ -2,15 +2,17 @@
2
2
  import { useContext } from 'react';
3
3
  import { useFormField } from '../useFormField.js';
4
4
  import { FieldsetContext } from '../Fieldset/FieldsetContext.js';
5
+ import { getSize } from '../../../utilities/getSize.js';
5
6
 
6
7
  /** Handles props for `Textfield` in context with `Fieldset` */
7
8
  const useTextfield = (props) => {
8
9
  const fieldset = useContext(FieldsetContext);
9
10
  const { inputProps, readOnly, ...rest } = useFormField(props, 'textfield');
11
+ const size = getSize(fieldset?.size ?? props.size ?? 'md');
10
12
  return {
11
13
  ...rest,
12
14
  readOnly,
13
- size: fieldset?.size ?? props.size,
15
+ size,
14
16
  inputProps: {
15
17
  ...inputProps,
16
18
  readOnly,
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { useContext, useId } from 'react';
3
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
3
+ import { clsx } from '../../node_modules/clsx/dist/lite.js';
4
+ import { getSize } from '../../utilities/getSize.js';
4
5
  import { FieldsetContext } from './Fieldset/FieldsetContext.js';
5
6
 
6
7
  /**
@@ -15,21 +16,18 @@ const useFormField = (props, prefix) => {
15
16
  const disabled = fieldset?.disabled || props?.disabled;
16
17
  const readOnly = ((fieldset?.readOnly || props?.readOnly) && !disabled) || undefined;
17
18
  const hasError = !disabled && !readOnly && !!(props.error || fieldset?.error);
19
+ const size = getSize(props.size || fieldset?.size || 'md');
18
20
  return {
19
21
  readOnly,
20
22
  hasError,
21
23
  errorId,
22
24
  descriptionId,
23
- size: props?.size ?? fieldset?.size ?? 'medium',
25
+ size,
24
26
  inputProps: {
25
27
  id,
26
28
  disabled,
27
29
  'aria-invalid': hasError ? true : undefined,
28
- 'aria-describedby': clsx(props['aria-describedby'], {
29
- [descriptionId]: !!props?.description && typeof props?.description === 'string',
30
- [errorId]: hasError && !fieldset?.error,
31
- [fieldset?.errorId ?? '']: hasError && !!fieldset?.error,
32
- }) || undefined,
30
+ 'aria-describedby': clsx(props['aria-describedby'], (!!props?.description && typeof props?.description === 'string') && descriptionId, (hasError && !fieldset?.error) && errorId, (hasError && !!fieldset?.error) && fieldset?.errorId) || undefined,
33
31
  },
34
32
  };
35
33
  };
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { evaluate, getSide, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, getAlignmentSides, getAlignment, getSideAxis, clamp, getPaddingObject, rectToClientRect, getAlignmentAxis, getOppositeAxis, getAxisLength, min, max } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.js';
2
+ import { evaluate, getSide, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, getAlignmentSides, getAlignment, getSideAxis, clamp, getPaddingObject, rectToClientRect, getAlignmentAxis, getOppositeAxis, getAxisLength, min, max } from '../../utils/dist/floating-ui.utils.js';
3
3
 
4
4
  function computeCoordsFromPlacement(_ref, placement, rtl) {
5
5
  let {
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { shift as shift$1, flip as flip$1, arrow as arrow$1, size as size$1, computePosition as computePosition$1 } from '../../core/dist/floating-ui.core.js';
3
3
  export { detectOverflow, offset } from '../../core/dist/floating-ui.core.js';
4
- import { createCoords, rectToClientRect, round, max, min, floor } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.js';
5
- import { getOverflowAncestors, isElement, getWindow, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, getNodeName, isOverflowElement, getNodeScroll, isTableElement, isContainingBlock, getContainingBlock, getParentNode, isLastTraversableNode } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js';
4
+ import { createCoords, rectToClientRect, round, max, min, floor } from '../../utils/dist/floating-ui.utils.js';
5
+ import { getOverflowAncestors, isElement, getWindow, getComputedStyle, getDocumentElement, isHTMLElement, isWebKit, getNodeName, isOverflowElement, getNodeScroll, isTableElement, isContainingBlock, getContainingBlock, getParentNode, isLastTraversableNode } from '../../utils/dist/floating-ui.utils.dom.js';
6
6
 
7
7
  function getCssDimensions(element) {
8
8
  const css = getComputedStyle(element);
@@ -2,10 +2,10 @@
2
2
  import * as React from 'react';
3
3
  import { useLayoutEffect, useEffect, useRef } from 'react';
4
4
  import { getDocument, isMouseLikePointerType, isTypeableCombobox, activeElement, contains, isVirtualClick, isVirtualPointerEvent, getTarget, isSafari, isMac, isTypeableElement, stopEvent, isReactEvent, isRootElement, isEventTargetWithin } from './floating-ui.react.utils.js';
5
- import { floor } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.js';
5
+ import { floor } from '../../utils/dist/floating-ui.utils.js';
6
6
  import { useFloating as useFloating$1 } from '../../react-dom/dist/floating-ui.react-dom.js';
7
7
  export { arrow } from '../../react-dom/dist/floating-ui.react-dom.js';
8
- import { isElement, isHTMLElement, getOverflowAncestors, getWindow, getNodeName, isLastTraversableNode, getParentNode, getComputedStyle } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js';
8
+ import { isElement, isHTMLElement, getOverflowAncestors, getWindow, getNodeName, isLastTraversableNode, getParentNode, getComputedStyle } from '../../utils/dist/floating-ui.utils.dom.js';
9
9
  import { tabbable, isTabbable } from '../../../tabbable/dist/index.esm.js';
10
10
  import { createPortal } from 'react-dom';
11
11
  import { platform } from '../../dom/dist/floating-ui.dom.js';
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { isShadowRoot, isHTMLElement } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js';
2
+ import { isShadowRoot, isHTMLElement } from '../../utils/dist/floating-ui.utils.dom.js';
3
3
 
4
4
  function activeElement(doc) {
5
5
  let activeElement = doc.activeElement;
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import _extends from '../../../@babel/runtime/helpers/esm/extends.js';
2
+ import _extends from '../node_modules/@babel/runtime/helpers/esm/extends.js';
3
3
  import { forwardRef, Children, isValidElement, createElement, cloneElement, Fragment } from 'react';
4
4
  import { composeRefs as $6ed0406888f73fc4$export$43e446d32b3d21af } from '../../react-compose-refs/dist/index.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useCallback } from 'react';
4
- import { clsx } from '../../node_modules/clsx/dist/clsx.js';
4
+ import { clsx } from '../../node_modules/clsx/dist/lite.js';
5
5
  import { usePrevious } from '../../hooks/usePrevious.js';
6
6
  import { useMediaQuery } from '../../hooks/useMediaQuery.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
- import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
+ import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
5
5
  import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
6
6
  import { useRovingTabindex } from './useRovingTabindex.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { createContext, forwardRef, useState, useRef } from 'react';
4
- import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
4
+ import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
5
5
  import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
6
6
 
7
7
  const RovingTabindexContext = createContext({
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ function getSize(size) {
3
+ switch (size) {
4
+ case 'xxxsmall':
5
+ return '3xs';
6
+ case 'xxsmall':
7
+ return '2xs';
8
+ case 'xsmall':
9
+ return 'xs';
10
+ case 'small':
11
+ return 'sm';
12
+ case 'medium':
13
+ return 'md';
14
+ case 'large':
15
+ return 'lg';
16
+ case 'xlarge':
17
+ return 'xl';
18
+ case 'xxlarge':
19
+ return '2xl';
20
+ case 'xxxlarge':
21
+ return '3xl';
22
+ case 'xxxxlarge':
23
+ return '4xl';
24
+ default:
25
+ return size;
26
+ }
27
+ }
28
+
29
+ export { getSize };
@@ -1,5 +1,6 @@
1
1
  import type { HTMLAttributes } from 'react';
2
2
  type Severity = 'info' | 'warning' | 'success' | 'danger';
3
+ type OldAlertSizes = 'small' | 'medium' | 'large';
3
4
  export type AlertProps = {
4
5
  /** Sets color & icon according to severity */
5
6
  severity?: Severity;
@@ -10,12 +11,15 @@ export type AlertProps = {
10
11
  * Use this to inform screenreaders of severity.
11
12
  * Defaults to Norwegian. */
12
13
  iconTitle?: string;
13
- /** Sets the size of the alert.
14
+ /**
15
+ * Sets the size of the alert.
14
16
  * Does not affect font size.
15
17
  *
16
- * @default 'medium'
18
+ * @default md
19
+ *
20
+ * @note `small`, `medium`, `large` is deprecated
17
21
  */
18
- size?: 'small' | 'medium' | 'large';
22
+ size?: 'sm' | 'md' | 'lg' | OldAlertSizes;
19
23
  } & HTMLAttributes<HTMLDivElement>;
20
24
  export declare const Alert: import("react").ForwardRefExoticComponent<{
21
25
  /** Sets color & icon according to severity */
@@ -27,12 +31,15 @@ export declare const Alert: import("react").ForwardRefExoticComponent<{
27
31
  * Use this to inform screenreaders of severity.
28
32
  * Defaults to Norwegian. */
29
33
  iconTitle?: string | undefined;
30
- /** Sets the size of the alert.
34
+ /**
35
+ * Sets the size of the alert.
31
36
  * Does not affect font size.
32
37
  *
33
- * @default 'medium'
38
+ * @default md
39
+ *
40
+ * @note `small`, `medium`, `large` is deprecated
34
41
  */
35
- size?: "small" | "medium" | "large" | undefined;
42
+ size?: "sm" | "md" | "lg" | OldAlertSizes | undefined;
36
43
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
37
44
  export {};
38
45
  //# sourceMappingURL=Alert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA4B5C,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;iCAG6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AACnC,eAAO,MAAM,KAAK;IAhBhB,8CAA8C;;IAE9C,6CAA6C;;IAE7C;;;iCAG6B;;IAE7B;;;;OAIG;;mFA8CJ,CAAC"}
1
+ {"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AA6B5C,KAAK,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,KAAK,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;iCAG6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC;CAC3C,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AACnC,eAAO,MAAM,KAAK;IAnBhB,8CAA8C;;IAE9C,6CAA6C;;IAE7C;;;iCAG6B;;IAE7B;;;;;;;OAOG;;mFAuCJ,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import type { HTMLAttributes } from 'react';
2
+ type OldShadowSizes = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
3
+ type OldBorderRadii = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'xxxlarge' | 'xxxxlarge';
2
4
  export type BoxProps = {
3
5
  /**
4
6
  * Shadow size of the box
5
7
  * @default undefined
6
8
  */
7
- shadow?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
9
+ shadow?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | OldShadowSizes;
8
10
  /**
9
11
  * Border color of the box
10
12
  * @default undefined
@@ -14,7 +16,7 @@ export type BoxProps = {
14
16
  * Border radius of the box
15
17
  * @default undefined
16
18
  */
17
- borderRadius?: 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'xxxlarge' | 'xxxxlarge' | 'full';
19
+ borderRadius?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | 'full' | OldBorderRadii;
18
20
  /**
19
21
  * Background color of the box
20
22
  * @default 'default'
@@ -31,7 +33,7 @@ export declare const Box: import("react").ForwardRefExoticComponent<{
31
33
  * Shadow size of the box
32
34
  * @default undefined
33
35
  */
34
- shadow?: "small" | "medium" | "large" | "xsmall" | "xlarge" | undefined;
36
+ shadow?: "xs" | "sm" | "md" | "lg" | "xl" | OldShadowSizes | undefined;
35
37
  /**
36
38
  * Border color of the box
37
39
  * @default undefined
@@ -41,7 +43,7 @@ export declare const Box: import("react").ForwardRefExoticComponent<{
41
43
  * Border radius of the box
42
44
  * @default undefined
43
45
  */
44
- borderRadius?: "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge" | "xxxxlarge" | "full" | undefined;
46
+ borderRadius?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | OldBorderRadii | "full" | undefined;
45
47
  /**
46
48
  * Background color of the box
47
49
  * @default 'default'
@@ -53,4 +55,5 @@ export declare const Box: import("react").ForwardRefExoticComponent<{
53
55
  */
54
56
  asChild?: boolean | undefined;
55
57
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
58
+ export {};
56
59
  //# sourceMappingURL=Box.d.ts.map