@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.
- package/.github/workflows/ci-cd-main.yml +47 -0
- package/.github/workflows/ci-cd-pull-request.yml +39 -0
- package/.github/workflows/workflow-deploy-storybook.yml +35 -0
- package/.node-version +1 -0
- package/.storybook/StoryDecorator.tsx +29 -0
- package/.storybook/ThemeProvider.tsx +16 -0
- package/.storybook/main.ts +20 -0
- package/.storybook/preview.tsx +63 -0
- package/.storybook/storyDecorator.module.css +20 -0
- package/.storybook/theme.module.css +3 -0
- package/CHANGELOG.md +111 -0
- package/CONTRIBUTING.MD +59 -0
- package/README.md +3 -15
- package/biome.jsonc +65 -0
- package/lib/components/Attachment/AttachmentLink.stories.ts +19 -0
- package/lib/components/Attachment/AttachmentLink.tsx +20 -0
- package/lib/components/Attachment/AttachmentList.stories.ts +39 -0
- package/lib/components/Attachment/AttachmentList.tsx +26 -0
- package/lib/components/Attachment/attachmentLink.module.css +20 -0
- package/lib/components/Attachment/attachmentList.module.css +12 -0
- package/lib/components/Avatar/Avatar.tsx +83 -0
- package/lib/components/Avatar/AvatarGroup.stories.ts +66 -0
- package/lib/components/Avatar/AvatarGroup.tsx +60 -0
- package/lib/components/Avatar/avatar.module.css +61 -0
- package/lib/components/Avatar/avatar.stories.tsx +40 -0
- package/lib/components/Avatar/avatarGroup.module.css +78 -0
- package/lib/components/Avatar/color.ts +71 -0
- package/lib/components/Badge/Badge.stories.ts +32 -0
- package/lib/components/Badge/Badge.tsx +22 -0
- package/lib/components/Badge/badge.module.css +27 -0
- package/lib/components/Bookmarks/BookmarksList.tsx +17 -0
- package/lib/components/Bookmarks/BookmarksListItem.stories.tsx +79 -0
- package/lib/components/Bookmarks/BookmarksListItem.tsx +32 -0
- package/lib/components/Bookmarks/QueryLabel.tsx +33 -0
- package/lib/components/Bookmarks/queryLabel.module.css +45 -0
- package/lib/components/Button/Button.stories.ts +50 -0
- package/lib/components/Button/Button.tsx +60 -0
- package/lib/components/Button/ButtonBase.tsx +54 -0
- package/lib/components/Button/ButtonIcon.tsx +16 -0
- package/lib/components/Button/ButtonLabel.tsx +18 -0
- package/lib/components/Button/Buttons.stories.tsx +64 -0
- package/lib/components/Button/ComboButton.stories.ts +45 -0
- package/lib/components/Button/ComboButton.tsx +46 -0
- package/lib/components/Button/IconButton.stories.tsx +47 -0
- package/lib/components/Button/IconButton.tsx +33 -0
- package/lib/components/Button/button.module.css +22 -0
- package/lib/components/Button/buttonBase.module.css +142 -0
- package/lib/components/Button/buttonIcon.module.css +17 -0
- package/lib/components/Button/buttonLabel.module.css +17 -0
- package/lib/components/Button/comboButton.module.css +35 -0
- package/lib/components/Button/iconButton.module.css +31 -0
- package/lib/components/ContextMenu/ContextMenu.stories.ts +49 -0
- package/lib/components/ContextMenu/ContextMenu.tsx +20 -0
- package/lib/components/ContextMenu/ContextMenuBase.tsx +35 -0
- package/lib/components/ContextMenu/contextMenuBase.module.css +35 -0
- package/lib/components/Datepicker/Datepicker.tsx +49 -0
- package/lib/components/Datepicker/DatepickerBase.tsx +12 -0
- package/lib/components/Datepicker/DatepickerHeader.tsx +20 -0
- package/lib/components/Datepicker/DatepickerTable.tsx +50 -0
- package/lib/components/Datepicker/datepickerBase.module.css +5 -0
- package/lib/components/Datepicker/datepickerHeader.module.css +17 -0
- package/lib/components/Datepicker/datepickerTable.module.css +37 -0
- package/lib/components/Datepicker/useDatepicker.tsx +146 -0
- package/lib/components/Dialog/Dialog.stories.ts +331 -0
- package/lib/components/Dialog/Dialog.tsx +111 -0
- package/lib/components/Dialog/DialogActions.stories.ts +60 -0
- package/lib/components/Dialog/DialogActions.tsx +80 -0
- package/lib/components/Dialog/DialogActivityLog.tsx +18 -0
- package/lib/components/Dialog/DialogArticleBase.tsx +10 -0
- package/lib/components/Dialog/DialogAttachments.stories.ts +38 -0
- package/lib/components/Dialog/DialogAttachments.tsx +25 -0
- package/lib/components/Dialog/DialogBase.tsx +10 -0
- package/lib/components/Dialog/DialogBodyBase.tsx +17 -0
- package/lib/components/Dialog/DialogBorder.tsx +19 -0
- package/lib/components/Dialog/DialogContent.stories.ts +26 -0
- package/lib/components/Dialog/DialogContent.tsx +23 -0
- package/lib/components/Dialog/DialogFooter.tsx +14 -0
- package/lib/components/Dialog/DialogGroup.tsx +24 -0
- package/lib/components/Dialog/DialogHeader.stories.ts +24 -0
- package/lib/components/Dialog/DialogHeader.tsx +23 -0
- package/lib/components/Dialog/DialogHeaderBase.tsx +10 -0
- package/lib/components/Dialog/DialogHeadings.stories.ts +35 -0
- package/lib/components/Dialog/DialogHeadings.tsx +77 -0
- package/lib/components/Dialog/DialogHistory.stories.ts +67 -0
- package/lib/components/Dialog/DialogHistory.tsx +19 -0
- package/lib/components/Dialog/DialogList.stories.ts +65 -0
- package/lib/components/Dialog/DialogList.tsx +35 -0
- package/lib/components/Dialog/DialogListItem.stories.tsx +238 -0
- package/lib/components/Dialog/DialogListItem.tsx +126 -0
- package/lib/components/Dialog/DialogListItemBase.tsx +52 -0
- package/lib/components/Dialog/DialogMetadata.stories.ts +75 -0
- package/lib/components/Dialog/DialogMetadata.tsx +56 -0
- package/lib/components/Dialog/DialogNav.stories.ts +88 -0
- package/lib/components/Dialog/DialogNav.tsx +56 -0
- package/lib/components/Dialog/DialogSectionBase.tsx +20 -0
- package/lib/components/Dialog/DialogSeenBy.stories.tsx +56 -0
- package/lib/components/Dialog/DialogSeenBy.tsx +36 -0
- package/lib/components/Dialog/DialogSelect.tsx +23 -0
- package/lib/components/Dialog/DialogStatus.stories.ts +57 -0
- package/lib/components/Dialog/DialogStatus.tsx +61 -0
- package/lib/components/Dialog/DialogTitle.stories.ts +31 -0
- package/lib/components/Dialog/DialogTitle.tsx +31 -0
- package/lib/components/Dialog/DialogTouchedBy.stories.tsx +27 -0
- package/lib/components/Dialog/DialogTouchedBy.tsx +19 -0
- package/lib/components/Dialog/dialog.module.css +21 -0
- package/lib/components/Dialog/dialogAction.module.css +26 -0
- package/lib/components/Dialog/dialogArticleBase.module.css +5 -0
- package/lib/components/Dialog/dialogBodyBase.module.css +13 -0
- package/lib/components/Dialog/dialogBorder.module.css +42 -0
- package/lib/components/Dialog/dialogGroup.module.css +35 -0
- package/lib/components/Dialog/dialogHeaderBase.module.css +6 -0
- package/lib/components/Dialog/dialogHeadings.module.css +24 -0
- package/lib/components/Dialog/dialogHistory.module.css +12 -0
- package/lib/components/Dialog/dialogListItem.module.css +81 -0
- package/lib/components/Dialog/dialogListItemBase.module.css +28 -0
- package/lib/components/Dialog/dialogNav.module.css +12 -0
- package/lib/components/Dialog/dialogSectionBase.module.css +11 -0
- package/lib/components/Dialog/dialogSelect.module.css +34 -0
- package/lib/components/Dialog/dialogTitle.module.css +47 -0
- package/lib/components/Dropdown/Backdrop.tsx +12 -0
- package/lib/components/Dropdown/DrawerBase.tsx +20 -0
- package/lib/components/Dropdown/DrawerBody.tsx +12 -0
- package/lib/components/Dropdown/DrawerButton.tsx +17 -0
- package/lib/components/Dropdown/DrawerFooter.tsx +12 -0
- package/lib/components/Dropdown/DrawerHeader.tsx +19 -0
- package/lib/components/Dropdown/DrawerOrDropdown.tsx +29 -0
- package/lib/components/Dropdown/DropdownBase.tsx +32 -0
- package/lib/components/Dropdown/backdrop.module.css +11 -0
- package/lib/components/Dropdown/drawerBase.module.css +17 -0
- package/lib/components/Dropdown/drawerBody.module.css +5 -0
- package/lib/components/Dropdown/drawerButton.module.css +6 -0
- package/lib/components/Dropdown/drawerFooter.module.css +13 -0
- package/lib/components/Dropdown/drawerHeader.module.css +17 -0
- package/lib/components/Dropdown/drawerOrDropdown.module.css +19 -0
- package/lib/components/Dropdown/dropdownBase.module.css +35 -0
- package/{dist/components/Dropdown/index.d.ts → lib/components/Dropdown/index.ts} +1 -0
- package/lib/components/Footer/Footer.stories.ts +37 -0
- package/lib/components/Footer/Footer.tsx +21 -0
- package/lib/components/Footer/FooterAddress.tsx +12 -0
- package/lib/components/Footer/FooterBase.tsx +16 -0
- package/lib/components/Footer/FooterLogo.tsx +17 -0
- package/lib/components/Footer/FooterMenu.tsx +43 -0
- package/lib/components/Footer/footerAddress.module.css +8 -0
- package/lib/components/Footer/footerBase.module.css +28 -0
- package/lib/components/Footer/footerLogo.module.css +12 -0
- package/lib/components/Footer/footerMenu.module.css +35 -0
- package/lib/components/GlobalMenu/AccountButton.tsx +46 -0
- package/lib/components/GlobalMenu/AccountMenu.stories.tsx +65 -0
- package/lib/components/GlobalMenu/AccountMenu.tsx +82 -0
- package/lib/components/GlobalMenu/BackButton.tsx +10 -0
- package/lib/components/GlobalMenu/GlobalMenu.stories.tsx +181 -0
- package/lib/components/GlobalMenu/GlobalMenu.tsx +86 -0
- package/lib/components/GlobalMenu/GlobalMenuBase.tsx +22 -0
- package/lib/components/GlobalMenu/LogoutButton.tsx +19 -0
- package/lib/components/GlobalMenu/globalMenuBase.module.css +39 -0
- package/lib/components/GlobalMenu/logoutButton.module.css +9 -0
- package/lib/components/Header/DigdirLogomark.tsx +23 -0
- package/lib/components/Header/Header.stories.tsx +188 -0
- package/lib/components/Header/Header.tsx +71 -0
- package/lib/components/Header/HeaderBase.tsx +21 -0
- package/lib/components/Header/HeaderButton.stories.ts +70 -0
- package/lib/components/Header/HeaderButton.tsx +68 -0
- package/lib/components/Header/HeaderLogo.stories.ts +17 -0
- package/lib/components/Header/HeaderLogo.tsx +22 -0
- package/lib/components/Header/HeaderMenu.tsx +17 -0
- package/lib/components/Header/HeaderSearch.tsx +17 -0
- package/lib/components/Header/header.module.css +24 -0
- package/lib/components/Header/headerBase.module.css +51 -0
- package/lib/components/Header/headerButton.module.css +37 -0
- package/lib/components/Header/headerLogo.module.css +24 -0
- package/lib/components/Header/headerMenu.module.css +3 -0
- package/lib/components/Header/headerSearch.module.css +21 -0
- package/lib/components/Header/mobileMenu.module.css +28 -0
- package/lib/components/History/HistoryAttachments.tsx +22 -0
- package/lib/components/History/HistoryBorder.tsx +17 -0
- package/lib/components/History/HistoryItem.stories.ts +56 -0
- package/lib/components/History/HistoryItem.tsx +56 -0
- package/lib/components/History/HistoryList.stories.ts +72 -0
- package/lib/components/History/HistoryList.tsx +26 -0
- package/lib/components/History/historyBorder.module.css +8 -0
- package/lib/components/History/historyItem.module.css +19 -0
- package/lib/components/History/historyList.module.css +12 -0
- package/lib/components/Icon/CheckboxCheckedIcon.tsx +28 -0
- package/lib/components/Icon/CheckboxIcon.stories.ts +32 -0
- package/lib/components/Icon/CheckboxIcon.tsx +17 -0
- package/lib/components/Icon/CheckboxUncheckedIcon.tsx +38 -0
- package/lib/components/Icon/Icon.stories.ts +24 -0
- package/lib/components/Icon/Icon.tsx +23 -0
- package/lib/components/Icon/ProgressIcon.stories.ts +43 -0
- package/lib/components/Icon/ProgressIcon.tsx +44 -0
- package/lib/components/Icon/RadioCheckedIcon.tsx +29 -0
- package/lib/components/Icon/RadioIcon.stories.ts +32 -0
- package/lib/components/Icon/RadioIcon.tsx +17 -0
- package/lib/components/Icon/RadioUncheckedIcon.tsx +30 -0
- package/lib/components/Icon/SvgIcon.tsx +18 -0
- package/lib/components/Icon/__AkselIcon.tsx +37 -0
- package/lib/components/Icon/checkboxIcon.module.css +23 -0
- package/lib/components/Icon/icon.module.css +4 -0
- package/lib/components/Icon/iconsMap.tsx +2078 -0
- package/lib/components/Icon/progressIcon.module.css +29 -0
- package/lib/components/Icon/radioIcon.module.css +21 -0
- package/lib/components/Layout/Layout.stories.tsx +308 -0
- package/lib/components/Layout/Layout.tsx +46 -0
- package/lib/components/Layout/LayoutBase.stories.ts +17 -0
- package/lib/components/Layout/LayoutBase.tsx +31 -0
- package/lib/components/Layout/LayoutBody.stories.ts +17 -0
- package/lib/components/Layout/LayoutBody.tsx +16 -0
- package/lib/components/Layout/LayoutContent.stories.ts +17 -0
- package/lib/components/Layout/LayoutContent.tsx +15 -0
- package/lib/components/Layout/LayoutSidebar.stories.ts +17 -0
- package/lib/components/Layout/LayoutSidebar.tsx +23 -0
- package/lib/components/Layout/layoutBase.module.css +22 -0
- package/lib/components/Layout/layoutBody.module.css +15 -0
- package/lib/components/Layout/layoutContent.module.css +13 -0
- package/lib/components/Layout/layoutSidebar.module.css +20 -0
- package/lib/components/LayoutAction/ActionFooter.stories.tsx +70 -0
- package/lib/components/LayoutAction/ActionFooter.tsx +15 -0
- package/lib/components/LayoutAction/ActionHeader.stories.ts +20 -0
- package/lib/components/LayoutAction/ActionHeader.tsx +19 -0
- package/lib/components/LayoutAction/ActionMenu.stories.tsx +40 -0
- package/lib/components/LayoutAction/ActionMenu.tsx +23 -0
- package/lib/components/LayoutAction/actionFooter.module.css +28 -0
- package/lib/components/LayoutAction/actionHeader.module.css +55 -0
- package/lib/components/LayoutAction/actionMenu.module.css +30 -0
- package/lib/components/List/List.stories.tsx +43 -0
- package/lib/components/List/List.tsx +20 -0
- package/lib/components/List/ListBase.tsx +19 -0
- package/lib/components/List/ListItem.stories.tsx +208 -0
- package/lib/components/List/ListItem.tsx +73 -0
- package/lib/components/List/ListItemBase.tsx +82 -0
- package/lib/components/List/ListItemLabel.tsx +29 -0
- package/lib/components/List/ListItemMedia.tsx +59 -0
- package/lib/components/List/listBase.module.css +30 -0
- package/lib/components/List/listItemBase.module.css +97 -0
- package/lib/components/List/listItemLabel.module.css +55 -0
- package/lib/components/List/listItemMedia.module.css +41 -0
- package/lib/components/Menu/Menu.stories.ts +514 -0
- package/lib/components/Menu/Menu.tsx +24 -0
- package/lib/components/Menu/MenuBase.tsx +63 -0
- package/lib/components/Menu/MenuHeader.tsx +13 -0
- package/lib/components/Menu/MenuInputField.tsx +38 -0
- package/lib/components/Menu/MenuItem.stories.tsx +164 -0
- package/lib/components/Menu/MenuItem.tsx +63 -0
- package/lib/components/Menu/MenuItemBase.tsx +77 -0
- package/lib/components/Menu/MenuItemLabel.tsx +30 -0
- package/lib/components/Menu/MenuItemMedia.tsx +42 -0
- package/lib/components/Menu/MenuItems.stories.ts +438 -0
- package/lib/components/Menu/MenuItems.tsx +96 -0
- package/lib/components/Menu/MenuOption.stories.ts +52 -0
- package/lib/components/Menu/MenuOption.tsx +48 -0
- package/lib/components/Menu/MenuSearch.stories.ts +18 -0
- package/lib/components/Menu/MenuSearch.tsx +25 -0
- package/lib/components/Menu/menu.module.css +25 -0
- package/lib/components/Menu/menuBase.module.css +25 -0
- package/lib/components/Menu/menuHeader.module.css +12 -0
- package/lib/components/Menu/menuInputField.module.css +54 -0
- package/lib/components/Menu/menuItemBase.module.css +79 -0
- package/lib/components/Menu/menuItemLabel.module.css +32 -0
- package/lib/components/Menu/menuItemMedia.module.css +38 -0
- package/lib/components/Menu/menuOption.module.css +27 -0
- package/lib/components/Menu/menuSearch.module.css +30 -0
- package/lib/components/Meta/MetaBase.tsx +15 -0
- package/lib/components/Meta/MetaItem.stories.ts +25 -0
- package/lib/components/Meta/MetaItem.tsx +31 -0
- package/lib/components/Meta/MetaItemBase.tsx +46 -0
- package/lib/components/Meta/MetaItemLabel.tsx +20 -0
- package/lib/components/Meta/MetaItemMedia.tsx +22 -0
- package/lib/components/Meta/MetaList.stories.ts +29 -0
- package/lib/components/Meta/MetaList.tsx +43 -0
- package/lib/components/Meta/MetaProgress.stories.ts +29 -0
- package/lib/components/Meta/MetaProgress.tsx +26 -0
- package/lib/components/Meta/MetaTimestamp.stories.ts +33 -0
- package/lib/components/Meta/MetaTimestamp.tsx +29 -0
- package/lib/components/Meta/meta.module.css +6 -0
- package/lib/components/Meta/metaItem.module.css +107 -0
- package/lib/components/Meta/metaList.module.css +15 -0
- package/lib/components/Page/PageBase.tsx +14 -0
- package/lib/components/Page/PageHeader.tsx +25 -0
- package/lib/components/Page/PageHeaderMedia.tsx +25 -0
- package/lib/components/Page/PageNav.tsx +34 -0
- package/lib/components/Page/SectionBase.tsx +52 -0
- package/lib/components/Page/SectionFooter.tsx +15 -0
- package/lib/components/Page/SectionHeader.tsx +16 -0
- package/lib/components/Page/pageHeader.module.css +18 -0
- package/lib/components/Page/pageNav.module.css +12 -0
- package/lib/components/Page/sectionBase.module.css +92 -0
- package/lib/components/Page/sectionFooter.module.css +8 -0
- package/lib/components/Page/sectionHeader.module.css +9 -0
- package/lib/components/RootProvider/RootProvider.tsx +56 -0
- package/lib/components/Searchbar/Autocomplete.stories.tsx +77 -0
- package/lib/components/Searchbar/Autocomplete.tsx +44 -0
- package/lib/components/Searchbar/AutocompleteBase.tsx +16 -0
- package/lib/components/Searchbar/AutocompleteGroup.tsx +17 -0
- package/lib/components/Searchbar/AutocompleteItem.tsx +23 -0
- package/lib/components/Searchbar/SearchField.tsx +81 -0
- package/lib/components/Searchbar/Searchbar.stories.tsx +151 -0
- package/lib/components/Searchbar/Searchbar.tsx +26 -0
- package/lib/components/Searchbar/SearchbarBase.tsx +23 -0
- package/lib/components/Searchbar/autocompleteBase.module.css +17 -0
- package/lib/components/Searchbar/autocompleteGroup.module.css +3 -0
- package/lib/components/Searchbar/autocompleteItem.module.css +19 -0
- package/lib/components/Searchbar/searchField.module.css +54 -0
- package/lib/components/Searchbar/searchbarBase.module.css +20 -0
- package/lib/components/Snackbar/Snackbar.stories.tsx +21 -0
- package/lib/components/Snackbar/Snackbar.tsx +32 -0
- package/lib/components/Snackbar/SnackbarBase.tsx +39 -0
- package/lib/components/Snackbar/SnackbarLabel.tsx +10 -0
- package/lib/components/Snackbar/SnackbarMedia.tsx +14 -0
- package/lib/components/Snackbar/snackbarBase.module.css +55 -0
- package/lib/components/Snackbar/snackbarLabel.module.css +6 -0
- package/lib/components/Snackbar/snackbarMedia.module.css +10 -0
- package/lib/components/Toolbar/Toolbar.stories.tsx +188 -0
- package/lib/components/Toolbar/Toolbar.tsx +159 -0
- package/lib/components/Toolbar/ToolbarAdd.stories.ts +23 -0
- package/lib/components/Toolbar/ToolbarAdd.tsx +26 -0
- package/lib/components/Toolbar/ToolbarBase.tsx +12 -0
- package/lib/components/Toolbar/ToolbarButton.stories.ts +32 -0
- package/lib/components/Toolbar/ToolbarButton.tsx +65 -0
- package/lib/components/Toolbar/ToolbarDate.stories.ts +62 -0
- package/lib/components/Toolbar/ToolbarDaterange.stories.ts +24 -0
- package/lib/components/Toolbar/ToolbarDaterange.tsx +73 -0
- package/lib/components/Toolbar/ToolbarFilter.stories.ts +64 -0
- package/lib/components/Toolbar/ToolbarFilter.tsx +82 -0
- package/lib/components/Toolbar/ToolbarFilterBase.tsx +15 -0
- package/lib/components/Toolbar/ToolbarMenu.stories.ts +37 -0
- package/lib/components/Toolbar/ToolbarMenu.tsx +29 -0
- package/lib/components/Toolbar/ToolbarOptions.stories.ts +108 -0
- package/lib/components/Toolbar/ToolbarOptions.tsx +74 -0
- package/lib/components/Toolbar/ToolbarSearch.stories.ts +19 -0
- package/lib/components/Toolbar/ToolbarSearch.tsx +24 -0
- package/lib/components/Toolbar/toolbarBase.module.css +19 -0
- package/lib/components/Toolbar/toolbarButton.module.css +3 -0
- package/lib/components/Toolbar/toolbarDaterange.module.css +12 -0
- package/lib/components/Toolbar/toolbarFilterBase.module.css +7 -0
- package/lib/components/Toolbar/toolbarMenu.module.css +7 -0
- package/lib/components/Toolbar/toolbarSearch.module.css +28 -0
- package/lib/components/Typography/Heading.tsx +23 -0
- package/lib/components/Typography/Typography.tsx +24 -0
- package/lib/components/Typography/heading.module.css +21 -0
- package/lib/components/Typography/typography.module.css +64 -0
- package/lib/css/colors.css +113 -0
- package/lib/css/global.css +16 -0
- package/lib/css/shadows.css +7 -0
- package/lib/css/theme-article.css +15 -0
- package/lib/css/theme-company.css +15 -0
- package/lib/css/theme-global-dark.css +19 -0
- package/lib/css/theme-global.css +15 -0
- package/lib/css/theme-neutral.css +15 -0
- package/lib/css/theme-person.css +15 -0
- package/lib/css/theme.css +22 -0
- package/lib/hooks/useClickOutside.ts +22 -0
- package/lib/hooks/useEscapeKey.ts +17 -0
- package/lib/hooks/useMenu.tsx +81 -0
- package/lib/stories/Color/MenuItem.stories.tsx +43 -0
- package/lib/stories/Color/Swatches.stories.tsx +19 -0
- package/lib/stories/Color/Swatches.tsx +42 -0
- package/lib/stories/Color/colors.json +62 -0
- package/lib/stories/Color/swatches.module.css +14 -0
- package/lib/stories/Inbox/BookmarksPage.tsx +78 -0
- package/lib/stories/Inbox/DialogPage.tsx +15 -0
- package/lib/stories/Inbox/Inbox.stories.tsx +55 -0
- package/lib/stories/Inbox/Inbox.tsx +12 -0
- package/lib/stories/Inbox/InboxLayout.tsx +51 -0
- package/lib/stories/Inbox/InboxPage.tsx +51 -0
- package/lib/stories/Inbox/InboxProvider.tsx +136 -0
- package/lib/stories/Inbox/InboxSection.tsx +39 -0
- package/lib/stories/Inbox/InboxToolbar.tsx +94 -0
- package/lib/stories/Inbox/ProfilePage.tsx +36 -0
- package/lib/stories/Inbox/SettingsPage.tsx +19 -0
- package/lib/stories/Inbox/accounts/accounts.ts +24 -0
- package/lib/stories/Inbox/accounts/index.ts +1 -0
- package/lib/stories/Inbox/actionMenu.ts +24 -0
- package/lib/stories/Inbox/dialogs/brreg-completed.json +35 -0
- package/lib/stories/Inbox/dialogs/brreg-draft.json +41 -0
- package/lib/stories/Inbox/dialogs/enova-in-progress.json +35 -0
- package/lib/stories/Inbox/dialogs/index.ts +53 -0
- package/lib/stories/Inbox/dialogs/skatt-2023.json +33 -0
- package/lib/stories/Inbox/dialogs/sykmelding-referat.json +41 -0
- package/lib/stories/Inbox/groupBy.ts +19 -0
- package/lib/stories/Inbox/inboxSection.module.css +19 -0
- package/lib/stories/Inbox/index.ts +15 -0
- package/lib/stories/Inbox/layout/footer.ts +27 -0
- package/lib/stories/Inbox/layout/header.ts +11 -0
- package/lib/stories/Inbox/layout/index.ts +3 -0
- package/lib/stories/Inbox/layout/menu.ts +64 -0
- package/package.json +19 -27
- package/renovate.json +4 -0
- package/tsconfig.json +28 -0
- package/tsconfig.node.json +11 -0
- package/typings.d.ts +1 -0
- package/vite.config.ts +20 -0
- package/dist/components/Attachment/AttachmentLink.d.ts +0 -10
- package/dist/components/Attachment/AttachmentList.d.ts +0 -7
- package/dist/components/Avatar/Avatar.d.ts +0 -27
- package/dist/components/Avatar/AvatarGroup.d.ts +0 -20
- package/dist/components/Avatar/color.d.ts +0 -4
- package/dist/components/Badge/Badge.d.ts +0 -11
- package/dist/components/Bookmarks/BookmarksList.d.ts +0 -7
- package/dist/components/Bookmarks/BookmarksListItem.d.ts +0 -21
- package/dist/components/Bookmarks/QueryLabel.d.ts +0 -11
- package/dist/components/Button/Button.d.ts +0 -8
- package/dist/components/Button/ButtonBase.d.ts +0 -20
- package/dist/components/Button/ButtonIcon.d.ts +0 -7
- package/dist/components/Button/ButtonLabel.d.ts +0 -8
- package/dist/components/Button/ComboButton.d.ts +0 -10
- package/dist/components/Button/IconButton.d.ts +0 -14
- package/dist/components/ContextMenu/ContextMenu.d.ts +0 -8
- package/dist/components/ContextMenu/ContextMenuBase.d.ts +0 -9
- package/dist/components/Dialog/Dialog.d.ts +0 -54
- package/dist/components/Dialog/DialogActions.d.ts +0 -16
- package/dist/components/Dialog/DialogActivityLog.d.ts +0 -10
- package/dist/components/Dialog/DialogArticleBase.d.ts +0 -6
- package/dist/components/Dialog/DialogAttachments.d.ts +0 -6
- package/dist/components/Dialog/DialogBase.d.ts +0 -5
- package/dist/components/Dialog/DialogBodyBase.d.ts +0 -5
- package/dist/components/Dialog/DialogBorder.d.ts +0 -9
- package/dist/components/Dialog/DialogContent.d.ts +0 -9
- package/dist/components/Dialog/DialogFooter.d.ts +0 -4
- package/dist/components/Dialog/DialogGroup.d.ts +0 -6
- package/dist/components/Dialog/DialogHeader.d.ts +0 -10
- package/dist/components/Dialog/DialogHeaderBase.d.ts +0 -5
- package/dist/components/Dialog/DialogHeadings.d.ts +0 -24
- package/dist/components/Dialog/DialogHistory.d.ts +0 -6
- package/dist/components/Dialog/DialogList.d.ts +0 -7
- package/dist/components/Dialog/DialogListItem.d.ts +0 -59
- package/dist/components/Dialog/DialogListItemBase.d.ts +0 -28
- package/dist/components/Dialog/DialogMetadata.d.ts +0 -22
- package/dist/components/Dialog/DialogNav.d.ts +0 -21
- package/dist/components/Dialog/DialogSectionBase.d.ts +0 -6
- package/dist/components/Dialog/DialogSeenBy.d.ts +0 -19
- package/dist/components/Dialog/DialogSelect.d.ts +0 -10
- package/dist/components/Dialog/DialogStatus.d.ts +0 -25
- package/dist/components/Dialog/DialogTitle.d.ts +0 -20
- package/dist/components/Dialog/DialogTouchedBy.d.ts +0 -10
- package/dist/components/Dropdown/Backdrop.d.ts +0 -6
- package/dist/components/Dropdown/DrawerBase.d.ts +0 -9
- package/dist/components/Dropdown/DrawerBody.d.ts +0 -6
- package/dist/components/Dropdown/DrawerButton.d.ts +0 -7
- package/dist/components/Dropdown/DrawerFooter.d.ts +0 -6
- package/dist/components/Dropdown/DrawerHeader.d.ts +0 -7
- package/dist/components/Dropdown/DrawerOrDropdown.d.ts +0 -10
- package/dist/components/Dropdown/DropdownBase.d.ts +0 -10
- package/dist/components/Footer/Footer.d.ts +0 -6
- package/dist/components/Footer/FooterAddress.d.ts +0 -6
- package/dist/components/Footer/FooterBase.d.ts +0 -6
- package/dist/components/Footer/FooterLogo.d.ts +0 -5
- package/dist/components/Footer/FooterMenu.d.ts +0 -14
- package/dist/components/GlobalMenu/AccountButton.d.ts +0 -14
- package/dist/components/GlobalMenu/AccountMenu.d.ts +0 -20
- package/dist/components/GlobalMenu/BackButton.d.ts +0 -5
- package/dist/components/GlobalMenu/GlobalMenu.d.ts +0 -16
- package/dist/components/GlobalMenu/GlobalMenuBase.d.ts +0 -7
- package/dist/components/GlobalMenu/LogoutButton.d.ts +0 -7
- package/dist/components/Header/DigdirLogomark.d.ts +0 -5
- package/dist/components/Header/Header.d.ts +0 -9
- package/dist/components/Header/HeaderBase.d.ts +0 -9
- package/dist/components/Header/HeaderButton.d.ts +0 -15
- package/dist/components/Header/HeaderLogo.d.ts +0 -9
- package/dist/components/Header/HeaderMenu.d.ts +0 -7
- package/dist/components/Header/HeaderSearch.d.ts +0 -7
- package/dist/components/History/HistoryAttachments.d.ts +0 -6
- package/dist/components/History/HistoryBorder.d.ts +0 -7
- package/dist/components/History/HistoryItem.d.ts +0 -14
- package/dist/components/History/HistoryList.d.ts +0 -6
- package/dist/components/Icon/CheckboxCheckedIcon.d.ts +0 -8
- package/dist/components/Icon/CheckboxIcon.d.ts +0 -10
- package/dist/components/Icon/CheckboxUncheckedIcon.d.ts +0 -9
- package/dist/components/Icon/Icon.d.ts +0 -9
- package/dist/components/Icon/ProgressIcon.d.ts +0 -6
- package/dist/components/Icon/RadioCheckedIcon.d.ts +0 -8
- package/dist/components/Icon/RadioIcon.d.ts +0 -10
- package/dist/components/Icon/RadioUncheckedIcon.d.ts +0 -9
- package/dist/components/Icon/SvgIcon.d.ts +0 -9
- package/dist/components/Icon/iconsMap.d.ts +0 -1911
- package/dist/components/Layout/Layout.d.ts +0 -24
- package/dist/components/Layout/LayoutBase.d.ts +0 -21
- package/dist/components/Layout/LayoutBody.d.ts +0 -7
- package/dist/components/Layout/LayoutContent.d.ts +0 -7
- package/dist/components/Layout/LayoutSidebar.d.ts +0 -13
- package/dist/components/LayoutAction/ActionFooter.d.ts +0 -6
- package/dist/components/LayoutAction/ActionHeader.d.ts +0 -7
- package/dist/components/LayoutAction/ActionMenu.d.ts +0 -6
- package/dist/components/List/List.d.ts +0 -10
- package/dist/components/List/ListBase.d.ts +0 -9
- package/dist/components/List/ListItem.d.ts +0 -46
- package/dist/components/List/ListItemBase.d.ts +0 -27
- package/dist/components/List/ListItemLabel.d.ts +0 -9
- package/dist/components/List/ListItemMedia.d.ts +0 -14
- package/dist/components/Menu/Menu.d.ts +0 -8
- package/dist/components/Menu/MenuBase.d.ts +0 -27
- package/dist/components/Menu/MenuHeader.d.ts +0 -4
- package/dist/components/Menu/MenuInputField.d.ts +0 -12
- package/dist/components/Menu/MenuItem.d.ts +0 -35
- package/dist/components/Menu/MenuItemBase.d.ts +0 -23
- package/dist/components/Menu/MenuItemLabel.d.ts +0 -10
- package/dist/components/Menu/MenuItemMedia.d.ts +0 -14
- package/dist/components/Menu/MenuItems.d.ts +0 -17
- package/dist/components/Menu/MenuOption.d.ts +0 -19
- package/dist/components/Menu/MenuSearch.d.ts +0 -8
- package/dist/components/Meta/MetaBase.d.ts +0 -7
- package/dist/components/Meta/MetaItem.d.ts +0 -18
- package/dist/components/Meta/MetaItemBase.d.ts +0 -15
- package/dist/components/Meta/MetaItemLabel.d.ts +0 -11
- package/dist/components/Meta/MetaItemMedia.d.ts +0 -9
- package/dist/components/Meta/MetaList.d.ts +0 -12
- package/dist/components/Meta/MetaProgress.d.ts +0 -13
- package/dist/components/Meta/MetaTimestamp.d.ts +0 -16
- package/dist/components/Page/PageBase.d.ts +0 -6
- package/dist/components/Page/PageHeader.d.ts +0 -7
- package/dist/components/Page/PageHeaderMedia.d.ts +0 -10
- package/dist/components/Page/PageNav.d.ts +0 -14
- package/dist/components/Page/SectionBase.d.ts +0 -19
- package/dist/components/Page/SectionFooter.d.ts +0 -6
- package/dist/components/Page/SectionHeader.d.ts +0 -7
- package/dist/components/RootProvider/RootProvider.d.ts +0 -19
- package/dist/components/Searchbar/Autocomplete.d.ts +0 -9
- package/dist/components/Searchbar/AutocompleteBase.d.ts +0 -7
- package/dist/components/Searchbar/AutocompleteGroup.d.ts +0 -6
- package/dist/components/Searchbar/AutocompleteItem.d.ts +0 -13
- package/dist/components/Searchbar/SearchField.d.ts +0 -16
- package/dist/components/Searchbar/Searchbar.d.ts +0 -9
- package/dist/components/Searchbar/SearchbarBase.d.ts +0 -8
- package/dist/components/Snackbar/Snackbar.d.ts +0 -21
- package/dist/components/Snackbar/SnackbarBase.d.ts +0 -13
- package/dist/components/Snackbar/SnackbarLabel.d.ts +0 -5
- package/dist/components/Snackbar/SnackbarMedia.d.ts +0 -6
- package/dist/components/Toolbar/Toolbar.d.ts +0 -15
- package/dist/components/Toolbar/ToolbarAdd.d.ts +0 -10
- package/dist/components/Toolbar/ToolbarBase.d.ts +0 -7
- package/dist/components/Toolbar/ToolbarButton.d.ts +0 -14
- package/dist/components/Toolbar/ToolbarFilter.d.ts +0 -23
- package/dist/components/Toolbar/ToolbarFilterBase.d.ts +0 -6
- package/dist/components/Toolbar/ToolbarMenu.d.ts +0 -13
- package/dist/components/Toolbar/ToolbarOptions.d.ts +0 -18
- package/dist/components/Toolbar/ToolbarSearch.d.ts +0 -8
- package/dist/components/Typography/Heading.d.ts +0 -10
- package/dist/components/Typography/Typography.d.ts +0 -11
- package/dist/hooks/useClickOutside.d.ts +0 -2
- package/dist/hooks/useEscapeKey.d.ts +0 -1
- package/dist/hooks/useMenu.d.ts +0 -21
- package/dist/index.css +0 -1
- package/dist/index.es.js +0 -3340
- /package/{dist/components/Attachment/index.d.ts → lib/components/Attachment/index.ts} +0 -0
- /package/{dist/components/Avatar/index.d.ts → lib/components/Avatar/index.ts} +0 -0
- /package/{dist/components/Badge/index.d.ts → lib/components/Badge/index.tsx} +0 -0
- /package/{dist/components/Bookmarks/index.d.ts → lib/components/Bookmarks/index.ts} +0 -0
- /package/{dist/components/Button/index.d.ts → lib/components/Button/index.ts} +0 -0
- /package/{dist/components/ContextMenu/index.d.ts → lib/components/ContextMenu/index.ts} +0 -0
- /package/{dist/components/Datepicker/index.d.ts → lib/components/Datepicker/index.ts} +0 -0
- /package/{dist/components/Dialog/index.d.ts → lib/components/Dialog/index.ts} +0 -0
- /package/{dist/components/Footer/index.d.ts → lib/components/Footer/index.ts} +0 -0
- /package/{dist/components/GlobalMenu/index.d.ts → lib/components/GlobalMenu/index.tsx} +0 -0
- /package/{dist/components/Header/index.d.ts → lib/components/Header/index.tsx} +0 -0
- /package/{dist/components/History/index.d.ts → lib/components/History/index.ts} +0 -0
- /package/{dist/components/Icon/index.d.ts → lib/components/Icon/index.ts} +0 -0
- /package/{dist/components/Layout/index.d.ts → lib/components/Layout/index.tsx} +0 -0
- /package/{dist/components/LayoutAction/index.d.ts → lib/components/LayoutAction/index.ts} +0 -0
- /package/{dist/components/List/index.d.ts → lib/components/List/index.ts} +0 -0
- /package/{dist/components/Menu/index.d.ts → lib/components/Menu/index.ts} +0 -0
- /package/{dist/components/Meta/index.d.ts → lib/components/Meta/index.ts} +0 -0
- /package/{dist/components/Page/index.d.ts → lib/components/Page/index.ts} +0 -0
- /package/{dist/components/RootProvider/index.d.ts → lib/components/RootProvider/index.ts} +0 -0
- /package/{dist/components/Searchbar/index.d.ts → lib/components/Searchbar/index.ts} +0 -0
- /package/{dist/components/Snackbar/index.d.ts → lib/components/Snackbar/index.ts} +0 -0
- /package/{dist/components/Toolbar/index.d.ts → lib/components/Toolbar/index.ts} +0 -0
- /package/{dist/components/Typography/index.d.ts → lib/components/Typography/index.ts} +0 -0
- /package/{dist/components/index.d.ts → lib/components/index.ts} +0 -0
- /package/{dist/hooks/index.d.ts → lib/hooks/index.ts} +0 -0
- /package/{dist/index.d.ts → lib/index.ts} +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Fragment, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { DialogListItem } from './DialogListItem';
|
|
5
|
+
import { DialogStatusEnum } from './DialogStatus';
|
|
6
|
+
|
|
7
|
+
import { ListBase } from '../List';
|
|
8
|
+
import { MetaItem } from '../Meta';
|
|
9
|
+
|
|
10
|
+
const getStatusLabel = (value) => {
|
|
11
|
+
switch (value) {
|
|
12
|
+
case 'draft':
|
|
13
|
+
return 'Utkast';
|
|
14
|
+
case 'sent':
|
|
15
|
+
return 'Sendt';
|
|
16
|
+
case 'requires-attention':
|
|
17
|
+
return 'Krever handling';
|
|
18
|
+
case 'in-progress':
|
|
19
|
+
return 'Under arbeid';
|
|
20
|
+
case 'completed':
|
|
21
|
+
return 'Avsluttet';
|
|
22
|
+
default:
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const sizes = ['lg', 'md', 'sm', 'xs'];
|
|
28
|
+
const statuslist = Object.keys(DialogStatusEnum)?.map((value) => {
|
|
29
|
+
return {
|
|
30
|
+
value,
|
|
31
|
+
label: getStatusLabel(value),
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const meta = {
|
|
36
|
+
title: 'Dialog/DialogListItem',
|
|
37
|
+
component: DialogListItem,
|
|
38
|
+
tags: ['autodocs'],
|
|
39
|
+
parameters: {},
|
|
40
|
+
argTypes: {},
|
|
41
|
+
args: {
|
|
42
|
+
title: 'Title',
|
|
43
|
+
summary: 'Summary',
|
|
44
|
+
sender: {
|
|
45
|
+
type: 'company',
|
|
46
|
+
name: 'Sender name',
|
|
47
|
+
},
|
|
48
|
+
recipient: {
|
|
49
|
+
type: 'person',
|
|
50
|
+
name: 'Recipient name',
|
|
51
|
+
},
|
|
52
|
+
status: {
|
|
53
|
+
value: 'completed',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
} satisfies Meta<typeof DialogListItem>;
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
type Story = StoryObj<typeof meta>;
|
|
60
|
+
|
|
61
|
+
export const selectable: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
select: {
|
|
64
|
+
checked: false,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const selected: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
selected: true,
|
|
72
|
+
select: {
|
|
73
|
+
checked: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const seenByEndUser: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
seenByEndUser: true,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const TouchedBy: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
touchedBy: [
|
|
87
|
+
{
|
|
88
|
+
name: 'Lars',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'Trine',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const Draft: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
status: {
|
|
100
|
+
value: 'draft',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const Sent: Story = {
|
|
106
|
+
args: {
|
|
107
|
+
status: {
|
|
108
|
+
value: 'sent',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const RequiresAttention: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
status: {
|
|
116
|
+
value: 'requires-attention',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const InProgress: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
status: {
|
|
124
|
+
value: 'in-progress',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const Completed: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
status: {
|
|
132
|
+
value: 'completed',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const GroupedView: Story = {
|
|
138
|
+
args: {
|
|
139
|
+
grouped: true,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const LongSummary: Story = {
|
|
144
|
+
args: {
|
|
145
|
+
title: 'Long summary',
|
|
146
|
+
summary:
|
|
147
|
+
'Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit.\n\nCras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit.',
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const LongTitle: Story = {
|
|
152
|
+
args: {
|
|
153
|
+
title:
|
|
154
|
+
'Cras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit.',
|
|
155
|
+
summary: 'Short summary.',
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const SelectableSelected = (args) => {
|
|
160
|
+
const [items, setItems] = useState({
|
|
161
|
+
1: {
|
|
162
|
+
id: '1',
|
|
163
|
+
title: 'Item 1',
|
|
164
|
+
selected: true,
|
|
165
|
+
},
|
|
166
|
+
2: {
|
|
167
|
+
id: '2',
|
|
168
|
+
title: 'Item 2',
|
|
169
|
+
selected: false,
|
|
170
|
+
},
|
|
171
|
+
3: {
|
|
172
|
+
id: '3',
|
|
173
|
+
title: 'Item 2',
|
|
174
|
+
selected: false,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const onSelect = ({ id }) => {
|
|
179
|
+
setItems((prevState) => {
|
|
180
|
+
return {
|
|
181
|
+
...prevState,
|
|
182
|
+
[id]: {
|
|
183
|
+
...prevState[id],
|
|
184
|
+
selected: !prevState[id].selected,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<ListBase>
|
|
192
|
+
{Object.values(items)?.map((item) => {
|
|
193
|
+
return (
|
|
194
|
+
<Fragment key={item?.id}>
|
|
195
|
+
<DialogListItem
|
|
196
|
+
{...args}
|
|
197
|
+
title={item.title}
|
|
198
|
+
onClick={item.selected ? () => onSelect(item) : null}
|
|
199
|
+
selected={item.selected}
|
|
200
|
+
select={{ checked: item?.selected, onChange: () => onSelect(item) }}
|
|
201
|
+
/>
|
|
202
|
+
<MetaItem>selected:{item.selected ? 'true' : 'false'}</MetaItem>
|
|
203
|
+
</Fragment>
|
|
204
|
+
);
|
|
205
|
+
})}
|
|
206
|
+
</ListBase>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export const Statuses = (args) => {
|
|
211
|
+
return (
|
|
212
|
+
<ListBase>
|
|
213
|
+
{statuslist?.map((status) => {
|
|
214
|
+
return (
|
|
215
|
+
<Fragment key={status?.value}>
|
|
216
|
+
<DialogListItem {...args} status={status} />
|
|
217
|
+
<MetaItem>{status?.value}</MetaItem>
|
|
218
|
+
</Fragment>
|
|
219
|
+
);
|
|
220
|
+
})}
|
|
221
|
+
</ListBase>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export const Sizes = (args) => {
|
|
226
|
+
return (
|
|
227
|
+
<ListBase>
|
|
228
|
+
{sizes?.map((size) => {
|
|
229
|
+
return (
|
|
230
|
+
<Fragment key={size}>
|
|
231
|
+
<DialogListItem {...args} size={size} />
|
|
232
|
+
<MetaItem>{size}</MetaItem>
|
|
233
|
+
</Fragment>
|
|
234
|
+
);
|
|
235
|
+
})}
|
|
236
|
+
</ListBase>
|
|
237
|
+
);
|
|
238
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import { DialogHeadings, type DialogRecipientProps, type DialogSenderProps } from './DialogHeadings';
|
|
3
|
+
import type { DialogSelectProps } from './DialogSelect';
|
|
4
|
+
import type { DialogStatusProps } from './DialogStatus';
|
|
5
|
+
import { DialogTitle } from './DialogTitle';
|
|
6
|
+
import { DialogTouchedBy, type DialogTouchedByActor } from './DialogTouchedBy';
|
|
7
|
+
import styles from './dialogListItem.module.css';
|
|
8
|
+
|
|
9
|
+
import { DialogListItemBase, type DialogListItemSize, type DialogListItemVariant } from './DialogListItemBase';
|
|
10
|
+
|
|
11
|
+
import { DialogBorder } from './DialogBorder';
|
|
12
|
+
import { DialogMetadata } from './DialogMetadata';
|
|
13
|
+
import type { DialogSeenByProps } from './DialogSeenBy';
|
|
14
|
+
|
|
15
|
+
export type DialogListItemProps = {
|
|
16
|
+
/** Dialog title */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Render as */
|
|
19
|
+
as?: ElementType;
|
|
20
|
+
/** Size */
|
|
21
|
+
size?: DialogListItemSize;
|
|
22
|
+
/** Variant */
|
|
23
|
+
variant?: DialogListItemVariant;
|
|
24
|
+
/** Link */
|
|
25
|
+
href?: string;
|
|
26
|
+
/** Select: Use to support batch operations */
|
|
27
|
+
select?: DialogSelectProps;
|
|
28
|
+
/** Dialog is selected */
|
|
29
|
+
selected?: boolean;
|
|
30
|
+
/** Dialog status */
|
|
31
|
+
status?: DialogStatusProps;
|
|
32
|
+
/** Dialog sender */
|
|
33
|
+
sender?: DialogSenderProps;
|
|
34
|
+
/** Dialog Recipient */
|
|
35
|
+
recipient?: DialogRecipientProps;
|
|
36
|
+
/** Group view, show avatar for recipient */
|
|
37
|
+
grouped?: boolean;
|
|
38
|
+
/** Dialog summary */
|
|
39
|
+
summary?: string;
|
|
40
|
+
/** Updated datetime */
|
|
41
|
+
updatedAt?: string;
|
|
42
|
+
/** Updated at label */
|
|
43
|
+
updatedAtLabel?: string;
|
|
44
|
+
/** Dialog due date */
|
|
45
|
+
dueAt?: string;
|
|
46
|
+
/** Dialog due date label */
|
|
47
|
+
dueAtLabel?: string;
|
|
48
|
+
/** Dialog has been seen */
|
|
49
|
+
seen?: boolean;
|
|
50
|
+
/** Dialog is seen by the user */
|
|
51
|
+
seenBy?: DialogSeenByProps;
|
|
52
|
+
/** List of users that have touched the dialog */
|
|
53
|
+
touchedBy?: DialogTouchedByActor[];
|
|
54
|
+
/** Number of attachments */
|
|
55
|
+
attachmentsCount?: number;
|
|
56
|
+
/** OnClick handler */
|
|
57
|
+
onClick?: () => void;
|
|
58
|
+
/** Group id */
|
|
59
|
+
groupId?: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Represents a dialog in list view, displaying information such as the title,
|
|
64
|
+
* summary, sender, and receiver.
|
|
65
|
+
* to mark the item as checked/unchecked and can visually indicate if it is unread.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export const DialogListItem = ({
|
|
69
|
+
as = 'a',
|
|
70
|
+
size = 'lg',
|
|
71
|
+
variant = 'neutral',
|
|
72
|
+
href,
|
|
73
|
+
onClick,
|
|
74
|
+
select,
|
|
75
|
+
selected,
|
|
76
|
+
status,
|
|
77
|
+
sender,
|
|
78
|
+
recipient,
|
|
79
|
+
grouped,
|
|
80
|
+
updatedAt,
|
|
81
|
+
updatedAtLabel,
|
|
82
|
+
dueAt,
|
|
83
|
+
dueAtLabel,
|
|
84
|
+
seen = false,
|
|
85
|
+
seenBy,
|
|
86
|
+
touchedBy,
|
|
87
|
+
attachmentsCount,
|
|
88
|
+
title,
|
|
89
|
+
summary,
|
|
90
|
+
}: DialogListItemProps) => {
|
|
91
|
+
return (
|
|
92
|
+
<DialogListItemBase
|
|
93
|
+
as={as}
|
|
94
|
+
size={size}
|
|
95
|
+
href={href}
|
|
96
|
+
select={select}
|
|
97
|
+
selected={selected}
|
|
98
|
+
variant={variant}
|
|
99
|
+
onClick={onClick}
|
|
100
|
+
>
|
|
101
|
+
<DialogBorder className={styles.border} size={size} seen={seen}>
|
|
102
|
+
<header data-size={size} className={styles.header}>
|
|
103
|
+
<DialogTitle size={size} seen={seen} variant={variant}>
|
|
104
|
+
{title}
|
|
105
|
+
</DialogTitle>
|
|
106
|
+
<DialogHeadings size="xs" grouped={grouped} sender={sender} recipient={recipient} />
|
|
107
|
+
</header>
|
|
108
|
+
<p data-size={size} className={styles.summary}>
|
|
109
|
+
{summary}
|
|
110
|
+
</p>
|
|
111
|
+
<footer data-size={size} className={styles.footer}>
|
|
112
|
+
<DialogMetadata
|
|
113
|
+
status={status}
|
|
114
|
+
updatedAt={updatedAt}
|
|
115
|
+
updatedAtLabel={updatedAtLabel}
|
|
116
|
+
dueAt={dueAt}
|
|
117
|
+
dueAtLabel={dueAtLabel}
|
|
118
|
+
seenBy={seenBy}
|
|
119
|
+
attachmentsCount={attachmentsCount}
|
|
120
|
+
/>
|
|
121
|
+
{touchedBy && <DialogTouchedBy size="xs" touchedBy={touchedBy} className={styles.touchedBy} />}
|
|
122
|
+
</footer>
|
|
123
|
+
</DialogBorder>
|
|
124
|
+
</DialogListItemBase>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
2
|
+
import { DialogSelect, type DialogSelectProps } from './DialogSelect';
|
|
3
|
+
import styles from './dialogListItemBase.module.css';
|
|
4
|
+
|
|
5
|
+
export type DialogListItemVariant = 'neutral' | 'draft' | 'bin' | 'archive';
|
|
6
|
+
export type DialogListItemSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
|
|
8
|
+
export type DialogListItemBaseProps = {
|
|
9
|
+
/** Render as */
|
|
10
|
+
as?: ElementType;
|
|
11
|
+
/** Size */
|
|
12
|
+
size?: DialogListItemSize;
|
|
13
|
+
/** Link */
|
|
14
|
+
href?: string;
|
|
15
|
+
/** Select? Use to support batch operations */
|
|
16
|
+
select?: DialogSelectProps;
|
|
17
|
+
/** Dialog is selected */
|
|
18
|
+
selected?: boolean;
|
|
19
|
+
/** Children */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** Variant */
|
|
22
|
+
variant?: DialogListItemVariant;
|
|
23
|
+
/** OnClick handler */
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Represents a dialog in list view, displaying information such as the title,
|
|
29
|
+
* summary, sender, and receiver.
|
|
30
|
+
* to mark the item as checked/unchecked and can visually indicate if it is unread.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
export const DialogListItemBase = ({
|
|
34
|
+
as = 'a',
|
|
35
|
+
size,
|
|
36
|
+
href,
|
|
37
|
+
select,
|
|
38
|
+
selected,
|
|
39
|
+
children,
|
|
40
|
+
onClick,
|
|
41
|
+
}: DialogListItemBaseProps) => {
|
|
42
|
+
const Component = as || 'button';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<article className={styles.item} data-size={size} aria-selected={selected}>
|
|
46
|
+
<Component className={styles.link} data-size={size} href={href} onClick={onClick} tabIndex={0}>
|
|
47
|
+
{children}
|
|
48
|
+
</Component>
|
|
49
|
+
{select && <DialogSelect className={styles.select} {...select} />}
|
|
50
|
+
</article>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { DialogMetadata } from './DialogMetadata';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Dialog/DialogMetadata',
|
|
6
|
+
component: DialogMetadata,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {},
|
|
9
|
+
args: {
|
|
10
|
+
updatedAt: '1999-05-26',
|
|
11
|
+
updatedAtLabel: '26. mai 1999',
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta<typeof DialogMetadata>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
export const Draft: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
status: {
|
|
21
|
+
value: 'draft',
|
|
22
|
+
label: 'Utkast',
|
|
23
|
+
},
|
|
24
|
+
updatedAtLabel: 'Ole Gunnar Solskjær, 26. mai 1999',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Sent: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
status: {
|
|
31
|
+
value: 'sent',
|
|
32
|
+
label: 'Sendt',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const RequiresAttentionAndDueDate: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
status: {
|
|
40
|
+
value: 'requires-attention',
|
|
41
|
+
label: 'Krever handling',
|
|
42
|
+
},
|
|
43
|
+
attachmentsCount: 3,
|
|
44
|
+
dueAt: '2000-01-01',
|
|
45
|
+
dueAtLabel: 'Frist: 1. januar 2001',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const InProgressSeenByOthers: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
status: {
|
|
52
|
+
value: 'in-progress',
|
|
53
|
+
label: 'Under arbeid',
|
|
54
|
+
},
|
|
55
|
+
seenBy: {
|
|
56
|
+
seenByEndUser: false,
|
|
57
|
+
seenByOthersCount: 4,
|
|
58
|
+
label: 'Sett av 4',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const CompletedSeenByEndUser: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
status: {
|
|
66
|
+
value: 'completed',
|
|
67
|
+
label: 'Avsluttet',
|
|
68
|
+
},
|
|
69
|
+
seenBy: {
|
|
70
|
+
seenByEndUser: true,
|
|
71
|
+
seenByOthersCount: 0,
|
|
72
|
+
label: 'Sett av deg',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { MetaBase, MetaItem, MetaTimestamp } from '../Meta';
|
|
2
|
+
import { DialogSeenBy, type DialogSeenByProps } from './DialogSeenBy';
|
|
3
|
+
import { DialogStatus, type DialogStatusProps } from './DialogStatus';
|
|
4
|
+
|
|
5
|
+
export type DialogMetadataProps = {
|
|
6
|
+
/** Dialog status */
|
|
7
|
+
status?: DialogStatusProps;
|
|
8
|
+
/** Updated datetime */
|
|
9
|
+
updatedAt?: string;
|
|
10
|
+
/** Updated label */
|
|
11
|
+
updatedAtLabel?: string;
|
|
12
|
+
/** Due date */
|
|
13
|
+
dueAt?: string;
|
|
14
|
+
/** Due date label */
|
|
15
|
+
dueAtLabel?: string;
|
|
16
|
+
/** Who have seen the dialog after latest update */
|
|
17
|
+
seenBy?: DialogSeenByProps;
|
|
18
|
+
/** Number of attachments */
|
|
19
|
+
attachmentsCount?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Metadata for a dialog in list view.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const DialogMetadata = ({
|
|
27
|
+
status,
|
|
28
|
+
updatedAt,
|
|
29
|
+
updatedAtLabel,
|
|
30
|
+
dueAt,
|
|
31
|
+
dueAtLabel,
|
|
32
|
+
seenBy,
|
|
33
|
+
attachmentsCount = 0,
|
|
34
|
+
}: DialogMetadataProps) => {
|
|
35
|
+
return (
|
|
36
|
+
<MetaBase size="xs">
|
|
37
|
+
{status && <DialogStatus size="xs" {...status} />}
|
|
38
|
+
{updatedAt && (
|
|
39
|
+
<MetaTimestamp datetime={updatedAt} size="xs">
|
|
40
|
+
{updatedAtLabel}
|
|
41
|
+
</MetaTimestamp>
|
|
42
|
+
)}
|
|
43
|
+
{dueAt && dueAtLabel && (
|
|
44
|
+
<MetaTimestamp datetime={dueAt} size="xs" icon="clock-dashed">
|
|
45
|
+
{dueAtLabel}
|
|
46
|
+
</MetaTimestamp>
|
|
47
|
+
)}
|
|
48
|
+
{seenBy && <DialogSeenBy size="xs" {...seenBy} />}
|
|
49
|
+
{attachmentsCount > 0 && (
|
|
50
|
+
<MetaItem size="xs" icon="paperclip">
|
|
51
|
+
{attachmentsCount}
|
|
52
|
+
</MetaItem>
|
|
53
|
+
)}
|
|
54
|
+
</MetaBase>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { DialogNav } from './DialogNav';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Dialog/DialogNav',
|
|
6
|
+
component: DialogNav,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {},
|
|
9
|
+
args: {},
|
|
10
|
+
} satisfies Meta<typeof DialogNav>;
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
|
|
15
|
+
export const Draft: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
status: {
|
|
18
|
+
value: 'draft',
|
|
19
|
+
label: 'Utkast',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Sent: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
status: {
|
|
27
|
+
value: 'draft',
|
|
28
|
+
label: 'Utkast',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const RequiresAttention: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
status: {
|
|
36
|
+
value: 'requires-attention',
|
|
37
|
+
label: 'Utkast',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const InProgress: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
status: {
|
|
45
|
+
value: 'in-progress',
|
|
46
|
+
label: 'Utkast',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const ContextMenu: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
menu: {
|
|
54
|
+
items: [
|
|
55
|
+
{
|
|
56
|
+
id: '1',
|
|
57
|
+
groupId: '1',
|
|
58
|
+
icon: 'arrow-redo',
|
|
59
|
+
label: 'Del og gi tilgang',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: '2',
|
|
63
|
+
groupId: '1',
|
|
64
|
+
icon: 'eye-closed',
|
|
65
|
+
label: 'Marker som ny',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: '3',
|
|
69
|
+
groupId: '2',
|
|
70
|
+
icon: 'archive',
|
|
71
|
+
label: 'Flytt til arkiv',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: '4',
|
|
75
|
+
groupId: '2',
|
|
76
|
+
icon: 'trash',
|
|
77
|
+
label: 'Flytt til papirkurv',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: '5',
|
|
81
|
+
groupId: '3',
|
|
82
|
+
icon: 'clock-dashed',
|
|
83
|
+
label: 'Aktivitetslogg',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import type { ElementType } from 'react';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { ContextMenu, type ContextMenuProps } from '../ContextMenu';
|
|
5
|
+
import { MetaTimestamp } from '../Meta';
|
|
6
|
+
import { DialogStatus, type DialogStatusProps } from './DialogStatus';
|
|
7
|
+
import { DialogTouchedBy, type DialogTouchedByActor } from './DialogTouchedBy';
|
|
8
|
+
import styles from './dialogNav.module.css';
|
|
9
|
+
|
|
10
|
+
export interface DialogBackButtonProps {
|
|
11
|
+
as?: ElementType;
|
|
12
|
+
href?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DialogNavProps {
|
|
17
|
+
status?: DialogStatusProps;
|
|
18
|
+
dueAt?: string;
|
|
19
|
+
dueAtLabel?: string;
|
|
20
|
+
touchedBy?: DialogTouchedByActor[];
|
|
21
|
+
backButton?: DialogBackButtonProps;
|
|
22
|
+
menu?: ContextMenuProps;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Dialog navigation bar with Back button and possibly a context menu.
|
|
27
|
+
*/
|
|
28
|
+
export const DialogNav = ({
|
|
29
|
+
backButton = {
|
|
30
|
+
as: 'a',
|
|
31
|
+
label: 'Back',
|
|
32
|
+
},
|
|
33
|
+
status,
|
|
34
|
+
dueAt,
|
|
35
|
+
dueAtLabel,
|
|
36
|
+
touchedBy,
|
|
37
|
+
menu,
|
|
38
|
+
}: DialogNavProps) => {
|
|
39
|
+
return (
|
|
40
|
+
<nav className={styles.nav}>
|
|
41
|
+
<Button {...backButton} variant="text" color="secondary" icon="arrow-left" reverse>
|
|
42
|
+
{backButton?.label || 'Back'}
|
|
43
|
+
</Button>
|
|
44
|
+
<div className={styles.action}>
|
|
45
|
+
{dueAt && dueAtLabel && (
|
|
46
|
+
<MetaTimestamp datetime={dueAt} size="xs">
|
|
47
|
+
{dueAtLabel}
|
|
48
|
+
</MetaTimestamp>
|
|
49
|
+
)}
|
|
50
|
+
{status && <DialogStatus {...status} />}
|
|
51
|
+
{touchedBy && <DialogTouchedBy touchedBy={touchedBy} />}
|
|
52
|
+
{menu && <ContextMenu {...menu} />}
|
|
53
|
+
</div>
|
|
54
|
+
</nav>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import styles from './dialogSectionBase.module.css';
|
|
3
|
+
|
|
4
|
+
export interface DialogSectionBaseProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const DialogSectionBase = ({ title, children }: DialogSectionBaseProps) => {
|
|
10
|
+
if (!children) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<section className={styles.section}>
|
|
16
|
+
{title && <h2 className={styles.title}>{title}</h2>}
|
|
17
|
+
{children}
|
|
18
|
+
</section>
|
|
19
|
+
);
|
|
20
|
+
};
|