@iota/apps-ui-kit 0.2.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/CHANGELOG.md +20 -0
- package/dist/index.d.ts +1622 -0
- package/dist/index.es.js +8805 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +198 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +5 -2
- package/src/lib/components/atoms/badge/Badge.tsx +37 -0
- package/src/lib/components/atoms/badge/badge.classes.ts +24 -0
- package/src/lib/components/atoms/badge/badge.enums.ts +8 -0
- package/src/lib/components/atoms/badge/index.ts +6 -0
- package/src/lib/components/atoms/button/Button.tsx +99 -0
- package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +23 -0
- package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +27 -0
- package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +11 -0
- package/src/lib/components/atoms/button/button-variants/index.ts +5 -0
- package/src/lib/components/atoms/button/button.classes.ts +53 -0
- package/src/lib/components/atoms/button/button.enums.ts +21 -0
- package/src/lib/components/atoms/button/index.ts +7 -0
- package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +86 -0
- package/src/lib/components/atoms/button-segment/buttonSegment.classes.ts +45 -0
- package/src/lib/components/atoms/button-segment/buttonSegment.enums.ts +7 -0
- package/src/lib/components/atoms/button-segment/index.ts +5 -0
- package/src/lib/components/atoms/checkbox/Checkbox.tsx +114 -0
- package/src/lib/components/atoms/checkbox/index.ts +4 -0
- package/src/lib/components/atoms/divider/Divider.tsx +48 -0
- package/src/lib/components/atoms/divider/divider.classes.ts +11 -0
- package/src/lib/components/atoms/divider/divider.enums.ts +7 -0
- package/src/lib/components/atoms/divider/index.ts +6 -0
- package/src/lib/components/atoms/header/Header.tsx +73 -0
- package/src/lib/components/atoms/header/index.ts +4 -0
- package/src/lib/components/atoms/index.ts +22 -0
- package/src/lib/components/atoms/info-box/InfoBox.tsx +73 -0
- package/src/lib/components/atoms/info-box/index.ts +5 -0
- package/src/lib/components/atoms/info-box/infoBox.classes.ts +14 -0
- package/src/lib/components/atoms/info-box/infoBox.enums.ts +12 -0
- package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +156 -0
- package/src/lib/components/atoms/key-value-info/index.ts +6 -0
- package/src/lib/components/atoms/key-value-info/keyValue.enums.ts +7 -0
- package/src/lib/components/atoms/label-text/LabelText.tsx +93 -0
- package/src/lib/components/atoms/label-text/index.ts +5 -0
- package/src/lib/components/atoms/label-text/labelText.classes.ts +22 -0
- package/src/lib/components/atoms/label-text/labelText.enums.ts +8 -0
- package/src/lib/components/atoms/list-item/ListItem.tsx +89 -0
- package/src/lib/components/atoms/list-item/index.ts +4 -0
- package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +38 -0
- package/src/lib/components/atoms/loading-indicator/index.ts +4 -0
- package/src/lib/components/atoms/panel/Panel.tsx +30 -0
- package/src/lib/components/atoms/panel/index.ts +4 -0
- package/src/lib/components/atoms/placeholder/Placeholder.tsx +27 -0
- package/src/lib/components/atoms/placeholder/index.ts +4 -0
- package/src/lib/components/atoms/radio-button/RadioButton.tsx +68 -0
- package/src/lib/components/atoms/radio-button/index.ts +4 -0
- package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +28 -0
- package/src/lib/components/atoms/secondary-text/index.ts +4 -0
- package/src/lib/components/atoms/skeleton/Skeleton.tsx +47 -0
- package/src/lib/components/atoms/skeleton/index.ts +4 -0
- package/src/lib/components/atoms/snackbar/Snackbar.tsx +69 -0
- package/src/lib/components/atoms/snackbar/index.ts +5 -0
- package/src/lib/components/atoms/snackbar/snackbar.classes.ts +14 -0
- package/src/lib/components/atoms/snackbar/snackbar.enums.tsx +7 -0
- package/src/lib/components/atoms/tooltip/Tooltip.tsx +34 -0
- package/src/lib/components/atoms/tooltip/index.ts +5 -0
- package/src/lib/components/atoms/tooltip/tooltip.classes.ts +11 -0
- package/src/lib/components/atoms/tooltip/tooltip.enums.ts +9 -0
- package/src/lib/components/atoms/visual-asset-card/VisualAssetCard.tsx +93 -0
- package/src/lib/components/atoms/visual-asset-card/index.ts +5 -0
- package/src/lib/components/atoms/visual-asset-card/visualAssetCard.enums.ts +7 -0
- package/src/lib/components/index.ts +8 -0
- package/src/lib/components/molecules/account/Account.tsx +174 -0
- package/src/lib/components/molecules/account/index.ts +4 -0
- package/src/lib/components/molecules/address/Address.tsx +101 -0
- package/src/lib/components/molecules/address/index.ts +4 -0
- package/src/lib/components/molecules/card/Card.tsx +70 -0
- package/src/lib/components/molecules/card/CardAction.tsx +78 -0
- package/src/lib/components/molecules/card/CardBody.tsx +61 -0
- package/src/lib/components/molecules/card/CardImage.tsx +43 -0
- package/src/lib/components/molecules/card/CardImagePlaceholder.tsx +146 -0
- package/src/lib/components/molecules/card/card.classes.ts +26 -0
- package/src/lib/components/molecules/card/card.enums.ts +25 -0
- package/src/lib/components/molecules/card/index.ts +8 -0
- package/src/lib/components/molecules/chip/Chip.tsx +105 -0
- package/src/lib/components/molecules/chip/chip.classes.ts +32 -0
- package/src/lib/components/molecules/chip/chip.enums.ts +7 -0
- package/src/lib/components/molecules/chip/index.ts +4 -0
- package/src/lib/components/molecules/display-stats/DisplayStats.tsx +104 -0
- package/src/lib/components/molecules/display-stats/displayStats.classes.ts +36 -0
- package/src/lib/components/molecules/display-stats/displayStats.enums.ts +13 -0
- package/src/lib/components/molecules/display-stats/index.ts +5 -0
- package/src/lib/components/molecules/dropdown/Dropdown.tsx +10 -0
- package/src/lib/components/molecules/dropdown/dropdownPosition.enums.ts +7 -0
- package/src/lib/components/molecules/dropdown/index.ts +5 -0
- package/src/lib/components/molecules/index.ts +17 -0
- package/src/lib/components/molecules/input/Input.tsx +245 -0
- package/src/lib/components/molecules/input/InputWrapper.tsx +97 -0
- package/src/lib/components/molecules/input/TextArea.tsx +149 -0
- package/src/lib/components/molecules/input/index.ts +8 -0
- package/src/lib/components/molecules/input/input.classes.ts +14 -0
- package/src/lib/components/molecules/input/input.enums.ts +14 -0
- package/src/lib/components/molecules/input/input.types.ts +29 -0
- package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +48 -0
- package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +65 -0
- package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +54 -0
- package/src/lib/components/molecules/navbar-item/index.ts +5 -0
- package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +16 -0
- package/src/lib/components/molecules/navbar-item/navbarItem.enums.ts +7 -0
- package/src/lib/components/molecules/search/Search.tsx +189 -0
- package/src/lib/components/molecules/search/index.ts +5 -0
- package/src/lib/components/molecules/search/search.classes.ts +20 -0
- package/src/lib/components/molecules/search/search.enums.ts +7 -0
- package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +34 -0
- package/src/lib/components/molecules/segmented-button/index.ts +6 -0
- package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +12 -0
- package/src/lib/components/molecules/segmented-button/segmentedButton.enums.ts +8 -0
- package/src/lib/components/molecules/select/Select.tsx +223 -0
- package/src/lib/components/molecules/select/index.ts +5 -0
- package/src/lib/components/molecules/select/select.enums.ts +7 -0
- package/src/lib/components/molecules/table-cell/TableCell.tsx +62 -0
- package/src/lib/components/molecules/table-cell/index.ts +4 -0
- package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +126 -0
- package/src/lib/components/molecules/table-header-cell/index.ts +5 -0
- package/src/lib/components/molecules/table-header-cell/tableHeaderCell.enums.ts +7 -0
- package/src/lib/components/molecules/title/Title.tsx +69 -0
- package/src/lib/components/molecules/title/index.ts +5 -0
- package/src/lib/components/molecules/title/titleClasses.constants.ts +14 -0
- package/src/lib/components/molecules/title/titleSize.enums.ts +7 -0
- package/src/lib/components/organisms/accordion/Accordion.tsx +111 -0
- package/src/lib/components/organisms/accordion/accordion.classes.ts +4 -0
- package/src/lib/components/organisms/accordion/index.ts +4 -0
- package/src/lib/components/organisms/dialog/Dialog.tsx +122 -0
- package/src/lib/components/organisms/dialog/dialog.enums.ts +7 -0
- package/src/lib/components/organisms/dialog/index.ts +5 -0
- package/src/lib/components/organisms/index.ts +7 -0
- package/src/lib/components/organisms/navbar/Navbar.tsx +100 -0
- package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +58 -0
- package/src/lib/components/organisms/navbar/index.ts +5 -0
- package/src/lib/components/organisms/table/Table.tsx +224 -0
- package/src/lib/components/organisms/table/TableContext.tsx +55 -0
- package/src/lib/components/organisms/table/index.ts +4 -0
- package/src/lib/constants/colors.constants.ts +127 -0
- package/src/lib/constants/index.ts +4 -0
- package/src/lib/enums/index.ts +4 -0
- package/src/lib/enums/screenSize.enums.ts +9 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/styles/fonts.css +5 -0
- package/src/lib/styles/index.css +136 -0
- package/src/lib/tailwind/base.presets.ts +47 -0
- package/src/lib/tailwind/constants/fontSizes.constants.ts +201 -0
- package/src/lib/tailwind/constants/index.ts +6 -0
- package/src/lib/tailwind/constants/scaling.constants.ts +41 -0
- package/src/lib/tailwind/constants/variableSpacing.constants.ts +66 -0
- package/src/lib/tailwind/helpers.ts +20 -0
- package/src/lib/tailwind/index.ts +5 -0
- package/src/lib/tailwind/responsive.presets.ts +36 -0
- package/src/lib/tailwind/static.presets.ts +25 -0
- package/src/lib/tailwind/types.ts +6 -0
- package/src/lib/utils/format.ts +8 -0
- package/src/lib/utils/index.ts +4 -0
- package/src/storybook/blocks/Showcase.tsx +20 -0
- package/src/storybook/blocks/TypeSet.tsx +34 -0
- package/src/storybook/blocks/TypeSetItem.tsx +74 -0
- package/src/storybook/blocks/index.ts +6 -0
- package/src/storybook/constants/index.ts +5 -0
- package/src/storybook/constants/typeset.constants.ts +39 -0
- package/src/storybook/constants/variableSpacing.constants.ts +6 -0
- package/src/storybook/helpers/getFontSizeLabel.ts +15 -0
- package/src/storybook/helpers/index.ts +4 -0
- package/src/storybook/stories/atoms/Badge.stories.tsx +32 -0
- package/src/storybook/stories/atoms/Button.stories.tsx +45 -0
- package/src/storybook/stories/atoms/ButtonSegment.stories.tsx +45 -0
- package/src/storybook/stories/atoms/Checkbox.stories.tsx +34 -0
- package/src/storybook/stories/atoms/CustomScrollbar.stories.tsx +22 -0
- package/src/storybook/stories/atoms/Divider.stories.tsx +41 -0
- package/src/storybook/stories/atoms/Header.stories.tsx +58 -0
- package/src/storybook/stories/atoms/InfoBox.stories.tsx +67 -0
- package/src/storybook/stories/atoms/KeyValueInfo.stories.tsx +59 -0
- package/src/storybook/stories/atoms/LabelText.stories.tsx +55 -0
- package/src/storybook/stories/atoms/ListItem.stories.tsx +41 -0
- package/src/storybook/stories/atoms/LoadingIndicator.stories.tsx +32 -0
- package/src/storybook/stories/atoms/Panel.stories.tsx +36 -0
- package/src/storybook/stories/atoms/Placeholder.stories.tsx +33 -0
- package/src/storybook/stories/atoms/RadioButton.stories.tsx +51 -0
- package/src/storybook/stories/atoms/Skeleton.stories.tsx +33 -0
- package/src/storybook/stories/atoms/Snackbar.stories.tsx +42 -0
- package/src/storybook/stories/atoms/Tooltip.stories.tsx +57 -0
- package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +56 -0
- package/src/storybook/stories/components/VariableSpacingShowcase.tsx +46 -0
- package/src/storybook/stories/components/index.ts +4 -0
- package/src/storybook/stories/design-tokens/colors.stories.mdx +23 -0
- package/src/storybook/stories/design-tokens/icons.stories.mdx +17 -0
- package/src/storybook/stories/design-tokens/typeset.stories.mdx +15 -0
- package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +10 -0
- package/src/storybook/stories/molecules/Account.stories.tsx +69 -0
- package/src/storybook/stories/molecules/Address.stories.tsx +39 -0
- package/src/storybook/stories/molecules/Card.stories.tsx +115 -0
- package/src/storybook/stories/molecules/Chip.stories.tsx +122 -0
- package/src/storybook/stories/molecules/DisplayStats.stories.tsx +63 -0
- package/src/storybook/stories/molecules/Dropdown.stories.tsx +38 -0
- package/src/storybook/stories/molecules/Input.stories.tsx +161 -0
- package/src/storybook/stories/molecules/NavbarItem.stories.tsx +45 -0
- package/src/storybook/stories/molecules/Search.stories.tsx +100 -0
- package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +107 -0
- package/src/storybook/stories/molecules/Select.stories.tsx +102 -0
- package/src/storybook/stories/molecules/TableCell.stories.tsx +46 -0
- package/src/storybook/stories/molecules/TableHeaderCell.stories.tsx +34 -0
- package/src/storybook/stories/molecules/TextArea.stories.tsx +80 -0
- package/src/storybook/stories/molecules/Title.stories.tsx +76 -0
- package/src/storybook/stories/organisms/Accordion.stories.tsx +70 -0
- package/src/storybook/stories/organisms/Dialog.stories.tsx +103 -0
- package/src/storybook/stories/organisms/Navbar.stories.tsx +77 -0
- package/src/storybook/stories/organisms/Table.stories.tsx +154 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
import { Snackbar, SnackbarProps, SnackbarType, Button } from '@/components/atoms';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<SnackbarProps> = {
|
|
9
|
+
component: Snackbar,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
} satisfies Meta<typeof Snackbar>;
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Default: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
type: SnackbarType.Default,
|
|
20
|
+
text: 'Test message',
|
|
21
|
+
showClose: false,
|
|
22
|
+
duration: 2000,
|
|
23
|
+
},
|
|
24
|
+
argTypes: {},
|
|
25
|
+
render: (props) => {
|
|
26
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
27
|
+
|
|
28
|
+
const onClose = () => {
|
|
29
|
+
setIsOpen(false);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<Button
|
|
35
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
36
|
+
text={isOpen ? 'Close Snackbar' : 'Open Snackbar'}
|
|
37
|
+
/>
|
|
38
|
+
{isOpen && <Snackbar {...props} onClose={onClose} />}
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Tooltip, TooltipPosition } from '@/lib/components';
|
|
5
|
+
import { Info } from '@iota/apps-ui-icons';
|
|
6
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Tooltip> = {
|
|
9
|
+
component: Tooltip,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
render: (props) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="flex h-20 items-center p-sm">
|
|
14
|
+
<Tooltip {...props}>
|
|
15
|
+
<span className="text-neutral-10 dark:text-neutral-92">Hover me</span>
|
|
16
|
+
</Tooltip>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof Tooltip>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
text: 'This is a tooltip',
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
text: {
|
|
32
|
+
control: {
|
|
33
|
+
type: 'text',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
position: {
|
|
37
|
+
control: {
|
|
38
|
+
type: 'select',
|
|
39
|
+
options: Object.values(TooltipPosition),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const WithIcon: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
text: 'This is a tooltip',
|
|
48
|
+
position: TooltipPosition.Right,
|
|
49
|
+
},
|
|
50
|
+
render: (props) => {
|
|
51
|
+
return (
|
|
52
|
+
<Tooltip {...props}>
|
|
53
|
+
<Info className="text-neutral-10 dark:text-neutral-92" />
|
|
54
|
+
</Tooltip>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { VisualAssetCard, VisualAssetType } from '@/components';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof VisualAssetCard> = {
|
|
8
|
+
component: VisualAssetCard,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
render: (props) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="w-64">
|
|
13
|
+
<VisualAssetCard {...props} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof VisualAssetCard>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
assetSrc: 'https://d315pvdvxi2gex.cloudfront.net/528399e23c1bb7b14cced0b89.png',
|
|
26
|
+
altText: 'IOTA Logo',
|
|
27
|
+
onIconClick: () => {
|
|
28
|
+
console.log('Icon clicked');
|
|
29
|
+
},
|
|
30
|
+
onClick: () => {
|
|
31
|
+
console.log('Card clicked');
|
|
32
|
+
},
|
|
33
|
+
assetTitle: 'IOTA Logo',
|
|
34
|
+
},
|
|
35
|
+
argTypes: {
|
|
36
|
+
assetSrc: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
},
|
|
39
|
+
altText: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
},
|
|
42
|
+
icon: {
|
|
43
|
+
control: 'none',
|
|
44
|
+
},
|
|
45
|
+
onIconClick: {
|
|
46
|
+
control: 'none',
|
|
47
|
+
},
|
|
48
|
+
assetType: { control: 'select', options: Object.values(VisualAssetType) },
|
|
49
|
+
onClick: {
|
|
50
|
+
control: 'none',
|
|
51
|
+
},
|
|
52
|
+
assetTitle: {
|
|
53
|
+
control: 'text',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Button } from '@/lib';
|
|
5
|
+
import { Showcase } from '@/storybook/blocks';
|
|
6
|
+
import { VARIABLE_GAP_CLASSES, VARIABLE_PADDING_CLASSES } from '@/storybook/constants';
|
|
7
|
+
|
|
8
|
+
export function VariableSpacingShowcase() {
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex flex-col gap-10">
|
|
11
|
+
<p className="text-headline-sm text-neutral-10">
|
|
12
|
+
The variable spacing changes based on the screen size.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<DocumentedBlock title="Gap">
|
|
16
|
+
{VARIABLE_GAP_CLASSES.map((value) => (
|
|
17
|
+
<Showcase key={value} title={value}>
|
|
18
|
+
<div className={`flex flex-row ${value}`}>
|
|
19
|
+
<Button text="Button 1" />
|
|
20
|
+
<Button text="Button 2" />
|
|
21
|
+
</div>
|
|
22
|
+
</Showcase>
|
|
23
|
+
))}
|
|
24
|
+
</DocumentedBlock>
|
|
25
|
+
|
|
26
|
+
<DocumentedBlock title="Padding">
|
|
27
|
+
{VARIABLE_PADDING_CLASSES.map((value) => (
|
|
28
|
+
<Showcase key={value} title={value}>
|
|
29
|
+
<div className={`flex flex-row ${value}`}>
|
|
30
|
+
<Button text="Button 1" />
|
|
31
|
+
</div>
|
|
32
|
+
</Showcase>
|
|
33
|
+
))}
|
|
34
|
+
</DocumentedBlock>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function DocumentedBlock({ title, children }: React.PropsWithChildren<{ title: string }>) {
|
|
40
|
+
return (
|
|
41
|
+
<div className="flex flex-col gap-y-4">
|
|
42
|
+
<h2 className="text-headline-md text-neutral-10">{title}</h2>
|
|
43
|
+
<div className="flex flex-row flex-wrap gap-10">{children}</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
|
|
2
|
+
import {
|
|
3
|
+
IOTA_PRIMITIVES_COLOR_PALETTE,
|
|
4
|
+
SHADER_COLOR_PALETTE,
|
|
5
|
+
} from '../../../lib/constants/colors.constants';
|
|
6
|
+
|
|
7
|
+
<Meta title="Design Tokens/Colors" />
|
|
8
|
+
|
|
9
|
+
## Primitives
|
|
10
|
+
|
|
11
|
+
<ColorPalette>
|
|
12
|
+
{Object.entries(IOTA_PRIMITIVES_COLOR_PALETTE).map(([color, values]) => {
|
|
13
|
+
return <ColorItem key={color} title={color} colors={values} />;
|
|
14
|
+
})}
|
|
15
|
+
</ColorPalette>
|
|
16
|
+
|
|
17
|
+
## Shaders
|
|
18
|
+
|
|
19
|
+
<ColorPalette>
|
|
20
|
+
{Object.entries(SHADER_COLOR_PALETTE).map(([color, values]) => {
|
|
21
|
+
return <ColorItem key={color} title={color} colors={values} />;
|
|
22
|
+
})}
|
|
23
|
+
</ColorPalette>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, Title, IconGallery, IconItem } from '@storybook/blocks';
|
|
3
|
+
import * as Icons from '@iota/apps-ui-icons';
|
|
4
|
+
|
|
5
|
+
<Meta title="Design Tokens/Icon Gallery" />
|
|
6
|
+
|
|
7
|
+
# Icon Gallery
|
|
8
|
+
|
|
9
|
+
<br />
|
|
10
|
+
|
|
11
|
+
<IconGallery>
|
|
12
|
+
{Object.keys(Icons).map((icon) => (
|
|
13
|
+
<IconItem key={icon} name={icon}>
|
|
14
|
+
{React.createElement(Icons[icon])}
|
|
15
|
+
</IconItem>
|
|
16
|
+
))}
|
|
17
|
+
</IconGallery>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Meta, Typeset, Unstyled } from '@storybook/blocks';
|
|
2
|
+
import { TYPESETS } from '../../constants';
|
|
3
|
+
import { TypeSet, TypeSetItem } from '../../blocks';
|
|
4
|
+
|
|
5
|
+
<Meta title="Design Tokens/Typesets" />
|
|
6
|
+
|
|
7
|
+
# Typesets
|
|
8
|
+
|
|
9
|
+
<Unstyled>
|
|
10
|
+
<div className="flex flex-col gap-y-12">
|
|
11
|
+
{TYPESETS.map((typeset, typeSetIndex) => (
|
|
12
|
+
<TypeSet key={typeSetIndex} {...typeset} />
|
|
13
|
+
))}
|
|
14
|
+
</div>
|
|
15
|
+
</Unstyled>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Account, BadgeType } from '@/components';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Account> = {
|
|
9
|
+
component: Account,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
render: (props) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="w-1/2">
|
|
14
|
+
<Account {...props} />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof Account>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
const Avatar = ({ isLocked }: { isLocked?: boolean }) => {
|
|
25
|
+
const circleFillClass = isLocked ? 'fill-neutral-80 dark:fill-neutral-30' : 'fill-primary-30';
|
|
26
|
+
return (
|
|
27
|
+
<svg
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
width="33"
|
|
30
|
+
height="32"
|
|
31
|
+
viewBox="0 0 33 32"
|
|
32
|
+
fill="none"
|
|
33
|
+
>
|
|
34
|
+
<circle cx="16.5" cy="16" r="16" className={cx(circleFillClass)} />
|
|
35
|
+
</svg>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
title: 'Account',
|
|
42
|
+
subtitle: '0x0d7...3f37',
|
|
43
|
+
isLocked: true,
|
|
44
|
+
avatarContent: Avatar,
|
|
45
|
+
},
|
|
46
|
+
argTypes: {
|
|
47
|
+
badgeType: {
|
|
48
|
+
control: 'select',
|
|
49
|
+
options: Object.values(BadgeType),
|
|
50
|
+
},
|
|
51
|
+
isLocked: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
},
|
|
54
|
+
onOptionsClick: {
|
|
55
|
+
action: 'onOptionsClick',
|
|
56
|
+
control: 'none',
|
|
57
|
+
},
|
|
58
|
+
onLockAccountClick: {
|
|
59
|
+
action: 'onLockAccount',
|
|
60
|
+
control: 'none',
|
|
61
|
+
},
|
|
62
|
+
avatarContent: {
|
|
63
|
+
control: 'none',
|
|
64
|
+
},
|
|
65
|
+
badgeText: {
|
|
66
|
+
control: 'text',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { Address } from '@/components';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Address> = {
|
|
9
|
+
component: Address,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
render: (props) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="flex flex-col items-start gap-2">
|
|
14
|
+
<Address {...props} />
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof Address>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
text: '0x0d7...3f37',
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
text: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
},
|
|
32
|
+
isCopyable: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
isExternal: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { IotaLogoSmall } from '@iota/apps-ui-icons';
|
|
6
|
+
import {
|
|
7
|
+
Card,
|
|
8
|
+
CardProps,
|
|
9
|
+
CardImage,
|
|
10
|
+
CardImageProps,
|
|
11
|
+
CardAction,
|
|
12
|
+
CardBody,
|
|
13
|
+
CardBodyProps,
|
|
14
|
+
CardActionProps,
|
|
15
|
+
CardActionType,
|
|
16
|
+
CardType,
|
|
17
|
+
ImageType,
|
|
18
|
+
ImageShape,
|
|
19
|
+
} from '@/components';
|
|
20
|
+
|
|
21
|
+
type CardCustomProps = CardProps & {
|
|
22
|
+
imageType: CardImageProps['type'];
|
|
23
|
+
imageUrl: CardImageProps['url'];
|
|
24
|
+
imageVariant: CardImageProps['shape'];
|
|
25
|
+
textTitle: CardBodyProps['title'];
|
|
26
|
+
textSubtitle: CardBodyProps['subtitle'];
|
|
27
|
+
actionTitle: CardActionProps['title'];
|
|
28
|
+
actionSubtitle: CardActionProps['subtitle'];
|
|
29
|
+
actionType: CardActionProps['type'];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const meta: Meta<CardCustomProps> = {
|
|
33
|
+
component: Card,
|
|
34
|
+
tags: ['autodocs'],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof meta>;
|
|
40
|
+
|
|
41
|
+
const COMMON_ARG_TYPES = {
|
|
42
|
+
imageType: {
|
|
43
|
+
control: 'select',
|
|
44
|
+
options: Object.values(ImageType),
|
|
45
|
+
},
|
|
46
|
+
imageVariant: {
|
|
47
|
+
control: 'select',
|
|
48
|
+
options: Object.values(ImageShape),
|
|
49
|
+
},
|
|
50
|
+
actionType: {
|
|
51
|
+
control: 'select',
|
|
52
|
+
options: Object.values(CardActionType),
|
|
53
|
+
},
|
|
54
|
+
onClick: {
|
|
55
|
+
action: 'clicked',
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const COMMON_ARGS = {
|
|
60
|
+
textTitle: 'Card Title',
|
|
61
|
+
textSubtitle: 'Card Subtitle',
|
|
62
|
+
actionTitle: 'Action title',
|
|
63
|
+
actionSubtitle: 'Action subtitle',
|
|
64
|
+
actionType: CardActionType.Link,
|
|
65
|
+
variant: CardType.Default,
|
|
66
|
+
isDisabled: false,
|
|
67
|
+
imageVariant: ImageShape.Rounded,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Default: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
...COMMON_ARGS,
|
|
73
|
+
imageType: ImageType.Placeholder,
|
|
74
|
+
imageUrl: 'https://via.placeholder.com/150.png',
|
|
75
|
+
},
|
|
76
|
+
argTypes: COMMON_ARG_TYPES,
|
|
77
|
+
render: (args) => {
|
|
78
|
+
return (
|
|
79
|
+
<Card isDisabled={args.isDisabled} type={args.type} onClick={args.onClick}>
|
|
80
|
+
<CardImage type={args.imageType} shape={args.imageVariant} url={args.imageUrl} />
|
|
81
|
+
<CardBody title={args.textTitle} subtitle={args.textSubtitle} />
|
|
82
|
+
<CardAction
|
|
83
|
+
title={args.actionTitle}
|
|
84
|
+
subtitle={args.actionSubtitle}
|
|
85
|
+
type={args.actionType}
|
|
86
|
+
onClick={args.onClick}
|
|
87
|
+
/>
|
|
88
|
+
</Card>
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const WithIcon: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
...COMMON_ARGS,
|
|
96
|
+
imageType: ImageType.BgSolid,
|
|
97
|
+
},
|
|
98
|
+
argTypes: COMMON_ARG_TYPES,
|
|
99
|
+
render: (args) => {
|
|
100
|
+
return (
|
|
101
|
+
<Card isDisabled={args.isDisabled} type={args.type} onClick={args.onClick}>
|
|
102
|
+
<CardImage type={args.imageType} shape={args.imageVariant} url={args.imageUrl}>
|
|
103
|
+
<IotaLogoSmall />
|
|
104
|
+
</CardImage>
|
|
105
|
+
<CardBody title={args.textTitle} subtitle={args.textSubtitle} />
|
|
106
|
+
<CardAction
|
|
107
|
+
title={args.actionTitle}
|
|
108
|
+
subtitle={args.actionSubtitle}
|
|
109
|
+
type={args.actionType}
|
|
110
|
+
onClick={args.onClick}
|
|
111
|
+
/>
|
|
112
|
+
</Card>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
import { Chip } from '@/components/molecules/chip/Chip';
|
|
7
|
+
import { PlaceholderReplace } from '@iota/apps-ui-icons';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Chip> = {
|
|
10
|
+
component: Chip,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
render: (props) => {
|
|
13
|
+
return (
|
|
14
|
+
<div className="flex">
|
|
15
|
+
<Chip {...props} />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
},
|
|
19
|
+
} satisfies Meta<typeof Chip>;
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
label: 'Label',
|
|
28
|
+
},
|
|
29
|
+
argTypes: {
|
|
30
|
+
label: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
},
|
|
33
|
+
showClose: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
},
|
|
36
|
+
selected: {
|
|
37
|
+
control: 'boolean',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const WithIcon: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
label: 'Label',
|
|
45
|
+
leadingElement: <PlaceholderReplace />,
|
|
46
|
+
},
|
|
47
|
+
render: (props) => {
|
|
48
|
+
return (
|
|
49
|
+
<div className="flex flex-row gap-x-4">
|
|
50
|
+
<Chip {...props} />
|
|
51
|
+
<Chip {...props} showClose />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithAvatar: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
label: 'Label',
|
|
60
|
+
avatar: <Avatar />,
|
|
61
|
+
},
|
|
62
|
+
render: (props) => {
|
|
63
|
+
return (
|
|
64
|
+
<div className="flex flex-row gap-x-4">
|
|
65
|
+
<Chip {...props} />
|
|
66
|
+
<Chip {...props} showClose />
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function Avatar() {
|
|
73
|
+
return (
|
|
74
|
+
<svg
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
width="24"
|
|
77
|
+
height="24"
|
|
78
|
+
viewBox="0 0 24 24"
|
|
79
|
+
fill="none"
|
|
80
|
+
>
|
|
81
|
+
<circle cx="12" cy="12" r="12" fill="#0101FF" />
|
|
82
|
+
<circle
|
|
83
|
+
cx="12"
|
|
84
|
+
cy="12"
|
|
85
|
+
r="12"
|
|
86
|
+
fill="url(#paint0_linear_288_11913)"
|
|
87
|
+
fill-opacity="0.2"
|
|
88
|
+
/>
|
|
89
|
+
<circle
|
|
90
|
+
cx="12"
|
|
91
|
+
cy="12"
|
|
92
|
+
r="12"
|
|
93
|
+
fill="url(#paint1_linear_288_11913)"
|
|
94
|
+
fill-opacity="0.2"
|
|
95
|
+
/>
|
|
96
|
+
<defs>
|
|
97
|
+
<linearGradient
|
|
98
|
+
id="paint0_linear_288_11913"
|
|
99
|
+
x1="12"
|
|
100
|
+
y1="0"
|
|
101
|
+
x2="17.7143"
|
|
102
|
+
y2="13.4286"
|
|
103
|
+
gradientUnits="userSpaceOnUse"
|
|
104
|
+
>
|
|
105
|
+
<stop offset="0.990135" stop-opacity="0" />
|
|
106
|
+
<stop offset="1" />
|
|
107
|
+
</linearGradient>
|
|
108
|
+
<linearGradient
|
|
109
|
+
id="paint1_linear_288_11913"
|
|
110
|
+
x1="12"
|
|
111
|
+
y1="0"
|
|
112
|
+
x2="6.85714"
|
|
113
|
+
y2="5.42857"
|
|
114
|
+
gradientUnits="userSpaceOnUse"
|
|
115
|
+
>
|
|
116
|
+
<stop offset="0.9999" stop-opacity="0" />
|
|
117
|
+
<stop offset="1" />
|
|
118
|
+
</linearGradient>
|
|
119
|
+
</defs>
|
|
120
|
+
</svg>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright (c) 2024 IOTA Stiftung
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { DisplayStats, TooltipPosition, DisplayStatsType, DisplayStatsSize } from '@/components';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof DisplayStats> = {
|
|
8
|
+
component: DisplayStats,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
render: (props) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="w-1/3">
|
|
13
|
+
<DisplayStats {...props} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
},
|
|
17
|
+
} satisfies Meta<typeof DisplayStats>;
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
label: 'Label',
|
|
26
|
+
value: 'Value',
|
|
27
|
+
supportingLabel: 'IOTA',
|
|
28
|
+
tooltipText: 'Tooltip',
|
|
29
|
+
type: DisplayStatsType.Default,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
label: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
},
|
|
35
|
+
tooltipText: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
},
|
|
38
|
+
tooltipPosition: {
|
|
39
|
+
control: {
|
|
40
|
+
type: 'select',
|
|
41
|
+
options: Object.values(TooltipPosition),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
value: {
|
|
45
|
+
control: 'text',
|
|
46
|
+
},
|
|
47
|
+
supportingLabel: {
|
|
48
|
+
control: 'text',
|
|
49
|
+
},
|
|
50
|
+
type: {
|
|
51
|
+
control: {
|
|
52
|
+
type: 'select',
|
|
53
|
+
options: Object.values(DisplayStatsType),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
control: {
|
|
58
|
+
type: 'select',
|
|
59
|
+
options: Object.values(DisplayStatsSize),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|