@altinn/altinn-components 0.27.1 → 0.28.1

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 (390) hide show
  1. package/dist/{Checkmark-RgzvRNxP.js → Checkmark-D17Nyv_u.js} +1 -1
  2. package/dist/{ChevronRight-DUaHaWi-.js → ChevronRight-BbelnTke.js} +1 -1
  3. package/dist/{ChevronDown-CRAwzuD3.js → ChevronUp-DR4Lz2Jb.js} +22 -3
  4. package/dist/{CircleFill-IZdiBc_K.js → CircleFill-BkDF4Wm0.js} +1 -1
  5. package/dist/{ClockDashed-PQgzLSPC.js → DialogActivityLog-BoPREh7Y.js} +25 -13
  6. package/dist/{Eye-CMPIjkcy.js → Eye-BuhFHkaK.js} +1 -1
  7. package/dist/{FieldsetLegend-Dwb3U0vQ.js → FieldsetLegend-CiZWWPgY.js} +1 -1
  8. package/dist/{Label-DjSEhgyW.js → Label-9elsbqMH.js} +1 -1
  9. package/dist/{MagnifyingGlass-DWIcpwS4.js → MagnifyingGlass-3Ln1MufI.js} +1 -1
  10. package/dist/{Paragraph-CFjOkbXa.js → Paragraph-Bm-eoPYv.js} +1 -1
  11. package/dist/{XMark-Bv1I87Ev.js → XMark-DIqxCTTQ.js} +1 -1
  12. package/dist/altinn-ds-overrides.css +15 -1
  13. package/dist/altinn-theme.css +5 -1
  14. package/dist/assets/Avatar.css +1 -1
  15. package/dist/assets/AvatarGroup.css +1 -1
  16. package/dist/assets/Byline.css +1 -1
  17. package/dist/assets/DialogListItem.css +1 -1
  18. package/dist/assets/Divider.css +1 -0
  19. package/dist/assets/Flex.css +1 -1
  20. package/dist/assets/Grid.css +1 -1
  21. package/dist/assets/HeaderButton.css +1 -1
  22. package/dist/assets/Heading.css +1 -1
  23. package/dist/assets/Icon.css +1 -1
  24. package/dist/assets/IconOrAvatar.css +1 -0
  25. package/dist/assets/ListItem.css +1 -0
  26. package/dist/assets/ListItemBase.css +1 -1
  27. package/dist/assets/ListItemHeader.css +1 -1
  28. package/dist/assets/ListItemIcon.css +1 -1
  29. package/dist/assets/ListItemLabel.css +1 -1
  30. package/dist/assets/ListItemLink.css +1 -1
  31. package/dist/assets/ListItemSelect.css +1 -1
  32. package/dist/assets/MenuItemIcon.css +1 -1
  33. package/dist/assets/MetaItemIcon.css +1 -0
  34. package/dist/assets/SearchItem.css +1 -0
  35. package/dist/assets/SettingsItem.css +1 -0
  36. package/dist/assets/TimelineBase.css +1 -1
  37. package/dist/assets/TimelineIcon.css +1 -0
  38. package/dist/components/AccessAreaList/AccessAreaList.js +2 -2
  39. package/dist/components/AccessAreaList/AccessAreaListItem.js +26 -25
  40. package/dist/components/AccessPackageList/AccessPackageList.js +3 -3
  41. package/dist/components/AccessPackageList/AccessPackageListItem.js +30 -11
  42. package/dist/components/ActivityLog/ActivityLog.js +14 -0
  43. package/dist/components/ActivityLog/ActivityLogItem.js +13 -0
  44. package/dist/components/ActivityLog/index.js +6 -0
  45. package/dist/components/Article/Article.js +11 -0
  46. package/dist/components/Article/ArticleContact.js +25 -0
  47. package/dist/components/Article/ArticleHeader.js +15 -0
  48. package/dist/components/Article/index.js +8 -0
  49. package/dist/components/Attachment/AttachmentLink.js +2 -2
  50. package/dist/components/Avatar/Avatar.js +47 -45
  51. package/dist/components/Avatar/AvatarGroup.js +26 -31
  52. package/dist/components/Avatar/index.js +6 -4
  53. package/dist/components/Bookmarks/BookmarksListItem.js +2 -2
  54. package/dist/components/Bookmarks/BookmarksSection.js +2 -2
  55. package/dist/components/Bookmarks/EditableBookmark.js +4 -4
  56. package/dist/components/Button/ButtonIcon.js +1 -1
  57. package/dist/components/Button/ComboButton.js +1 -2
  58. package/dist/components/Byline/Byline.js +18 -16
  59. package/dist/components/ContextMenu/ContextMenu.js +16 -17
  60. package/dist/components/{Page → Dashboard}/DashboardCard.js +19 -19
  61. package/dist/components/Dashboard/DashboardHeader.js +25 -0
  62. package/dist/components/Dashboard/DashboardIcon.js +26 -0
  63. package/dist/components/Dashboard/index.js +8 -0
  64. package/dist/components/Datepicker/DatepickerHeader.js +3 -3
  65. package/dist/components/Datepicker/DatepickerTable.js +1 -1
  66. package/dist/components/Dialog/Dialog.js +1 -1
  67. package/dist/components/Dialog/DialogActions.js +18 -19
  68. package/dist/components/Dialog/DialogActivity.js +10 -10
  69. package/dist/components/Dialog/DialogActivityLog.js +5 -11
  70. package/dist/components/Dialog/DialogAttachments.js +4 -4
  71. package/dist/components/Dialog/DialogBody.js +13 -13
  72. package/dist/components/Dialog/DialogByline.js +3 -3
  73. package/dist/components/Dialog/DialogContact.js +1 -1
  74. package/dist/components/Dialog/DialogHeader.js +1 -1
  75. package/dist/components/Dialog/DialogHeading.js +1 -1
  76. package/dist/components/Dialog/DialogHistory.js +1 -1
  77. package/dist/components/Dialog/DialogHistoryItem.js +10 -10
  78. package/dist/components/Dialog/DialogHistorySegment.js +2 -2
  79. package/dist/components/Dialog/DialogLayout.js +1 -1
  80. package/dist/components/Dialog/DialogList.js +1 -1
  81. package/dist/components/Dialog/DialogListGroup.js +8 -8
  82. package/dist/components/Dialog/DialogListItem.js +93 -95
  83. package/dist/components/Dialog/DialogMetadata.js +97 -63
  84. package/dist/components/Dialog/DialogSection.js +1 -1
  85. package/dist/components/Dialog/DialogSeenBy.js +4 -4
  86. package/dist/components/Dialog/DialogSelect.js +1 -1
  87. package/dist/components/Dialog/DialogStatus.js +3 -3
  88. package/dist/components/Dialog/DialogTabs.js +1 -1
  89. package/dist/components/Dialog/SeenByLog.js +10 -10
  90. package/dist/components/Dialog/index.js +7 -7
  91. package/dist/components/Divider/Divider.js +7 -0
  92. package/dist/components/Divider/index.js +4 -0
  93. package/dist/components/Dropdown/DrawerButton.js +1 -1
  94. package/dist/components/Dropdown/DrawerHeader.js +2 -2
  95. package/dist/components/Dropdown/DrawerOrDropdown.js +1 -1
  96. package/dist/components/DsComponents/index.js +4 -4
  97. package/dist/components/Forms/Checkbox.js +1 -1
  98. package/dist/components/Forms/CheckboxOptions.js +1 -1
  99. package/dist/components/Forms/Field.js +13 -4
  100. package/dist/components/Forms/FieldBase.js +1 -1
  101. package/dist/components/Forms/Fieldset.js +2 -2
  102. package/dist/components/Forms/FieldsetBase.js +1 -1
  103. package/dist/components/Forms/Label.js +1 -1
  104. package/dist/components/Forms/Legend.js +1 -1
  105. package/dist/components/Forms/Radio.js +1 -1
  106. package/dist/components/Forms/RadioOptions.js +1 -1
  107. package/dist/components/Forms/Select.js +1 -1
  108. package/dist/components/Forms/SelectField.js +1 -1
  109. package/dist/components/Forms/Switch.js +9 -9
  110. package/dist/components/Forms/SwitchOptions.js +1 -1
  111. package/dist/components/Forms/TextField.js +1 -1
  112. package/dist/components/Forms/TextareaField.js +1 -1
  113. package/dist/components/GlobalMenu/AccountButton.js +15 -17
  114. package/dist/components/GlobalMenu/AccountMenu.js +22 -24
  115. package/dist/components/GlobalMenu/BackButton.js +26 -7
  116. package/dist/components/GlobalMenu/EndUserLabel.js +30 -10
  117. package/dist/components/GlobalMenu/GlobalMenu.js +15 -15
  118. package/dist/components/GlobalMenu/GlobalMenuBase.js +7 -9
  119. package/dist/components/GlobalMenu/LogoutButton.js +1 -1
  120. package/dist/components/Header/Header.js +2 -2
  121. package/dist/components/Header/HeaderBase.js +1 -1
  122. package/dist/components/Header/HeaderButton.js +62 -43
  123. package/dist/components/Header/HeaderLogo.js +11 -12
  124. package/dist/components/Header/LocaleButton.js +16 -17
  125. package/dist/components/Header/LocaleSwitcher.js +1 -1
  126. package/dist/components/Icon/Icon.js +29 -17
  127. package/dist/components/Icon/IconOrAvatar.js +23 -15
  128. package/dist/components/Icon/index.js +11 -10
  129. package/dist/components/Layout/Layout.js +1 -1
  130. package/dist/components/LayoutAction/ActionHeader.js +2 -2
  131. package/dist/components/LayoutAction/LayoutAction.js +1 -1
  132. package/dist/components/List/List.js +7 -16
  133. package/dist/components/List/ListBase.js +5 -5
  134. package/dist/components/List/ListItem.js +55 -60
  135. package/dist/components/List/ListItemBase.js +35 -45
  136. package/dist/components/List/ListItemControls.js +6 -8
  137. package/dist/components/List/ListItemHeader.js +76 -103
  138. package/dist/components/List/ListItemIcon.js +22 -10
  139. package/dist/components/List/ListItemLabel.js +48 -21
  140. package/dist/components/List/ListItemLink.js +28 -30
  141. package/dist/components/List/ListItemSelect.js +12 -12
  142. package/dist/components/List/index.js +4 -6
  143. package/dist/components/Menu/MenuInputField.js +23 -26
  144. package/dist/components/Menu/MenuItem.js +39 -58
  145. package/dist/components/Menu/MenuItemBase.js +1 -1
  146. package/dist/components/Menu/MenuItemIcon.js +21 -21
  147. package/dist/components/Menu/MenuItems.js +1 -1
  148. package/dist/components/Menu/MenuItemsVirtual.js +8 -8
  149. package/dist/components/Menu/MenuOption.js +1 -1
  150. package/dist/components/Menu/MenuSearch.js +3 -3
  151. package/dist/components/Metadata/MetaItem.js +24 -0
  152. package/dist/components/Metadata/MetaItemIcon.js +18 -0
  153. package/dist/components/Metadata/MetaProgress.js +16 -0
  154. package/dist/components/Metadata/MetaTimestamp.js +23 -0
  155. package/dist/components/{Meta → Metadata}/Metadata.js +1 -1
  156. package/dist/components/Metadata/index.js +19 -0
  157. package/dist/components/Page/AccordionSection.js +1 -1
  158. package/dist/components/Page/Breadcrumbs.js +36 -17
  159. package/dist/components/Page/ContactButtons.js +1 -1
  160. package/dist/components/Page/ContactSection.js +1 -1
  161. package/dist/components/Page/Flex.js +37 -35
  162. package/dist/components/Page/Grid.js +5 -5
  163. package/dist/components/Page/PageDetails.js +1 -1
  164. package/dist/components/Page/PageHeader.js +30 -32
  165. package/dist/components/Page/PageMenu.js +1 -1
  166. package/dist/components/Page/PageNav.js +38 -20
  167. package/dist/components/Page/PageTabs.js +1 -1
  168. package/dist/components/Page/Section.js +1 -1
  169. package/dist/components/Page/index.js +20 -26
  170. package/dist/components/Profile/AccountList.js +4 -4
  171. package/dist/components/Profile/AccountListItem.js +47 -49
  172. package/dist/components/ResourceList/ResourceList.js +3 -3
  173. package/dist/components/ResourceList/ResourceListItem.js +6 -6
  174. package/dist/components/Search/SearchItem.js +20 -0
  175. package/dist/components/Search/index.js +2 -21
  176. package/dist/components/{Search → Searchbar}/Autocomplete.js +8 -8
  177. package/dist/components/Searchbar/AutocompleteBase.js +11 -0
  178. package/dist/components/{Search → Searchbar}/AutocompleteItem.js +28 -26
  179. package/dist/components/{Search → Searchbar}/SearchField.js +2 -2
  180. package/dist/components/Searchbar/index.js +23 -0
  181. package/dist/components/Settings/Settings.js +20 -0
  182. package/dist/components/Settings/SettingsItem.js +37 -0
  183. package/dist/components/Settings/index.js +6 -0
  184. package/dist/components/Skeleton/Skeleton.js +12 -13
  185. package/dist/components/Snackbar/SnackbarItem.js +5 -5
  186. package/dist/components/Timeline/Timeline.js +1 -1
  187. package/dist/components/Timeline/TimelineActivity.js +2 -2
  188. package/dist/components/Timeline/TimelineBase.js +20 -23
  189. package/dist/components/Timeline/TimelineFooter.js +2 -2
  190. package/dist/components/Timeline/TimelineHeader.js +13 -21
  191. package/dist/components/Timeline/TimelineIcon.js +20 -0
  192. package/dist/components/Timeline/TimelineLink.js +1 -1
  193. package/dist/components/Timeline/TimelineSection.js +1 -1
  194. package/dist/components/Timeline/TimelineSegment.js +2 -2
  195. package/dist/components/Timeline/index.js +6 -4
  196. package/dist/components/Toolbar/Toolbar.js +25 -25
  197. package/dist/components/Toolbar/ToolbarAccountMenu.js +1 -1
  198. package/dist/components/Toolbar/ToolbarAdd.js +1 -1
  199. package/dist/components/Toolbar/ToolbarButton.js +76 -59
  200. package/dist/components/Toolbar/ToolbarDaterange.js +1 -1
  201. package/dist/components/Toolbar/ToolbarFilter.js +1 -1
  202. package/dist/components/Toolbar/ToolbarMenu.js +1 -1
  203. package/dist/components/Toolbar/ToolbarOptions.js +1 -1
  204. package/dist/components/Toolbar/ToolbarSearch.js +3 -3
  205. package/dist/components/Transmission/Transmission.js +45 -43
  206. package/dist/components/Transmission/TransmissionList.js +9 -9
  207. package/dist/components/Typography/Heading.js +28 -22
  208. package/dist/components/Typography/Typography.js +14 -14
  209. package/dist/components/index.js +410 -389
  210. package/dist/{index-Bq6w9CqA.js → index-CnWc2FNH.js} +6 -6
  211. package/dist/{index-DyDqjche.js → index-D-VWMqlv.js} +129 -123
  212. package/dist/{index-B7UjMwQm.js → index-D3Rt9ate.js} +17 -17
  213. package/dist/index-D8Pn8SCu.js +78 -0
  214. package/dist/index.js +416 -395
  215. package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.d.ts +1 -1
  216. package/dist/types/lib/components/AccessPackageList/AccessPackageList.d.ts +2 -2
  217. package/dist/types/lib/components/AccessPackageList/AccessPackageListItem.d.ts +1 -1
  218. package/dist/types/lib/components/ActivityLog/ActivityLog.d.ts +5 -0
  219. package/dist/types/lib/components/ActivityLog/ActivityLog.stories.d.ts +8 -0
  220. package/dist/types/lib/components/ActivityLog/ActivityLogItem.d.ts +8 -0
  221. package/dist/types/lib/components/ActivityLog/index.d.ts +2 -0
  222. package/dist/types/lib/components/Article/Article.d.ts +7 -0
  223. package/dist/types/lib/components/Article/Article.stories.d.ts +19 -0
  224. package/dist/types/lib/components/Article/ArticleContact.d.ts +12 -0
  225. package/dist/types/lib/components/{Profile/AccountList.stories.d.ts → Article/ArticleContact.stories.d.ts} +3 -2
  226. package/dist/types/lib/components/Article/ArticleHeader.d.ts +7 -0
  227. package/dist/types/lib/components/{Page → Article}/ArticleHeader.stories.d.ts +2 -2
  228. package/dist/types/lib/components/Article/index.d.ts +3 -0
  229. package/dist/types/lib/components/Avatar/Avatar.d.ts +5 -2
  230. package/dist/types/lib/components/Avatar/AvatarGroup.d.ts +5 -1
  231. package/dist/types/lib/components/Avatar/AvatarGroup.stories.d.ts +7 -3
  232. package/dist/types/lib/components/Avatar/Examples.stories.d.ts +1 -1
  233. package/dist/types/lib/components/Avatar/avatar.stories.d.ts +10 -2
  234. package/dist/types/lib/components/Button/ComboButton.stories.d.ts +10 -0
  235. package/dist/types/lib/components/Button/IconButton.stories.d.ts +7 -0
  236. package/dist/types/lib/components/ContextMenu/ContextMenu.stories.d.ts +7 -0
  237. package/dist/types/lib/components/{Page → Dashboard}/DashboardCard.d.ts +2 -2
  238. package/dist/types/lib/components/Dashboard/DashboardIcon.d.ts +10 -0
  239. package/dist/types/lib/components/Dashboard/index.d.ts +3 -0
  240. package/dist/types/lib/components/Dialog/DialogActivity.d.ts +1 -1
  241. package/dist/types/lib/components/Dialog/DialogActivityLog.d.ts +1 -1
  242. package/dist/types/lib/components/Dialog/DialogAttachments.stories.d.ts +1 -1
  243. package/dist/types/lib/components/Dialog/DialogHistorySegment.d.ts +1 -2
  244. package/dist/types/lib/components/Dialog/DialogList.d.ts +1 -1
  245. package/dist/types/lib/components/Dialog/DialogListItem.d.ts +3 -5
  246. package/dist/types/lib/components/Dialog/DialogSeenBy.d.ts +1 -1
  247. package/dist/types/lib/components/Dialog/DialogStatus.d.ts +1 -1
  248. package/dist/types/lib/components/Divider/Divider.d.ts +8 -0
  249. package/dist/types/lib/components/Divider/index.d.ts +1 -0
  250. package/dist/types/lib/components/Forms/Field.d.ts +3 -2
  251. package/dist/types/lib/components/Forms/Switch.d.ts +2 -1
  252. package/dist/types/lib/components/Forms/Switch.stories.d.ts +1 -1
  253. package/dist/types/lib/components/Header/Header.d.ts +1 -1
  254. package/dist/types/lib/components/Icon/Icon.d.ts +6 -1
  255. package/dist/types/lib/components/Icon/Icon.stories.d.ts +3 -1
  256. package/dist/types/lib/components/Icon/IconOrAvatar.d.ts +2 -1
  257. package/dist/types/lib/components/LayoutAction/LayoutAction.stories.d.ts +5 -0
  258. package/dist/types/lib/components/List/List.d.ts +10 -6
  259. package/dist/types/lib/components/List/List.stories.d.ts +6 -12
  260. package/dist/types/lib/components/List/ListBase.d.ts +6 -5
  261. package/dist/types/lib/components/List/ListItem.d.ts +14 -18
  262. package/dist/types/lib/components/List/ListItem.stories.d.ts +6 -4
  263. package/dist/types/lib/components/List/ListItemBase.d.ts +8 -12
  264. package/dist/types/lib/components/List/ListItemHeader.d.ts +6 -14
  265. package/dist/types/lib/components/List/ListItemIcon.d.ts +7 -4
  266. package/dist/types/lib/components/List/ListItemLabel.d.ts +6 -6
  267. package/dist/types/lib/components/List/ListItemLink.d.ts +1 -3
  268. package/dist/types/lib/components/List/ListItemSelect.d.ts +4 -10
  269. package/dist/types/lib/components/List/Specimens.stories.d.ts +6 -3
  270. package/dist/types/lib/components/List/index.d.ts +0 -1
  271. package/dist/types/lib/components/Menu/MenuItem.d.ts +5 -5
  272. package/dist/types/lib/components/Menu/MenuItemBase.d.ts +1 -1
  273. package/dist/types/lib/components/Menu/MenuItemIcon.d.ts +9 -7
  274. package/dist/types/lib/components/{Meta → Metadata}/MetaItem.d.ts +1 -1
  275. package/dist/types/lib/components/{Meta/MetaItemMedia.d.ts → Metadata/MetaItemIcon.d.ts} +2 -2
  276. package/dist/types/lib/components/{Meta → Metadata}/MetaProgress.d.ts +1 -1
  277. package/dist/types/lib/components/{Meta → Metadata}/MetaTimestamp.d.ts +1 -1
  278. package/dist/types/lib/components/Metadata/Metadata.stories.d.ts +7 -0
  279. package/dist/types/lib/components/{Meta → Metadata}/index.d.ts +1 -1
  280. package/dist/types/lib/components/Page/ContactSection.stories.d.ts +7 -0
  281. package/dist/types/lib/components/Page/Flex.d.ts +3 -1
  282. package/dist/types/lib/components/Page/Grid.d.ts +1 -1
  283. package/dist/types/lib/components/Page/PageHeader.d.ts +1 -1
  284. package/dist/types/lib/components/Page/PageHeader.stories.d.ts +1 -1
  285. package/dist/types/lib/components/Page/PageMenu.stories.d.ts +7 -0
  286. package/dist/types/lib/components/Page/index.d.ts +0 -3
  287. package/dist/types/lib/components/Profile/AccountListItem.d.ts +2 -1
  288. package/dist/types/lib/components/Profile/AccountListItem.stories.d.ts +57 -0
  289. package/dist/types/lib/components/ResourceList/ResourceList.d.ts +2 -2
  290. package/dist/types/lib/components/ResourceList/ResourceList.stories.d.ts +10 -3
  291. package/dist/types/lib/components/Search/SearchItem.d.ts +14 -0
  292. package/dist/types/lib/components/Search/index.d.ts +1 -10
  293. package/dist/types/lib/components/{Search → Searchbar}/Autocomplete.d.ts +1 -1
  294. package/dist/types/lib/components/{Search → Searchbar}/Searchbar.stories.d.ts +0 -1
  295. package/dist/types/lib/components/Searchbar/index.d.ts +10 -0
  296. package/dist/types/lib/components/Settings/Settings.d.ts +9 -0
  297. package/dist/types/lib/components/Settings/Settings.stories.d.ts +14 -0
  298. package/dist/types/lib/components/Settings/SettingsItem.d.ts +12 -0
  299. package/dist/types/lib/components/Settings/SettingsItem.stories.d.ts +51 -0
  300. package/dist/types/lib/components/Settings/index.d.ts +2 -0
  301. package/dist/types/lib/components/Timeline/TimelineActivity.stories.d.ts +0 -1
  302. package/dist/types/lib/components/Timeline/TimelineBase.d.ts +5 -5
  303. package/dist/types/lib/components/Timeline/TimelineHeader.d.ts +3 -5
  304. package/dist/types/lib/components/Timeline/TimelineHeader.stories.d.ts +2 -2
  305. package/dist/types/lib/components/Timeline/TimelineIcon.d.ts +11 -0
  306. package/dist/types/lib/components/Timeline/TimelineSegment.d.ts +2 -2
  307. package/dist/types/lib/components/Timeline/index.d.ts +1 -0
  308. package/dist/types/lib/components/Transmission/Transmission.d.ts +1 -1
  309. package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +6 -9
  310. package/dist/types/lib/components/Typography/Heading.d.ts +9 -5
  311. package/dist/types/lib/components/Typography/Heading.stories.d.ts +1 -1
  312. package/dist/types/lib/components/Typography/Typography.d.ts +3 -3
  313. package/dist/types/lib/components/Typography/Typography.stories.d.ts +1 -1
  314. package/dist/types/lib/components/index.d.ts +7 -1
  315. package/dist/types/lib/stories/Admin/Settings.stories.d.ts +10 -0
  316. package/dist/types/lib/stories/Admin.stories.d.ts +18 -0
  317. package/dist/types/lib/stories/Inbox.stories.d.ts +20 -0
  318. package/dist/types/lib/stories/Portal.stories.d.ts +14 -0
  319. package/dist/types/lib/stories/Profile/Accounts.stories.d.ts +19 -0
  320. package/dist/types/lib/stories/Profile/Settings.stories.d.ts +16 -0
  321. package/dist/types/lib/stories/Profile.stories.d.ts +16 -0
  322. package/dist/types/lib/types/color.d.ts +2 -2
  323. package/dist/useId-BVFxCjkq.js +16 -0
  324. package/dist/useMergeRefs-DOnoWyUH.js +29 -0
  325. package/dist/usePagination-D247OF6_.js +3838 -0
  326. package/package.json +33 -33
  327. package/dist/ArrowLeft-C91mClJx.js +0 -25
  328. package/dist/ArrowRedo-BYz1MHxK.js +0 -25
  329. package/dist/ArrowRight-OLgmLkGy.js +0 -25
  330. package/dist/Bookmark-85oKfr9m.js +0 -25
  331. package/dist/Buildings2-DO6ftvL7.js +0 -25
  332. package/dist/ChevronUp-H8Nuww4h.js +0 -25
  333. package/dist/DocPencil-CVby07uu.js +0 -25
  334. package/dist/Handshake-Bz9FuL-x.js +0 -25
  335. package/dist/Inbox-z7qqLz8Y.js +0 -25
  336. package/dist/Package-ASRzCHA7.js +0 -25
  337. package/dist/PadlockLocked-xJsxvaHH.js +0 -25
  338. package/dist/PersonCircle-DMwECpgW.js +0 -25
  339. package/dist/Plus-B6MBOAcH.js +0 -25
  340. package/dist/Trash-DMlYh49i.js +0 -44
  341. package/dist/assets/MetaItemMedia.css +0 -1
  342. package/dist/assets/NotificationsItem.css +0 -1
  343. package/dist/companyAccess-DVKbpCnw.js +0 -626
  344. package/dist/components/Meta/MetaItem.js +0 -19
  345. package/dist/components/Meta/MetaItemMedia.js +0 -17
  346. package/dist/components/Meta/MetaProgress.js +0 -11
  347. package/dist/components/Meta/MetaTimestamp.js +0 -18
  348. package/dist/components/Meta/index.js +0 -19
  349. package/dist/components/Page/ArticleHeader.js +0 -16
  350. package/dist/components/Page/DashboardHeader.js +0 -25
  351. package/dist/components/Search/AutocompleteBase.js +0 -11
  352. package/dist/floating-ui.react-DpzNAs2N.js +0 -2835
  353. package/dist/globalMenu-CtokaeGw.js +0 -124
  354. package/dist/index-C8BS_2GY.js +0 -64
  355. package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.stories.d.ts +0 -40
  356. package/dist/types/lib/components/List/ListBase.stories.d.ts +0 -12
  357. package/dist/types/lib/components/List/MultilevelList.stories.d.ts +0 -5
  358. package/dist/types/lib/components/List/Patterns.stories.d.ts +0 -8
  359. package/dist/types/lib/components/Page/ArticleHeader.d.ts +0 -8
  360. package/dist/types/lib/components/Page/Examples.stories.d.ts +0 -27
  361. package/dist/useId-CsCRkvK3.js +0 -16
  362. package/dist/usePagination-B4GfH2GQ.js +0 -1026
  363. /package/dist/components/{Meta → Metadata}/MetaBase.js +0 -0
  364. /package/dist/components/{Meta → Metadata}/MetaItemBase.js +0 -0
  365. /package/dist/components/{Meta → Metadata}/MetaItemLabel.js +0 -0
  366. /package/dist/components/{Search → Searchbar}/AutocompleteGroup.js +0 -0
  367. /package/dist/components/{Search → Searchbar}/QueryLabel.js +0 -0
  368. /package/dist/components/{Search → Searchbar}/ScopeListItem.js +0 -0
  369. /package/dist/components/{Search → Searchbar}/Searchbar.js +0 -0
  370. /package/dist/components/{Search → Searchbar}/SearchbarBase.js +0 -0
  371. /package/dist/components/{Search → Searchbar}/SuggestListItem.js +0 -0
  372. /package/dist/types/lib/components/{Page → Dashboard}/DashboardHeader.d.ts +0 -0
  373. /package/dist/types/lib/components/{Page → Dashboard}/DashboardHeader.stories.d.ts +0 -0
  374. /package/dist/types/lib/components/{Meta → Metadata}/MetaBase.d.ts +0 -0
  375. /package/dist/types/lib/components/{Meta → Metadata}/MetaItem.stories.d.ts +0 -0
  376. /package/dist/types/lib/components/{Meta → Metadata}/MetaItemBase.d.ts +0 -0
  377. /package/dist/types/lib/components/{Meta → Metadata}/MetaItemLabel.d.ts +0 -0
  378. /package/dist/types/lib/components/{Meta → Metadata}/MetaProgress.stories.d.ts +0 -0
  379. /package/dist/types/lib/components/{Meta → Metadata}/MetaTimestamp.stories.d.ts +0 -0
  380. /package/dist/types/lib/components/{Meta → Metadata}/Metadata.d.ts +0 -0
  381. /package/dist/types/lib/components/{Search → Searchbar}/Autocomplete.stories.d.ts +0 -0
  382. /package/dist/types/lib/components/{Search → Searchbar}/AutocompleteBase.d.ts +0 -0
  383. /package/dist/types/lib/components/{Search → Searchbar}/AutocompleteGroup.d.ts +0 -0
  384. /package/dist/types/lib/components/{Search → Searchbar}/AutocompleteItem.d.ts +0 -0
  385. /package/dist/types/lib/components/{Search → Searchbar}/QueryLabel.d.ts +0 -0
  386. /package/dist/types/lib/components/{Search → Searchbar}/ScopeListItem.d.ts +0 -0
  387. /package/dist/types/lib/components/{Search → Searchbar}/SearchField.d.ts +0 -0
  388. /package/dist/types/lib/components/{Search → Searchbar}/Searchbar.d.ts +0 -0
  389. /package/dist/types/lib/components/{Search → Searchbar}/SearchbarBase.d.ts +0 -0
  390. /package/dist/types/lib/components/{Search → Searchbar}/SuggestListItem.d.ts +0 -0
@@ -1,1026 +0,0 @@
1
- "use client";
2
- import { jsxs as O, jsx as a, Fragment as me } from "react/jsx-runtime";
3
- import { c as I } from "./lite-1fxw3LjI.js";
4
- import * as we from "react";
5
- import { forwardRef as b, useLayoutEffect as Ot, useEffect as L, useRef as z, createContext as Y, useState as X, useContext as E, useId as ee, version as St, useReducer as _t, useMemo as Q, isValidElement as Ue, memo as Et, useCallback as Tt, Children as Ke } from "react";
6
- import { a as Xe, S } from "./index-C8BS_2GY.js";
7
- import { u as V, a as qe, c as Pt, o as Rt, f as Dt, s as Lt, b as At, d as Bt, e as Ft, g as zt, h as $t, i as jt, j as Mt, k as Vt, F as Kt, l as Ht } from "./floating-ui.react-DpzNAs2N.js";
8
- import { F as ue, V as _e, a as Ut, b as Xt, c as He } from "./index-Bq6w9CqA.js";
9
- import { I as ce } from "./Input-B_w6SBmg.js";
10
- import { L as U } from "./Label-DjSEhgyW.js";
11
- import { T as qt } from "./Textarea-BBstVlPT.js";
12
- import { u as Wt } from "./index-DyDqjche.js";
13
- import { S as Yt } from "./XMark-Bv1I87Ev.js";
14
- import { P as Ne } from "./Paragraph-CFjOkbXa.js";
15
- import { S as Gt } from "./ChevronUp-H8Nuww4h.js";
16
- import { S as Jt } from "./ChevronDown-CRAwzuD3.js";
17
- import { u as Qt } from "./useId-CsCRkvK3.js";
18
- import { S as Zt } from "./Checkmark-RgzvRNxP.js";
19
- import { flushSync as en } from "react-dom";
20
- var tn = function(t, n) {
21
- var e = {};
22
- for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && n.indexOf(o) < 0 && (e[o] = t[o]);
23
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
24
- for (var r = 0, o = Object.getOwnPropertySymbols(t); r < o.length; r++)
25
- n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[r]) && (e[o[r]] = t[o[r]]);
26
- return e;
27
- };
28
- const nn = b((t, n) => {
29
- var { title: e, titleId: o } = t, r = tn(t, ["title", "titleId"]);
30
- let i = Qt();
31
- return i = e ? o || "title-" + i : void 0, we.createElement(
32
- "svg",
33
- 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),
34
- e ? we.createElement("title", { id: i }, e) : null,
35
- we.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" })
36
- );
37
- }), on = typeof window < "u" ? Ot : L;
38
- function Oe(t) {
39
- const n = z(null);
40
- return on(() => {
41
- const e = document.getAnimations().filter((i) => "animationName" in i && i.animationName === t), o = e.find((i) => "animationName" in i && i.animationName === t), r = e.find((i) => {
42
- var s;
43
- return ((s = i.effect) == null ? void 0 : s.target) === n.current;
44
- });
45
- return r && r === o && (r.currentTime = 0), r && (o != null && o.currentTime) && r !== o && (r.currentTime = o.currentTime), () => {
46
- r && (o != null && o.currentTime) && (r.currentTime = o.currentTime);
47
- };
48
- }, [t]), n;
49
- }
50
- const We = b(function({ "aria-label": n, className: e, ...o }, r) {
51
- const i = Oe("ds-spinner-rotate-animation"), s = Oe("ds-spinner-stroke-animation"), c = V([i, r]);
52
- return O("svg", { "aria-label": n, className: I("ds-spinner", e), ref: c, role: "img", viewBox: "0 0 50 50", ...o, children: [a("circle", { className: I("ds-spinner__background"), cx: "25", cy: "25", r: "20", fill: "none", strokeWidth: "5" }), a("circle", { className: I("ds-spinner__circle"), cx: "25", cy: "25", r: "20", fill: "none", strokeWidth: "5", ref: s })] });
53
- }), te = b(function({ asChild: n, className: e, children: o, icon: r = !1, loading: i = !1, variant: s = "primary", ...c }, l) {
54
- return O(n ? S : "button", {
55
- "aria-busy": !!i || void 0,
56
- "aria-disabled": !!i || void 0,
57
- className: I("ds-button", e),
58
- "data-icon": r || void 0,
59
- "data-variant": s,
60
- ref: l,
61
- /* don't set type when we use `asChild` */
62
- type: n ? void 0 : "button",
63
- ...c,
64
- children: [i === !0 ? a(We, { "aria-hidden": "true" }) : i, a(Xe, { children: o })]
65
- });
66
- }), rn = b(function({ className: n, count: e, maxCount: o, variant: r = "base", ...i }, s) {
67
- return a("span", { className: I("ds-badge", n), "data-count": e && o && e > o ? `${o}+` : e, "data-variant": r, ref: s, ...i });
68
- }), sn = b(function({ className: n, overlap: e = "rectangle", placement: o = "top-right", ...r }, i) {
69
- return a("span", { className: I("ds-badge--position", n), "data-overlap": e, "data-placement": o, ref: i, ...r });
70
- }), an = Object.assign(rn, { Position: sn });
71
- an.Position.displayName = "Badge.Position";
72
- const cn = b(({ asChild: t, className: n, ...e }, o) => a(t ? S : "a", { className: I("ds-link", n), ref: o, ...e }));
73
- cn.displayName = "Link";
74
- const lo = b(function({ asChild: n, className: e, height: o, style: r, variant: i = "rectangle", width: s, ...c }, l) {
75
- const u = n ? S : "span", h = i === "text", f = Oe("ds-skeleton-opacity-fade"), m = V([f, l]);
76
- return a(u, { "aria-hidden": "true", className: I("ds-skeleton", e), "data-text": h ? "-".repeat(Number(s) || 1) : void 0, "data-variant": i, ref: m, style: h ? r : { width: s, height: o, ...r }, ...c });
77
- }), uo = b(function({ asChild: n, ...e }, o) {
78
- return a(n ? S : "li", { ...e, ref: o });
79
- }), Ye = (t, { asChild: n, className: e, ...o }, r) => a(n ? S : t, { className: I("ds-list", e), ref: r, ...o }), mo = b(function(n, e) {
80
- return Ye("ul", n, e);
81
- });
82
- b(function(n, e) {
83
- return Ye("ol", n, e);
84
- });
85
- const fo = b(function({ level: n = 2, className: e, asChild: o, ...r }, i) {
86
- const s = o ? S : `h${n}`;
87
- return a(s, { className: I("ds-heading", e), ref: i, ...r });
88
- }), po = b(function({ "data-color": n = "info", className: e, ...o }, r) {
89
- return a("div", { className: I("ds-alert", e), "data-color": n, ref: r, ...o });
90
- }), Ge = b(function({ asChild: n, className: e, ...o }, r) {
91
- return a(n ? S : "button", { className: I("ds-chip", e), type: n ? void 0 : "button", ref: r, ...o });
92
- }), Je = b(function(n, e) {
93
- return a(Ge, { "data-removable": !0, ref: e, ...n });
94
- }), Qe = b(function({ asChild: n, children: e, className: o, "data-size": r, "data-color": i, ...s }, c) {
95
- const l = s.type ?? "checkbox";
96
- return O(n ? S : "label", { className: I("ds-chip", o), "data-size": r, "data-color": i, ref: c, children: [a(ce, { ...s, type: l }), a(Xe, { children: e })] });
97
- }), ln = b(function(n, e) {
98
- return a(Qe, { ref: e, type: "radio", ...n });
99
- }), fe = {
100
- Button: Ge,
101
- Checkbox: Qe,
102
- Radio: ln,
103
- Removable: Je
104
- };
105
- fe.Button.displayName = "Chip.Button";
106
- fe.Checkbox.displayName = "Chip.Checkbox";
107
- fe.Radio.displayName = "Chip.Radio";
108
- fe.Removable.displayName = "Chip.Removable";
109
- const dn = b(function({ "aria-label": n = "Sidenavigering", asChild: e, className: o, ...r }, i) {
110
- return a(e ? S : "nav", { "aria-label": n, className: I("ds-pagination", o), ref: i, ...r });
111
- }), un = b(function(n, e) {
112
- return a(te, { ref: e, ...n });
113
- }), mn = b(function({ asChild: n, className: e, ...o }, r) {
114
- return a(n ? S : "li", { ref: r, ...o });
115
- }), fn = b(function({ asChild: n, ...e }, o) {
116
- return a(n ? S : "ul", { ref: o, ...e });
117
- }), Ee = Object.assign(dn, {
118
- List: fn,
119
- Item: mn,
120
- Button: un
121
- });
122
- Ee.List.displayName = "Pagination.List";
123
- Ee.Item.displayName = "Pagination.Item";
124
- Ee.Button.displayName = "Pagination.Button";
125
- const bo = b(function({ "data-size": n, className: e, style: o, children: r, label: i, description: s, error: c, ...l }, u) {
126
- return O(ue, { "data-size": n, className: e, style: o, children: [a(ce, { type: "checkbox", ref: u, ...l }), !!i && a(U, { weight: "regular", children: i }), !!s && a("div", { "data-field": "description", children: s }), !!c && a(_e, { children: c })] });
127
- }), ho = b(function({ "data-size": n, children: e, className: o, description: r, label: i, position: s, style: c, ...l }, u) {
128
- return O(ue, { className: o, "data-position": s, "data-size": n, style: c, children: [a(ce, { type: "checkbox", role: "switch", ref: u, ...l }), !!i && a(U, { weight: "regular", children: i }), !!r && a("div", { "data-field": "description", children: r })] });
129
- }), go = b(function({ label: n, description: e, error: o, multiline: r, prefix: i, suffix: s, "data-size": c, counter: l, style: u, className: h, ...f }, m) {
130
- return O(ue, { className: h, "data-size": c, style: u, children: [!!n && a(U, { children: n }), !!e && a(Ut, { children: e }), O(Xt, { children: [i === void 0 || a(He, { children: i }), r === !0 ? a(qt, { ref: m, "aria-invalid": !!o || void 0, ...f }) : a(ce, { ref: m, "aria-invalid": !!o || void 0, ...f }), s === void 0 || a(He, { children: s })] }), !!o && a(_e, { children: o }), !!l && a(ue.Counter, { ...typeof l == "number" ? { limit: l } : l })] });
131
- }), pe = Y({}), pn = b(function({ value: n, defaultValue: e, className: o, onChange: r, ...i }, s) {
132
- const c = n !== void 0, [l, u] = X(e);
133
- let h = r;
134
- return c || (h = (f) => {
135
- u(f), r == null || r(f);
136
- }, n = l), a(pe.Provider, { value: {
137
- value: n,
138
- defaultValue: e,
139
- onChange: h
140
- }, children: a("div", { className: I("ds-tabs", o), ref: s, ...i }) });
141
- }), Ze = Y({
142
- elements: { current: /* @__PURE__ */ new Map() },
143
- getOrderedItems: () => [],
144
- setFocusableValue: () => {
145
- },
146
- onShiftTab: () => {
147
- },
148
- focusableValue: null,
149
- orientation: "horizontal"
150
- }), bn = b(({ activeValue: t, asChild: n, orientation: e = "horizontal", onBlur: o, onFocus: r, ...i }, s) => {
151
- const c = n ? S : "div", [l, u] = X(null), [h, f] = X(!1), m = z(/* @__PURE__ */ new Map()), g = z(null), x = V([s, g]), w = () => {
152
- if (!g.current)
153
- return [];
154
- const d = Array.from(g.current.querySelectorAll("[data-roving-tabindex-item]"));
155
- return Array.from(m.current).sort((v, p) => d.indexOf(v[1]) - d.indexOf(p[1])).map(([v, p]) => ({ value: v, element: p }));
156
- };
157
- return L(() => {
158
- u(t ?? null);
159
- }, [t]), a(Ze.Provider, { value: {
160
- elements: m,
161
- getOrderedItems: w,
162
- focusableValue: l,
163
- setFocusableValue: u,
164
- onShiftTab: () => {
165
- f(!0);
166
- },
167
- orientation: e
168
- }, children: a(c, { ...i, tabIndex: h ? -1 : 0, onBlur: (d) => {
169
- o == null || o(d), f(!1), u(t ?? null);
170
- }, onFocus: (d) => {
171
- var p, y, C;
172
- if (r == null || r(d), d.target !== d.currentTarget)
173
- return;
174
- const v = w();
175
- v.length !== 0 && (l != null ? (p = m.current.get(l)) == null || p.focus() : t != null ? (y = m.current.get(t)) == null || y.focus() : (C = v.at(0)) == null || C.element.focus());
176
- }, ref: x }) });
177
- }), hn = b(function({ children: n, ...e }, o) {
178
- const { value: r } = E(pe);
179
- return a(bn, { role: "tablist", activeValue: r, orientation: "ambiguous", ref: o, ...e, children: n });
180
- }), gn = b(function({ children: n, value: e, ...o }, r) {
181
- const { value: i } = E(pe), s = e === i, [c, l] = X(!1), u = z(null), h = V([r, u]);
182
- return L(() => {
183
- if (!u.current)
184
- return;
185
- const f = u.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
186
- l(f.length > 0);
187
- }, [n]), a(me, { children: s && a("div", { ref: h, role: "tabpanel", tabIndex: c ? void 0 : 0, ...o, children: n }) });
188
- }), yn = (t) => {
189
- const { elements: n, getOrderedItems: e, setFocusableValue: o, focusableValue: r, onShiftTab: i, orientation: s } = E(Ze);
190
- return {
191
- getOrderedItems: e,
192
- isFocusable: r === t,
193
- orientation: s,
194
- getRovingProps: (c) => ({
195
- ...c,
196
- ref: (l) => {
197
- l ? n.current.set(t, l) : n.current.delete(t);
198
- },
199
- onKeyDown: (l) => {
200
- var u;
201
- if ((u = c == null ? void 0 : c.onKeyDown) == null || u.call(c, l), l.shiftKey && l.key === "Tab") {
202
- i();
203
- return;
204
- }
205
- },
206
- onFocus: (l) => {
207
- var u;
208
- (u = c == null ? void 0 : c.onFocus) == null || u.call(c, l), o(t);
209
- },
210
- "data-roving-tabindex-item": !0,
211
- tabIndex: r === t ? 0 : -1
212
- })
213
- };
214
- };
215
- function Ie(t, n) {
216
- const e = t.findIndex((o) => o.value === n);
217
- return t.at(e === t.length - 1 ? 0 : e + 1);
218
- }
219
- function ke(t, n) {
220
- const e = t.findIndex((o) => o.value === n);
221
- return t.at(e === 0 ? -1 : e - 1);
222
- }
223
- const xn = b(({ value: t, asChild: n, ...e }, o) => {
224
- const r = n ? S : "div", i = t ?? (typeof e.children == "string" ? e.children : ""), { getOrderedItems: s, getRovingProps: c, orientation: l } = yn(i), u = c({
225
- onKeyDown: (f) => {
226
- var x;
227
- (x = e == null ? void 0 : e.onKeyDown) == null || x.call(e, f);
228
- const m = s();
229
- let g;
230
- switch (l) {
231
- case "horizontal":
232
- f.key === "ArrowRight" && (g = Ie(m, i)), f.key === "ArrowLeft" && (g = ke(m, i));
233
- break;
234
- case "vertical":
235
- f.key === "ArrowDown" && (g = Ie(m, i)), f.key === "ArrowUp" && (g = ke(m, i));
236
- break;
237
- case "ambiguous":
238
- ["ArrowRight", "ArrowDown"].includes(f.key) && (g = Ie(m, i)), ["ArrowLeft", "ArrowUp"].includes(f.key) && (g = ke(m, i));
239
- }
240
- f.key === "Home" && (g = m[0]), f.key === "End" && (g = m[m.length - 1]), g && (f.preventDefault(), g.element.focus());
241
- }
242
- }), h = V([o, u.ref]);
243
- return a(r, { ...e, ...u, ref: h, children: e.children });
244
- }), vn = b(function({ value: n, id: e, ...o }, r) {
245
- const i = E(pe), s = e ?? `tab-${ee()}`;
246
- return a(xn, { value: n, ...o, asChild: !0, children: a("button", { ...o, "aria-selected": i.value === n, id: s, onClick: () => {
247
- var c;
248
- return (c = i.onChange) == null ? void 0 : c.call(i, n);
249
- }, ref: r, role: "tab", type: "button" }) });
250
- }), Te = Object.assign(pn, {
251
- List: hn,
252
- Tab: vn,
253
- Panel: gn
254
- });
255
- Te.Tab.displayName = "Tabs.Tab";
256
- Te.List.displayName = "Tabs.List";
257
- Te.Panel.displayName = "Tabs.Panel";
258
- const et = ({ children: t }) => {
259
- const n = ee(), [e, o] = X(n);
260
- return a(Pe.Provider, { value: { popoverId: e, setPopoverId: o }, children: t });
261
- };
262
- et.displayName = "PopoverTriggerContext";
263
- const Pe = Y({}), Cn = b(function({ id: n, className: e, onClose: o, onOpen: r, open: i, variant: s = "default", placement: c = "top", autoPlacement: l = !0, asChild: u = !1, ...h }, f) {
264
- const m = u ? S : "div", g = z(null), x = V([g, f]), { popoverId: w, setPopoverId: d } = E(Pe), [v, p] = X(!1), y = i ?? v;
265
- return L(() => {
266
- var A;
267
- const C = g.current, N = ($) => {
268
- var J;
269
- const B = $.target, K = (J = B == null ? void 0 : B.closest) == null ? void 0 : J.call(B, `[popovertarget="${C == null ? void 0 : C.id}"]`), j = !K && !(C != null && C.contains(B));
270
- K && ($.preventDefault(), p((P) => !P), r == null || r()), j && (p(!1), o == null || o());
271
- }, T = ($) => {
272
- $.key !== "Escape" || !y || ($.preventDefault(), p(!1), o == null || o());
273
- };
274
- return (A = C == null ? void 0 : C.togglePopover) == null || A.call(C, y), document.addEventListener("click", N, !0), document.addEventListener("keydown", T), () => {
275
- document.removeEventListener("click", N, !0), document.removeEventListener("keydown", T);
276
- };
277
- }, [y]), L(() => {
278
- const C = g.current, N = document.querySelector(`[popovertarget="${C == null ? void 0 : C.id}"]`);
279
- if (C && N && y)
280
- return qe(N, C, () => {
281
- Pt(N, C, {
282
- placement: c,
283
- strategy: "fixed",
284
- middleware: [
285
- Rt((T) => {
286
- const A = getComputedStyle(T.elements.floating, "::before");
287
- return parseFloat(A.height);
288
- }),
289
- ...l ? [Dt({ fallbackAxisSideDirection: "start" }), Lt()] : [],
290
- wn
291
- ]
292
- }).then(({ x: T, y: A }) => {
293
- C.style.translate = `${T}px ${A}px`;
294
- });
295
- });
296
- }, [y, c, n, l]), L(() => {
297
- n && (d == null || d(n));
298
- }, [n]), a(m, {
299
- className: I("ds-popover", e),
300
- id: n || w,
301
- // @ts-ignore @types/react-dom does not understand popover yet
302
- popover: "manual",
303
- "data-variant": s,
304
- ref: x,
305
- ...h
306
- });
307
- }), wn = {
308
- name: "ArrowPseudoElement",
309
- fn(t) {
310
- const { elements: n, rects: e, placement: o } = t;
311
- 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`;
312
- 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]) {
313
- case "top":
314
- i = "100%";
315
- break;
316
- case "right":
317
- r = "0";
318
- break;
319
- case "bottom":
320
- i = "0";
321
- break;
322
- case "left":
323
- r = "100%";
324
- break;
325
- }
326
- 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;
327
- }
328
- }, In = b(function({ id: n, inline: e, asChild: o, ...r }, i) {
329
- const { popoverId: s } = E(Pe), c = o ? S : e ? "button" : te, l = Object.assign({
330
- [St.startsWith("19") ? "popoverTarget" : "popovertarget"]: s,
331
- ...e ? {
332
- "data-popover": "inline"
333
- } : {}
334
- }, r);
335
- return a(c, { ref: i, ...l });
336
- }), tt = Object.assign(Cn, {
337
- TriggerContext: et,
338
- Trigger: In
339
- });
340
- tt.TriggerContext.displayName = "Popover.TriggerContext";
341
- tt.Trigger.displayName = "Popover.Trigger";
342
- const Re = Y({
343
- current: null
344
- }), nt = ({ children: t }) => {
345
- const n = z(null);
346
- return a(Re.Provider, { value: n, children: t });
347
- };
348
- nt.displayName = "DialogTriggerContext";
349
- const kn = b(function({ asChild: n, children: e, className: o, closeButton: r = "Lukk dialogvindu", closedby: i = "closerequest", modal: s = !0, onClose: c, open: l, ...u }, h) {
350
- const f = E(Re), m = z(null), g = n ? S : "dialog", x = V([f, h, m]), w = s ? "showModal" : "show";
351
- return L(() => {
352
- var d;
353
- return (d = m.current) == null ? void 0 : d[l ? w : "close"]();
354
- }, [l]), L(() => {
355
- const d = m.current, v = (y) => {
356
- var A;
357
- const { clientY: C, clientX: N, target: T } = y;
358
- if (y instanceof KeyboardEvent)
359
- return i === "none" && y.key === "Escape" && y.preventDefault();
360
- if (!((A = window.getSelection()) != null && A.toString()) && d && T === d && i === "any") {
361
- const { top: $, left: B, right: K, bottom: j } = d.getBoundingClientRect();
362
- $ <= C && C <= j && B <= N && N <= K || d == null || d.close();
363
- }
364
- }, p = () => {
365
- const y = d == null ? void 0 : d.querySelector("[autofocus]");
366
- document.activeElement !== y && (y == null || y.focus());
367
- };
368
- return d == null || d.addEventListener("animationend", p), d == null || d.addEventListener("click", v), d == null || d.addEventListener("keydown", v), () => {
369
- d == null || d.removeEventListener("animationend", p), d == null || d.removeEventListener("click", v), d == null || d.removeEventListener("keydown", v);
370
- };
371
- }, [i]), L(() => {
372
- var v;
373
- const d = (p) => c == null ? void 0 : c(p);
374
- return (v = m.current) == null || v.addEventListener("close", d), () => {
375
- var p;
376
- return (p = m.current) == null ? void 0 : p.removeEventListener("close", d);
377
- };
378
- }, [c]), O(g, { className: I("ds-dialog", o), ref: x, "data-modal": s, ...u, children: [r !== !1 && a("form", { method: "dialog", children: a(te, { "aria-label": r, autoFocus: !0, "data-color": "neutral", icon: !0, name: "close", type: "submit", variant: "tertiary" }) }), e] });
379
- }), Nn = b(function({ asChild: n, className: e, ...o }, r) {
380
- return a(n ? S : "div", { className: I("ds-dialog__block", e), ref: r, ...o });
381
- }), On = b(function({ asChild: n, ...e }, o) {
382
- const r = E(Re);
383
- return a(n ? S : te, { "aria-haspopup": "dialog", onClick: () => {
384
- var c, l, u;
385
- ((c = r.current) == null ? void 0 : c.getAttribute("data-modal")) === "true" ? (l = r.current) == null || l.showModal() : (u = r.current) == null || u.show();
386
- }, ref: o, ...e });
387
- }), De = Object.assign(kn, {
388
- Block: Nn,
389
- TriggerContext: nt,
390
- Trigger: On
391
- });
392
- De.Block.displayName = "Dialog.Block";
393
- De.TriggerContext.displayName = "Dialog.TriggerContext";
394
- De.Trigger.displayName = "Dialog.Trigger";
395
- const G = Y(void 0), ot = Y({
396
- activeIndex: 0
397
- }), Sn = (t, n) => {
398
- switch (n.type) {
399
- case "SET_ACTIVE_INDEX":
400
- return {
401
- ...t,
402
- activeIndex: n.payload
403
- };
404
- default:
405
- return t;
406
- }
407
- }, rt = Y(() => {
408
- throw new Error("ComboboxIdDispatch must be used within a provider");
409
- }), _n = ({ children: t }) => {
410
- const [n, e] = _t(Sn, {
411
- activeIndex: 0
412
- });
413
- return a(ot.Provider, { value: n, children: a(rt.Provider, { value: e, children: t }) });
414
- };
415
- function Le() {
416
- return E(rt);
417
- }
418
- function be() {
419
- return E(ot);
420
- }
421
- const Z = (t, n) => {
422
- const e = {}, o = {};
423
- let r = 0;
424
- const i = t.length;
425
- for (; r < i; )
426
- o[t[r]] = 1, r += 1;
427
- for (const s in n)
428
- Object.prototype.hasOwnProperty.call(o, s) || (e[s] = n[s]);
429
- return e;
430
- }, it = b(({ asChild: t, interactive: n, id: e, className: o, ...r }, i) => {
431
- if (n && !e)
432
- throw new Error("If ComboboxCustom is interactive, it must have an id");
433
- const s = t ? S : "div", c = ee(), { activeIndex: l } = be(), u = E(G);
434
- if (!u)
435
- throw new Error("ComboboxCustom must be used within a Combobox");
436
- const { customIds: h, setListRef: f, getItemProps: m, size: g } = u, x = Q(() => e && h.indexOf(e) || 0, [e, h]), w = V([
437
- (d) => {
438
- f(x, d);
439
- },
440
- i
441
- ]);
442
- return a(U, { "data-size": g, asChild: !0, children: a(s, { ref: w, tabIndex: -1, className: I("ds-combobox__custom", o), id: e || c, role: "option", "aria-selected": l === x, "data-active": l === x, ...Z(["interactive"], r), ...Z(["onClick", "onPointerLeave"], m()) }) });
443
- });
444
- function En(t) {
445
- return Ue(t) && t.type === it;
446
- }
447
- function Tn(t) {
448
- return En(t) && t.props.interactive === !0;
449
- }
450
- const st = "internal-option-", D = (t) => st + t, Se = (t) => t.slice(st.length), ae = (t, n) => {
451
- const e = t.value;
452
- t.value = n;
453
- const o = t._valueTracker;
454
- typeof o < "u" && o.setValue(e), t.dispatchEvent(new Event("change", { bubbles: !0 }));
455
- }, Pn = b(function({ "aria-label": n = "Tøm", onClick: e, ...o }, r) {
456
- return a(te, { ref: r, variant: "tertiary", type: "reset", "aria-label": n, onClick: (s) => {
457
- var u;
458
- const c = s.target;
459
- let l = null;
460
- if (c instanceof HTMLElement && (l = (u = c.closest(".ds-search")) == null ? void 0 : u.querySelector("input")), !l)
461
- throw new Error("Input is missing");
462
- if (!(l instanceof HTMLInputElement))
463
- throw new Error("Input is not an input element");
464
- s.preventDefault(), ae(l, ""), l.focus(), e == null || e(s);
465
- }, icon: !0, ...o });
466
- }), Rn = b(function({ children: n = "Søk", ...e }, o) {
467
- return a(te, { ref: o, type: "submit", ...e, children: n });
468
- }), Dn = b(function({ ...n }, e) {
469
- return a(ce, {
470
- ref: e,
471
- type: "search",
472
- /* We need an empty placeholder for the clear button to be able to show/hide */
473
- placeholder: "",
474
- ...n
475
- });
476
- }), Ln = b(function({ className: n, ...e }, o) {
477
- return a("div", { ref: o, className: I("ds-search", n), ...e });
478
- }), Ae = Object.assign(Ln, {
479
- Clear: Pn,
480
- Button: Rn,
481
- Input: Dn
482
- });
483
- Ae.Clear.displayName = "Search.Clear";
484
- Ae.Button.displayName = "Search.Button";
485
- Ae.Input.displayName = "Search.Input";
486
- const An = Y(null), Bn = (t, n) => {
487
- const e = E(An), o = ee(), r = t.id ?? `${n}-${o}`, i = t.errorId ?? `${n}-error-${o}`, s = `${n}-description-${o}`, c = 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);
488
- return {
489
- hasError: u,
490
- errorId: i,
491
- descriptionId: s,
492
- size: c,
493
- inputProps: {
494
- id: r,
495
- disabled: l,
496
- "aria-invalid": u ? !0 : void 0,
497
- "aria-describedby": I(t["aria-describedby"], !!(t != null && t.description) && typeof (t == null ? void 0 : t.description) == "string" && s, u && !(e != null && e.error) && i, u && !!(e != null && e.error) && (e == null ? void 0 : e.errorId)) || void 0
498
- }
499
- };
500
- }, at = ({ size: t, error: n, formFieldProps: e }) => a("div", { className: "ds-combobox__error-message", id: e.errorId, "aria-live": "polite", "aria-relevant": "additions removals", children: n && a(_e, { "data-size": t, children: n }) });
501
- at.displayName = "ComboboxError";
502
- const ct = () => {
503
- const t = E(G);
504
- if (!t)
505
- throw new Error("ComboboxContext is missing");
506
- const { size: n, readOnly: e, disabled: o, selectedOptions: r, chipSrLabel: i, handleSelectOption: s, inputRef: c } = t;
507
- return a(me, { children: Object.keys(r).map((l) => a(Je, { "data-size": n, disabled: o, onKeyDown: (u) => {
508
- var h;
509
- e || o || u.key === "Enter" && (u.stopPropagation(), s({
510
- option: r[l],
511
- remove: !0
512
- }), (h = c == null ? void 0 : c.current) == null || h.focus());
513
- }, onClick: () => {
514
- e || o || s({
515
- option: r[l],
516
- remove: !0
517
- });
518
- }, "aria-label": i(r[l]), children: r[l].label }, l)) });
519
- };
520
- ct.displayName = "ComboboxChips";
521
- const lt = b((t, n) => {
522
- const e = E(G);
523
- if (!e)
524
- throw new Error("ComboboxContext is missing");
525
- const { readOnly: o, disabled: r, clearButtonLabel: i, handleSelectOption: s } = e;
526
- return a("button", { ...t, ref: n, disabled: r, className: I("ds-combobox__clear-button", "ds-focus"), onClick: () => {
527
- o || r || s({ option: null, clear: !0 });
528
- }, onKeyDown: (c) => {
529
- o || r || c.key === "Enter" && (c.stopPropagation(), s({ option: null, clear: !0 }));
530
- }, type: "button", "aria-label": i, children: a(Yt, { fontSize: "1.5em", title: "Clear selection" }) });
531
- });
532
- lt.displayName = "ComboboxClearButton";
533
- const dt = ({ hideClearButton: t, listId: n, error: e, hideChips: o, handleKeyDown: r, ...i }) => {
534
- const s = E(G), c = Le(), l = z(null);
535
- if (!s)
536
- throw new Error("ComboboxContext is missing");
537
- const u = (R) => {
538
- c == null || c({ type: "SET_ACTIVE_INDEX", payload: R });
539
- }, { forwareddRef: h, readOnly: f, disabled: m, open: g, inputRef: x, refs: w, inputValue: d, multiple: v, selectedOptions: p, formFieldProps: y, htmlSize: C, options: N, setOpen: T, getReferenceProps: A, setInputValue: $, handleSelectOption: B, size: K } = s, j = V([h, x]), J = (R) => {
540
- const F = R.target.value;
541
- $(F), u(0);
542
- for (const H of Object.values(N))
543
- if (H.label.toLowerCase() === F.toLowerCase()) {
544
- if (p[D(H.value)])
545
- continue;
546
- B({ option: H });
547
- }
548
- }, P = !t && Object.keys(p).length > 0, ne = A({
549
- ref: w == null ? void 0 : w.setReference,
550
- role: null,
551
- "aria-controls": null,
552
- "aria-expanded": null,
553
- "aria-haspopup": null,
554
- /* If we click the wrapper, toggle open, set index to first option, and focus the input */
555
- onClick(R) {
556
- var F, H;
557
- m || f || (F = l.current) != null && F.contains(R.target) || (T(!g), u(0), (H = x.current) == null || H.focus());
558
- },
559
- /* Handles list navigation */
560
- onKeyDown: r,
561
- // preventDefault on keydown to avoid sending in form
562
- onKeyPress(R) {
563
- R.key === "Enter" && R.preventDefault();
564
- }
565
- });
566
- return a(Ne, { "data-size": K, asChild: !0, children: O("div", { ...ne, "aria-disabled": m ? "true" : void 0, className: I("ds-textfield__input", "ds-combobox__input__wrapper", f && "ds-combobox--readonly", e && "ds-combobox--error"), children: [O("div", { className: "ds-combobox__chip-and-input", children: [v && !o && a(ct, {}), a(Ne, { "data-size": K, asChild: !0, children: a("input", { ref: j, "aria-activedescendant": ne["aria-activedescendant"], readOnly: f, "aria-autocomplete": "list", role: "combobox", "aria-expanded": g, "aria-controls": g ? n : void 0, autoComplete: "off", size: C, value: d, ...Z(["style", "className"], i), ...y.inputProps, className: "ds-combobox__input", onChange: (R) => {
567
- var F;
568
- J(R), !g && T(!0), (F = i.onChange) == null || F.call(i, R);
569
- } }) })] }), P && a(lt, { ref: l }), a("div", { className: "ds-combobox__arrow", children: g ? a(Gt, { title: "arrow up", fontSize: "1.5em" }) : a(Jt, { title: "arrow down", fontSize: "1.5em" }) })] }) });
570
- };
571
- dt.displayName = "ComboboxInput";
572
- const ut = ({ label: t, description: n, hideLabel: e, size: o, readOnly: r, formFieldProps: i }) => O(me, { children: [t && O(U, { "data-size": o, htmlFor: i.inputProps.id, className: I("ds-combobox__label", e && "ds-sr-only"), children: [r && a(nn, { "aria-hidden": !0, className: "ds-combobox__readonly__icon" }), t] }), n && a(Ne, { asChild: !0, "data-size": o, children: a("div", { id: i.descriptionId, className: I("ds-combobox__description", e && "ds-sr-only"), children: n }) })] });
573
- ut.displayName = "ComboboxLabel";
574
- const mt = ({ selectedOptions: t, multiple: n, name: e }) => {
575
- const o = Object.keys(t).map((r) => Se(r));
576
- return a("select", { name: e, multiple: n, style: { display: "none" }, value: n ? o : o[0], onChange: () => {
577
- }, children: o.map((r) => a("option", { value: r }, r)) });
578
- };
579
- mt.displayName = "ComboboxNative";
580
- const ft = b(({ children: t, className: n, ...e }, o) => a("span", { className: I("ds-combobox__option__description", n), ref: o, ...e, children: t }));
581
- ft.displayName = "ComboboxOptionDescription";
582
- const pt = ({ multiple: t, selected: n }) => a("div", { className: I(t && "ds-combobox__option__icon-wrapper", n && "ds-combobox__option__icon-wrapper--selected"), children: n && a(Zt, { className: "ds-combobox__option__icon-wrapper__icon", "aria-hidden": !0 }) });
583
- pt.displayName = "SelectedIcon";
584
- function Be(t, n = 50) {
585
- const e = z(null);
586
- return L(() => () => {
587
- e.current && clearTimeout(e.current);
588
- }, []), (...r) => {
589
- e.current && clearTimeout(e.current), e.current = window.setTimeout(() => {
590
- t(...r);
591
- }, n);
592
- };
593
- }
594
- const Fn = ({ id: t, ref: n, value: e }) => {
595
- const o = ee(), r = t || o, i = E(G), { activeIndex: s } = be(), c = Le();
596
- if (!i)
597
- throw new Error("ComboboxOption must be used within a Combobox");
598
- const { selectedOptions: l, onOptionClick: u, setListRef: h, customIds: f, filteredOptions: m } = i, g = Q(() => m.indexOf(D(String(e))) + f.length, [f.length, m, e]), x = V([
599
- (p) => {
600
- h(g, p);
601
- },
602
- n
603
- ]);
604
- if (g === -1)
605
- throw new Error("Internal error: ComboboxOption did not find index");
606
- const w = l[D(e)], d = s === g;
607
- L(() => {
608
- d && (c == null || c({ type: "SET_ACTIVE_INDEX", payload: g }));
609
- }, [o, t, c, d, g]);
610
- const v = Be(() => u(e), 50);
611
- return {
612
- id: r,
613
- ref: x,
614
- selected: w,
615
- active: d,
616
- onOptionClick: v
617
- };
618
- }, Fe = Et(b(({ value: t, description: n, children: e, className: o, ...r }, i) => {
619
- const s = ee(), { id: c, ref: l, selected: u, active: h, onOptionClick: f } = Fn({
620
- id: r.id,
621
- ref: i,
622
- value: t
623
- }), m = E(G);
624
- if (!m)
625
- throw new Error("ComboboxOption must be used within a Combobox");
626
- const { size: g, multiple: x, getItemProps: w } = m, d = w();
627
- return a(U, { "data-size": "md", asChild: !0, children: O("button", {
628
- ref: l,
629
- id: c,
630
- // biome-ignore lint/a11y/useSemanticElements: biome wants me to use the <option> element
631
- role: "option",
632
- type: "button",
633
- "aria-selected": !!u,
634
- "aria-labelledby": s,
635
- tabIndex: -1,
636
- onClick: (v) => {
637
- var p;
638
- f(), (p = r.onClick) == null || p.call(r, v);
639
- },
640
- className: I("ds-combobox__option", h && "ds-combobox__option--active", x && "ds-combobox__option--multiple", o),
641
- ...Z(["displayValue"], r),
642
- ...Z(["onClick", "onPointerLeave"], d),
643
- children: [a(U, { asChild: !0, "data-size": g, children: a("span", { children: a(pt, { multiple: x, selected: !!u }) }) }), O(U, { className: "ds-combobox__option__label", "data-size": g, id: s, children: [e, n && a(ft, { children: n })] })]
644
- }) });
645
- }));
646
- Fe.displayName = "ComboboxOption";
647
- function zn(t) {
648
- return Ue(t) && t.type === Fe;
649
- }
650
- const $n = (t) => !!t;
651
- function jn({ children: t, inputValue: n, multiple: e, filter: o = (i, s) => s.label.toLowerCase().startsWith(i.toLowerCase()), initialValue: r }) {
652
- const i = Tt(o, [o]), { optionsChildren: s, customIds: c, restChildren: l, interactiveChildren: u } = Q(() => Ke.toArray(t).reduce((p, y) => {
653
- if (zn(y))
654
- p.optionsChildren.push(y);
655
- else if (p.restChildren.push(y), Tn(y)) {
656
- const C = y;
657
- if (p.interactiveChildren.push(C), !C.props.id)
658
- throw new Error("If ComboboxCustom is interactive, it must have an id");
659
- p.customIds.push(C.props.id);
660
- }
661
- return p;
662
- }, {
663
- optionsChildren: [],
664
- customIds: [],
665
- restChildren: [],
666
- interactiveChildren: []
667
- }), [t]), h = Q(() => {
668
- const d = [], v = {};
669
- return s.map((p) => {
670
- const y = p.props;
671
- let C = y.displayValue || "";
672
- if (!y.displayValue) {
673
- let N = "";
674
- Ke.forEach(y.children, (T) => {
675
- if (typeof T == "string")
676
- N += T;
677
- else
678
- throw new Error("If ComboboxOption is not a string, it must have a displayValue prop");
679
- }), C = N;
680
- }
681
- d.includes(y.value) && console.warn(`Combobox has multiple options with the same value: ${y.value}`), d.push(y.value), v[D(String(y.value))] = {
682
- value: String(y.value),
683
- label: C,
684
- displayValue: y.displayValue,
685
- description: y.description
686
- };
687
- }), v;
688
- }, [s]), f = Q(() => ((r == null ? void 0 : r.map((d) => D(d))) || []).reduce((d, v) => {
689
- const p = h[v];
690
- return $n(p) && (d[v] = p), d;
691
- }, {}), [r, h]), [m, g] = X(f), { filteredOptions: x, filteredOptionsChildren: w } = Q(() => {
692
- const d = [], v = Object.keys(h).map((p, y) => {
693
- if (!e && Object.keys(m).length === 1 || e && m[p] || i(n, h[p]))
694
- return d.push(p), s[y];
695
- }).filter((p) => p);
696
- return { filteredOptions: d, filteredOptionsChildren: v };
697
- }, [
698
- i,
699
- n,
700
- e,
701
- h,
702
- s,
703
- m
704
- ]);
705
- return {
706
- filteredOptionsChildren: w,
707
- filteredOptions: x,
708
- restChildren: l,
709
- options: h,
710
- customIds: c,
711
- selectedOptions: m,
712
- interactiveChildren: u,
713
- setSelectedOptions: g
714
- };
715
- }
716
- const Mn = ({ readOnly: t, disabled: n, interactiveChildren: e, filteredOptions: o, inputValue: r, selectedOptions: i, multiple: s, open: c, options: l, setOpen: u, handleSelectOption: h }) => {
717
- const { activeIndex: f } = be();
718
- return Be((x) => {
719
- if (!(t || n) && x)
720
- switch (x.key) {
721
- case "ArrowDown":
722
- if (x.preventDefault(), c)
723
- break;
724
- u(!0);
725
- break;
726
- case "ArrowUp":
727
- if (x.preventDefault(), f !== 0)
728
- break;
729
- u(!1);
730
- break;
731
- case "Enter": {
732
- if (x.preventDefault(), !c)
733
- break;
734
- if (f <= e.length - 1) {
735
- const v = e[f];
736
- if (v.props.onSelect) {
737
- v == null || v.props.onSelect();
738
- return;
739
- }
740
- }
741
- const w = f - e.length, d = o[w];
742
- h({ option: l[d] });
743
- break;
744
- }
745
- case "Backspace":
746
- if (!s) {
747
- const w = Object.keys(i).pop();
748
- w && h({
749
- option: i[w],
750
- remove: !0
751
- });
752
- break;
753
- }
754
- if (r === "" && s) {
755
- const w = Object.keys(i).pop();
756
- w && h({
757
- option: i[w],
758
- remove: !0
759
- });
760
- }
761
- break;
762
- }
763
- }, 20);
764
- }, Vn = ({ listRef: t }) => {
765
- const [n, e] = X(!1), { activeIndex: o } = be(), r = Le(), { refs: i, floatingStyles: s, context: c } = At({
766
- open: n,
767
- onOpenChange: (x) => {
768
- x || r == null || r({ type: "SET_ACTIVE_INDEX", payload: 0 }), en(() => {
769
- i.floating.current && !x && (i.floating.current.scrollTop = 0), setTimeout(() => {
770
- e(x);
771
- }, 1);
772
- });
773
- },
774
- whileElementsMounted: (x, w, d) => (qe(x, w, d), () => {
775
- w.scrollTop = 0;
776
- }),
777
- middleware: [
778
- Bt({ padding: 10 }),
779
- Ft({
780
- apply({ rects: x, elements: w }) {
781
- requestAnimationFrame(() => {
782
- Object.assign(w.floating.style, {
783
- width: `${x.reference.width}px`,
784
- maxHeight: "200px"
785
- });
786
- });
787
- }
788
- }),
789
- zt(10)
790
- ]
791
- }), l = $t(c, { role: "listbox" }), u = jt(c), h = Mt(c, {
792
- listRef: t,
793
- activeIndex: o,
794
- virtual: !0,
795
- scrollItemIntoView: !0,
796
- enabled: n,
797
- focusItemOnHover: !0,
798
- onNavigate: (x) => {
799
- r == null || r({ type: "SET_ACTIVE_INDEX", payload: x || 0 });
800
- }
801
- }), { getReferenceProps: f, getFloatingProps: m, getItemProps: g } = Vt([l, u, h]);
802
- return {
803
- open: n,
804
- setOpen: e,
805
- activeIndex: o,
806
- refs: i,
807
- floatingStyles: s,
808
- context: c,
809
- getReferenceProps: f,
810
- getFloatingProps: m,
811
- getItemProps: g
812
- };
813
- }, Kn = b(({ value: t, initialValue: n = [], onValueChange: e, label: o, hideLabel: r = !1, description: i, multiple: s = !1, disabled: c = !1, readOnly: l = !1, hideChips: u = !1, clearButtonLabel: h = "Fjern alt", hideClearButton: f = !1, error: m, errorId: g, id: x, name: w, portal: d = !0, htmlSize: v = 0, virtual: p = !1, children: y, style: C, size: N = "md", loading: T, loadingLabel: A = "Laster...", filter: $, chipSrLabel: B = (P) => "Slett " + P.label, className: K, ...j }, J) => {
814
- const P = z(null), ne = z(null), R = z([]), [F, H] = X(j.inputValue || "");
815
- L(() => {
816
- typeof j.inputValue == "string" && H(j.inputValue);
817
- }, [j.inputValue]);
818
- const { selectedOptions: oe, options: q, restChildren: gt, interactiveChildren: yt, customIds: xt, filteredOptionsChildren: ge, filteredOptions: ze, setSelectedOptions: re } = jn({
819
- children: y,
820
- inputValue: F,
821
- filter: $,
822
- multiple: s,
823
- initialValue: n
824
- }), { open: ye, setOpen: xe, refs: le, floatingStyles: vt, context: $e, getReferenceProps: Ct, getFloatingProps: wt, getItemProps: It } = Vn({
825
- listRef: R
826
- }), ie = Bn({
827
- disabled: c,
828
- error: m,
829
- errorId: g,
830
- size: N,
831
- description: i,
832
- id: x
833
- }, "combobox");
834
- L(() => {
835
- if (t && t.length > 0 && !s) {
836
- const _ = q[D(t[0])];
837
- P.current && ae(P.current, (_ == null ? void 0 : _.label) || "");
838
- }
839
- }, [s, t, q]), L(() => {
840
- if (t && Object.keys(q).length >= 0) {
841
- const _ = t.map((k) => q[D(k)]);
842
- re(_.reduce((k, se) => (k[D(se.value)] = se, k), {}));
843
- }
844
- }, [s, t, q, re]);
845
- const ve = Be((_) => {
846
- var je, Me;
847
- const { option: k, clear: se, remove: Nt } = _;
848
- if (se) {
849
- re({}), P.current && ae(P.current, ""), e == null || e([]);
850
- return;
851
- }
852
- if (!k)
853
- return;
854
- if (Nt) {
855
- const M = { ...oe };
856
- delete M[D(k.value)], re(M), e == null || e(Object.keys(M).map((de) => Se(de)));
857
- return;
858
- }
859
- const W = { ...oe };
860
- if (s)
861
- W[D(k.value)] ? delete W[D(k.value)] : W[D(k.value)] = k, P.current && ae(P.current, ""), (je = P.current) == null || je.focus();
862
- else {
863
- for (const M of Object.keys(W))
864
- delete W[M];
865
- W[D(k.value)] = k, P.current && ae(P.current, (k == null ? void 0 : k.label) || ""), setTimeout(() => {
866
- var M, de, Ve;
867
- (Ve = P.current) == null || Ve.setSelectionRange(((M = k == null ? void 0 : k.label) == null ? void 0 : M.length) || 0, ((de = k == null ? void 0 : k.label) == null ? void 0 : de.length) || 0);
868
- }, 0);
869
- }
870
- re(W), e == null || e(Object.keys(W).map((M) => Se(M))), !s && xe(!1), (Me = le.domReference.current) == null || Me.focus();
871
- }, 50), kt = Mn({
872
- filteredOptions: ze,
873
- selectedOptions: oe,
874
- readOnly: ie.readOnly || !1,
875
- disabled: c,
876
- multiple: s,
877
- inputValue: F,
878
- options: q,
879
- open: ye,
880
- interactiveChildren: yt,
881
- setOpen: xe,
882
- handleSelectOption: ve
883
- }), Ce = Wt({
884
- count: Object.keys(ge).length,
885
- getScrollElement: () => p ? le.floating.current : null,
886
- estimateSize: () => 70,
887
- measureElement: (_) => _.getBoundingClientRect().height,
888
- overscan: 7
889
- });
890
- return O(G.Provider, { value: {
891
- size: N,
892
- options: q,
893
- selectedOptions: oe,
894
- multiple: s,
895
- disabled: c,
896
- readOnly: l,
897
- open: ye,
898
- inputRef: P,
899
- refs: le,
900
- inputValue: F,
901
- formFieldProps: ie,
902
- htmlSize: v,
903
- clearButtonLabel: h,
904
- customIds: xt,
905
- filteredOptions: ze,
906
- setInputValue: H,
907
- setOpen: xe,
908
- getReferenceProps: Ct,
909
- getItemProps: It,
910
- /* Recieves the value of the option, and searches for it in our values lookup */
911
- onOptionClick: (_) => {
912
- if (l || c)
913
- return;
914
- const k = q[D(_)];
915
- ve({ option: k });
916
- },
917
- handleSelectOption: ve,
918
- chipSrLabel: B,
919
- listRef: R,
920
- forwareddRef: J,
921
- setListRef: (_, k) => {
922
- R.current[_] = k;
923
- }
924
- }, children: [O("div", { className: I("ds-combobox", `ds-combobox--${N}`, c && "ds-combobox__disabled", K), style: C, ref: ne, children: [w && a(mt, { name: w, selectedOptions: oe, multiple: s }), a(ut, { label: o, description: i, size: N, readOnly: l, hideLabel: r, formFieldProps: ie }), a(dt, { ...Z(["inputValue"], j), hideClearButton: f, listId: $e.floatingId || "", error: m, hideChips: u, handleKeyDown: kt, "aria-busy": T }), a(at, { size: N, error: m, formFieldProps: ie })] }), ye && a(Kt, { root: d ? null : ne, children: a(Ht, { context: $e, initialFocus: -1, visuallyHiddenDismiss: !0, children: O("div", { "aria-labelledby": ie.inputProps.id, "aria-autocomplete": "list", tabIndex: -1, ...wt({
925
- ref: le.setFloating,
926
- style: {
927
- ...vt
928
- }
929
- }), className: I("ds-combobox__options-wrapper", `ds-combobox--${N}`), children: [p && a("div", { style: {
930
- height: `${Ce.getTotalSize()}px`,
931
- width: "100%",
932
- position: "relative"
933
- }, children: Ce.getVirtualItems().map((_) => a("div", { ref: Ce.measureElement, "data-index": _.index, style: {
934
- position: "absolute",
935
- top: 0,
936
- left: 0,
937
- width: "100%",
938
- transform: `translateY(${_.start}px)`
939
- }, children: ge[_.index] }, _.index)) }), T ? O(it, { className: "ds-combobox__loading", children: [a(We, { "aria-label": "Laster", "data-size": "sm" }), A] }) : O(me, { children: [gt, !p && ge] })] }) }) })] });
940
- }), bt = b((t, n) => a(_n, { children: a(Kn, { ...t, ref: n }) }));
941
- bt.displayName = "Combobox";
942
- const ht = b(({ children: t, className: n, ...e }, o) => {
943
- const r = E(G);
944
- if (!r)
945
- throw new Error("ComboboxEmpty must be used within a Combobox");
946
- const { filteredOptions: i, size: s } = r;
947
- return i.length === 0 && a(U, { "data-size": s, asChild: !0, children: a("div", { ref: o, className: I("ds-combobox__empty", n), ...e, children: t }) });
948
- });
949
- ht.displayName = "ComboboxEmpty";
950
- const he = bt;
951
- he.Option = Fe;
952
- he.Empty = ht;
953
- he.Option.displayName = "Combobox.Option";
954
- he.Empty.displayName = "Combobox.Empty";
955
- const Hn = (t, n, e) => {
956
- 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), s = Array.from({ length: i + 1 - r }, (c, l) => l + r);
957
- return e > 4 && r > 1 && s.splice(0, 2, 1, 0), e > 3 && i < n && s.splice(-2, 2, 0, n), s;
958
- }, yo = ({ currentPage: t = 1, setCurrentPage: n, onChange: e, totalPages: o = 1, showPages: r = 7 }) => Q(() => {
959
- const i = t < o, s = t !== 1, c = (l) => (u) => {
960
- if (l < 1 || l > o)
961
- return u.preventDefault();
962
- e == null || e(u, l), u.defaultPrevented || n == null || n(l);
963
- };
964
- return {
965
- /** Number of steps */
966
- pages: Hn(t, o, r).map((l, u) => ({
967
- /**
968
- * Page number or "ellipsis" for the ellipsis item
969
- */
970
- page: l || "ellipsis",
971
- /**
972
- * Unique key for the item
973
- */
974
- itemKey: l ? `page-${l}` : `ellipsis-${u}`,
975
- // React key utility
976
- /**
977
- * Properties to spread on Pagination.Button
978
- */
979
- buttonProps: l ? {
980
- "aria-current": l === t ? "page" : void 0,
981
- onClick: c(l),
982
- variant: l === t ? "primary" : "tertiary"
983
- } : null
984
- })),
985
- /** Properties to spread on Pagination.Button used for previous naviagation */
986
- prevButtonProps: {
987
- "aria-disabled": !s,
988
- // Using aria-disabled to support all HTML elements because of potential asChild
989
- onClick: c(t - 1),
990
- variant: "tertiary"
991
- },
992
- /** Properties to spread on Pagination.Button used for next naviagation */
993
- nextButtonProps: {
994
- "aria-disabled": !i,
995
- // Using aria-disabled to support all HTML elements because of potential asChild
996
- onClick: c(t + 1),
997
- variant: "tertiary"
998
- },
999
- /** Indication if previous page action should be shown or not */
1000
- hasPrev: s,
1001
- /** Indication if next page action should be shown or not */
1002
- hasNext: i
1003
- };
1004
- }, [t, o, r]);
1005
- export {
1006
- po as A,
1007
- an as B,
1008
- bo as C,
1009
- De as D,
1010
- fo as H,
1011
- cn as L,
1012
- Ee as P,
1013
- ho as S,
1014
- go as T,
1015
- te as a,
1016
- fe as b,
1017
- he as c,
1018
- uo as d,
1019
- mo as e,
1020
- tt as f,
1021
- Ae as g,
1022
- lo as h,
1023
- We as i,
1024
- Te as j,
1025
- yo as u
1026
- };