@altinn/altinn-components 0.6.1 → 0.6.2

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 (569) hide show
  1. package/.github/workflows/ci-cd-main.yml +47 -0
  2. package/.github/workflows/ci-cd-pull-request.yml +39 -0
  3. package/.github/workflows/workflow-deploy-storybook.yml +35 -0
  4. package/.node-version +1 -0
  5. package/.storybook/StoryDecorator.tsx +29 -0
  6. package/.storybook/ThemeProvider.tsx +16 -0
  7. package/.storybook/main.ts +20 -0
  8. package/.storybook/preview.tsx +63 -0
  9. package/.storybook/storyDecorator.module.css +20 -0
  10. package/.storybook/theme.module.css +3 -0
  11. package/CHANGELOG.md +111 -0
  12. package/CONTRIBUTING.MD +59 -0
  13. package/README.md +3 -15
  14. package/biome.jsonc +65 -0
  15. package/lib/components/Attachment/AttachmentLink.stories.ts +19 -0
  16. package/lib/components/Attachment/AttachmentLink.tsx +20 -0
  17. package/lib/components/Attachment/AttachmentList.stories.ts +39 -0
  18. package/lib/components/Attachment/AttachmentList.tsx +26 -0
  19. package/lib/components/Attachment/attachmentLink.module.css +20 -0
  20. package/lib/components/Attachment/attachmentList.module.css +12 -0
  21. package/lib/components/Avatar/Avatar.tsx +83 -0
  22. package/lib/components/Avatar/AvatarGroup.stories.ts +66 -0
  23. package/lib/components/Avatar/AvatarGroup.tsx +60 -0
  24. package/lib/components/Avatar/avatar.module.css +61 -0
  25. package/lib/components/Avatar/avatar.stories.tsx +40 -0
  26. package/lib/components/Avatar/avatarGroup.module.css +78 -0
  27. package/lib/components/Avatar/color.ts +71 -0
  28. package/lib/components/Badge/Badge.stories.ts +32 -0
  29. package/lib/components/Badge/Badge.tsx +22 -0
  30. package/lib/components/Badge/badge.module.css +27 -0
  31. package/lib/components/Bookmarks/BookmarksList.tsx +17 -0
  32. package/lib/components/Bookmarks/BookmarksListItem.stories.tsx +79 -0
  33. package/lib/components/Bookmarks/BookmarksListItem.tsx +32 -0
  34. package/lib/components/Bookmarks/QueryLabel.tsx +33 -0
  35. package/lib/components/Bookmarks/queryLabel.module.css +45 -0
  36. package/lib/components/Button/Button.stories.ts +50 -0
  37. package/lib/components/Button/Button.tsx +60 -0
  38. package/lib/components/Button/ButtonBase.tsx +54 -0
  39. package/lib/components/Button/ButtonIcon.tsx +16 -0
  40. package/lib/components/Button/ButtonLabel.tsx +18 -0
  41. package/lib/components/Button/Buttons.stories.tsx +64 -0
  42. package/lib/components/Button/ComboButton.stories.ts +45 -0
  43. package/lib/components/Button/ComboButton.tsx +46 -0
  44. package/lib/components/Button/IconButton.stories.tsx +47 -0
  45. package/lib/components/Button/IconButton.tsx +33 -0
  46. package/lib/components/Button/button.module.css +22 -0
  47. package/lib/components/Button/buttonBase.module.css +142 -0
  48. package/lib/components/Button/buttonIcon.module.css +17 -0
  49. package/lib/components/Button/buttonLabel.module.css +17 -0
  50. package/lib/components/Button/comboButton.module.css +35 -0
  51. package/lib/components/Button/iconButton.module.css +31 -0
  52. package/lib/components/ContextMenu/ContextMenu.stories.ts +49 -0
  53. package/lib/components/ContextMenu/ContextMenu.tsx +20 -0
  54. package/lib/components/ContextMenu/ContextMenuBase.tsx +35 -0
  55. package/lib/components/ContextMenu/contextMenuBase.module.css +35 -0
  56. package/lib/components/Datepicker/Datepicker.tsx +49 -0
  57. package/lib/components/Datepicker/DatepickerBase.tsx +12 -0
  58. package/lib/components/Datepicker/DatepickerHeader.tsx +20 -0
  59. package/lib/components/Datepicker/DatepickerTable.tsx +50 -0
  60. package/lib/components/Datepicker/datepickerBase.module.css +5 -0
  61. package/lib/components/Datepicker/datepickerHeader.module.css +17 -0
  62. package/lib/components/Datepicker/datepickerTable.module.css +37 -0
  63. package/lib/components/Datepicker/useDatepicker.tsx +146 -0
  64. package/lib/components/Dialog/Dialog.stories.ts +331 -0
  65. package/lib/components/Dialog/Dialog.tsx +111 -0
  66. package/lib/components/Dialog/DialogActions.stories.ts +60 -0
  67. package/lib/components/Dialog/DialogActions.tsx +80 -0
  68. package/lib/components/Dialog/DialogActivityLog.tsx +18 -0
  69. package/lib/components/Dialog/DialogArticleBase.tsx +10 -0
  70. package/lib/components/Dialog/DialogAttachments.stories.ts +38 -0
  71. package/lib/components/Dialog/DialogAttachments.tsx +25 -0
  72. package/lib/components/Dialog/DialogBase.tsx +10 -0
  73. package/lib/components/Dialog/DialogBodyBase.tsx +17 -0
  74. package/lib/components/Dialog/DialogBorder.tsx +19 -0
  75. package/lib/components/Dialog/DialogContent.stories.ts +26 -0
  76. package/lib/components/Dialog/DialogContent.tsx +23 -0
  77. package/lib/components/Dialog/DialogFooter.tsx +14 -0
  78. package/lib/components/Dialog/DialogGroup.tsx +24 -0
  79. package/lib/components/Dialog/DialogHeader.stories.ts +24 -0
  80. package/lib/components/Dialog/DialogHeader.tsx +23 -0
  81. package/lib/components/Dialog/DialogHeaderBase.tsx +10 -0
  82. package/lib/components/Dialog/DialogHeadings.stories.ts +35 -0
  83. package/lib/components/Dialog/DialogHeadings.tsx +77 -0
  84. package/lib/components/Dialog/DialogHistory.stories.ts +67 -0
  85. package/lib/components/Dialog/DialogHistory.tsx +19 -0
  86. package/lib/components/Dialog/DialogList.stories.ts +65 -0
  87. package/lib/components/Dialog/DialogList.tsx +35 -0
  88. package/lib/components/Dialog/DialogListItem.stories.tsx +238 -0
  89. package/lib/components/Dialog/DialogListItem.tsx +126 -0
  90. package/lib/components/Dialog/DialogListItemBase.tsx +52 -0
  91. package/lib/components/Dialog/DialogMetadata.stories.ts +75 -0
  92. package/lib/components/Dialog/DialogMetadata.tsx +56 -0
  93. package/lib/components/Dialog/DialogNav.stories.ts +88 -0
  94. package/lib/components/Dialog/DialogNav.tsx +56 -0
  95. package/lib/components/Dialog/DialogSectionBase.tsx +20 -0
  96. package/lib/components/Dialog/DialogSeenBy.stories.tsx +56 -0
  97. package/lib/components/Dialog/DialogSeenBy.tsx +36 -0
  98. package/lib/components/Dialog/DialogSelect.tsx +23 -0
  99. package/lib/components/Dialog/DialogStatus.stories.ts +57 -0
  100. package/lib/components/Dialog/DialogStatus.tsx +61 -0
  101. package/lib/components/Dialog/DialogTitle.stories.ts +31 -0
  102. package/lib/components/Dialog/DialogTitle.tsx +31 -0
  103. package/lib/components/Dialog/DialogTouchedBy.stories.tsx +27 -0
  104. package/lib/components/Dialog/DialogTouchedBy.tsx +19 -0
  105. package/lib/components/Dialog/dialog.module.css +21 -0
  106. package/lib/components/Dialog/dialogAction.module.css +26 -0
  107. package/lib/components/Dialog/dialogArticleBase.module.css +5 -0
  108. package/lib/components/Dialog/dialogBodyBase.module.css +13 -0
  109. package/lib/components/Dialog/dialogBorder.module.css +42 -0
  110. package/lib/components/Dialog/dialogGroup.module.css +35 -0
  111. package/lib/components/Dialog/dialogHeaderBase.module.css +6 -0
  112. package/lib/components/Dialog/dialogHeadings.module.css +24 -0
  113. package/lib/components/Dialog/dialogHistory.module.css +12 -0
  114. package/lib/components/Dialog/dialogListItem.module.css +81 -0
  115. package/lib/components/Dialog/dialogListItemBase.module.css +28 -0
  116. package/lib/components/Dialog/dialogNav.module.css +12 -0
  117. package/lib/components/Dialog/dialogSectionBase.module.css +11 -0
  118. package/lib/components/Dialog/dialogSelect.module.css +34 -0
  119. package/lib/components/Dialog/dialogTitle.module.css +47 -0
  120. package/lib/components/Dropdown/Backdrop.tsx +12 -0
  121. package/lib/components/Dropdown/DrawerBase.tsx +20 -0
  122. package/lib/components/Dropdown/DrawerBody.tsx +12 -0
  123. package/lib/components/Dropdown/DrawerButton.tsx +17 -0
  124. package/lib/components/Dropdown/DrawerFooter.tsx +12 -0
  125. package/lib/components/Dropdown/DrawerHeader.tsx +19 -0
  126. package/lib/components/Dropdown/DrawerOrDropdown.tsx +29 -0
  127. package/lib/components/Dropdown/DropdownBase.tsx +32 -0
  128. package/lib/components/Dropdown/backdrop.module.css +11 -0
  129. package/lib/components/Dropdown/drawerBase.module.css +17 -0
  130. package/lib/components/Dropdown/drawerBody.module.css +5 -0
  131. package/lib/components/Dropdown/drawerButton.module.css +6 -0
  132. package/lib/components/Dropdown/drawerFooter.module.css +13 -0
  133. package/lib/components/Dropdown/drawerHeader.module.css +17 -0
  134. package/lib/components/Dropdown/drawerOrDropdown.module.css +19 -0
  135. package/lib/components/Dropdown/dropdownBase.module.css +35 -0
  136. package/{dist/components/Dropdown/index.d.ts → lib/components/Dropdown/index.ts} +1 -0
  137. package/lib/components/Footer/Footer.stories.ts +37 -0
  138. package/lib/components/Footer/Footer.tsx +21 -0
  139. package/lib/components/Footer/FooterAddress.tsx +12 -0
  140. package/lib/components/Footer/FooterBase.tsx +16 -0
  141. package/lib/components/Footer/FooterLogo.tsx +17 -0
  142. package/lib/components/Footer/FooterMenu.tsx +43 -0
  143. package/lib/components/Footer/footerAddress.module.css +8 -0
  144. package/lib/components/Footer/footerBase.module.css +28 -0
  145. package/lib/components/Footer/footerLogo.module.css +12 -0
  146. package/lib/components/Footer/footerMenu.module.css +35 -0
  147. package/lib/components/GlobalMenu/AccountButton.tsx +46 -0
  148. package/lib/components/GlobalMenu/AccountMenu.stories.tsx +65 -0
  149. package/lib/components/GlobalMenu/AccountMenu.tsx +82 -0
  150. package/lib/components/GlobalMenu/BackButton.tsx +10 -0
  151. package/lib/components/GlobalMenu/GlobalMenu.stories.tsx +181 -0
  152. package/lib/components/GlobalMenu/GlobalMenu.tsx +86 -0
  153. package/lib/components/GlobalMenu/GlobalMenuBase.tsx +22 -0
  154. package/lib/components/GlobalMenu/LogoutButton.tsx +19 -0
  155. package/lib/components/GlobalMenu/globalMenuBase.module.css +39 -0
  156. package/lib/components/GlobalMenu/logoutButton.module.css +9 -0
  157. package/lib/components/Header/DigdirLogomark.tsx +23 -0
  158. package/lib/components/Header/Header.stories.tsx +188 -0
  159. package/lib/components/Header/Header.tsx +71 -0
  160. package/lib/components/Header/HeaderBase.tsx +21 -0
  161. package/lib/components/Header/HeaderButton.stories.ts +70 -0
  162. package/lib/components/Header/HeaderButton.tsx +68 -0
  163. package/lib/components/Header/HeaderLogo.stories.ts +17 -0
  164. package/lib/components/Header/HeaderLogo.tsx +22 -0
  165. package/lib/components/Header/HeaderMenu.tsx +17 -0
  166. package/lib/components/Header/HeaderSearch.tsx +17 -0
  167. package/lib/components/Header/header.module.css +24 -0
  168. package/lib/components/Header/headerBase.module.css +51 -0
  169. package/lib/components/Header/headerButton.module.css +37 -0
  170. package/lib/components/Header/headerLogo.module.css +24 -0
  171. package/lib/components/Header/headerMenu.module.css +3 -0
  172. package/lib/components/Header/headerSearch.module.css +21 -0
  173. package/lib/components/Header/mobileMenu.module.css +28 -0
  174. package/lib/components/History/HistoryAttachments.tsx +22 -0
  175. package/lib/components/History/HistoryBorder.tsx +17 -0
  176. package/lib/components/History/HistoryItem.stories.ts +56 -0
  177. package/lib/components/History/HistoryItem.tsx +56 -0
  178. package/lib/components/History/HistoryList.stories.ts +72 -0
  179. package/lib/components/History/HistoryList.tsx +26 -0
  180. package/lib/components/History/historyBorder.module.css +8 -0
  181. package/lib/components/History/historyItem.module.css +19 -0
  182. package/lib/components/History/historyList.module.css +12 -0
  183. package/lib/components/Icon/CheckboxCheckedIcon.tsx +28 -0
  184. package/lib/components/Icon/CheckboxIcon.stories.ts +32 -0
  185. package/lib/components/Icon/CheckboxIcon.tsx +17 -0
  186. package/lib/components/Icon/CheckboxUncheckedIcon.tsx +38 -0
  187. package/lib/components/Icon/Icon.stories.ts +24 -0
  188. package/lib/components/Icon/Icon.tsx +23 -0
  189. package/lib/components/Icon/ProgressIcon.stories.ts +43 -0
  190. package/lib/components/Icon/ProgressIcon.tsx +44 -0
  191. package/lib/components/Icon/RadioCheckedIcon.tsx +29 -0
  192. package/lib/components/Icon/RadioIcon.stories.ts +32 -0
  193. package/lib/components/Icon/RadioIcon.tsx +17 -0
  194. package/lib/components/Icon/RadioUncheckedIcon.tsx +30 -0
  195. package/lib/components/Icon/SvgIcon.tsx +18 -0
  196. package/lib/components/Icon/__AkselIcon.tsx +37 -0
  197. package/lib/components/Icon/checkboxIcon.module.css +23 -0
  198. package/lib/components/Icon/icon.module.css +4 -0
  199. package/lib/components/Icon/iconsMap.tsx +2078 -0
  200. package/lib/components/Icon/progressIcon.module.css +29 -0
  201. package/lib/components/Icon/radioIcon.module.css +21 -0
  202. package/lib/components/Layout/Layout.stories.tsx +308 -0
  203. package/lib/components/Layout/Layout.tsx +46 -0
  204. package/lib/components/Layout/LayoutBase.stories.ts +17 -0
  205. package/lib/components/Layout/LayoutBase.tsx +31 -0
  206. package/lib/components/Layout/LayoutBody.stories.ts +17 -0
  207. package/lib/components/Layout/LayoutBody.tsx +16 -0
  208. package/lib/components/Layout/LayoutContent.stories.ts +17 -0
  209. package/lib/components/Layout/LayoutContent.tsx +15 -0
  210. package/lib/components/Layout/LayoutSidebar.stories.ts +17 -0
  211. package/lib/components/Layout/LayoutSidebar.tsx +23 -0
  212. package/lib/components/Layout/layoutBase.module.css +22 -0
  213. package/lib/components/Layout/layoutBody.module.css +15 -0
  214. package/lib/components/Layout/layoutContent.module.css +13 -0
  215. package/lib/components/Layout/layoutSidebar.module.css +20 -0
  216. package/lib/components/LayoutAction/ActionFooter.stories.tsx +70 -0
  217. package/lib/components/LayoutAction/ActionFooter.tsx +15 -0
  218. package/lib/components/LayoutAction/ActionHeader.stories.ts +20 -0
  219. package/lib/components/LayoutAction/ActionHeader.tsx +19 -0
  220. package/lib/components/LayoutAction/ActionMenu.stories.tsx +40 -0
  221. package/lib/components/LayoutAction/ActionMenu.tsx +23 -0
  222. package/lib/components/LayoutAction/actionFooter.module.css +28 -0
  223. package/lib/components/LayoutAction/actionHeader.module.css +55 -0
  224. package/lib/components/LayoutAction/actionMenu.module.css +30 -0
  225. package/lib/components/List/List.stories.tsx +43 -0
  226. package/lib/components/List/List.tsx +20 -0
  227. package/lib/components/List/ListBase.tsx +19 -0
  228. package/lib/components/List/ListItem.stories.tsx +208 -0
  229. package/lib/components/List/ListItem.tsx +73 -0
  230. package/lib/components/List/ListItemBase.tsx +82 -0
  231. package/lib/components/List/ListItemLabel.tsx +29 -0
  232. package/lib/components/List/ListItemMedia.tsx +59 -0
  233. package/lib/components/List/listBase.module.css +30 -0
  234. package/lib/components/List/listItemBase.module.css +97 -0
  235. package/lib/components/List/listItemLabel.module.css +55 -0
  236. package/lib/components/List/listItemMedia.module.css +41 -0
  237. package/lib/components/Menu/Menu.stories.ts +514 -0
  238. package/lib/components/Menu/Menu.tsx +24 -0
  239. package/lib/components/Menu/MenuBase.tsx +63 -0
  240. package/lib/components/Menu/MenuHeader.tsx +13 -0
  241. package/lib/components/Menu/MenuInputField.tsx +38 -0
  242. package/lib/components/Menu/MenuItem.stories.tsx +164 -0
  243. package/lib/components/Menu/MenuItem.tsx +63 -0
  244. package/lib/components/Menu/MenuItemBase.tsx +77 -0
  245. package/lib/components/Menu/MenuItemLabel.tsx +30 -0
  246. package/lib/components/Menu/MenuItemMedia.tsx +42 -0
  247. package/lib/components/Menu/MenuItems.stories.ts +438 -0
  248. package/lib/components/Menu/MenuItems.tsx +96 -0
  249. package/lib/components/Menu/MenuOption.stories.ts +52 -0
  250. package/lib/components/Menu/MenuOption.tsx +48 -0
  251. package/lib/components/Menu/MenuSearch.stories.ts +18 -0
  252. package/lib/components/Menu/MenuSearch.tsx +25 -0
  253. package/lib/components/Menu/menu.module.css +25 -0
  254. package/lib/components/Menu/menuBase.module.css +25 -0
  255. package/lib/components/Menu/menuHeader.module.css +12 -0
  256. package/lib/components/Menu/menuInputField.module.css +54 -0
  257. package/lib/components/Menu/menuItemBase.module.css +79 -0
  258. package/lib/components/Menu/menuItemLabel.module.css +32 -0
  259. package/lib/components/Menu/menuItemMedia.module.css +38 -0
  260. package/lib/components/Menu/menuOption.module.css +27 -0
  261. package/lib/components/Menu/menuSearch.module.css +30 -0
  262. package/lib/components/Meta/MetaBase.tsx +15 -0
  263. package/lib/components/Meta/MetaItem.stories.ts +25 -0
  264. package/lib/components/Meta/MetaItem.tsx +31 -0
  265. package/lib/components/Meta/MetaItemBase.tsx +46 -0
  266. package/lib/components/Meta/MetaItemLabel.tsx +20 -0
  267. package/lib/components/Meta/MetaItemMedia.tsx +22 -0
  268. package/lib/components/Meta/MetaList.stories.ts +29 -0
  269. package/lib/components/Meta/MetaList.tsx +43 -0
  270. package/lib/components/Meta/MetaProgress.stories.ts +29 -0
  271. package/lib/components/Meta/MetaProgress.tsx +26 -0
  272. package/lib/components/Meta/MetaTimestamp.stories.ts +33 -0
  273. package/lib/components/Meta/MetaTimestamp.tsx +29 -0
  274. package/lib/components/Meta/meta.module.css +6 -0
  275. package/lib/components/Meta/metaItem.module.css +107 -0
  276. package/lib/components/Meta/metaList.module.css +15 -0
  277. package/lib/components/Page/PageBase.tsx +14 -0
  278. package/lib/components/Page/PageHeader.tsx +25 -0
  279. package/lib/components/Page/PageHeaderMedia.tsx +25 -0
  280. package/lib/components/Page/PageNav.tsx +34 -0
  281. package/lib/components/Page/SectionBase.tsx +52 -0
  282. package/lib/components/Page/SectionFooter.tsx +15 -0
  283. package/lib/components/Page/SectionHeader.tsx +16 -0
  284. package/lib/components/Page/pageHeader.module.css +18 -0
  285. package/lib/components/Page/pageNav.module.css +12 -0
  286. package/lib/components/Page/sectionBase.module.css +92 -0
  287. package/lib/components/Page/sectionFooter.module.css +8 -0
  288. package/lib/components/Page/sectionHeader.module.css +9 -0
  289. package/lib/components/RootProvider/RootProvider.tsx +56 -0
  290. package/lib/components/Searchbar/Autocomplete.stories.tsx +77 -0
  291. package/lib/components/Searchbar/Autocomplete.tsx +44 -0
  292. package/lib/components/Searchbar/AutocompleteBase.tsx +16 -0
  293. package/lib/components/Searchbar/AutocompleteGroup.tsx +17 -0
  294. package/lib/components/Searchbar/AutocompleteItem.tsx +23 -0
  295. package/lib/components/Searchbar/SearchField.tsx +81 -0
  296. package/lib/components/Searchbar/Searchbar.stories.tsx +151 -0
  297. package/lib/components/Searchbar/Searchbar.tsx +26 -0
  298. package/lib/components/Searchbar/SearchbarBase.tsx +23 -0
  299. package/lib/components/Searchbar/autocompleteBase.module.css +17 -0
  300. package/lib/components/Searchbar/autocompleteGroup.module.css +3 -0
  301. package/lib/components/Searchbar/autocompleteItem.module.css +19 -0
  302. package/lib/components/Searchbar/searchField.module.css +54 -0
  303. package/lib/components/Searchbar/searchbarBase.module.css +20 -0
  304. package/lib/components/Snackbar/Snackbar.stories.tsx +21 -0
  305. package/lib/components/Snackbar/Snackbar.tsx +32 -0
  306. package/lib/components/Snackbar/SnackbarBase.tsx +39 -0
  307. package/lib/components/Snackbar/SnackbarLabel.tsx +10 -0
  308. package/lib/components/Snackbar/SnackbarMedia.tsx +14 -0
  309. package/lib/components/Snackbar/snackbarBase.module.css +55 -0
  310. package/lib/components/Snackbar/snackbarLabel.module.css +6 -0
  311. package/lib/components/Snackbar/snackbarMedia.module.css +10 -0
  312. package/lib/components/Toolbar/Toolbar.stories.tsx +188 -0
  313. package/lib/components/Toolbar/Toolbar.tsx +159 -0
  314. package/lib/components/Toolbar/ToolbarAdd.stories.ts +23 -0
  315. package/lib/components/Toolbar/ToolbarAdd.tsx +26 -0
  316. package/lib/components/Toolbar/ToolbarBase.tsx +12 -0
  317. package/lib/components/Toolbar/ToolbarButton.stories.ts +32 -0
  318. package/lib/components/Toolbar/ToolbarButton.tsx +65 -0
  319. package/lib/components/Toolbar/ToolbarDate.stories.ts +62 -0
  320. package/lib/components/Toolbar/ToolbarDaterange.stories.ts +24 -0
  321. package/lib/components/Toolbar/ToolbarDaterange.tsx +73 -0
  322. package/lib/components/Toolbar/ToolbarFilter.stories.ts +64 -0
  323. package/lib/components/Toolbar/ToolbarFilter.tsx +82 -0
  324. package/lib/components/Toolbar/ToolbarFilterBase.tsx +15 -0
  325. package/lib/components/Toolbar/ToolbarMenu.stories.ts +37 -0
  326. package/lib/components/Toolbar/ToolbarMenu.tsx +29 -0
  327. package/lib/components/Toolbar/ToolbarOptions.stories.ts +108 -0
  328. package/lib/components/Toolbar/ToolbarOptions.tsx +74 -0
  329. package/lib/components/Toolbar/ToolbarSearch.stories.ts +19 -0
  330. package/lib/components/Toolbar/ToolbarSearch.tsx +24 -0
  331. package/lib/components/Toolbar/toolbarBase.module.css +19 -0
  332. package/lib/components/Toolbar/toolbarButton.module.css +3 -0
  333. package/lib/components/Toolbar/toolbarDaterange.module.css +12 -0
  334. package/lib/components/Toolbar/toolbarFilterBase.module.css +7 -0
  335. package/lib/components/Toolbar/toolbarMenu.module.css +7 -0
  336. package/lib/components/Toolbar/toolbarSearch.module.css +28 -0
  337. package/lib/components/Typography/Heading.tsx +23 -0
  338. package/lib/components/Typography/Typography.tsx +24 -0
  339. package/lib/components/Typography/heading.module.css +21 -0
  340. package/lib/components/Typography/typography.module.css +64 -0
  341. package/lib/css/colors.css +113 -0
  342. package/lib/css/global.css +16 -0
  343. package/lib/css/shadows.css +7 -0
  344. package/lib/css/theme-article.css +15 -0
  345. package/lib/css/theme-company.css +15 -0
  346. package/lib/css/theme-global-dark.css +19 -0
  347. package/lib/css/theme-global.css +15 -0
  348. package/lib/css/theme-neutral.css +15 -0
  349. package/lib/css/theme-person.css +15 -0
  350. package/lib/css/theme.css +22 -0
  351. package/lib/hooks/useClickOutside.ts +22 -0
  352. package/lib/hooks/useEscapeKey.ts +17 -0
  353. package/lib/hooks/useMenu.tsx +81 -0
  354. package/lib/stories/Color/MenuItem.stories.tsx +43 -0
  355. package/lib/stories/Color/Swatches.stories.tsx +19 -0
  356. package/lib/stories/Color/Swatches.tsx +42 -0
  357. package/lib/stories/Color/colors.json +62 -0
  358. package/lib/stories/Color/swatches.module.css +14 -0
  359. package/lib/stories/Inbox/BookmarksPage.tsx +78 -0
  360. package/lib/stories/Inbox/DialogPage.tsx +15 -0
  361. package/lib/stories/Inbox/Inbox.stories.tsx +55 -0
  362. package/lib/stories/Inbox/Inbox.tsx +12 -0
  363. package/lib/stories/Inbox/InboxLayout.tsx +51 -0
  364. package/lib/stories/Inbox/InboxPage.tsx +51 -0
  365. package/lib/stories/Inbox/InboxProvider.tsx +136 -0
  366. package/lib/stories/Inbox/InboxSection.tsx +39 -0
  367. package/lib/stories/Inbox/InboxToolbar.tsx +94 -0
  368. package/lib/stories/Inbox/ProfilePage.tsx +36 -0
  369. package/lib/stories/Inbox/SettingsPage.tsx +19 -0
  370. package/lib/stories/Inbox/accounts/accounts.ts +24 -0
  371. package/lib/stories/Inbox/accounts/index.ts +1 -0
  372. package/lib/stories/Inbox/actionMenu.ts +24 -0
  373. package/lib/stories/Inbox/dialogs/brreg-completed.json +35 -0
  374. package/lib/stories/Inbox/dialogs/brreg-draft.json +41 -0
  375. package/lib/stories/Inbox/dialogs/enova-in-progress.json +35 -0
  376. package/lib/stories/Inbox/dialogs/index.ts +53 -0
  377. package/lib/stories/Inbox/dialogs/skatt-2023.json +33 -0
  378. package/lib/stories/Inbox/dialogs/sykmelding-referat.json +41 -0
  379. package/lib/stories/Inbox/groupBy.ts +19 -0
  380. package/lib/stories/Inbox/inboxSection.module.css +19 -0
  381. package/lib/stories/Inbox/index.ts +15 -0
  382. package/lib/stories/Inbox/layout/footer.ts +27 -0
  383. package/lib/stories/Inbox/layout/header.ts +11 -0
  384. package/lib/stories/Inbox/layout/index.ts +3 -0
  385. package/lib/stories/Inbox/layout/menu.ts +64 -0
  386. package/package.json +19 -27
  387. package/renovate.json +4 -0
  388. package/tsconfig.json +28 -0
  389. package/tsconfig.node.json +11 -0
  390. package/typings.d.ts +1 -0
  391. package/vite.config.ts +20 -0
  392. package/dist/components/Attachment/AttachmentLink.d.ts +0 -10
  393. package/dist/components/Attachment/AttachmentList.d.ts +0 -7
  394. package/dist/components/Avatar/Avatar.d.ts +0 -27
  395. package/dist/components/Avatar/AvatarGroup.d.ts +0 -20
  396. package/dist/components/Avatar/color.d.ts +0 -4
  397. package/dist/components/Badge/Badge.d.ts +0 -11
  398. package/dist/components/Bookmarks/BookmarksList.d.ts +0 -7
  399. package/dist/components/Bookmarks/BookmarksListItem.d.ts +0 -21
  400. package/dist/components/Bookmarks/QueryLabel.d.ts +0 -11
  401. package/dist/components/Button/Button.d.ts +0 -8
  402. package/dist/components/Button/ButtonBase.d.ts +0 -20
  403. package/dist/components/Button/ButtonIcon.d.ts +0 -7
  404. package/dist/components/Button/ButtonLabel.d.ts +0 -8
  405. package/dist/components/Button/ComboButton.d.ts +0 -10
  406. package/dist/components/Button/IconButton.d.ts +0 -14
  407. package/dist/components/ContextMenu/ContextMenu.d.ts +0 -8
  408. package/dist/components/ContextMenu/ContextMenuBase.d.ts +0 -9
  409. package/dist/components/Dialog/Dialog.d.ts +0 -54
  410. package/dist/components/Dialog/DialogActions.d.ts +0 -16
  411. package/dist/components/Dialog/DialogActivityLog.d.ts +0 -10
  412. package/dist/components/Dialog/DialogArticleBase.d.ts +0 -6
  413. package/dist/components/Dialog/DialogAttachments.d.ts +0 -6
  414. package/dist/components/Dialog/DialogBase.d.ts +0 -5
  415. package/dist/components/Dialog/DialogBodyBase.d.ts +0 -5
  416. package/dist/components/Dialog/DialogBorder.d.ts +0 -9
  417. package/dist/components/Dialog/DialogContent.d.ts +0 -9
  418. package/dist/components/Dialog/DialogFooter.d.ts +0 -4
  419. package/dist/components/Dialog/DialogGroup.d.ts +0 -6
  420. package/dist/components/Dialog/DialogHeader.d.ts +0 -10
  421. package/dist/components/Dialog/DialogHeaderBase.d.ts +0 -5
  422. package/dist/components/Dialog/DialogHeadings.d.ts +0 -24
  423. package/dist/components/Dialog/DialogHistory.d.ts +0 -6
  424. package/dist/components/Dialog/DialogList.d.ts +0 -7
  425. package/dist/components/Dialog/DialogListItem.d.ts +0 -59
  426. package/dist/components/Dialog/DialogListItemBase.d.ts +0 -28
  427. package/dist/components/Dialog/DialogMetadata.d.ts +0 -22
  428. package/dist/components/Dialog/DialogNav.d.ts +0 -21
  429. package/dist/components/Dialog/DialogSectionBase.d.ts +0 -6
  430. package/dist/components/Dialog/DialogSeenBy.d.ts +0 -19
  431. package/dist/components/Dialog/DialogSelect.d.ts +0 -10
  432. package/dist/components/Dialog/DialogStatus.d.ts +0 -25
  433. package/dist/components/Dialog/DialogTitle.d.ts +0 -20
  434. package/dist/components/Dialog/DialogTouchedBy.d.ts +0 -10
  435. package/dist/components/Dropdown/Backdrop.d.ts +0 -6
  436. package/dist/components/Dropdown/DrawerBase.d.ts +0 -9
  437. package/dist/components/Dropdown/DrawerBody.d.ts +0 -6
  438. package/dist/components/Dropdown/DrawerButton.d.ts +0 -7
  439. package/dist/components/Dropdown/DrawerFooter.d.ts +0 -6
  440. package/dist/components/Dropdown/DrawerHeader.d.ts +0 -7
  441. package/dist/components/Dropdown/DrawerOrDropdown.d.ts +0 -10
  442. package/dist/components/Dropdown/DropdownBase.d.ts +0 -10
  443. package/dist/components/Footer/Footer.d.ts +0 -6
  444. package/dist/components/Footer/FooterAddress.d.ts +0 -6
  445. package/dist/components/Footer/FooterBase.d.ts +0 -6
  446. package/dist/components/Footer/FooterLogo.d.ts +0 -5
  447. package/dist/components/Footer/FooterMenu.d.ts +0 -14
  448. package/dist/components/GlobalMenu/AccountButton.d.ts +0 -14
  449. package/dist/components/GlobalMenu/AccountMenu.d.ts +0 -20
  450. package/dist/components/GlobalMenu/BackButton.d.ts +0 -5
  451. package/dist/components/GlobalMenu/GlobalMenu.d.ts +0 -16
  452. package/dist/components/GlobalMenu/GlobalMenuBase.d.ts +0 -7
  453. package/dist/components/GlobalMenu/LogoutButton.d.ts +0 -7
  454. package/dist/components/Header/DigdirLogomark.d.ts +0 -5
  455. package/dist/components/Header/Header.d.ts +0 -9
  456. package/dist/components/Header/HeaderBase.d.ts +0 -9
  457. package/dist/components/Header/HeaderButton.d.ts +0 -15
  458. package/dist/components/Header/HeaderLogo.d.ts +0 -9
  459. package/dist/components/Header/HeaderMenu.d.ts +0 -7
  460. package/dist/components/Header/HeaderSearch.d.ts +0 -7
  461. package/dist/components/History/HistoryAttachments.d.ts +0 -6
  462. package/dist/components/History/HistoryBorder.d.ts +0 -7
  463. package/dist/components/History/HistoryItem.d.ts +0 -14
  464. package/dist/components/History/HistoryList.d.ts +0 -6
  465. package/dist/components/Icon/CheckboxCheckedIcon.d.ts +0 -8
  466. package/dist/components/Icon/CheckboxIcon.d.ts +0 -10
  467. package/dist/components/Icon/CheckboxUncheckedIcon.d.ts +0 -9
  468. package/dist/components/Icon/Icon.d.ts +0 -9
  469. package/dist/components/Icon/ProgressIcon.d.ts +0 -6
  470. package/dist/components/Icon/RadioCheckedIcon.d.ts +0 -8
  471. package/dist/components/Icon/RadioIcon.d.ts +0 -10
  472. package/dist/components/Icon/RadioUncheckedIcon.d.ts +0 -9
  473. package/dist/components/Icon/SvgIcon.d.ts +0 -9
  474. package/dist/components/Icon/iconsMap.d.ts +0 -1911
  475. package/dist/components/Layout/Layout.d.ts +0 -24
  476. package/dist/components/Layout/LayoutBase.d.ts +0 -21
  477. package/dist/components/Layout/LayoutBody.d.ts +0 -7
  478. package/dist/components/Layout/LayoutContent.d.ts +0 -7
  479. package/dist/components/Layout/LayoutSidebar.d.ts +0 -13
  480. package/dist/components/LayoutAction/ActionFooter.d.ts +0 -6
  481. package/dist/components/LayoutAction/ActionHeader.d.ts +0 -7
  482. package/dist/components/LayoutAction/ActionMenu.d.ts +0 -6
  483. package/dist/components/List/List.d.ts +0 -10
  484. package/dist/components/List/ListBase.d.ts +0 -9
  485. package/dist/components/List/ListItem.d.ts +0 -46
  486. package/dist/components/List/ListItemBase.d.ts +0 -27
  487. package/dist/components/List/ListItemLabel.d.ts +0 -9
  488. package/dist/components/List/ListItemMedia.d.ts +0 -14
  489. package/dist/components/Menu/Menu.d.ts +0 -8
  490. package/dist/components/Menu/MenuBase.d.ts +0 -27
  491. package/dist/components/Menu/MenuHeader.d.ts +0 -4
  492. package/dist/components/Menu/MenuInputField.d.ts +0 -12
  493. package/dist/components/Menu/MenuItem.d.ts +0 -35
  494. package/dist/components/Menu/MenuItemBase.d.ts +0 -23
  495. package/dist/components/Menu/MenuItemLabel.d.ts +0 -10
  496. package/dist/components/Menu/MenuItemMedia.d.ts +0 -14
  497. package/dist/components/Menu/MenuItems.d.ts +0 -17
  498. package/dist/components/Menu/MenuOption.d.ts +0 -19
  499. package/dist/components/Menu/MenuSearch.d.ts +0 -8
  500. package/dist/components/Meta/MetaBase.d.ts +0 -7
  501. package/dist/components/Meta/MetaItem.d.ts +0 -18
  502. package/dist/components/Meta/MetaItemBase.d.ts +0 -15
  503. package/dist/components/Meta/MetaItemLabel.d.ts +0 -11
  504. package/dist/components/Meta/MetaItemMedia.d.ts +0 -9
  505. package/dist/components/Meta/MetaList.d.ts +0 -12
  506. package/dist/components/Meta/MetaProgress.d.ts +0 -13
  507. package/dist/components/Meta/MetaTimestamp.d.ts +0 -16
  508. package/dist/components/Page/PageBase.d.ts +0 -6
  509. package/dist/components/Page/PageHeader.d.ts +0 -7
  510. package/dist/components/Page/PageHeaderMedia.d.ts +0 -10
  511. package/dist/components/Page/PageNav.d.ts +0 -14
  512. package/dist/components/Page/SectionBase.d.ts +0 -19
  513. package/dist/components/Page/SectionFooter.d.ts +0 -6
  514. package/dist/components/Page/SectionHeader.d.ts +0 -7
  515. package/dist/components/RootProvider/RootProvider.d.ts +0 -19
  516. package/dist/components/Searchbar/Autocomplete.d.ts +0 -9
  517. package/dist/components/Searchbar/AutocompleteBase.d.ts +0 -7
  518. package/dist/components/Searchbar/AutocompleteGroup.d.ts +0 -6
  519. package/dist/components/Searchbar/AutocompleteItem.d.ts +0 -13
  520. package/dist/components/Searchbar/SearchField.d.ts +0 -16
  521. package/dist/components/Searchbar/Searchbar.d.ts +0 -9
  522. package/dist/components/Searchbar/SearchbarBase.d.ts +0 -8
  523. package/dist/components/Snackbar/Snackbar.d.ts +0 -21
  524. package/dist/components/Snackbar/SnackbarBase.d.ts +0 -13
  525. package/dist/components/Snackbar/SnackbarLabel.d.ts +0 -5
  526. package/dist/components/Snackbar/SnackbarMedia.d.ts +0 -6
  527. package/dist/components/Toolbar/Toolbar.d.ts +0 -15
  528. package/dist/components/Toolbar/ToolbarAdd.d.ts +0 -10
  529. package/dist/components/Toolbar/ToolbarBase.d.ts +0 -7
  530. package/dist/components/Toolbar/ToolbarButton.d.ts +0 -14
  531. package/dist/components/Toolbar/ToolbarFilter.d.ts +0 -23
  532. package/dist/components/Toolbar/ToolbarFilterBase.d.ts +0 -6
  533. package/dist/components/Toolbar/ToolbarMenu.d.ts +0 -13
  534. package/dist/components/Toolbar/ToolbarOptions.d.ts +0 -18
  535. package/dist/components/Toolbar/ToolbarSearch.d.ts +0 -8
  536. package/dist/components/Typography/Heading.d.ts +0 -10
  537. package/dist/components/Typography/Typography.d.ts +0 -11
  538. package/dist/hooks/useClickOutside.d.ts +0 -2
  539. package/dist/hooks/useEscapeKey.d.ts +0 -1
  540. package/dist/hooks/useMenu.d.ts +0 -21
  541. package/dist/index.css +0 -1
  542. package/dist/index.es.js +0 -3340
  543. /package/{dist/components/Attachment/index.d.ts → lib/components/Attachment/index.ts} +0 -0
  544. /package/{dist/components/Avatar/index.d.ts → lib/components/Avatar/index.ts} +0 -0
  545. /package/{dist/components/Badge/index.d.ts → lib/components/Badge/index.tsx} +0 -0
  546. /package/{dist/components/Bookmarks/index.d.ts → lib/components/Bookmarks/index.ts} +0 -0
  547. /package/{dist/components/Button/index.d.ts → lib/components/Button/index.ts} +0 -0
  548. /package/{dist/components/ContextMenu/index.d.ts → lib/components/ContextMenu/index.ts} +0 -0
  549. /package/{dist/components/Datepicker/index.d.ts → lib/components/Datepicker/index.ts} +0 -0
  550. /package/{dist/components/Dialog/index.d.ts → lib/components/Dialog/index.ts} +0 -0
  551. /package/{dist/components/Footer/index.d.ts → lib/components/Footer/index.ts} +0 -0
  552. /package/{dist/components/GlobalMenu/index.d.ts → lib/components/GlobalMenu/index.tsx} +0 -0
  553. /package/{dist/components/Header/index.d.ts → lib/components/Header/index.tsx} +0 -0
  554. /package/{dist/components/History/index.d.ts → lib/components/History/index.ts} +0 -0
  555. /package/{dist/components/Icon/index.d.ts → lib/components/Icon/index.ts} +0 -0
  556. /package/{dist/components/Layout/index.d.ts → lib/components/Layout/index.tsx} +0 -0
  557. /package/{dist/components/LayoutAction/index.d.ts → lib/components/LayoutAction/index.ts} +0 -0
  558. /package/{dist/components/List/index.d.ts → lib/components/List/index.ts} +0 -0
  559. /package/{dist/components/Menu/index.d.ts → lib/components/Menu/index.ts} +0 -0
  560. /package/{dist/components/Meta/index.d.ts → lib/components/Meta/index.ts} +0 -0
  561. /package/{dist/components/Page/index.d.ts → lib/components/Page/index.ts} +0 -0
  562. /package/{dist/components/RootProvider/index.d.ts → lib/components/RootProvider/index.ts} +0 -0
  563. /package/{dist/components/Searchbar/index.d.ts → lib/components/Searchbar/index.ts} +0 -0
  564. /package/{dist/components/Snackbar/index.d.ts → lib/components/Snackbar/index.ts} +0 -0
  565. /package/{dist/components/Toolbar/index.d.ts → lib/components/Toolbar/index.ts} +0 -0
  566. /package/{dist/components/Typography/index.d.ts → lib/components/Typography/index.ts} +0 -0
  567. /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
  568. /package/{dist/hooks/index.d.ts → lib/hooks/index.ts} +0 -0
  569. /package/{dist/index.d.ts → lib/index.ts} +0 -0
@@ -0,0 +1,55 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { accounts, dialogs } from './';
3
+ import { Inbox } from './Inbox';
4
+
5
+ const meta = {
6
+ title: 'Demo/Inbox/Inbox',
7
+ component: Inbox,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ layout: 'fullscreen',
11
+ },
12
+ args: {
13
+ inboxId: 'inbox',
14
+ accounts,
15
+ accountId: 'a0',
16
+ dialogs,
17
+ },
18
+ } satisfies Meta<typeof Inbox>;
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {
24
+ args: {},
25
+ };
26
+
27
+ export const BulkMode: Story = {
28
+ args: {
29
+ selectedIds: ['d1'],
30
+ },
31
+ };
32
+
33
+ export const DialogOpen: Story = {
34
+ args: {
35
+ dialogId: 'd1',
36
+ },
37
+ };
38
+
39
+ export const SavedSearches: Story = {
40
+ args: {
41
+ inboxId: 'bookmarks',
42
+ },
43
+ };
44
+
45
+ export const ProfilePage: Story = {
46
+ args: {
47
+ inboxId: 'profile',
48
+ },
49
+ };
50
+
51
+ export const SettingsPage: Story = {
52
+ args: {
53
+ inboxId: 'settings',
54
+ },
55
+ };
@@ -0,0 +1,12 @@
1
+ import { InboxLayout, InboxProvider, InboxSection } from './';
2
+ import type { InboxDefaultValue } from './';
3
+
4
+ export const Inbox = ({ accounts, accountId, inboxId, dialogId, dialogs, selectedIds }: InboxDefaultValue) => {
5
+ return (
6
+ <InboxProvider defaultValue={{ accounts, accountId, inboxId, dialogId, dialogs, selectedIds }}>
7
+ <InboxLayout>
8
+ <InboxSection />
9
+ </InboxLayout>
10
+ </InboxProvider>
11
+ );
12
+ };
@@ -0,0 +1,51 @@
1
+ import type { ReactNode } from 'react';
2
+ import { ActionFooter, ActionHeader, ActionMenu, Layout } from '../../components';
3
+ import { actionMenu, footer, header, menu } from './';
4
+ import { useInbox } from './';
5
+
6
+ export interface InboxLayoutProps {
7
+ children: ReactNode;
8
+ }
9
+
10
+ export const InboxLayout = ({ children }: InboxLayoutProps) => {
11
+ const { theme, itemsCount, selectedCount, inboxId, accounts, dialogId, onInboxId, onUnselectAll } = useInbox();
12
+
13
+ const selectedTitle = `${selectedCount} av ${itemsCount} valgt`;
14
+ const bulkMode = selectedCount > 0;
15
+
16
+ return (
17
+ <Layout
18
+ theme={selectedCount ? 'neutral' : theme}
19
+ footer={footer}
20
+ header={{
21
+ ...header,
22
+ currentAccount: accounts?.[0],
23
+ menu: {
24
+ accounts,
25
+ },
26
+ search: !dialogId && {
27
+ ...header.search,
28
+ },
29
+ }}
30
+ sidebar={{
31
+ hidden: bulkMode,
32
+ menu: {
33
+ ...menu,
34
+ items: menu?.items.map((item) => {
35
+ return {
36
+ ...item,
37
+ selected: inboxId === item.id,
38
+ onClick: () => onInboxId(item.id),
39
+ };
40
+ }),
41
+ },
42
+ }}
43
+ >
44
+ <ActionHeader title={selectedTitle} hidden={!bulkMode} onDismiss={onUnselectAll} />
45
+ {children}
46
+ <ActionFooter hidden={!bulkMode}>
47
+ <ActionMenu theme="global-dark" items={actionMenu} />
48
+ </ActionFooter>
49
+ </Layout>
50
+ );
51
+ };
@@ -0,0 +1,51 @@
1
+ 'use client';
2
+ import { DialogList, PageBase } from '../../components';
3
+ import { useInbox } from './';
4
+ import { InboxToolbar } from './InboxToolbar';
5
+
6
+ export function InboxPage() {
7
+ const { inboxId, onDialogId, items = [], onSelectId, selectedCount } = useInbox();
8
+ const selected = items?.filter((item) => item.selected);
9
+
10
+ const inboxItems = items
11
+ ?.filter((item) => {
12
+ const inboxStatus = item?.status.value;
13
+
14
+ if (inboxId === 'drafts' && inboxStatus !== 'draft') {
15
+ return false;
16
+ }
17
+ if (inboxId === 'sent' && inboxStatus !== 'sent') {
18
+ return false;
19
+ }
20
+ if (inboxId === 'inbox' && (item.status.value === 'sent' || item.status.value === 'draft')) {
21
+ return false;
22
+ }
23
+
24
+ return true;
25
+ })
26
+ .map((item) => {
27
+
28
+ return {
29
+ ...item,
30
+ groupId: 'g1',
31
+ onClick: selectedCount > 0 ? () => onSelectId(item.id) : () => onDialogId(item.id),
32
+ select: {
33
+ checked: item?.selected,
34
+ onChange: () => onSelectId(item.id),
35
+ },
36
+ };
37
+ });
38
+
39
+ const inboxGroups = {
40
+ g1: {
41
+ title: 'Gruppe',
42
+ },
43
+ };
44
+
45
+ return (
46
+ <PageBase spacing="md" margin="lg">
47
+ {!selected.length > 0 && <InboxToolbar items={inboxItems} />}
48
+ <DialogList items={inboxItems} groups={inboxGroups} />
49
+ </PageBase>
50
+ );
51
+ }
@@ -0,0 +1,136 @@
1
+ import { type ReactNode, createContext, useContext, useState } from 'react';
2
+ import type { DialogProps } from '../../components';
3
+
4
+ interface AccountProps {
5
+ id?: string;
6
+ type?: string;
7
+ name?: string;
8
+ }
9
+
10
+ export interface InboxDefaultValue {
11
+ accountId?: string | null;
12
+ accounts: AccountProps[];
13
+ inboxId?: string | null;
14
+ dialogId?: string | null;
15
+ dialogs?: DialogProps[];
16
+ selectedIds?: string[];
17
+ }
18
+
19
+ interface InboxProviderProps {
20
+ children: ReactNode;
21
+ defaultValue?: InboxDefaultValue;
22
+ }
23
+
24
+ interface InboxContextProvider {
25
+ theme?: string;
26
+ account?: AccountProps;
27
+ accountId?: string | null;
28
+ accounts?: AccountProps[];
29
+ inboxId?: string | null;
30
+ dialogId?: string | null;
31
+ onAccountId?: (id: string) => void;
32
+ onInboxId?: (id: string) => void;
33
+ onDialogId?: (id: string) => void;
34
+ items?: (DialogProps & { selected: boolean })[];
35
+ itemsCount: number;
36
+ onSelectId?: (id: string) => void;
37
+ onUnselectAll?: () => void;
38
+ selectedCount: number;
39
+ }
40
+
41
+ const InboxContext = createContext<InboxContextProvider>({
42
+ theme: '',
43
+ account: {},
44
+ accountId: null,
45
+ accounts: [],
46
+ inboxId: null,
47
+ dialogId: null,
48
+ items: [],
49
+ itemsCount: 0,
50
+ selectedCount: 0,
51
+ });
52
+
53
+ export const InboxProvider = ({ defaultValue, children }: InboxProviderProps) => {
54
+ const [accountId, setAccountId] = useState(defaultValue?.accountId ?? null);
55
+ const [accounts, setAccounts] = useState(defaultValue?.accounts ?? []);
56
+ const [inboxId, setInboxId] = useState(defaultValue?.inboxId ?? null);
57
+ const [dialogId, setDialogId] = useState(defaultValue?.dialogId ?? null);
58
+ const [selectedIds, setSelectedIds] = useState(defaultValue?.selectedIds || []);
59
+
60
+ const onAccountId = (id: string) => {
61
+ setAccountId(id);
62
+ setAccounts((prevState) => {
63
+ return prevState.map((item) => {
64
+ return {
65
+ ...item,
66
+ selected: id === item.id,
67
+ };
68
+ });
69
+ });
70
+ };
71
+
72
+ const account = accounts?.find((item) => item.id === accountId);
73
+ const theme = account?.type;
74
+
75
+ const onInboxId = (id: string) => {
76
+ setInboxId(id);
77
+ setDialogId(null);
78
+ };
79
+
80
+ const onDialogId = (id: string) => {
81
+ setDialogId((prevState) => (prevState === id ? null : id));
82
+ };
83
+
84
+ const onSelectId = (id: string) => {
85
+ setSelectedIds((prevState) => {
86
+ if (prevState.includes(id)) {
87
+ return prevState.filter((prevId) => prevId !== id);
88
+ }
89
+ return [...prevState, id];
90
+ });
91
+ };
92
+
93
+ const onUnselectAll = () => {
94
+ setSelectedIds([]);
95
+ };
96
+
97
+ const items = defaultValue?.dialogs?.map((item) => ({
98
+ ...item,
99
+ selected: selectedIds.includes(item.id),
100
+ recipient: account
101
+ }));
102
+
103
+ const itemsCount = items?.length || 0;
104
+ const selectedCount = selectedIds.length;
105
+
106
+ return (
107
+ <InboxContext.Provider
108
+ value={{
109
+ theme,
110
+ account,
111
+ accounts,
112
+ accountId,
113
+ onAccountId,
114
+ inboxId,
115
+ onInboxId,
116
+ dialogId,
117
+ onDialogId,
118
+ items,
119
+ itemsCount,
120
+ onSelectId,
121
+ onUnselectAll,
122
+ selectedCount,
123
+ }}
124
+ >
125
+ {children}
126
+ </InboxContext.Provider>
127
+ );
128
+ };
129
+
130
+ export const useInbox = () => {
131
+ return useContext(InboxContext);
132
+ };
133
+
134
+ export const useProfile = () => {
135
+ return useContext(InboxContext);
136
+ };
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ import { actionMenu, useInbox } from './';
3
+ import { BookmarksPage, DialogPage, InboxPage, ProfilePage, SettingsPage } from './';
4
+
5
+ export function InboxSection() {
6
+ const { inboxId, dialogId, onDialogId, items = [] } = useInbox();
7
+
8
+ if (inboxId === 'bookmarks') {
9
+ return <BookmarksPage />;
10
+ }
11
+
12
+ if (inboxId === 'settings') {
13
+ return <SettingsPage />;
14
+ }
15
+
16
+ if (inboxId === 'profile') {
17
+ return <ProfilePage />;
18
+ }
19
+
20
+ if (dialogId) {
21
+ const dialog = items.find((item) => item.id === dialogId);
22
+ return (
23
+ <DialogPage
24
+ dialog={{
25
+ ...dialog,
26
+ menu: {
27
+ id: 'context-menu',
28
+ items: actionMenu,
29
+ },
30
+ backButton: {
31
+ onClick: () => onDialogId(dialogId),
32
+ },
33
+ }}
34
+ />
35
+ );
36
+ }
37
+
38
+ return <InboxPage />;
39
+ }
@@ -0,0 +1,94 @@
1
+ 'use client';
2
+ import { Toolbar, Button } from '../../components';
3
+ import { useInbox } from './';
4
+
5
+ export function InboxToolbar({ items }) {
6
+ const { accounts = [], accountId, onAccountId } = useInbox();
7
+
8
+ const senderOptions = {};
9
+
10
+ items?.map((item) => {
11
+ const { sender } = item;
12
+
13
+ if (!senderOptions[sender?.name]) {
14
+ senderOptions[sender?.name] = {
15
+ label: sender.name,
16
+ value: sender.name,
17
+ count: 0,
18
+ };
19
+ }
20
+
21
+ senderOptions[sender?.name].count++;
22
+ });
23
+
24
+ const currentAccount = accounts?.find((item) => item.id === accountId);
25
+
26
+ const accountMenu = {
27
+ label: currentAccount?.name,
28
+ value: currentAccount?.id,
29
+ currentAccount,
30
+ items: accounts.map((item) => {
31
+ return {
32
+ group: item.type,
33
+ title: item?.name,
34
+ avatar: item,
35
+ onClick: () => onAccountId(item.id),
36
+ };
37
+ }),
38
+ };
39
+
40
+ const filters =
41
+ items &&
42
+ [
43
+ {
44
+ name: 'status',
45
+ label: 'Velg status',
46
+ optionType: 'checkbox',
47
+ options: [
48
+ {
49
+ groupId: '1',
50
+ value: 'draft',
51
+ label: 'Utkast',
52
+ },
53
+ {
54
+ groupId: '1',
55
+ value: 'sent',
56
+ label: 'Sendt',
57
+ },
58
+ {
59
+ groupId: '2',
60
+ value: 'in-progress',
61
+ label: 'Under arbeid',
62
+ },
63
+ {
64
+ groupId: '2',
65
+ value: 'requires-attention',
66
+ label: 'Krever handling',
67
+ },
68
+ {
69
+ groupId: '2',
70
+ value: 'completed',
71
+ label: 'Avsluttet',
72
+ },
73
+ ],
74
+ },
75
+ {
76
+ name: 'sender',
77
+ label: 'Velg avsender',
78
+ optionType: 'checkbox',
79
+ options: Object.values(senderOptions)?.map((item) => {
80
+ return {
81
+ ...item,
82
+ badge: { label: item?.count.toString() || '2' },
83
+ };
84
+ }),
85
+ },
86
+ ].map((item) => {
87
+ return {
88
+ ...item,
89
+ removable: true,
90
+ };
91
+ });
92
+
93
+ return <Toolbar menu={accountMenu} filters={filters}><Button size="sm" variant="text" reverse icon="bookmark">Lagre søk</Button></Toolbar>;
94
+ }
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+ import {
3
+ Avatar,
4
+ Heading,
5
+ ListBase,
6
+ ListItem,
7
+ MetaItem,
8
+ PageBase,
9
+ PageHeader,
10
+ SectionBase,
11
+ SectionFooter,
12
+ SectionHeader,
13
+ Typography,
14
+ } from '../../components';
15
+ import { useProfile } from './';
16
+
17
+ export function ProfilePage() {
18
+ const { account } = useProfile();
19
+
20
+ return (
21
+ <PageBase>
22
+ <PageHeader
23
+ title={account.name}
24
+ description="Fnr: XXXXXXX XXXXX"
25
+ avatar={{ type: account?.type, name: account.name }}
26
+ inset
27
+ padding
28
+ spacing="lg"
29
+ color="white"
30
+ shadow="xs"
31
+ >
32
+ <Typography size="lg">Lorem ipsum dolor sit amet</Typography>
33
+ </PageHeader>
34
+ </PageBase>
35
+ );
36
+ }
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import {
3
+ Heading,
4
+ ListBase,
5
+ ListItem,
6
+ MetaItem,
7
+ PageBase,
8
+ SectionBase,
9
+ SectionFooter,
10
+ SectionHeader,
11
+ Typography,
12
+ } from '../../components';
13
+ import { useProfile } from './';
14
+
15
+ export function SettingsPage() {
16
+ const { account } = useProfile;
17
+
18
+ return <PageBase inset>{JSON.stringify(account)}</PageBase>;
19
+ }
@@ -0,0 +1,24 @@
1
+ export const accounts = [
2
+ {
3
+ type: 'person',
4
+ name: 'Aurora Mikalsen',
5
+ selected: true,
6
+ },
7
+ {
8
+ type: 'company',
9
+ name: 'Auroras blomster',
10
+ },
11
+ {
12
+ type: 'company',
13
+ name: 'Aurora bier',
14
+ },
15
+ {
16
+ type: 'company',
17
+ name: 'Auroras bier og blomster',
18
+ },
19
+ ].map((item, index) => {
20
+ return {
21
+ ...item,
22
+ id: 'a' + index,
23
+ };
24
+ });
@@ -0,0 +1 @@
1
+ export * from './accounts';
@@ -0,0 +1,24 @@
1
+ import type { MenuItemProps } from '../../components';
2
+
3
+ export const actionMenu: MenuItemProps[] = [
4
+ {
5
+ id: '1',
6
+ icon: 'arrow-redo',
7
+ title: 'Del og gi tilgang',
8
+ },
9
+ {
10
+ id: '2',
11
+ icon: 'eye',
12
+ title: 'Marker som lest',
13
+ },
14
+ {
15
+ id: '3',
16
+ icon: 'archive',
17
+ title: 'Flytt til arkiv',
18
+ },
19
+ {
20
+ id: '4',
21
+ icon: 'trash',
22
+ title: 'Flytt til papirkurv',
23
+ },
24
+ ];
@@ -0,0 +1,35 @@
1
+ {
2
+ "_createdAt": "2024-10-23T09:33:00Z",
3
+ "_id": "95f30463-b886-402d-b765-95d9eccf68c0",
4
+ "_rev": "n6M6ED8lI6VdyYqDQoyiME",
5
+ "_type": "dialog",
6
+ "_updatedAt": "2024-10-28T17:07:12Z",
7
+ "additionalInfo": "For at du skal kunne registrere enkeltpersonforetaket, er du nødt til å drive med næringsaktivitet. Dette er aktivitet som er egnet til å ha et visst omfang og varighet.",
8
+ "body": "## Nøkkelinformasjon\n- **Foretakets navn:** Olas Enkeltmannsforetak\n- **Organisasjonsnummer:** 999 999 999\n- **Dato registrert**: 14. mai 2024\n\n## Hva nå?\nTips og triks til deg som har startet enkeltpersonforetak:\n- Få en regnskapsfører.\n- Slik driver du selskapet ditt.\n- Bla bla bla.",
9
+ "history": [
10
+ {
11
+ "_key": "334c343862da",
12
+ "_type": "historyItem",
13
+ "summary": "Skjema ble opprettet."
14
+ },
15
+ {
16
+ "_key": "f5cc7d1053c9",
17
+ "_type": "historyItem",
18
+ "summary": "Bla bla bla."
19
+ }
20
+ ],
21
+ "recipient": {
22
+ "type": "person",
23
+ "name": "Rein Regnskapsfører",
24
+ "imageUrl": null
25
+ },
26
+ "sender": {
27
+ "type": "company",
28
+ "name": "Brønnøysundregistrene",
29
+ "imageUrl": "https://cdn.sanity.io/images/z3it2oa7/production/3be5df0229c0b58c7ab59db2ade6208cc83954d2-300x300.png?w=96"
30
+ },
31
+ "status": { "label": "Avsluttet", "value": "completed" },
32
+ "summary": "Gratulerer! Ditt enkeltpersonforetak er godkjent og klart til bruk.",
33
+ "title": "Registrering av enkeltmannsforetak",
34
+ "updatedAt": "2024-10-28T17:07:12Z"
35
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "_createdAt": "2024-10-23T07:17:42Z",
3
+ "_id": "7cda3a28-2171-488c-8554-6b061b48e533",
4
+ "_rev": "n6M6ED8lI6VdyYqDQoylrM",
5
+ "_type": "dialog",
6
+ "_updatedAt": "2024-10-28T17:07:32Z",
7
+ "additionalInfo": "For at du skal kunne registrere enkeltpersonforetaket, er du nødt til å drive med næringsaktivitet. Dette er aktivitet som er egnet til å ha et visst omfang og varighet.",
8
+ "body": "## Oppsummering\n- **Foretakets navn:** Olas Enkeltmannsforetak\n- **Lorem ipsum:** Data",
9
+ "history": [
10
+ {
11
+ "_key": "334c343862da",
12
+ "_type": "historyItem",
13
+ "summary": "Skjema ble opprettet."
14
+ },
15
+ {
16
+ "_key": "f5cc7d1053c9",
17
+ "_type": "historyItem",
18
+ "summary": "Bla bla bla."
19
+ }
20
+ ],
21
+ "recipient": { "type": "person", "name": "Ola Nordmann", "imageUrl": null },
22
+ "sender": {
23
+ "type": "company",
24
+ "name": "Brønnøysundregistrene",
25
+ "imageUrl": "https://cdn.sanity.io/images/z3it2oa7/production/3be5df0229c0b58c7ab59db2ade6208cc83954d2-300x300.png?w=96"
26
+ },
27
+ "status": { "label": "Draft", "value": "draft" },
28
+ "summary": "Et utkast til skjema er lagret.",
29
+ "title": "Registrering av enkeltmannsforetak",
30
+ "updatedAt": "2024-10-28T17:07:32Z",
31
+ "actions": [
32
+ {
33
+ "priority": "primary",
34
+ "label": "Til skjema"
35
+ },
36
+ {
37
+ "priority": "secondary",
38
+ "label": "Forkast utkast"
39
+ }
40
+ ]
41
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "_createdAt": "2024-10-25T09:44:01Z",
3
+ "_id": "c06f1c30-8c7b-45ad-ab72-86b26514419a",
4
+ "_rev": "n6M6ED8lI6VdyYqDQmkmXW",
5
+ "_type": "dialog",
6
+ "_updatedAt": "2024-10-28T13:00:31Z",
7
+ "additionalInfo": "Søk om støtte til å installere solenergianlegg i borettslag eller sameier. Ordningen støtter både solcelleanlegg og solfangere og du kan få dekket inntil 20% av kostnadene.",
8
+ "body": "## Nøkkelinformasjon\n- **Din saksbehandler:** Johanna Yo. \n- **Ditt saksnummer:** 3456\n- **Forventet behandlingstid:** 2 uker",
9
+ "history": [
10
+ {
11
+ "_key": "d80749bc45a8",
12
+ "_type": "historyItem",
13
+ "attachments": [
14
+ {
15
+ "_key": "dfa24dc52aee",
16
+ "_type": "attachment",
17
+ "label": "Søknad om støtte til utbygging av solceller.pdf"
18
+ }
19
+ ],
20
+ "relativeTime": { "_type": "relativeTimeAgo", "unit": "day", "value": 3 },
21
+ "summary": "Søknaden ble sendt.",
22
+ "createdAt": "2024-10-25T12:00:31.000Z"
23
+ }
24
+ ],
25
+ "recipient": { "type": "person", "name": "Ola Nordmann", "imageUrl": null },
26
+ "sender": {
27
+ "type": "company",
28
+ "name": "Enova",
29
+ "imageUrl": "https://cdn.sanity.io/images/z3it2oa7/production/454b2ce709b0695c97f4c0861d694a18381194de-48x48.png?w=96"
30
+ },
31
+ "status": { "label": "Under arbeid", "value": "in-progress" },
32
+ "summary": "Din søknad har fått saksbehandler. Forventet behandlingstid: 2 uker.",
33
+ "title": "Støtte til utbygging av solceller",
34
+ "updatedAt": "2024-10-28T13:00:31Z"
35
+ }