@altinn/altinn-components 0.52.3 → 0.52.5

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 (496) hide show
  1. package/dist/assets/AccountMenuButton.css +1 -1
  2. package/dist/assets/AccountSelector.css +1 -1
  3. package/dist/assets/ActionFooter.css +1 -1
  4. package/dist/assets/ActionHeader.css +1 -1
  5. package/dist/assets/Avatar.css +1 -1
  6. package/dist/assets/Backdrop.css +1 -1
  7. package/dist/assets/BreadcrumbsLink.css +1 -1
  8. package/dist/assets/ButtonBase.css +1 -1
  9. package/dist/assets/ButtonGroup.css +1 -0
  10. package/dist/assets/ButtonGroupDivider.css +1 -0
  11. package/dist/assets/ButtonLabel.css +1 -1
  12. package/dist/assets/DrawerBase.css +1 -1
  13. package/dist/assets/DrawerOrDropdown.css +1 -1
  14. package/dist/assets/DropdownBase.css +1 -1
  15. package/dist/assets/Flex.css +1 -1
  16. package/dist/assets/FooterBase.css +1 -1
  17. package/dist/assets/FooterMenu.css +1 -1
  18. package/dist/assets/GlobalHeader.css +1 -1
  19. package/dist/assets/GlobalHeaderBase.css +1 -1
  20. package/dist/assets/GlobalMenuBase.css +1 -1
  21. package/dist/assets/Grid.css +1 -1
  22. package/dist/assets/Header.css +1 -1
  23. package/dist/assets/HeaderBase.css +1 -1
  24. package/dist/assets/HeaderGroup.css +1 -1
  25. package/dist/assets/HeaderGroup2.css +1 -1
  26. package/dist/assets/HeaderLogo.css +1 -1
  27. package/dist/assets/HeaderSearch.css +1 -1
  28. package/dist/assets/LayoutBody.css +1 -1
  29. package/dist/assets/LayoutContent.css +1 -1
  30. package/dist/assets/LayoutSidebar.css +1 -1
  31. package/dist/assets/ListItemBase.css +1 -1
  32. package/dist/assets/ListItemHeader.css +1 -1
  33. package/dist/assets/ListItemLink.css +1 -1
  34. package/dist/assets/MenuItem.css +1 -1
  35. package/dist/assets/MenuItemBase.css +1 -1
  36. package/dist/assets/MenuSearch.css +1 -1
  37. package/dist/assets/MetaItemBase.css +1 -1
  38. package/dist/assets/NotificationItemBase.css +1 -1
  39. package/dist/assets/NotificationItemIcon.css +1 -1
  40. package/dist/assets/PageMenu.css +1 -1
  41. package/dist/assets/PageTabs.css +1 -1
  42. package/dist/assets/SearchField.css +1 -1
  43. package/dist/assets/SearchbarBase.css +1 -1
  44. package/dist/assets/SearchbarField.css +1 -1
  45. package/dist/assets/SnackbarBase.css +1 -1
  46. package/dist/assets/TimelineBase.css +1 -1
  47. package/dist/assets/ToolbarBase.css +1 -1
  48. package/dist/assets/globalSearch.css +1 -1
  49. package/dist/button-MzZgmHyA.js +23 -0
  50. package/dist/components/AccessAreaListItem/AccessAreaListItem.js +1 -1
  51. package/dist/components/AccessPackageListItem/AccessPackageListItem.js +1 -1
  52. package/dist/components/Account/AccountList.js +23 -23
  53. package/dist/components/Account/AccountListItem.js +1 -1
  54. package/dist/components/Account/AccountListItemControls.js +26 -26
  55. package/dist/components/Account/AccountListItemDetails.js +1 -1
  56. package/dist/components/Account/AccountListVirtual.js +47 -50
  57. package/dist/components/Account/AccountMenu.js +47 -51
  58. package/dist/components/Account/AccountMenuButton.js +65 -65
  59. package/dist/components/Account/AccountNotificationSettings.js +1 -1
  60. package/dist/components/Account/AccountOrganization.js +1 -1
  61. package/dist/components/ActivityLog/ActivityLog.js +13 -13
  62. package/dist/components/ActivityLog/ActivityLogItem.js +1 -1
  63. package/dist/components/ActivityLog/ActivityLogSegment.js +6 -6
  64. package/dist/components/Alert/Alert.js +1 -1
  65. package/dist/components/Article/Article.js +1 -1
  66. package/dist/components/Article/ArticleContact.js +1 -1
  67. package/dist/components/Article/ArticleHeader.js +1 -1
  68. package/dist/components/Attachment/AttachmentLink.js +1 -1
  69. package/dist/components/Avatar/Avatar.js +1 -1
  70. package/dist/components/Avatar/AvatarGroup.js +31 -31
  71. package/dist/components/Badge/Badge.js +1 -1
  72. package/dist/components/Banner/Banner.js +6 -6
  73. package/dist/components/Button/Button.js +1 -1
  74. package/dist/components/Button/ButtonBase.js +2 -2
  75. package/dist/components/Button/ButtonGroup.js +28 -8
  76. package/dist/components/Button/ButtonGroupDivider.js +8 -0
  77. package/dist/components/Button/ButtonIcon.js +1 -1
  78. package/dist/components/Button/ButtonLabel.js +5 -5
  79. package/dist/components/Button/ComboButton.js +1 -1
  80. package/dist/components/Button/FloatingActionButton.js +1 -1
  81. package/dist/components/Button/IconButton.js +1 -1
  82. package/dist/components/Byline/Byline.js +1 -1
  83. package/dist/components/ContextMenu/ContextMenu.js +51 -54
  84. package/dist/components/Dashboard/DashboardCard.js +25 -25
  85. package/dist/components/Dashboard/DashboardHeader.js +1 -1
  86. package/dist/components/Dashboard/DashboardIcon.js +1 -1
  87. package/dist/components/Datepicker/DatepickerBase.js +1 -1
  88. package/dist/components/Datepicker/DatepickerHeader.js +1 -1
  89. package/dist/components/Datepicker/DatepickerTable.js +1 -1
  90. package/dist/components/Dialog/Dialog.js +1 -1
  91. package/dist/components/Dialog/DialogActions.js +13 -16
  92. package/dist/components/Dialog/DialogActivityLog.js +1 -1
  93. package/dist/components/Dialog/DialogAttachments.js +8 -8
  94. package/dist/components/Dialog/DialogBody.js +20 -20
  95. package/dist/components/Dialog/DialogByline.js +14 -14
  96. package/dist/components/Dialog/DialogContact.js +1 -1
  97. package/dist/components/Dialog/DialogHeader.js +1 -1
  98. package/dist/components/Dialog/DialogHistory.js +14 -14
  99. package/dist/components/Dialog/DialogHistoryItem.js +1 -1
  100. package/dist/components/Dialog/DialogHistorySegment.js +15 -15
  101. package/dist/components/Dialog/DialogLayout.js +14 -14
  102. package/dist/components/Dialog/DialogList.js +15 -15
  103. package/dist/components/Dialog/DialogListGroup.js +1 -1
  104. package/dist/components/Dialog/DialogListItem.js +27 -27
  105. package/dist/components/Dialog/DialogMetadata.js +38 -38
  106. package/dist/components/Dialog/DialogSection.js +1 -1
  107. package/dist/components/Dialog/DialogSeenBy.js +1 -1
  108. package/dist/components/Dialog/DialogSelect.js +1 -1
  109. package/dist/components/Dialog/DialogStatus.js +1 -1
  110. package/dist/components/Dialog/DialogTabs.js +1 -1
  111. package/dist/components/Dialog/SeenByLog.js +18 -18
  112. package/dist/components/Dialog/SeenByLogButton.js +1 -1
  113. package/dist/components/Dialog/SeenByLogItem.js +1 -1
  114. package/dist/components/Dropdown/Backdrop.js +1 -1
  115. package/dist/components/Dropdown/DrawerBase.js +1 -1
  116. package/dist/components/Dropdown/DrawerBody.js +1 -1
  117. package/dist/components/Dropdown/DrawerButton.js +1 -1
  118. package/dist/components/Dropdown/DrawerFooter.js +1 -1
  119. package/dist/components/Dropdown/DrawerHeader.js +1 -1
  120. package/dist/components/Dropdown/DrawerOrDropdown.js +30 -30
  121. package/dist/components/Dropdown/DropdownBase.js +1 -1
  122. package/dist/components/Dropdown/FloatingDropdown.js +53 -55
  123. package/dist/components/DsComponents/index.js +9 -9
  124. package/dist/components/Footer/FooterAddress.js +1 -1
  125. package/dist/components/Footer/FooterBase.js +1 -1
  126. package/dist/components/Footer/FooterLogo.js +1 -1
  127. package/dist/components/Footer/FooterMenu.js +1 -1
  128. package/dist/components/Forms/Checkbox.js +1 -1
  129. package/dist/components/Forms/CheckboxOptions.js +1 -1
  130. package/dist/components/Forms/Field.js +8 -8
  131. package/dist/components/Forms/FieldBase.js +1 -1
  132. package/dist/components/Forms/Fieldset.js +2 -2
  133. package/dist/components/Forms/FieldsetBase.js +1 -1
  134. package/dist/components/Forms/Input.js +1 -1
  135. package/dist/components/Forms/Label.js +1 -1
  136. package/dist/components/Forms/Legend.js +1 -1
  137. package/dist/components/Forms/Radio.js +1 -1
  138. package/dist/components/Forms/RadioOptions.js +5 -5
  139. package/dist/components/Forms/SearchField.js +34 -32
  140. package/dist/components/Forms/Select.js +15 -15
  141. package/dist/components/Forms/SelectField.js +1 -1
  142. package/dist/components/Forms/Switch.js +1 -1
  143. package/dist/components/Forms/SwitchOptions.js +4 -4
  144. package/dist/components/Forms/TextField.js +1 -1
  145. package/dist/components/Forms/Textarea.js +1 -1
  146. package/dist/components/Forms/TextareaField.js +1 -1
  147. package/dist/components/GlobalHeader/AccountSelector.js +50 -51
  148. package/dist/components/GlobalHeader/GlobalHeader.js +86 -87
  149. package/dist/components/GlobalHeader/GlobalHeaderBase.js +1 -1
  150. package/dist/components/GlobalHeader/GlobalSearch.js +17 -18
  151. package/dist/components/GlobalHeader/GlobalSearchButton.js +3 -3
  152. package/dist/components/GlobalHeader/HeaderGroup.js +1 -1
  153. package/dist/components/GlobalHeader/HeaderLogo.js +1 -1
  154. package/dist/components/GlobalMenu/BackButton.js +1 -1
  155. package/dist/components/GlobalMenu/GlobalMenu.js +40 -42
  156. package/dist/components/GlobalMenu/GlobalMenuButton.js +10 -10
  157. package/dist/components/GlobalMenu/LocaleButton.js +1 -1
  158. package/dist/components/GlobalMenu/LocaleSwitcher.js +18 -19
  159. package/dist/components/GlobalMenu/LogoutButton.js +1 -1
  160. package/dist/components/GlobalMenu_old/BackButton.js +1 -1
  161. package/dist/components/GlobalMenu_old/CurrentAccount.js +10 -10
  162. package/dist/components/GlobalMenu_old/GlobalMenu.js +50 -53
  163. package/dist/components/GlobalMenu_old/GlobalMenuButton.js +29 -29
  164. package/dist/components/GlobalMenu_old/LogoutButton.js +1 -1
  165. package/dist/components/Header/Header.js +50 -50
  166. package/dist/components/Header/HeaderBase.js +1 -1
  167. package/dist/components/Header/HeaderButton.js +30 -30
  168. package/dist/components/Header/HeaderGroup.js +1 -1
  169. package/dist/components/Header/HeaderLogo.js +1 -1
  170. package/dist/components/Header/HeaderSearch.js +1 -1
  171. package/dist/components/Header/LocaleButton.js +1 -1
  172. package/dist/components/Header/LocaleSwitcher.js +27 -29
  173. package/dist/components/Icon/Icon.js +1 -1
  174. package/dist/components/Icon/IconOrAvatar.js +1 -1
  175. package/dist/components/Icon/ProgressIcon.js +1 -1
  176. package/dist/components/InboxSearch/InboxSearch.js +1 -1
  177. package/dist/components/Layout/Layout.js +39 -39
  178. package/dist/components/LayoutAction/ActionHeader.js +1 -1
  179. package/dist/components/LayoutAction/LayoutAction.js +10 -10
  180. package/dist/components/List/List.js +1 -1
  181. package/dist/components/List/ListBase.js +1 -1
  182. package/dist/components/List/ListItem.js +1 -1
  183. package/dist/components/List/ListItemBase.js +1 -1
  184. package/dist/components/List/ListItemControls.js +1 -1
  185. package/dist/components/List/ListItemHeader.js +1 -1
  186. package/dist/components/List/ListItemIcon.js +1 -1
  187. package/dist/components/List/ListItemLabel.js +1 -1
  188. package/dist/components/List/ListItemLink.js +39 -39
  189. package/dist/components/List/ListItemSelect.js +1 -1
  190. package/dist/components/Menu/MenuBase.js +1 -1
  191. package/dist/components/Menu/MenuItem.js +1 -1
  192. package/dist/components/Menu/MenuItemBase.js +46 -46
  193. package/dist/components/Menu/MenuItemIcon.js +9 -9
  194. package/dist/components/Menu/MenuItemLabel.js +29 -29
  195. package/dist/components/Menu/MenuItems.js +61 -64
  196. package/dist/components/Menu/MenuItemsVirtual.js +111 -120
  197. package/dist/components/Menu/MenuOption.js +1 -1
  198. package/dist/components/Menu/MenuSearch.js +1 -1
  199. package/dist/components/Metadata/MetaBase.js +1 -1
  200. package/dist/components/Metadata/MetaItem.js +1 -1
  201. package/dist/components/Metadata/MetaItemBase.js +1 -1
  202. package/dist/components/Metadata/MetaItemIcon.js +1 -1
  203. package/dist/components/Metadata/MetaProgress.js +1 -1
  204. package/dist/components/Metadata/MetaTimestamp.js +1 -1
  205. package/dist/components/Metadata/Metadata.js +1 -1
  206. package/dist/components/Modal/Modal.js +1 -1
  207. package/dist/components/Modal/ModalBase.js +49 -50
  208. package/dist/components/Modal/ModalBody.js +1 -1
  209. package/dist/components/Modal/ModalFooter.js +1 -1
  210. package/dist/components/Modal/ModalHeader.js +18 -18
  211. package/dist/components/Modal/ModalIcon.js +1 -1
  212. package/dist/components/Notifications/NotificationItem.js +1 -1
  213. package/dist/components/Notifications/NotificationItemBase.js +1 -1
  214. package/dist/components/Notifications/NotificationItemControls.js +1 -1
  215. package/dist/components/Notifications/NotificationItemIcon.js +1 -1
  216. package/dist/components/Page/AccordionSection.js +9 -9
  217. package/dist/components/Page/Breadcrumbs.js +14 -14
  218. package/dist/components/Page/BreadcrumbsLink.js +1 -1
  219. package/dist/components/Page/ContactButtons.js +1 -1
  220. package/dist/components/Page/ContactSection.js +1 -1
  221. package/dist/components/Page/Flex.js +1 -1
  222. package/dist/components/Page/Grid.js +1 -1
  223. package/dist/components/Page/PageDetails.js +5 -5
  224. package/dist/components/Page/PageMenu.js +1 -1
  225. package/dist/components/Page/PageNav.js +17 -17
  226. package/dist/components/Page/PageTabs.js +1 -1
  227. package/dist/components/Page/Section.js +1 -1
  228. package/dist/components/ResourceListItem/ResourceListItem.js +1 -1
  229. package/dist/components/RootProvider/RootProvider.js +30 -30
  230. package/dist/components/Search/SearchItem.js +12 -12
  231. package/dist/components/Searchbar/Autocomplete.js +35 -38
  232. package/dist/components/Searchbar/AutocompleteBase.js +1 -1
  233. package/dist/components/Searchbar/AutocompleteItem.js +1 -1
  234. package/dist/components/Searchbar/Searchbar.js +41 -44
  235. package/dist/components/Searchbar/SearchbarBase.js +1 -1
  236. package/dist/components/Searchbar/SearchbarField.js +59 -60
  237. package/dist/components/Settings/BookmarksSettingsItem.js +57 -59
  238. package/dist/components/Settings/BookmarksSettingsList.js +25 -25
  239. package/dist/components/Settings/SettingsItem.js +48 -48
  240. package/dist/components/Settings/SettingsItemBase.js +1 -1
  241. package/dist/components/Settings/SettingsList.js +25 -25
  242. package/dist/components/Settings/SettingsModal.js +27 -28
  243. package/dist/components/Settings/SettingsSection.js +1 -1
  244. package/dist/components/Settings/UsedByLog.js +31 -31
  245. package/dist/components/Settings/UsedByLogItem.js +1 -1
  246. package/dist/components/Skeleton/Skeleton.js +1 -1
  247. package/dist/components/SkipLink/SkipLink.js +1 -1
  248. package/dist/components/Snackbar/SnackbarItem.js +13 -13
  249. package/dist/components/Snackbar/useSnackbar.js +20 -20
  250. package/dist/components/Timeline/Timeline.js +1 -1
  251. package/dist/components/Timeline/TimelineActivity.js +1 -1
  252. package/dist/components/Timeline/TimelineBase.js +1 -1
  253. package/dist/components/Timeline/TimelineFooter.js +1 -1
  254. package/dist/components/Timeline/TimelineHeader.js +1 -1
  255. package/dist/components/Timeline/TimelineIcon.js +1 -1
  256. package/dist/components/Timeline/TimelineLink.js +1 -1
  257. package/dist/components/Timeline/TimelineSection.js +1 -1
  258. package/dist/components/Timeline/TimelineSegment.js +1 -1
  259. package/dist/components/Toolbar/Toolbar.js +57 -58
  260. package/dist/components/Toolbar/ToolbarAccountMenu.js +36 -36
  261. package/dist/components/Toolbar/ToolbarAdd.js +1 -1
  262. package/dist/components/Toolbar/ToolbarButton.js +1 -1
  263. package/dist/components/Toolbar/ToolbarDaterange.js +1 -1
  264. package/dist/components/Toolbar/ToolbarFilter.js +51 -51
  265. package/dist/components/Toolbar/ToolbarFilterBase.js +1 -1
  266. package/dist/components/Toolbar/ToolbarMenu.js +1 -1
  267. package/dist/components/Toolbar/ToolbarOptions.js +51 -55
  268. package/dist/components/Toolbar/ToolbarSearch.js +1 -1
  269. package/dist/components/Transmission/Transmission.js +45 -45
  270. package/dist/components/Transmission/TransmissionList.js +1 -1
  271. package/dist/components/Transmission/TransmissionType.js +1 -1
  272. package/dist/components/Typography/Heading.js +1 -1
  273. package/dist/components/Typography/Typography.js +1 -1
  274. package/dist/components/Typography/useHighlightedText.js +13 -13
  275. package/dist/components/UserListItem/UserListItem.js +1 -1
  276. package/dist/components/index.js +449 -455
  277. package/dist/{FieldsetLegend-CiZWWPgY.js → fieldset-legend-B6lDmp0N.js} +1 -1
  278. package/dist/global.css +7 -7
  279. package/dist/globalSearch.module-DziLSGZg.js +9 -0
  280. package/dist/{Heading-By5DKz2H.js → heading-C_XYsUfi.js} +1 -1
  281. package/dist/hooks/useAccountSelector.js +96 -97
  282. package/dist/hooks/useClickOutside.js +8 -8
  283. package/dist/hooks/useEnterKey.js +6 -6
  284. package/dist/hooks/useEscapeKey.js +5 -5
  285. package/dist/hooks/useMenu.js +33 -33
  286. package/dist/index-D7FJjvrv.js +86 -0
  287. package/dist/{index-D-VWMqlv.js → index-De5bF0Gf.js} +4 -4
  288. package/dist/index-Dg71_7ad.js +2993 -0
  289. package/dist/index-Q0EA2XB0.js +111 -0
  290. package/dist/index-p1eeF8LQ.js +42 -0
  291. package/dist/index-z82sbSVU.js +105 -0
  292. package/dist/index.js +457 -463
  293. package/dist/input-wBv_FkEV.js +12 -0
  294. package/dist/{Label-9elsbqMH.js → label-xTmTyPhk.js} +1 -1
  295. package/dist/{Paragraph-Bm-eoPYv.js → paragraph-BRiIBpbY.js} +1 -1
  296. package/dist/spinner-0Qe_jRGB.js +23 -0
  297. package/dist/textfield-B_OMMEbF.js +1442 -0
  298. package/dist/tokens/{altinn-ds.css → design-tokens-build/theme.css} +425 -466
  299. package/dist/types/lib/components/Banner/Banner.d.ts +1 -1
  300. package/dist/types/lib/components/Button/ButtonGroup.d.ts +9 -5
  301. package/dist/types/lib/components/Button/ButtonGroup.stories.d.ts +12 -0
  302. package/dist/types/lib/components/Button/ButtonGroupDivider.d.ts +1 -0
  303. package/dist/types/lib/components/Forms/SearchField.stories.d.ts +1 -0
  304. package/dist/types/lib/components/LayoutAction/LayoutAction.d.ts +1 -1
  305. package/dist/types/lib/components/Snackbar/SnackbarItem.d.ts +1 -1
  306. package/dist/types/lib/components/index.d.ts +0 -1
  307. package/dist/types/lib/types/color.d.ts +1 -1
  308. package/dist/types/lib/types/fields.d.ts +1 -1
  309. package/dist/use-merge-refs-Cj4kTYVj.js +29 -0
  310. package/package.json +24 -20
  311. package/dist/Button-B0t0vz2h.js +0 -23
  312. package/dist/Input-B_w6SBmg.js +0 -12
  313. package/dist/Spinner-BDXfwXIh.js +0 -26
  314. package/dist/altinn-ds-overrides.css +0 -53
  315. package/dist/altinn-ds.css +0 -1125
  316. package/dist/components/Bookmarks/BookmarksListItem.js +0 -20
  317. package/dist/components/Bookmarks/BookmarksSection.js +0 -40
  318. package/dist/components/Bookmarks/EditableBookmark.js +0 -92
  319. package/dist/components/Bookmarks/index.js +0 -8
  320. package/dist/globalSearch.module-Ejp7X0dO.js +0 -9
  321. package/dist/index-B6sKSsN9.js +0 -2951
  322. package/dist/index-CnWc2FNH.js +0 -81
  323. package/dist/index-D3Rt9ate.js +0 -116
  324. package/dist/index-D8Pn8SCu.js +0 -78
  325. package/dist/index-L8X2o7IH.js +0 -44
  326. package/dist/tokens/$metadata.json +0 -25
  327. package/dist/tokens/$themes.json +0 -137
  328. package/dist/tokens/README.md +0 -14
  329. package/dist/tokens/alert.css +0 -25
  330. package/dist/tokens/alert.json +0 -70
  331. package/dist/tokens/altinn-ds/color/alert.css +0 -25
  332. package/dist/tokens/altinn-ds/color/article.css +0 -25
  333. package/dist/tokens/altinn-ds/color/company.css +0 -26
  334. package/dist/tokens/altinn-ds/color/danger.css +0 -25
  335. package/dist/tokens/altinn-ds/color/info.css +0 -25
  336. package/dist/tokens/altinn-ds/color/neutral.css +0 -25
  337. package/dist/tokens/altinn-ds/color/person.css +0 -25
  338. package/dist/tokens/altinn-ds/color/success.css +0 -25
  339. package/dist/tokens/altinn-ds/color/warning.css +0 -25
  340. package/dist/tokens/altinn-ds/color-scheme/dark.css +0 -311
  341. package/dist/tokens/altinn-ds/color-scheme/light.css +0 -312
  342. package/dist/tokens/altinn-ds/semantic.css +0 -70
  343. package/dist/tokens/altinn-ds/typography/primary.css +0 -123
  344. package/dist/tokens/altinn-ds/typography/secondary.css +0 -122
  345. package/dist/tokens/altinn-ds.json +0 -22
  346. package/dist/tokens/article.css +0 -25
  347. package/dist/tokens/article.json +0 -70
  348. package/dist/tokens/color/alert.css +0 -25
  349. package/dist/tokens/color/article.css +0 -25
  350. package/dist/tokens/color/company.css +0 -26
  351. package/dist/tokens/color/danger.css +0 -25
  352. package/dist/tokens/color/info.css +0 -25
  353. package/dist/tokens/color/neutral.css +0 -25
  354. package/dist/tokens/color/person.css +0 -25
  355. package/dist/tokens/color/success.css +0 -25
  356. package/dist/tokens/color/warning.css +0 -25
  357. package/dist/tokens/color-scheme/dark/altinn-ds.json +0 -334
  358. package/dist/tokens/color-scheme/dark/global.json +0 -334
  359. package/dist/tokens/color-scheme/dark.css +0 -311
  360. package/dist/tokens/color-scheme/light/altinn-ds.json +0 -334
  361. package/dist/tokens/color-scheme/light/global.json +0 -334
  362. package/dist/tokens/color-scheme/light.css +0 -312
  363. package/dist/tokens/color.json +0 -616
  364. package/dist/tokens/colors.d.ts +0 -10
  365. package/dist/tokens/company.css +0 -26
  366. package/dist/tokens/company.json +0 -70
  367. package/dist/tokens/danger.css +0 -25
  368. package/dist/tokens/dark/altinn-ds.json +0 -334
  369. package/dist/tokens/dark/global.json +0 -334
  370. package/dist/tokens/dark.css +0 -311
  371. package/dist/tokens/design-tokens/$metadata.json +0 -25
  372. package/dist/tokens/design-tokens/$themes.json +0 -137
  373. package/dist/tokens/design-tokens/primitives/globals.json +0 -143
  374. package/dist/tokens/design-tokens/primitives/modes/color-scheme/dark/altinn-ds.json +0 -334
  375. package/dist/tokens/design-tokens/primitives/modes/color-scheme/dark/global.json +0 -334
  376. package/dist/tokens/design-tokens/primitives/modes/color-scheme/light/altinn-ds.json +0 -334
  377. package/dist/tokens/design-tokens/primitives/modes/color-scheme/light/global.json +0 -334
  378. package/dist/tokens/design-tokens/primitives/modes/size/global.json +0 -96
  379. package/dist/tokens/design-tokens/primitives/modes/size/large.json +0 -16
  380. package/dist/tokens/design-tokens/primitives/modes/size/medium.json +0 -16
  381. package/dist/tokens/design-tokens/primitives/modes/size/small.json +0 -16
  382. package/dist/tokens/design-tokens/primitives/modes/typography/primary/altinn-ds.json +0 -22
  383. package/dist/tokens/design-tokens/primitives/modes/typography/secondary/altinn-ds.json +0 -22
  384. package/dist/tokens/design-tokens/primitives/modes/typography/size/large.json +0 -96
  385. package/dist/tokens/design-tokens/primitives/modes/typography/size/medium.json +0 -96
  386. package/dist/tokens/design-tokens/primitives/modes/typography/size/small.json +0 -96
  387. package/dist/tokens/design-tokens/semantic/color.json +0 -616
  388. package/dist/tokens/design-tokens/semantic/modes/main-color/company.json +0 -70
  389. package/dist/tokens/design-tokens/semantic/modes/main-color/person.json +0 -70
  390. package/dist/tokens/design-tokens/semantic/modes/support-color/alert.json +0 -70
  391. package/dist/tokens/design-tokens/semantic/modes/support-color/article.json +0 -70
  392. package/dist/tokens/design-tokens/semantic/style.json +0 -378
  393. package/dist/tokens/design-tokens/themes/altinn-ds.json +0 -386
  394. package/dist/tokens/design-tokens-build/altinn-ds/color/alert.css +0 -25
  395. package/dist/tokens/design-tokens-build/altinn-ds/color/article.css +0 -25
  396. package/dist/tokens/design-tokens-build/altinn-ds/color/company.css +0 -26
  397. package/dist/tokens/design-tokens-build/altinn-ds/color/danger.css +0 -25
  398. package/dist/tokens/design-tokens-build/altinn-ds/color/info.css +0 -25
  399. package/dist/tokens/design-tokens-build/altinn-ds/color/neutral.css +0 -25
  400. package/dist/tokens/design-tokens-build/altinn-ds/color/person.css +0 -25
  401. package/dist/tokens/design-tokens-build/altinn-ds/color/success.css +0 -25
  402. package/dist/tokens/design-tokens-build/altinn-ds/color/warning.css +0 -25
  403. package/dist/tokens/design-tokens-build/altinn-ds/color-scheme/dark.css +0 -311
  404. package/dist/tokens/design-tokens-build/altinn-ds/color-scheme/light.css +0 -312
  405. package/dist/tokens/design-tokens-build/altinn-ds/semantic.css +0 -70
  406. package/dist/tokens/design-tokens-build/altinn-ds/typography/primary.css +0 -123
  407. package/dist/tokens/design-tokens-build/altinn-ds/typography/secondary.css +0 -122
  408. package/dist/tokens/design-tokens-build/altinn-ds.css +0 -1125
  409. package/dist/tokens/design-tokens-build/colors.d.ts +0 -10
  410. package/dist/tokens/global.json +0 -334
  411. package/dist/tokens/globals.json +0 -143
  412. package/dist/tokens/info.css +0 -25
  413. package/dist/tokens/large.json +0 -96
  414. package/dist/tokens/light/altinn-ds.json +0 -334
  415. package/dist/tokens/light/global.json +0 -334
  416. package/dist/tokens/light.css +0 -312
  417. package/dist/tokens/main-color/company.json +0 -70
  418. package/dist/tokens/main-color/person.json +0 -70
  419. package/dist/tokens/medium.json +0 -96
  420. package/dist/tokens/modes/color-scheme/dark/altinn-ds.json +0 -334
  421. package/dist/tokens/modes/color-scheme/dark/global.json +0 -334
  422. package/dist/tokens/modes/color-scheme/light/altinn-ds.json +0 -334
  423. package/dist/tokens/modes/color-scheme/light/global.json +0 -334
  424. package/dist/tokens/modes/main-color/company.json +0 -70
  425. package/dist/tokens/modes/main-color/person.json +0 -70
  426. package/dist/tokens/modes/size/global.json +0 -96
  427. package/dist/tokens/modes/size/large.json +0 -16
  428. package/dist/tokens/modes/size/medium.json +0 -16
  429. package/dist/tokens/modes/size/small.json +0 -16
  430. package/dist/tokens/modes/support-color/alert.json +0 -70
  431. package/dist/tokens/modes/support-color/article.json +0 -70
  432. package/dist/tokens/modes/typography/primary/altinn-ds.json +0 -22
  433. package/dist/tokens/modes/typography/secondary/altinn-ds.json +0 -22
  434. package/dist/tokens/modes/typography/size/large.json +0 -96
  435. package/dist/tokens/modes/typography/size/medium.json +0 -96
  436. package/dist/tokens/modes/typography/size/small.json +0 -96
  437. package/dist/tokens/neutral.css +0 -25
  438. package/dist/tokens/person.css +0 -25
  439. package/dist/tokens/person.json +0 -70
  440. package/dist/tokens/primary/altinn-ds.json +0 -22
  441. package/dist/tokens/primary.css +0 -123
  442. package/dist/tokens/primitives/globals.json +0 -143
  443. package/dist/tokens/primitives/modes/color-scheme/dark/altinn-ds.json +0 -334
  444. package/dist/tokens/primitives/modes/color-scheme/dark/global.json +0 -334
  445. package/dist/tokens/primitives/modes/color-scheme/light/altinn-ds.json +0 -334
  446. package/dist/tokens/primitives/modes/color-scheme/light/global.json +0 -334
  447. package/dist/tokens/primitives/modes/size/global.json +0 -96
  448. package/dist/tokens/primitives/modes/size/large.json +0 -16
  449. package/dist/tokens/primitives/modes/size/medium.json +0 -16
  450. package/dist/tokens/primitives/modes/size/small.json +0 -16
  451. package/dist/tokens/primitives/modes/typography/primary/altinn-ds.json +0 -22
  452. package/dist/tokens/primitives/modes/typography/secondary/altinn-ds.json +0 -22
  453. package/dist/tokens/primitives/modes/typography/size/large.json +0 -96
  454. package/dist/tokens/primitives/modes/typography/size/medium.json +0 -96
  455. package/dist/tokens/primitives/modes/typography/size/small.json +0 -96
  456. package/dist/tokens/secondary/altinn-ds.json +0 -22
  457. package/dist/tokens/secondary.css +0 -122
  458. package/dist/tokens/semantic/color.json +0 -616
  459. package/dist/tokens/semantic/modes/main-color/company.json +0 -70
  460. package/dist/tokens/semantic/modes/main-color/person.json +0 -70
  461. package/dist/tokens/semantic/modes/support-color/alert.json +0 -70
  462. package/dist/tokens/semantic/modes/support-color/article.json +0 -70
  463. package/dist/tokens/semantic/style.json +0 -378
  464. package/dist/tokens/semantic.css +0 -70
  465. package/dist/tokens/size/global.json +0 -96
  466. package/dist/tokens/size/large.json +0 -96
  467. package/dist/tokens/size/medium.json +0 -96
  468. package/dist/tokens/size/small.json +0 -96
  469. package/dist/tokens/small.json +0 -96
  470. package/dist/tokens/style.json +0 -378
  471. package/dist/tokens/success.css +0 -25
  472. package/dist/tokens/support-color/alert.json +0 -70
  473. package/dist/tokens/support-color/article.json +0 -70
  474. package/dist/tokens/themes/altinn-ds.json +0 -386
  475. package/dist/tokens/typography/primary/altinn-ds.json +0 -22
  476. package/dist/tokens/typography/primary.css +0 -123
  477. package/dist/tokens/typography/secondary/altinn-ds.json +0 -22
  478. package/dist/tokens/typography/secondary.css +0 -122
  479. package/dist/tokens/typography/size/large.json +0 -96
  480. package/dist/tokens/typography/size/medium.json +0 -96
  481. package/dist/tokens/typography/size/small.json +0 -96
  482. package/dist/tokens/warning.css +0 -25
  483. package/dist/types/lib/components/Bookmarks/BookmarksListItem.d.ts +0 -7
  484. package/dist/types/lib/components/Bookmarks/BookmarksListItem.stories.d.ts +0 -23
  485. package/dist/types/lib/components/Bookmarks/BookmarksSection.d.ts +0 -12
  486. package/dist/types/lib/components/Bookmarks/BookmarksSection.stories.d.ts +0 -77
  487. package/dist/types/lib/components/Bookmarks/EditableBookmark.d.ts +0 -32
  488. package/dist/types/lib/components/Bookmarks/index.d.ts +0 -3
  489. package/dist/useMergeRefs-DOnoWyUH.js +0 -29
  490. package/dist/usePagination-cq1YWZkE.js +0 -889
  491. /package/dist/{Alert-BzifOfXl.js → alert-BzifOfXl.js} +0 -0
  492. /package/dist/{padding.css → data-padding.css} +0 -0
  493. /package/dist/{shadow.css → data-shadow.css} +0 -0
  494. /package/dist/{spacing.css → data-spacing.css} +0 -0
  495. /package/dist/{altinn-theme.css → data-theme.css} +0 -0
  496. /package/dist/{Textarea-BBstVlPT.js → textarea-BBstVlPT.js} +0 -0
@@ -1,889 +0,0 @@
1
- "use client";
2
- import { jsx as s, jsxs as T, Fragment as de } from "react/jsx-runtime";
3
- import { c as I } from "./lite-1fxw3LjI.js";
4
- import ve, { forwardRef as v, useState as U, createContext as oe, useRef as j, useEffect as F, useContext as D, useId as re, version as yt, useMemo as G, isValidElement as xt, memo as Ct, useCallback as vt, Children as Me } from "react";
5
- import { S as E, a as wt } from "./index-D8Pn8SCu.js";
6
- import { u as kt, S as It } from "./Spinner-BDXfwXIh.js";
7
- import { u as J } from "./useMergeRefs-DOnoWyUH.js";
8
- import { B as ue } from "./Button-B0t0vz2h.js";
9
- import { F as ce, V as Ne, a as Ot, b as Nt, c as Ke } from "./index-CnWc2FNH.js";
10
- import { I as me } from "./Input-B_w6SBmg.js";
11
- import { L as X } from "./Label-9elsbqMH.js";
12
- import { T as _t } from "./Textarea-BBstVlPT.js";
13
- import { a as Ve, c as St, o as Tt, f as Et, s as Pt, C as W, u as _e, b as Ue, d as le, p as R, r as Ie, e as Se, i as Dt, g as Rt, h as Lt, j as Ft, k as zt, l as At, m as $t, n as Bt, q as jt, t as Mt, v as ae, F as Kt, w as Vt, x as Ut } from "./index-B6sKSsN9.js";
14
- import { u as qt } from "./index-D-VWMqlv.js";
15
- import { S as Ht } from "./XMark-tKk6aExO.js";
16
- import { P as Oe } from "./Paragraph-Bm-eoPYv.js";
17
- import { S as Xt, a as Yt } from "./ChevronUp-_BBfEirx.js";
18
- import { u as Wt } from "./useId-BVFxCjkq.js";
19
- import { S as Gt } from "./Checkmark-Byz_C9x4.js";
20
- import { flushSync as Jt } from "react-dom";
21
- var Qt = function(t, n) {
22
- var e = {};
23
- for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && n.indexOf(o) < 0 && (e[o] = t[o]);
24
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
25
- for (var r = 0, o = Object.getOwnPropertySymbols(t); r < o.length; r++)
26
- n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[r]) && (e[o[r]] = t[o[r]]);
27
- return e;
28
- };
29
- const Zt = v((t, n) => {
30
- var { title: e, titleId: o } = t, r = Qt(t, ["title", "titleId"]);
31
- let i = Wt();
32
- return i = e ? o || "title-" + i : void 0, ve.createElement(
33
- "svg",
34
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: n, "aria-labelledby": i }, r),
35
- e ? ve.createElement("title", { id: i }, e) : null,
36
- ve.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 2.25A4.75 4.75 0 0 0 7.25 7v2.25H7A1.75 1.75 0 0 0 5.25 11v9c0 .414.336.75.75.75h12a.75.75 0 0 0 .75-.75v-9A1.75 1.75 0 0 0 17 9.25h-.25V7A4.75 4.75 0 0 0 12 2.25m3.25 7V7a3.25 3.25 0 0 0-6.5 0v2.25zM12 13a1.5 1.5 0 0 0-.75 2.8V17a.75.75 0 0 0 1.5 0v-1.2A1.5 1.5 0 0 0 12 13", clipRule: "evenodd" })
37
- );
38
- }), en = v(function({ className: n, count: e, maxCount: o, variant: r = "base", ...i }, c) {
39
- return s("span", { className: I("ds-badge", n), "data-count": e && o && e > o ? `${o}+` : e, "data-variant": r, ref: c, ...i });
40
- }), tn = v(function({ className: n, overlap: e = "rectangle", placement: o = "top-right", ...r }, i) {
41
- return s("span", { className: I("ds-badge--position", n), "data-overlap": e, "data-placement": o, ref: i, ...r });
42
- }), nn = Object.assign(en, { Position: tn });
43
- nn.Position.displayName = "Badge.Position";
44
- const on = v(({ asChild: t, className: n, ...e }, o) => s(t ? E : "a", { className: I("ds-link", n), ref: o, ...e }));
45
- on.displayName = "Link";
46
- const Zn = v(function({ asChild: n, className: e, height: o, style: r, variant: i = "rectangle", width: c, ...a }, l) {
47
- const u = n ? E : "span", g = i === "text", b = kt("ds-skeleton-opacity-fade"), f = J([b, l]);
48
- return s(u, { "aria-hidden": "true", className: I("ds-skeleton", e), "data-text": g ? "-".repeat(Number(c) || 1) : void 0, "data-variant": i, ref: f, style: g ? r : { width: c, height: o, ...r }, ...a });
49
- }), eo = v(function({ asChild: n, ...e }, o) {
50
- return s(n ? E : "li", { ...e, ref: o });
51
- }), qe = (t, { asChild: n, className: e, ...o }, r) => s(n ? E : t, { className: I("ds-list", e), ref: r, ...o }), to = v(function(n, e) {
52
- return qe("ul", n, e);
53
- });
54
- v(function(n, e) {
55
- return qe("ol", n, e);
56
- });
57
- const He = v(function({ asChild: n, className: e, ...o }, r) {
58
- return s(n ? E : "button", { className: I("ds-chip", e), type: n ? void 0 : "button", ref: r, ...o });
59
- }), Xe = v(function(n, e) {
60
- return s(He, { "data-removable": !0, ref: e, ...n });
61
- }), Ye = v(function({ asChild: n, children: e, className: o, "data-size": r, "data-color": i, ...c }, a) {
62
- const l = c.type ?? "checkbox";
63
- return T(n ? E : "label", { className: I("ds-chip", o), "data-size": r, "data-color": i, ref: a, children: [s(me, { ...c, type: l }), s(wt, { children: e })] });
64
- }), rn = v(function(n, e) {
65
- return s(Ye, { ref: e, type: "radio", ...n });
66
- }), fe = {
67
- Button: He,
68
- Checkbox: Ye,
69
- Radio: rn,
70
- Removable: Xe
71
- };
72
- fe.Button.displayName = "Chip.Button";
73
- fe.Checkbox.displayName = "Chip.Checkbox";
74
- fe.Radio.displayName = "Chip.Radio";
75
- fe.Removable.displayName = "Chip.Removable";
76
- const sn = v(function({ "aria-label": n = "Sidenavigering", asChild: e, className: o, ...r }, i) {
77
- return s(e ? E : "nav", { "aria-label": n, className: I("ds-pagination", o), ref: i, ...r });
78
- }), an = v(function(n, e) {
79
- return s(ue, { ref: e, ...n });
80
- }), cn = v(function({ asChild: n, className: e, ...o }, r) {
81
- return s(n ? E : "li", { ref: r, ...o });
82
- }), ln = v(function({ asChild: n, ...e }, o) {
83
- return s(n ? E : "ul", { ref: o, ...e });
84
- }), Te = Object.assign(sn, {
85
- List: ln,
86
- Item: cn,
87
- Button: an
88
- });
89
- Te.List.displayName = "Pagination.List";
90
- Te.Item.displayName = "Pagination.Item";
91
- Te.Button.displayName = "Pagination.Button";
92
- const no = v(function({ "data-size": n, className: e, style: o, children: r, label: i, description: c, error: a, ...l }, u) {
93
- return T(ce, { "data-size": n, className: e, style: o, children: [s(me, { type: "checkbox", ref: u, ...l }), !!i && s(X, { weight: "regular", children: i }), !!c && s("div", { "data-field": "description", children: c }), !!a && s(Ne, { children: a })] });
94
- }), oo = v(function({ "data-size": n, children: e, className: o, description: r, label: i, position: c, style: a, ...l }, u) {
95
- return T(ce, { className: o, "data-position": c, "data-size": n, style: a, children: [s(me, { type: "checkbox", role: "switch", ref: u, ...l }), !!i && s(X, { weight: "regular", children: i }), !!r && s("div", { "data-field": "description", children: r })] });
96
- }), ro = v(function({ label: n, description: e, error: o, multiline: r, prefix: i, suffix: c, "data-size": a, counter: l, style: u, className: g, ...b }, f) {
97
- return T(ce, { className: g, "data-size": a, style: u, children: [!!n && s(X, { children: n }), !!e && s(Ot, { children: e }), T(Nt, { children: [i === void 0 || s(Ke, { children: i }), r === !0 ? s(_t, { ref: f, "aria-invalid": !!o || void 0, ...b }) : s(me, { ref: f, "aria-invalid": !!o || void 0, ...b }), c === void 0 || s(Ke, { children: c })] }), !!o && s(Ne, { children: o }), !!l && s(ce.Counter, { ...typeof l == "number" ? { limit: l } : l })] });
98
- }), be = oe({}), dn = v(function({ value: n, defaultValue: e, className: o, onChange: r, ...i }, c) {
99
- const a = n !== void 0, [l, u] = U(e);
100
- let g = r;
101
- return a || (g = (b) => {
102
- u(b), r == null || r(b);
103
- }, n = l), s(be.Provider, { value: {
104
- value: n,
105
- defaultValue: e,
106
- onChange: g
107
- }, children: s("div", { className: I("ds-tabs", o), ref: c, ...i }) });
108
- }), We = oe({
109
- elements: { current: /* @__PURE__ */ new Map() },
110
- getOrderedItems: () => [],
111
- setFocusableValue: () => {
112
- },
113
- onShiftTab: () => {
114
- },
115
- focusableValue: null,
116
- orientation: "horizontal"
117
- }), un = v(({ activeValue: t, asChild: n, orientation: e = "horizontal", onBlur: o, onFocus: r, ...i }, c) => {
118
- const a = n ? E : "div", [l, u] = U(null), [g, b] = U(!1), f = j(/* @__PURE__ */ new Map()), h = j(null), x = J([c, h]), w = () => {
119
- if (!h.current)
120
- return [];
121
- const d = Array.from(h.current.querySelectorAll("[data-roving-tabindex-item]"));
122
- return Array.from(f.current).sort((y, m) => d.indexOf(y[1]) - d.indexOf(m[1])).map(([y, m]) => ({ value: y, element: m }));
123
- };
124
- return F(() => {
125
- u(t ?? null);
126
- }, [t]), s(We.Provider, { value: {
127
- elements: f,
128
- getOrderedItems: w,
129
- focusableValue: l,
130
- setFocusableValue: u,
131
- onShiftTab: () => {
132
- b(!0);
133
- },
134
- orientation: e
135
- }, children: s(a, { ...i, tabIndex: g ? -1 : 0, onBlur: (d) => {
136
- o == null || o(d), b(!1), u(t ?? null);
137
- }, onFocus: (d) => {
138
- var m, p, C;
139
- if (r == null || r(d), d.target !== d.currentTarget)
140
- return;
141
- const y = w();
142
- y.length !== 0 && (l != null ? (m = f.current.get(l)) == null || m.focus() : t != null ? (p = f.current.get(t)) == null || p.focus() : (C = y.at(0)) == null || C.element.focus());
143
- }, ref: x }) });
144
- }), mn = v(function({ children: n, ...e }, o) {
145
- const { value: r } = D(be);
146
- return s(un, { role: "tablist", activeValue: r, orientation: "ambiguous", ref: o, ...e, children: n });
147
- }), fn = v(function({ children: n, value: e, ...o }, r) {
148
- const { value: i } = D(be), c = e === i, [a, l] = U(!1), u = j(null), g = J([r, u]);
149
- return F(() => {
150
- if (!u.current)
151
- return;
152
- const b = u.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
153
- l(b.length > 0);
154
- }, [n]), s(de, { children: c && s("div", { ref: g, role: "tabpanel", tabIndex: a ? void 0 : 0, ...o, children: n }) });
155
- }), bn = (t) => {
156
- const { elements: n, getOrderedItems: e, setFocusableValue: o, focusableValue: r, onShiftTab: i, orientation: c } = D(We);
157
- return {
158
- getOrderedItems: e,
159
- isFocusable: r === t,
160
- orientation: c,
161
- getRovingProps: (a) => ({
162
- ...a,
163
- ref: (l) => {
164
- l ? n.current.set(t, l) : n.current.delete(t);
165
- },
166
- onKeyDown: (l) => {
167
- var u;
168
- if ((u = a == null ? void 0 : a.onKeyDown) == null || u.call(a, l), l.shiftKey && l.key === "Tab") {
169
- i();
170
- return;
171
- }
172
- },
173
- onFocus: (l) => {
174
- var u;
175
- (u = a == null ? void 0 : a.onFocus) == null || u.call(a, l), o(t);
176
- },
177
- "data-roving-tabindex-item": !0,
178
- tabIndex: r === t ? 0 : -1
179
- })
180
- };
181
- };
182
- function we(t, n) {
183
- const e = t.findIndex((o) => o.value === n);
184
- return t.at(e === t.length - 1 ? 0 : e + 1);
185
- }
186
- function ke(t, n) {
187
- const e = t.findIndex((o) => o.value === n);
188
- return t.at(e === 0 ? -1 : e - 1);
189
- }
190
- const pn = v(({ value: t, asChild: n, ...e }, o) => {
191
- const r = n ? E : "div", i = t ?? (typeof e.children == "string" ? e.children : ""), { getOrderedItems: c, getRovingProps: a, orientation: l } = bn(i), u = a({
192
- onKeyDown: (b) => {
193
- var x;
194
- (x = e == null ? void 0 : e.onKeyDown) == null || x.call(e, b);
195
- const f = c();
196
- let h;
197
- switch (l) {
198
- case "horizontal":
199
- b.key === "ArrowRight" && (h = we(f, i)), b.key === "ArrowLeft" && (h = ke(f, i));
200
- break;
201
- case "vertical":
202
- b.key === "ArrowDown" && (h = we(f, i)), b.key === "ArrowUp" && (h = ke(f, i));
203
- break;
204
- case "ambiguous":
205
- ["ArrowRight", "ArrowDown"].includes(b.key) && (h = we(f, i)), ["ArrowLeft", "ArrowUp"].includes(b.key) && (h = ke(f, i));
206
- }
207
- b.key === "Home" && (h = f[0]), b.key === "End" && (h = f[f.length - 1]), h && (b.preventDefault(), h.element.focus());
208
- }
209
- }), g = J([o, u.ref]);
210
- return s(r, { ...e, ...u, ref: g, children: e.children });
211
- }), hn = v(function({ value: n, id: e, ...o }, r) {
212
- const i = D(be), c = e ?? `tab-${re()}`;
213
- return s(pn, { value: n, ...o, asChild: !0, children: s("button", { ...o, "aria-selected": i.value === n, id: c, onClick: () => {
214
- var a;
215
- return (a = i.onChange) == null ? void 0 : a.call(i, n);
216
- }, ref: r, role: "tab", type: "button" }) });
217
- }), Ee = Object.assign(dn, {
218
- List: mn,
219
- Tab: hn,
220
- Panel: fn
221
- });
222
- Ee.Tab.displayName = "Tabs.Tab";
223
- Ee.List.displayName = "Tabs.List";
224
- Ee.Panel.displayName = "Tabs.Panel";
225
- const Ge = ({ children: t }) => {
226
- const n = re(), [e, o] = U(n);
227
- return s(Pe.Provider, { value: { popoverId: e, setPopoverId: o }, children: t });
228
- };
229
- Ge.displayName = "PopoverTriggerContext";
230
- const Pe = oe({}), gn = v(function({ id: n, className: e, onClose: o, onOpen: r, open: i, variant: c = "default", placement: a = "top", autoPlacement: l = !0, asChild: u = !1, ...g }, b) {
231
- const f = u ? E : "div", h = j(null), x = J([h, b]), { popoverId: w, setPopoverId: d } = D(Pe), [y, m] = U(!1), p = i ?? y;
232
- return F(() => {
233
- var L;
234
- const C = h.current, O = ($) => {
235
- var Y;
236
- const z = $.target, K = (Y = z == null ? void 0 : z.closest) == null ? void 0 : Y.call(z, `[popovertarget="${C == null ? void 0 : C.id}"]`), B = !K && !(C != null && C.contains(z));
237
- K && ($.preventDefault(), m((S) => !S), r == null || r()), B && (m(!1), o == null || o());
238
- }, _ = ($) => {
239
- $.key !== "Escape" || !p || ($.preventDefault(), m(!1), o == null || o());
240
- };
241
- return (L = C == null ? void 0 : C.togglePopover) == null || L.call(C, p), document.addEventListener("click", O, !0), document.addEventListener("keydown", _), () => {
242
- document.removeEventListener("click", O, !0), document.removeEventListener("keydown", _);
243
- };
244
- }, [p]), F(() => {
245
- const C = h.current, O = document.querySelector(`[popovertarget="${C == null ? void 0 : C.id}"]`);
246
- if (C && O && p)
247
- return Ve(O, C, () => {
248
- St(O, C, {
249
- placement: a,
250
- strategy: "fixed",
251
- middleware: [
252
- Tt((_) => {
253
- const L = getComputedStyle(_.elements.floating, "::before");
254
- return parseFloat(L.height);
255
- }),
256
- ...l ? [Et({ fallbackAxisSideDirection: "start" }), Pt()] : [],
257
- yn
258
- ]
259
- }).then(({ x: _, y: L }) => {
260
- C.style.translate = `${_}px ${L}px`;
261
- });
262
- });
263
- }, [p, a, n, l]), F(() => {
264
- n && (d == null || d(n));
265
- }, [n]), s(f, { className: I("ds-popover", e), id: n || w, popover: "manual", "data-variant": c, ref: x, ...g });
266
- }), yn = {
267
- name: "ArrowPseudoElement",
268
- fn(t) {
269
- const { elements: n, rects: e, placement: o } = t;
270
- let r = `${Math.round(e.reference.width / 2 + e.reference.x - t.x)}px`, i = `${Math.round(e.reference.height / 2 + e.reference.y - t.y)}px`;
271
- switch (e.reference.width > e.floating.width && (r = `${Math.round(e.floating.width / 2)}px`), e.reference.height > e.floating.height && (i = `${Math.round(e.floating.height / 2)}px`), o.split("-")[0]) {
272
- case "top":
273
- i = "100%";
274
- break;
275
- case "right":
276
- r = "0";
277
- break;
278
- case "bottom":
279
- i = "0";
280
- break;
281
- case "left":
282
- r = "100%";
283
- break;
284
- }
285
- return n.floating.setAttribute("data-placement", o.split("-")[0]), n.floating.style.setProperty("--ds-popover-arrow-x", r), n.floating.style.setProperty("--ds-popover-arrow-y", i), t;
286
- }
287
- }, xn = v(function({ id: n, inline: e, asChild: o, ...r }, i) {
288
- const { popoverId: c } = D(Pe), a = o ? E : e ? "button" : ue, l = Object.assign({
289
- [yt.startsWith("19") ? "popoverTarget" : "popovertarget"]: c,
290
- ...e ? {
291
- "data-popover": "inline"
292
- } : {}
293
- }, r);
294
- return s(a, { ref: i, ...l });
295
- }), Je = Object.assign(gn, {
296
- TriggerContext: Ge,
297
- Trigger: xn
298
- });
299
- Je.TriggerContext.displayName = "Popover.TriggerContext";
300
- Je.Trigger.displayName = "Popover.Trigger";
301
- const De = oe({
302
- current: null
303
- }), Qe = ({ children: t }) => {
304
- const n = j(null);
305
- return s(De.Provider, { value: n, children: t });
306
- };
307
- Qe.displayName = "DialogTriggerContext";
308
- const Cn = v(function({ asChild: n, children: e, className: o, closeButton: r = "Lukk dialogvindu", closedby: i = "closerequest", modal: c = !0, onClose: a, open: l, ...u }, g) {
309
- const b = D(De), f = j(null), h = n ? E : "dialog", x = J([b, g, f]), w = c ? "showModal" : "show";
310
- return F(() => {
311
- var d;
312
- return (d = f.current) == null ? void 0 : d[l ? w : "close"]();
313
- }, [l]), F(() => {
314
- const d = f.current, y = (p) => {
315
- var L;
316
- const { clientY: C, clientX: O, target: _ } = p;
317
- if (p instanceof KeyboardEvent)
318
- return i === "none" && p.key === "Escape" && p.preventDefault();
319
- if (!((L = window.getSelection()) != null && L.toString()) && d && _ === d && i === "any") {
320
- const { top: $, left: z, right: K, bottom: B } = d.getBoundingClientRect();
321
- $ <= C && C <= B && z <= O && O <= K || d == null || d.close();
322
- }
323
- }, m = () => {
324
- const p = d == null ? void 0 : d.querySelector("[autofocus]");
325
- document.activeElement !== p && (p == null || p.focus());
326
- };
327
- return d == null || d.addEventListener("animationend", m), d == null || d.addEventListener("click", y), d == null || d.addEventListener("keydown", y), () => {
328
- d == null || d.removeEventListener("animationend", m), d == null || d.removeEventListener("click", y), d == null || d.removeEventListener("keydown", y);
329
- };
330
- }, [i]), F(() => {
331
- var y;
332
- const d = (m) => a == null ? void 0 : a(m);
333
- return (y = f.current) == null || y.addEventListener("close", d), () => {
334
- var m;
335
- return (m = f.current) == null ? void 0 : m.removeEventListener("close", d);
336
- };
337
- }, [a]), T(h, { className: I("ds-dialog", o), ref: x, "data-modal": c, ...u, children: [r !== !1 && s("form", { method: "dialog", children: s(ue, { "aria-label": r, autoFocus: !0, "data-color": "neutral", icon: !0, name: "close", type: "submit", variant: "tertiary" }) }), e] });
338
- }), vn = v(function({ asChild: n, className: e, ...o }, r) {
339
- return s(n ? E : "div", { className: I("ds-dialog__block", e), ref: r, ...o });
340
- }), wn = v(function({ asChild: n, ...e }, o) {
341
- const r = D(De);
342
- return s(n ? E : ue, { "aria-haspopup": "dialog", onClick: () => {
343
- var a, l, u;
344
- ((a = r.current) == null ? void 0 : a.getAttribute("data-modal")) === "true" ? (l = r.current) == null || l.showModal() : (u = r.current) == null || u.show();
345
- }, ref: o, ...e });
346
- }), Re = Object.assign(Cn, {
347
- Block: vn,
348
- TriggerContext: Qe,
349
- Trigger: wn
350
- });
351
- Re.Block.displayName = "Dialog.Block";
352
- Re.TriggerContext.displayName = "Dialog.TriggerContext";
353
- Re.Trigger.displayName = "Dialog.Trigger";
354
- const kn = oe(null), In = (t, n) => {
355
- const e = D(kn), o = re(), r = t.id ?? `${n}-${o}`, i = t.errorId ?? `${n}-error-${o}`, c = `${n}-description-${o}`, a = t.size ?? (e == null ? void 0 : e.size) ?? "md", l = (e == null ? void 0 : e.disabled) || (t == null ? void 0 : t.disabled), u = !l && !!(t.error || e != null && e.error);
356
- return {
357
- hasError: u,
358
- errorId: i,
359
- descriptionId: c,
360
- size: a,
361
- inputProps: {
362
- id: r,
363
- disabled: l,
364
- "aria-invalid": u ? !0 : void 0,
365
- "aria-describedby": I(t["aria-describedby"], !!(t != null && t.description) && typeof (t == null ? void 0 : t.description) == "string" && c, u && !(e != null && e.error) && i, u && !!(e != null && e.error) && (e == null ? void 0 : e.errorId)) || void 0
366
- }
367
- };
368
- }, Ze = ({ size: t, error: n, formFieldProps: e }) => s("div", { className: "ds-combobox__error-message", id: e.errorId, "aria-live": "polite", "aria-relevant": "additions removals", children: n && s(Ne, { "data-size": t, children: n }) });
369
- Ze.displayName = "ComboboxError";
370
- const et = () => {
371
- const t = D(W);
372
- if (!t)
373
- throw new Error("ComboboxContext is missing");
374
- const { size: n, readOnly: e, disabled: o, selectedOptions: r, chipSrLabel: i, handleSelectOption: c, inputRef: a } = t;
375
- return s(de, { children: Object.keys(r).map((l) => s(Xe, { "data-size": n, disabled: o, onKeyDown: (u) => {
376
- var g;
377
- e || o || u.key === "Enter" && (u.stopPropagation(), c({
378
- option: r[l],
379
- remove: !0
380
- }), (g = a == null ? void 0 : a.current) == null || g.focus());
381
- }, onClick: () => {
382
- e || o || c({
383
- option: r[l],
384
- remove: !0
385
- });
386
- }, "aria-label": i(r[l]), children: r[l].label }, l)) });
387
- };
388
- et.displayName = "ComboboxChips";
389
- const tt = v((t, n) => {
390
- const e = D(W);
391
- if (!e)
392
- throw new Error("ComboboxContext is missing");
393
- const { readOnly: o, disabled: r, clearButtonLabel: i, handleSelectOption: c } = e;
394
- return s("button", { ...t, ref: n, disabled: r, className: I("ds-combobox__clear-button", "ds-focus"), onClick: () => {
395
- o || r || c({ option: null, clear: !0 });
396
- }, onKeyDown: (a) => {
397
- o || r || a.key === "Enter" && (a.stopPropagation(), c({ option: null, clear: !0 }));
398
- }, type: "button", "aria-label": i, children: s(Ht, { fontSize: "1.5em", title: "Clear selection" }) });
399
- });
400
- tt.displayName = "ComboboxClearButton";
401
- const nt = ({ hideClearButton: t, listId: n, error: e, hideChips: o, handleKeyDown: r, ...i }) => {
402
- const c = D(W), a = _e(), l = j(null);
403
- if (!c)
404
- throw new Error("ComboboxContext is missing");
405
- const u = (P) => {
406
- a == null || a({ type: "SET_ACTIVE_INDEX", payload: P });
407
- }, { forwareddRef: g, readOnly: b, disabled: f, open: h, inputRef: x, refs: w, inputValue: d, multiple: y, selectedOptions: m, formFieldProps: p, htmlSize: C, options: O, setOpen: _, getReferenceProps: L, setInputValue: $, handleSelectOption: z, size: K } = c, B = Ue([g, x]), Y = (P) => {
408
- const A = P.target.value;
409
- $(A), u(0);
410
- for (const V of Object.values(O))
411
- if (V.label.toLowerCase() === A.toLowerCase()) {
412
- if (m[R(V.value)])
413
- continue;
414
- z({ option: V });
415
- }
416
- }, S = !t && Object.keys(m).length > 0, Q = L({
417
- ref: w == null ? void 0 : w.setReference,
418
- role: null,
419
- "aria-controls": null,
420
- "aria-expanded": null,
421
- "aria-haspopup": null,
422
- /* If we click the wrapper, toggle open, set index to first option, and focus the input */
423
- onClick(P) {
424
- var A, V;
425
- f || b || (A = l.current) != null && A.contains(P.target) || (_(!h), u(0), (V = x.current) == null || V.focus());
426
- },
427
- /* Handles list navigation */
428
- onKeyDown: r,
429
- // preventDefault on keydown to avoid sending in form
430
- onKeyPress(P) {
431
- P.key === "Enter" && P.preventDefault();
432
- }
433
- });
434
- return s(Oe, { "data-size": K, asChild: !0, children: T("div", { ...Q, "aria-disabled": f ? "true" : void 0, className: I("ds-textfield__input", "ds-combobox__input__wrapper", b && "ds-combobox--readonly", e && "ds-combobox--error"), children: [T("div", { className: "ds-combobox__chip-and-input", children: [y && !o && s(et, {}), s(Oe, { "data-size": K, asChild: !0, children: s("input", { ref: B, "aria-activedescendant": Q["aria-activedescendant"], readOnly: b, "aria-autocomplete": "list", role: "combobox", "aria-expanded": h, "aria-controls": h ? n : void 0, autoComplete: "off", size: C, value: d, ...le(["style", "className"], i), ...p.inputProps, className: "ds-combobox__input", onChange: (P) => {
435
- var A;
436
- Y(P), !h && _(!0), (A = i.onChange) == null || A.call(i, P);
437
- } }) })] }), S && s(tt, { ref: l }), s("div", { className: "ds-combobox__arrow", children: h ? s(Xt, { title: "arrow up", fontSize: "1.5em" }) : s(Yt, { title: "arrow down", fontSize: "1.5em" }) })] }) });
438
- };
439
- nt.displayName = "ComboboxInput";
440
- const ot = ({ label: t, description: n, hideLabel: e, size: o, readOnly: r, formFieldProps: i }) => T(de, { children: [t && T(X, { "data-size": o, htmlFor: i.inputProps.id, className: I("ds-combobox__label", e && "ds-sr-only"), children: [r && s(Zt, { "aria-hidden": !0, className: "ds-combobox__readonly__icon" }), t] }), n && s(Oe, { asChild: !0, "data-size": o, children: s("div", { id: i.descriptionId, className: I("ds-combobox__description", e && "ds-sr-only"), children: n }) })] });
441
- ot.displayName = "ComboboxLabel";
442
- const rt = ({ selectedOptions: t, multiple: n, name: e }) => {
443
- const o = Object.keys(t).map((r) => Ie(r));
444
- return s("select", { name: e, multiple: n, style: { display: "none" }, value: n ? o : o[0], onChange: () => {
445
- }, children: o.map((r) => s("option", { value: r }, r)) });
446
- };
447
- rt.displayName = "ComboboxNative";
448
- const it = v(({ children: t, className: n, ...e }, o) => s("span", { className: I("ds-combobox__option__description", n), ref: o, ...e, children: t }));
449
- it.displayName = "ComboboxOptionDescription";
450
- const st = ({ multiple: t, selected: n }) => s("div", { className: I(t && "ds-combobox__option__icon-wrapper", n && "ds-combobox__option__icon-wrapper--selected"), children: n && s(Gt, { className: "ds-combobox__option__icon-wrapper__icon", "aria-hidden": !0 }) });
451
- st.displayName = "SelectedIcon";
452
- function Le(t, n = 50) {
453
- const e = j(null);
454
- return F(() => () => {
455
- e.current && clearTimeout(e.current);
456
- }, []), (...r) => {
457
- e.current && clearTimeout(e.current), e.current = window.setTimeout(() => {
458
- t(...r);
459
- }, n);
460
- };
461
- }
462
- const On = ({ id: t, ref: n, value: e }) => {
463
- const o = re(), r = t || o, i = D(W), { activeIndex: c } = Se(), a = _e();
464
- if (!i)
465
- throw new Error("ComboboxOption must be used within a Combobox");
466
- const { selectedOptions: l, onOptionClick: u, setListRef: g, customIds: b, filteredOptions: f } = i, h = G(() => f.indexOf(R(String(e))) + b.length, [b.length, f, e]), x = Ue([
467
- (m) => {
468
- g(h, m);
469
- },
470
- n
471
- ]);
472
- if (h === -1)
473
- throw new Error("Internal error: ComboboxOption did not find index");
474
- const w = l[R(e)], d = c === h;
475
- F(() => {
476
- d && (a == null || a({ type: "SET_ACTIVE_INDEX", payload: h }));
477
- }, [o, t, a, d, h]);
478
- const y = Le(() => u(e), 50);
479
- return {
480
- id: r,
481
- ref: x,
482
- selected: w,
483
- active: d,
484
- onOptionClick: y
485
- };
486
- }, Fe = Ct(v(({ value: t, description: n, children: e, className: o, ...r }, i) => {
487
- const c = re(), { id: a, ref: l, selected: u, active: g, onOptionClick: b } = On({
488
- id: r.id,
489
- ref: i,
490
- value: t
491
- }), f = D(W);
492
- if (!f)
493
- throw new Error("ComboboxOption must be used within a Combobox");
494
- const { size: h, multiple: x, getItemProps: w } = f, d = w();
495
- return s(X, { "data-size": "md", asChild: !0, children: T("button", {
496
- ref: l,
497
- id: a,
498
- // biome-ignore lint/a11y/useSemanticElements: biome wants me to use the <option> element
499
- role: "option",
500
- type: "button",
501
- "aria-selected": !!u,
502
- "aria-labelledby": c,
503
- tabIndex: -1,
504
- onClick: (y) => {
505
- var m;
506
- b(), (m = r.onClick) == null || m.call(r, y);
507
- },
508
- className: I("ds-combobox__option", g && "ds-combobox__option--active", x && "ds-combobox__option--multiple", o),
509
- ...le(["displayValue"], r),
510
- ...le(["onClick", "onPointerLeave"], d),
511
- children: [s(X, { asChild: !0, "data-size": h, children: s("span", { children: s(st, { multiple: x, selected: !!u }) }) }), T(X, { className: "ds-combobox__option__label", "data-size": h, id: c, children: [e, n && s(it, { children: n })] })]
512
- }) });
513
- }));
514
- Fe.displayName = "ComboboxOption";
515
- function Nn(t) {
516
- return xt(t) && t.type === Fe;
517
- }
518
- const _n = (t) => !!t;
519
- function Sn({ children: t, inputValue: n, multiple: e, filter: o = (i, c) => c.label.toLowerCase().startsWith(i.toLowerCase()), initialValue: r }) {
520
- const i = vt(o, [o]), { optionsChildren: c, customIds: a, restChildren: l, interactiveChildren: u } = G(() => Me.toArray(t).reduce((m, p) => {
521
- if (Nn(p))
522
- m.optionsChildren.push(p);
523
- else if (m.restChildren.push(p), Dt(p)) {
524
- const C = p;
525
- if (m.interactiveChildren.push(C), !C.props.id)
526
- throw new Error("If ComboboxCustom is interactive, it must have an id");
527
- m.customIds.push(C.props.id);
528
- }
529
- return m;
530
- }, {
531
- optionsChildren: [],
532
- customIds: [],
533
- restChildren: [],
534
- interactiveChildren: []
535
- }), [t]), g = G(() => {
536
- const d = [], y = {};
537
- return c.map((m) => {
538
- const p = m.props;
539
- let C = p.displayValue || "";
540
- if (!p.displayValue) {
541
- let O = "";
542
- Me.forEach(p.children, (_) => {
543
- if (typeof _ == "string")
544
- O += _;
545
- else
546
- throw new Error("If ComboboxOption is not a string, it must have a displayValue prop");
547
- }), C = O;
548
- }
549
- d.includes(p.value) && console.warn(`Combobox has multiple options with the same value: ${p.value}`), d.push(p.value), y[R(String(p.value))] = {
550
- value: String(p.value),
551
- label: C,
552
- displayValue: p.displayValue,
553
- description: p.description
554
- };
555
- }), y;
556
- }, [c]), b = G(() => ((r == null ? void 0 : r.map((d) => R(d))) || []).reduce((d, y) => {
557
- const m = g[y];
558
- return _n(m) && (d[y] = m), d;
559
- }, {}), [r, g]), [f, h] = U(b), { filteredOptions: x, filteredOptionsChildren: w } = G(() => {
560
- const d = [], y = Object.keys(g).map((m, p) => {
561
- if (!e && Object.keys(f).length === 1 || e && f[m] || i(n, g[m]))
562
- return d.push(m), c[p];
563
- }).filter((m) => m);
564
- return { filteredOptions: d, filteredOptionsChildren: y };
565
- }, [
566
- i,
567
- n,
568
- e,
569
- g,
570
- c,
571
- f
572
- ]);
573
- return {
574
- filteredOptionsChildren: w,
575
- filteredOptions: x,
576
- restChildren: l,
577
- options: g,
578
- customIds: a,
579
- selectedOptions: f,
580
- interactiveChildren: u,
581
- setSelectedOptions: h
582
- };
583
- }
584
- const Tn = ({ readOnly: t, disabled: n, interactiveChildren: e, filteredOptions: o, inputValue: r, selectedOptions: i, multiple: c, open: a, options: l, setOpen: u, handleSelectOption: g }) => {
585
- const { activeIndex: b } = Se();
586
- return Le((x) => {
587
- if (!(t || n) && x)
588
- switch (x.key) {
589
- case "ArrowDown":
590
- if (x.preventDefault(), a)
591
- break;
592
- u(!0);
593
- break;
594
- case "ArrowUp":
595
- if (x.preventDefault(), b !== 0)
596
- break;
597
- u(!1);
598
- break;
599
- case "Enter": {
600
- if (x.preventDefault(), !a)
601
- break;
602
- if (b <= e.length - 1) {
603
- const y = e[b];
604
- if (y.props.onSelect) {
605
- y == null || y.props.onSelect();
606
- return;
607
- }
608
- }
609
- const w = b - e.length, d = o[w];
610
- g({ option: l[d] });
611
- break;
612
- }
613
- case "Backspace":
614
- if (!c) {
615
- const w = Object.keys(i).pop();
616
- w && g({
617
- option: i[w],
618
- remove: !0
619
- });
620
- break;
621
- }
622
- if (r === "" && c) {
623
- const w = Object.keys(i).pop();
624
- w && g({
625
- option: i[w],
626
- remove: !0
627
- });
628
- }
629
- break;
630
- }
631
- }, 20);
632
- }, En = ({ listRef: t }) => {
633
- const [n, e] = U(!1), { activeIndex: o } = Se(), r = _e(), { refs: i, floatingStyles: c, context: a } = Rt({
634
- open: n,
635
- onOpenChange: (x) => {
636
- x || r == null || r({ type: "SET_ACTIVE_INDEX", payload: 0 }), Jt(() => {
637
- i.floating.current && !x && (i.floating.current.scrollTop = 0), setTimeout(() => {
638
- e(x);
639
- }, 1);
640
- });
641
- },
642
- whileElementsMounted: (x, w, d) => (Ve(x, w, d), () => {
643
- w.scrollTop = 0;
644
- }),
645
- middleware: [
646
- $t({ padding: 10 }),
647
- Bt({
648
- apply({ rects: x, elements: w }) {
649
- requestAnimationFrame(() => {
650
- Object.assign(w.floating.style, {
651
- width: `${x.reference.width}px`,
652
- maxHeight: "200px"
653
- });
654
- });
655
- }
656
- }),
657
- jt(10)
658
- ]
659
- }), l = Lt(a, { role: "listbox" }), u = Ft(a), g = zt(a, {
660
- listRef: t,
661
- activeIndex: o,
662
- virtual: !0,
663
- scrollItemIntoView: !0,
664
- enabled: n,
665
- focusItemOnHover: !0,
666
- onNavigate: (x) => {
667
- r == null || r({ type: "SET_ACTIVE_INDEX", payload: x || 0 });
668
- }
669
- }), { getReferenceProps: b, getFloatingProps: f, getItemProps: h } = At([l, u, g]);
670
- return {
671
- open: n,
672
- setOpen: e,
673
- activeIndex: o,
674
- refs: i,
675
- floatingStyles: c,
676
- context: a,
677
- getReferenceProps: b,
678
- getFloatingProps: f,
679
- getItemProps: h
680
- };
681
- }, Pn = v(({ value: t, initialValue: n = [], onValueChange: e, label: o, hideLabel: r = !1, description: i, multiple: c = !1, disabled: a = !1, readOnly: l = !1, hideChips: u = !1, clearButtonLabel: g = "Fjern alt", hideClearButton: b = !1, error: f, errorId: h, id: x, name: w, portal: d = !0, htmlSize: y = 0, virtual: m = !1, children: p, style: C, size: O = "md", loading: _, loadingLabel: L = "Laster...", filter: $, chipSrLabel: z = (S) => "Slett " + S.label, className: K, ...B }, Y) => {
682
- const S = j(null), Q = j(null), P = j([]), [A, V] = U(B.inputValue || "");
683
- F(() => {
684
- typeof B.inputValue == "string" && V(B.inputValue);
685
- }, [B.inputValue]);
686
- const { selectedOptions: Z, options: q, restChildren: lt, interactiveChildren: dt, customIds: ut, filteredOptionsChildren: he, filteredOptions: ze, setSelectedOptions: ee } = Sn({
687
- children: p,
688
- inputValue: A,
689
- filter: $,
690
- multiple: c,
691
- initialValue: n
692
- }), { open: ge, setOpen: ye, refs: ie, floatingStyles: mt, context: Ae, getReferenceProps: ft, getFloatingProps: bt, getItemProps: pt } = En({
693
- listRef: P
694
- }), te = In({
695
- disabled: a,
696
- error: f,
697
- errorId: h,
698
- size: O,
699
- description: i,
700
- id: x
701
- }, "combobox");
702
- F(() => {
703
- if (t && t.length > 0 && !c) {
704
- const N = q[R(t[0])];
705
- S.current && ae(S.current, (N == null ? void 0 : N.label) || "");
706
- }
707
- }, [c, t, q]), F(() => {
708
- if (t && Object.keys(q).length >= 0) {
709
- const N = t.map((k) => q[R(k)]);
710
- ee(N.reduce((k, ne) => (k[R(ne.value)] = ne, k), {}));
711
- }
712
- }, [c, t, q, ee]);
713
- const xe = Le((N) => {
714
- var $e, Be;
715
- const { option: k, clear: ne, remove: gt } = N;
716
- if (ne) {
717
- ee({}), S.current && ae(S.current, ""), e == null || e([]);
718
- return;
719
- }
720
- if (!k)
721
- return;
722
- if (gt) {
723
- const M = { ...Z };
724
- delete M[R(k.value)], ee(M), e == null || e(Object.keys(M).map((se) => Ie(se)));
725
- return;
726
- }
727
- const H = { ...Z };
728
- if (c)
729
- H[R(k.value)] ? delete H[R(k.value)] : H[R(k.value)] = k, S.current && ae(S.current, ""), ($e = S.current) == null || $e.focus();
730
- else {
731
- for (const M of Object.keys(H))
732
- delete H[M];
733
- H[R(k.value)] = k, S.current && ae(S.current, (k == null ? void 0 : k.label) || ""), setTimeout(() => {
734
- var M, se, je;
735
- (je = S.current) == null || je.setSelectionRange(((M = k == null ? void 0 : k.label) == null ? void 0 : M.length) || 0, ((se = k == null ? void 0 : k.label) == null ? void 0 : se.length) || 0);
736
- }, 0);
737
- }
738
- ee(H), e == null || e(Object.keys(H).map((M) => Ie(M))), !c && ye(!1), (Be = ie.domReference.current) == null || Be.focus();
739
- }, 50), ht = Tn({
740
- filteredOptions: ze,
741
- selectedOptions: Z,
742
- readOnly: te.readOnly || !1,
743
- disabled: a,
744
- multiple: c,
745
- inputValue: A,
746
- options: q,
747
- open: ge,
748
- interactiveChildren: dt,
749
- setOpen: ye,
750
- handleSelectOption: xe
751
- }), Ce = qt({
752
- count: Object.keys(he).length,
753
- getScrollElement: () => m ? ie.floating.current : null,
754
- estimateSize: () => 70,
755
- measureElement: (N) => N.getBoundingClientRect().height,
756
- overscan: 7
757
- });
758
- return T(W.Provider, { value: {
759
- size: O,
760
- options: q,
761
- selectedOptions: Z,
762
- multiple: c,
763
- disabled: a,
764
- readOnly: l,
765
- open: ge,
766
- inputRef: S,
767
- refs: ie,
768
- inputValue: A,
769
- formFieldProps: te,
770
- htmlSize: y,
771
- clearButtonLabel: g,
772
- customIds: ut,
773
- filteredOptions: ze,
774
- setInputValue: V,
775
- setOpen: ye,
776
- getReferenceProps: ft,
777
- getItemProps: pt,
778
- /* Recieves the value of the option, and searches for it in our values lookup */
779
- onOptionClick: (N) => {
780
- if (l || a)
781
- return;
782
- const k = q[R(N)];
783
- xe({ option: k });
784
- },
785
- handleSelectOption: xe,
786
- chipSrLabel: z,
787
- listRef: P,
788
- forwareddRef: Y,
789
- setListRef: (N, k) => {
790
- P.current[N] = k;
791
- }
792
- }, children: [T("div", { className: I("ds-combobox", `ds-combobox--${O}`, a && "ds-combobox__disabled", K), style: C, ref: Q, children: [w && s(rt, { name: w, selectedOptions: Z, multiple: c }), s(ot, { label: o, description: i, size: O, readOnly: l, hideLabel: r, formFieldProps: te }), s(nt, { ...le(["inputValue"], B), hideClearButton: b, listId: Ae.floatingId || "", error: f, hideChips: u, handleKeyDown: ht, "aria-busy": _ }), s(Ze, { size: O, error: f, formFieldProps: te })] }), ge && s(Kt, { root: d ? null : Q, children: s(Vt, { context: Ae, initialFocus: -1, visuallyHiddenDismiss: !0, children: T("div", { "aria-labelledby": te.inputProps.id, "aria-autocomplete": "list", tabIndex: -1, ...bt({
793
- ref: ie.setFloating,
794
- style: {
795
- ...mt
796
- }
797
- }), className: I("ds-combobox__options-wrapper", `ds-combobox--${O}`), children: [m && s("div", { style: {
798
- height: `${Ce.getTotalSize()}px`,
799
- width: "100%",
800
- position: "relative"
801
- }, children: Ce.getVirtualItems().map((N) => s("div", { ref: Ce.measureElement, "data-index": N.index, style: {
802
- position: "absolute",
803
- top: 0,
804
- left: 0,
805
- width: "100%",
806
- transform: `translateY(${N.start}px)`
807
- }, children: he[N.index] }, N.index)) }), _ ? T(Ut, { className: "ds-combobox__loading", children: [s(It, { "aria-label": "Laster", "data-size": "sm" }), L] }) : T(de, { children: [lt, !m && he] })] }) }) })] });
808
- }), at = v((t, n) => s(Mt, { children: s(Pn, { ...t, ref: n }) }));
809
- at.displayName = "Combobox";
810
- const ct = v(({ children: t, className: n, ...e }, o) => {
811
- const r = D(W);
812
- if (!r)
813
- throw new Error("ComboboxEmpty must be used within a Combobox");
814
- const { filteredOptions: i, size: c } = r;
815
- return i.length === 0 && s(X, { "data-size": c, asChild: !0, children: s("div", { ref: o, className: I("ds-combobox__empty", n), ...e, children: t }) });
816
- });
817
- ct.displayName = "ComboboxEmpty";
818
- const pe = at;
819
- pe.Option = Fe;
820
- pe.Empty = ct;
821
- pe.Option.displayName = "Combobox.Option";
822
- pe.Empty.displayName = "Combobox.Empty";
823
- const Dn = (t, n, e) => {
824
- const o = (e - 1) / 2, r = Math.min(Math.max(t - Math.floor(o), 1), n - e + 1), i = Math.min(Math.max(t + Math.ceil(o), e), n), c = Array.from({ length: i + 1 - r }, (a, l) => l + r);
825
- return e > 4 && r > 1 && c.splice(0, 2, 1, 0), e > 3 && i < n && c.splice(-2, 2, 0, n), c;
826
- }, io = ({ currentPage: t = 1, setCurrentPage: n, onChange: e, totalPages: o = 1, showPages: r = 7 }) => G(() => {
827
- const i = t < o, c = t !== 1, a = (l) => (u) => {
828
- if (l < 1 || l > o)
829
- return u.preventDefault();
830
- e == null || e(u, l), u.defaultPrevented || n == null || n(l);
831
- };
832
- return {
833
- /** Number of steps */
834
- pages: Dn(t, o, r).map((l, u) => ({
835
- /**
836
- * Page number or "ellipsis" for the ellipsis item
837
- */
838
- page: l || "ellipsis",
839
- /**
840
- * Unique key for the item
841
- */
842
- itemKey: l ? `page-${l}` : `ellipsis-${u}`,
843
- // React key utility
844
- /**
845
- * Properties to spread on Pagination.Button
846
- */
847
- buttonProps: l ? {
848
- "aria-current": l === t ? "page" : void 0,
849
- onClick: a(l),
850
- variant: l === t ? "primary" : "tertiary"
851
- } : null
852
- })),
853
- /** Properties to spread on Pagination.Button used for previous naviagation */
854
- prevButtonProps: {
855
- "aria-disabled": !c,
856
- // Using aria-disabled to support all HTML elements because of potential asChild
857
- onClick: a(t - 1),
858
- variant: "tertiary"
859
- },
860
- /** Properties to spread on Pagination.Button used for next naviagation */
861
- nextButtonProps: {
862
- "aria-disabled": !i,
863
- // Using aria-disabled to support all HTML elements because of potential asChild
864
- onClick: a(t + 1),
865
- variant: "tertiary"
866
- },
867
- /** Indication if previous page action should be shown or not */
868
- hasPrev: c,
869
- /** Indication if next page action should be shown or not */
870
- hasNext: i
871
- };
872
- }, [t, o, r]);
873
- export {
874
- nn as B,
875
- no as C,
876
- Re as D,
877
- on as L,
878
- Te as P,
879
- oo as S,
880
- ro as T,
881
- fe as a,
882
- pe as b,
883
- eo as c,
884
- to as d,
885
- Je as e,
886
- Zn as f,
887
- Ee as g,
888
- io as u
889
- };