@altinn/altinn-components 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/StoryDecorator.tsx +27 -0
- package/.storybook/ThemeProvider.tsx +16 -0
- package/.storybook/main.ts +4 -5
- package/.storybook/preview.tsx +31 -29
- package/.storybook/storyDecorator.module.css +20 -0
- package/.storybook/theme.module.css +3 -0
- package/CHANGELOG.md +21 -0
- package/CONTRIBUTING.MD +59 -0
- package/README.md +33 -1
- package/lib/components/Attachment/AttachmentLink.stories.ts +21 -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/Attachment/index.ts +2 -0
- package/lib/components/Avatar/AvatarGroup.tsx +1 -0
- package/lib/components/Avatar/avatar.module.css +2 -0
- package/lib/components/Badge/Badge.stories.ts +32 -0
- package/lib/components/Badge/Badge.tsx +13 -10
- package/lib/components/Badge/badge.module.css +18 -27
- package/lib/components/Button/Button.stories.ts +6 -0
- package/lib/components/Button/Button.tsx +19 -1
- package/lib/components/Button/ButtonBase.tsx +1 -1
- package/lib/components/Button/button.module.css +0 -19
- package/lib/components/Button/buttonBase.module.css +30 -12
- package/lib/components/Button/comboButton.module.css +4 -2
- package/lib/components/ContextMenu/ContextMenu.tsx +28 -0
- package/lib/components/ContextMenu/contextMenu.module.css +35 -0
- package/lib/components/ContextMenu/index.ts +1 -0
- package/lib/components/Dialog/Dialog.stories.ts +320 -0
- package/lib/components/Dialog/Dialog.tsx +101 -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 +40 -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 +24 -0
- package/lib/components/Dialog/DialogFooter.tsx +14 -0
- package/lib/components/Dialog/DialogHeader.stories.ts +26 -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 +61 -0
- package/lib/components/Dialog/DialogList.tsx +20 -0
- package/lib/components/Dialog/DialogListItem.stories.tsx +238 -0
- package/lib/components/Dialog/DialogListItem.tsx +114 -0
- package/lib/components/Dialog/DialogListItemBase.tsx +50 -0
- package/lib/components/Dialog/DialogMetadata.stories.ts +77 -0
- package/lib/components/Dialog/DialogMetadata.tsx +56 -0
- package/lib/components/Dialog/DialogNav.stories.ts +90 -0
- package/lib/components/Dialog/DialogNav.tsx +60 -0
- package/lib/components/Dialog/DialogSectionBase.tsx +20 -0
- package/lib/components/Dialog/DialogSeenBy.stories.tsx +58 -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 +33 -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/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/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/Dialog/index.ts +24 -0
- package/lib/components/Header/GlobalMenu.tsx +1 -1
- package/lib/components/Header/Header.tsx +3 -3
- package/lib/components/Header/HeaderSearch.tsx +1 -1
- package/lib/components/History/HistoryBorder.tsx +17 -0
- package/lib/components/History/HistoryItem.stories.ts +47 -0
- package/lib/components/History/HistoryItem.tsx +64 -0
- package/lib/components/History/HistoryList.stories.ts +58 -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/History/index.ts +2 -0
- package/lib/components/Icon/CheckboxCheckedIcon.tsx +28 -0
- package/lib/components/Icon/CheckboxIcon.stories.ts +7 -0
- package/lib/components/Icon/CheckboxIcon.tsx +6 -18
- package/lib/components/Icon/CheckboxUncheckedIcon.tsx +38 -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 +7 -0
- package/lib/components/Icon/RadioIcon.tsx +7 -19
- package/lib/components/Icon/RadioUncheckedIcon.tsx +30 -0
- package/lib/components/Icon/checkboxIcon.module.css +2 -0
- package/lib/components/Icon/index.ts +1 -0
- package/lib/components/Icon/progressIcon.module.css +29 -0
- package/lib/components/Layout/Layout.stories.ts +0 -3
- 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 +70 -0
- package/lib/components/List/ListItemBase.tsx +62 -0
- package/lib/components/List/ListItemLabel.tsx +29 -0
- package/lib/components/List/ListItemMedia.tsx +59 -0
- package/lib/components/List/index.ts +6 -0
- package/lib/components/List/listBase.module.css +16 -0
- package/lib/components/List/listItemBase.module.css +86 -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 +46 -27
- package/lib/components/Menu/Menu.tsx +3 -3
- package/lib/components/Menu/MenuItem.stories.ts +12 -5
- package/lib/components/Menu/MenuItem.tsx +4 -3
- package/lib/components/Menu/MenuItemBase.tsx +7 -7
- package/lib/components/Menu/MenuItemLabel.tsx +4 -4
- package/lib/components/Menu/MenuItemMedia.tsx +2 -2
- package/lib/components/Menu/MenuOption.stories.ts +4 -2
- package/lib/components/Menu/MenuOption.tsx +4 -4
- package/lib/components/Menu/menuItemBase.module.css +72 -0
- package/lib/components/Menu/menuItemLabel.module.css +22 -0
- package/lib/components/Menu/menuItemMedia.module.css +36 -0
- package/lib/components/Menu/menuOption.module.css +6 -8
- package/lib/components/Menu/useClickOutside.ts +1 -0
- package/lib/components/Menu/useEscapeKey.ts +1 -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/index.ts +8 -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/Toolbar/ToolbarAdd.tsx +1 -1
- package/lib/components/Typography/Typography.tsx +21 -0
- package/lib/components/Typography/index.ts +1 -0
- package/lib/components/Typography/typography.module.css +56 -0
- package/lib/components/index.ts +14 -0
- package/lib/css/global.css +2 -0
- package/lib/css/shadows.css +7 -0
- package/lib/css/theme-article.css +15 -0
- package/lib/css/theme.css +5 -7
- package/package.json +4 -2
- package/renovate.json +1 -3
- package/.storybook/preview.css +0 -18
- /package/lib/components/Toolbar/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { DialogSeenBy } from './DialogSeenBy';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Dialog/Atoms/DialogSeenBy',
|
|
9
|
+
component: DialogSeenBy,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {},
|
|
12
|
+
args: {
|
|
13
|
+
seenByEndUser: true,
|
|
14
|
+
seenByOthersCount: 2,
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<typeof DialogSeenBy>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Unseen: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
seenByEndUser: false,
|
|
24
|
+
seenByOthersCount: 0,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const seenByEndUser: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
seenByEndUser: true,
|
|
31
|
+
seenByOthersCount: 0,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const seenByEndUserAndOthers: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
seenByEndUser: true,
|
|
38
|
+
seenByOthersCount: 10,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const ExampleLabel = ({ seenByEndUser, seenByOthersCount }) => {
|
|
43
|
+
let seen = false;
|
|
44
|
+
const seenByLabel = [];
|
|
45
|
+
|
|
46
|
+
if (seenByEndUser) {
|
|
47
|
+
seen = true;
|
|
48
|
+
seenByLabel.push('deg');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (seenByOthersCount) {
|
|
52
|
+
seen = true;
|
|
53
|
+
seenByLabel.push(seenByOthersCount);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const label = 'Sett av ' + seenByLabel.join('+');
|
|
57
|
+
return <DialogSeenBy seenByEndUser={seenByEndUser} seenByOthersCount={seenByOthersCount} label={label} />;
|
|
58
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ElementType, MouseEventHandler } from 'react';
|
|
2
|
+
import { MetaItem, type MetaItemSize } from '../Meta';
|
|
3
|
+
|
|
4
|
+
export interface DialogSeenByProps {
|
|
5
|
+
size?: MetaItemSize;
|
|
6
|
+
/** Dialog has been seen by current end user */
|
|
7
|
+
seenByEndUser?: boolean;
|
|
8
|
+
/** Dialog has been seen by other people */
|
|
9
|
+
seenByOthersCount?: number;
|
|
10
|
+
/** A label explaining that the dialog have been seen and by whom. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Render element as a link or button to display more informastion */
|
|
13
|
+
as?: ElementType;
|
|
14
|
+
onClick?: MouseEventHandler;
|
|
15
|
+
href?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Dialog seen by. Used to indicate if the dialog has been seen by end user or other users.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export const DialogSeenBy = ({
|
|
23
|
+
size = 'xs',
|
|
24
|
+
label = 'Seen by label',
|
|
25
|
+
seenByEndUser = false,
|
|
26
|
+
seenByOthersCount = 0,
|
|
27
|
+
...rest
|
|
28
|
+
}: DialogSeenByProps) => {
|
|
29
|
+
const seen = seenByEndUser || seenByOthersCount > 0;
|
|
30
|
+
const iconName = seen ? 'eye' : 'eye-closed';
|
|
31
|
+
return (
|
|
32
|
+
<MetaItem size={size} icon={iconName} {...rest}>
|
|
33
|
+
{label}
|
|
34
|
+
</MetaItem>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import cx from 'classnames';
|
|
2
|
+
import type { ChangeEventHandler } from 'react';
|
|
3
|
+
import { CheckboxIcon } from '../Icon/';
|
|
4
|
+
import styles from './dialogSelect.module.css';
|
|
5
|
+
|
|
6
|
+
export type DialogSelectProps = {
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
onChange?: ChangeEventHandler;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Dialog checkbox
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const DialogSelect = ({ checked = false, onChange, className }: DialogSelectProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<label className={cx(styles.label, className)}>
|
|
19
|
+
<input type="checkbox" checked={checked} onChange={onChange} className={styles.input} />
|
|
20
|
+
<CheckboxIcon hover={true} checked={checked} className={styles.icon} />
|
|
21
|
+
</label>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import { DialogStatus, DialogStatusEnum } from './DialogStatus';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Dialog/DialogStatus',
|
|
8
|
+
component: DialogStatus,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
value: {
|
|
15
|
+
options: Object.keys(DialogStatusEnum),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
args: {},
|
|
19
|
+
} satisfies Meta<typeof DialogStatus>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Draft: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
value: 'draft',
|
|
27
|
+
label: 'Utkast',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Sent: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
value: 'sent',
|
|
34
|
+
label: 'Sendt',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const RequiresAttention: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
value: 'requires-attention',
|
|
41
|
+
label: 'Krever handling',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const InProgress: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
value: 'in-progress',
|
|
48
|
+
label: 'Under arbeid',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Completed: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
value: 'completed',
|
|
55
|
+
label: 'Avsluttet',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { MetaItem, type MetaItemSize, MetaProgress } from '../Meta';
|
|
2
|
+
|
|
3
|
+
export enum DialogStatusEnum {
|
|
4
|
+
/** Used to indicate user-initiated dialogs not yet sent. */
|
|
5
|
+
draft = 'DRAFT',
|
|
6
|
+
/** Sent by the service owner. In a serial process, this is used after a submission is made. */
|
|
7
|
+
sent = 'SENT',
|
|
8
|
+
/** The dialogue is considered new. Typically used for simple messages that do not require any interaction, or as an initial step for dialogues. This is the default. */
|
|
9
|
+
new = 'NEW',
|
|
10
|
+
/** The dialogue was completed. This typically means that the dialogue is moved to a GUI archive or similar. */
|
|
11
|
+
completed = 'COMPLETED',
|
|
12
|
+
/** Started. In a serial process, this is used to indicate that, for example, a form filling is ongoing. */
|
|
13
|
+
'in-progress' = 'IN_PROGRESS',
|
|
14
|
+
/** Used to indicate that the dialogue is in progress/under work, but is in a state where the user must do something - for example, correct an error, or other conditions that hinder further processing. */
|
|
15
|
+
'requires-attention' = 'REQUIRES_ATTENTION',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type DialogStatusValue = keyof typeof DialogStatusEnum;
|
|
19
|
+
|
|
20
|
+
export interface DialogStatusProps {
|
|
21
|
+
size?: MetaItemSize;
|
|
22
|
+
value?: DialogStatusValue;
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Dialog status.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export const DialogStatus = ({ size = 'xs', value = 'new', label }: DialogStatusProps) => {
|
|
31
|
+
switch (value) {
|
|
32
|
+
case 'new':
|
|
33
|
+
return null;
|
|
34
|
+
case 'draft':
|
|
35
|
+
return (
|
|
36
|
+
<MetaItem size={size} variant="dotted">
|
|
37
|
+
{label || value}
|
|
38
|
+
</MetaItem>
|
|
39
|
+
);
|
|
40
|
+
case 'requires-attention':
|
|
41
|
+
return <MetaItem variant="solid">{label || value}</MetaItem>;
|
|
42
|
+
case 'in-progress':
|
|
43
|
+
return (
|
|
44
|
+
<MetaProgress size={size} variant="outline" progress={75}>
|
|
45
|
+
{label || value}
|
|
46
|
+
</MetaProgress>
|
|
47
|
+
);
|
|
48
|
+
case 'completed':
|
|
49
|
+
return (
|
|
50
|
+
<MetaProgress size={size} variant="outline" progress={100}>
|
|
51
|
+
{label || value}
|
|
52
|
+
</MetaProgress>
|
|
53
|
+
);
|
|
54
|
+
default:
|
|
55
|
+
return (
|
|
56
|
+
<MetaItem size={size} variant="outline">
|
|
57
|
+
{label || value}
|
|
58
|
+
</MetaItem>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import { DialogTitle } from './DialogTitle';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Dialog/DialogTitle',
|
|
8
|
+
component: DialogTitle,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {},
|
|
11
|
+
args: {
|
|
12
|
+
children: 'Title',
|
|
13
|
+
},
|
|
14
|
+
} satisfies Meta<typeof DialogTitle>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Default: Story = {
|
|
20
|
+
args: {},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Seen: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
variant: 'seen',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Trash: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
variant: 'trash',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Icon, type IconName } from '../Icon';
|
|
3
|
+
import type { DialogListItemVariant } from './DialogListItemBase';
|
|
4
|
+
import styles from './dialogTitle.module.css';
|
|
5
|
+
|
|
6
|
+
export type DialogTitleSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
|
|
8
|
+
export type DialogTitleProps = {
|
|
9
|
+
/** Variant */
|
|
10
|
+
variant: DialogListItemVariant;
|
|
11
|
+
/** Size */
|
|
12
|
+
size?: DialogTitleSize;
|
|
13
|
+
/** Variant */
|
|
14
|
+
seen?: boolean;
|
|
15
|
+
/** Display an icon next to title */
|
|
16
|
+
icon?: IconName;
|
|
17
|
+
/** Dialog title */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Dialog title
|
|
23
|
+
*/
|
|
24
|
+
export const DialogTitle = ({ size = 'sm', seen = false, variant, icon, children }: DialogTitleProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<h2 className={styles.title} data-seen={seen} data-size={size} data-variant={variant}>
|
|
27
|
+
<span>{children}</span>
|
|
28
|
+
{icon && <Icon name={icon} className={styles.icon} />}
|
|
29
|
+
</h2>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { DialogTouchedBy } from './DialogTouchedBy';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Dialog/Atoms/DialogTouchedBy',
|
|
6
|
+
component: DialogTouchedBy,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
parameters: {},
|
|
9
|
+
args: {
|
|
10
|
+
touchedBy: [
|
|
11
|
+
{
|
|
12
|
+
name: 'Donald Duck',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Pelle Khan',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Langbein',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof DialogTouchedBy>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AvatarGroup, type AvatarSize } from '../Avatar';
|
|
2
|
+
|
|
3
|
+
export interface DialogTouchedByActor {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface DialogTouchedByProps {
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
touchedBy?: DialogTouchedByActor[];
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DialogTouchedBy = ({ size = 'sm', touchedBy = [], className }: DialogTouchedByProps) => {
|
|
14
|
+
if (!touchedBy?.length) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return <AvatarGroup defaultType="person" items={touchedBy} size={size} className={className} />;
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.dialog {
|
|
2
|
+
background-color: var(--theme-background-default);
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
row-gap: 1.5em;
|
|
6
|
+
box-shadow: var(--ds-shadow-xs);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nav {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
padding: 0.5rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.header {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
row-gap: 1.5em;
|
|
20
|
+
margin-bottom: 1.5rem;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.action {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.comboButton {
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dropdown {
|
|
12
|
+
margin-top: 0.5rem;
|
|
13
|
+
padding: 0 0.5rem;
|
|
14
|
+
background-color: var(--neutral-background-default);
|
|
15
|
+
border-radius: 2px;
|
|
16
|
+
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dropdown[aria-expanded="true"] {
|
|
21
|
+
display: block;
|
|
22
|
+
position: absolute;
|
|
23
|
+
min-width: 256px;
|
|
24
|
+
left: 0;
|
|
25
|
+
z-index: 2;
|
|
26
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.border {
|
|
2
|
+
border-left: 0.25rem solid;
|
|
3
|
+
border-color: var(--theme-surface-active);
|
|
4
|
+
/*
|
|
5
|
+
padding-left: 1rem;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
*/
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.border[data-seen="true"] {
|
|
12
|
+
border-color: var(--neutral-surface-default);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
|
|
17
|
+
.border[data-size="sm"][data-status="draft"] {
|
|
18
|
+
border-color: transparent;
|
|
19
|
+
padding-left: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.border[data-size="sm"] {
|
|
23
|
+
row-gap: 1rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.border[data-size="lg"] {
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
padding-left: 1.5rem;
|
|
29
|
+
padding-top: 0;
|
|
30
|
+
padding-bottom: 1.5rem;
|
|
31
|
+
margin-left: 1rem;
|
|
32
|
+
row-gap: 1.5rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.border[data-size="lg"][data-status="draft"] {
|
|
36
|
+
border: 1px dashed;
|
|
37
|
+
border-color: var(--theme-text-subtle);
|
|
38
|
+
padding: 1.5rem;
|
|
39
|
+
margin-left: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.headings {
|
|
2
|
+
display: flex;
|
|
3
|
+
column-gap: 0.5em;
|
|
4
|
+
align-items: center;
|
|
5
|
+
font-size: 16px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.headings[data-size="xs"] {
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.headings[data-size="sm"] {
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.text {
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
color: var(--neutral-text-subtle);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sender {
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
color: var(--neutral-text-default);
|
|
24
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.border {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
text-decoration: none;
|
|
6
|
+
row-gap: 1rem;
|
|
7
|
+
padding-left: 1rem;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.header {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
row-gap: 0.25rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.summary {
|
|
17
|
+
font-size: 1rem;
|
|
18
|
+
line-height: 1.35;
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
-webkit-line-clamp: 2;
|
|
23
|
+
line-clamp: 2;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
color: var(--neutral-text-subtle);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.footer {
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.touchedBy {
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: 0;
|
|
37
|
+
bottom: 0;
|
|
38
|
+
margin: 8px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* medium */
|
|
42
|
+
|
|
43
|
+
.border[data-size="md"] {
|
|
44
|
+
padding-left: 0.75rem;
|
|
45
|
+
row-gap: 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.summary[data-size="md"] {
|
|
49
|
+
font-size: 1rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.summary[data-size="md"] {
|
|
53
|
+
font-size: 1rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* sizes */
|
|
57
|
+
|
|
58
|
+
.link[data-size="xs"],
|
|
59
|
+
.link[data-size="sm"] {
|
|
60
|
+
padding: 0.5rem 0.75rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.summary[data-size="xs"],
|
|
64
|
+
.summary[data-size="sm"] {
|
|
65
|
+
font-size: 0.875rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.header[data-size="xs"],
|
|
69
|
+
.header[data-size="sm"] {
|
|
70
|
+
row-gap: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.footer[data-size="xs"] {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.border[data-size="xs"],
|
|
78
|
+
.border[data-size="sm"] {
|
|
79
|
+
padding-left: 0.75rem;
|
|
80
|
+
row-gap: 0.25rem;
|
|
81
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
position: relative;
|
|
3
|
+
background-color: var(--theme-background-default);
|
|
4
|
+
position: relative;
|
|
5
|
+
box-shadow: var(--ds-shadow-xs);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.item[aria-selected="true"] {
|
|
9
|
+
background-color: var(--theme-background-subtle);
|
|
10
|
+
outline: 1px solid;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.link {
|
|
14
|
+
display: flex;
|
|
15
|
+
padding: 1rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.item[aria-selected="false"] .link:hover {
|
|
19
|
+
outline: 2px solid;
|
|
20
|
+
outline-color: var(--global-base-default);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.select {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
right: 0;
|
|
27
|
+
margin: 0.375rem;
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.label {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
background-color: transparent;
|
|
6
|
+
padding: .75rem;
|
|
7
|
+
border-radius: 50%;
|
|
8
|
+
border: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.label:hover {
|
|
12
|
+
background-color: var(--theme-surface-default);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.input {
|
|
16
|
+
position: absolute;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.icon {
|
|
21
|
+
font-size: 1.25rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.icon {
|
|
25
|
+
color: var(--theme-base-default);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.icon [data-hover="true"] {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.label:hover [data-hover="true"] {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|