@iota/apps-ui-kit 0.0.0-experimental-20250613144451

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/LICENSE +201 -0
  3. package/README.md +16 -0
  4. package/dist/index.d.ts +1726 -0
  5. package/dist/index.es.js +6923 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/dist/index.umd.js +118 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/style.css +1 -0
  10. package/package.json +75 -0
  11. package/src/lib/components/atoms/badge/Badge.tsx +37 -0
  12. package/src/lib/components/atoms/badge/badge.classes.ts +33 -0
  13. package/src/lib/components/atoms/badge/badge.enums.ts +11 -0
  14. package/src/lib/components/atoms/badge/index.ts +6 -0
  15. package/src/lib/components/atoms/button/Button.tsx +99 -0
  16. package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +23 -0
  17. package/src/lib/components/atoms/button/button-variants/ButtonUnstyled.tsx +27 -0
  18. package/src/lib/components/atoms/button/button-variants/buttonVariants.types.ts +11 -0
  19. package/src/lib/components/atoms/button/button-variants/index.ts +5 -0
  20. package/src/lib/components/atoms/button/button.classes.ts +53 -0
  21. package/src/lib/components/atoms/button/button.enums.ts +21 -0
  22. package/src/lib/components/atoms/button/index.ts +7 -0
  23. package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +98 -0
  24. package/src/lib/components/atoms/button-segment/buttonSegment.classes.ts +45 -0
  25. package/src/lib/components/atoms/button-segment/buttonSegment.enums.ts +7 -0
  26. package/src/lib/components/atoms/button-segment/index.ts +5 -0
  27. package/src/lib/components/atoms/checkbox/Checkbox.tsx +114 -0
  28. package/src/lib/components/atoms/checkbox/index.ts +4 -0
  29. package/src/lib/components/atoms/divider/Divider.tsx +48 -0
  30. package/src/lib/components/atoms/divider/divider.classes.ts +11 -0
  31. package/src/lib/components/atoms/divider/divider.enums.ts +7 -0
  32. package/src/lib/components/atoms/divider/index.ts +6 -0
  33. package/src/lib/components/atoms/header/Header.tsx +73 -0
  34. package/src/lib/components/atoms/header/index.ts +4 -0
  35. package/src/lib/components/atoms/index.ts +23 -0
  36. package/src/lib/components/atoms/info-box/InfoBox.tsx +74 -0
  37. package/src/lib/components/atoms/info-box/index.ts +5 -0
  38. package/src/lib/components/atoms/info-box/infoBox.classes.ts +19 -0
  39. package/src/lib/components/atoms/info-box/infoBox.enums.ts +14 -0
  40. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +157 -0
  41. package/src/lib/components/atoms/key-value-info/index.ts +6 -0
  42. package/src/lib/components/atoms/key-value-info/keyValue.enums.ts +7 -0
  43. package/src/lib/components/atoms/label-text/LabelText.tsx +94 -0
  44. package/src/lib/components/atoms/label-text/index.ts +5 -0
  45. package/src/lib/components/atoms/label-text/labelText.classes.ts +22 -0
  46. package/src/lib/components/atoms/label-text/labelText.enums.ts +8 -0
  47. package/src/lib/components/atoms/list-item/ListItem.tsx +89 -0
  48. package/src/lib/components/atoms/list-item/index.ts +4 -0
  49. package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +38 -0
  50. package/src/lib/components/atoms/loading-indicator/index.ts +4 -0
  51. package/src/lib/components/atoms/panel/Panel.tsx +30 -0
  52. package/src/lib/components/atoms/panel/index.ts +4 -0
  53. package/src/lib/components/atoms/placeholder/Placeholder.tsx +27 -0
  54. package/src/lib/components/atoms/placeholder/index.ts +4 -0
  55. package/src/lib/components/atoms/radio-button/RadioButton.tsx +68 -0
  56. package/src/lib/components/atoms/radio-button/index.ts +4 -0
  57. package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +28 -0
  58. package/src/lib/components/atoms/secondary-text/index.ts +4 -0
  59. package/src/lib/components/atoms/skeleton/Skeleton.tsx +47 -0
  60. package/src/lib/components/atoms/skeleton/index.ts +4 -0
  61. package/src/lib/components/atoms/snackbar/Snackbar.tsx +69 -0
  62. package/src/lib/components/atoms/snackbar/index.ts +5 -0
  63. package/src/lib/components/atoms/snackbar/snackbar.classes.ts +18 -0
  64. package/src/lib/components/atoms/snackbar/snackbar.enums.tsx +9 -0
  65. package/src/lib/components/atoms/toggle/Toggle.tsx +140 -0
  66. package/src/lib/components/atoms/toggle/index.ts +6 -0
  67. package/src/lib/components/atoms/toggle/toggle.classes.ts +41 -0
  68. package/src/lib/components/atoms/toggle/toggle.enums.ts +12 -0
  69. package/src/lib/components/atoms/tooltip/Tooltip.tsx +138 -0
  70. package/src/lib/components/atoms/tooltip/index.ts +5 -0
  71. package/src/lib/components/atoms/tooltip/tooltip.classes.ts +11 -0
  72. package/src/lib/components/atoms/tooltip/tooltip.enums.ts +9 -0
  73. package/src/lib/components/atoms/visual-asset-card/VisualAssetCard.tsx +101 -0
  74. package/src/lib/components/atoms/visual-asset-card/index.ts +5 -0
  75. package/src/lib/components/atoms/visual-asset-card/visualAssetCard.enums.ts +7 -0
  76. package/src/lib/components/index.ts +8 -0
  77. package/src/lib/components/molecules/account/Account.tsx +192 -0
  78. package/src/lib/components/molecules/account/index.ts +4 -0
  79. package/src/lib/components/molecules/address/Address.tsx +101 -0
  80. package/src/lib/components/molecules/address/index.ts +4 -0
  81. package/src/lib/components/molecules/card/Card.tsx +70 -0
  82. package/src/lib/components/molecules/card/CardAction.tsx +80 -0
  83. package/src/lib/components/molecules/card/CardBody.tsx +72 -0
  84. package/src/lib/components/molecules/card/CardImage.tsx +43 -0
  85. package/src/lib/components/molecules/card/CardImagePlaceholder.tsx +146 -0
  86. package/src/lib/components/molecules/card/card.classes.ts +27 -0
  87. package/src/lib/components/molecules/card/card.enums.ts +26 -0
  88. package/src/lib/components/molecules/card/index.ts +8 -0
  89. package/src/lib/components/molecules/chip/Chip.tsx +105 -0
  90. package/src/lib/components/molecules/chip/chip.classes.ts +32 -0
  91. package/src/lib/components/molecules/chip/chip.enums.ts +7 -0
  92. package/src/lib/components/molecules/chip/index.ts +4 -0
  93. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +142 -0
  94. package/src/lib/components/molecules/display-stats/displayStats.classes.ts +36 -0
  95. package/src/lib/components/molecules/display-stats/displayStats.enums.ts +13 -0
  96. package/src/lib/components/molecules/display-stats/index.ts +5 -0
  97. package/src/lib/components/molecules/dropdown/Dropdown.tsx +10 -0
  98. package/src/lib/components/molecules/dropdown/dropdownPosition.enums.ts +7 -0
  99. package/src/lib/components/molecules/dropdown/index.ts +5 -0
  100. package/src/lib/components/molecules/index.ts +17 -0
  101. package/src/lib/components/molecules/input/Input.tsx +246 -0
  102. package/src/lib/components/molecules/input/InputWrapper.tsx +97 -0
  103. package/src/lib/components/molecules/input/TextArea.tsx +150 -0
  104. package/src/lib/components/molecules/input/index.ts +8 -0
  105. package/src/lib/components/molecules/input/input.classes.ts +14 -0
  106. package/src/lib/components/molecules/input/input.enums.ts +14 -0
  107. package/src/lib/components/molecules/input/input.types.ts +29 -0
  108. package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +48 -0
  109. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +65 -0
  110. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +54 -0
  111. package/src/lib/components/molecules/navbar-item/index.ts +5 -0
  112. package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +16 -0
  113. package/src/lib/components/molecules/navbar-item/navbarItem.enums.ts +7 -0
  114. package/src/lib/components/molecules/search/Search.tsx +216 -0
  115. package/src/lib/components/molecules/search/index.ts +5 -0
  116. package/src/lib/components/molecules/search/search.classes.ts +20 -0
  117. package/src/lib/components/molecules/search/search.enums.ts +7 -0
  118. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +38 -0
  119. package/src/lib/components/molecules/segmented-button/index.ts +6 -0
  120. package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +12 -0
  121. package/src/lib/components/molecules/segmented-button/segmentedButton.enums.ts +8 -0
  122. package/src/lib/components/molecules/select/Select.tsx +222 -0
  123. package/src/lib/components/molecules/select/index.ts +5 -0
  124. package/src/lib/components/molecules/select/select.enums.ts +7 -0
  125. package/src/lib/components/molecules/table-cell/TableCell.tsx +62 -0
  126. package/src/lib/components/molecules/table-cell/index.ts +4 -0
  127. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +140 -0
  128. package/src/lib/components/molecules/table-header-cell/index.ts +5 -0
  129. package/src/lib/components/molecules/table-header-cell/tableHeaderCell.enums.ts +7 -0
  130. package/src/lib/components/molecules/title/Title.tsx +78 -0
  131. package/src/lib/components/molecules/title/index.ts +5 -0
  132. package/src/lib/components/molecules/title/titleClasses.constants.ts +14 -0
  133. package/src/lib/components/molecules/title/titleSize.enums.ts +7 -0
  134. package/src/lib/components/organisms/accordion/Accordion.tsx +109 -0
  135. package/src/lib/components/organisms/accordion/accordion.classes.ts +4 -0
  136. package/src/lib/components/organisms/accordion/index.ts +4 -0
  137. package/src/lib/components/organisms/dialog/Dialog.tsx +142 -0
  138. package/src/lib/components/organisms/dialog/dialog.enums.ts +7 -0
  139. package/src/lib/components/organisms/dialog/index.ts +5 -0
  140. package/src/lib/components/organisms/index.ts +7 -0
  141. package/src/lib/components/organisms/navbar/Navbar.tsx +101 -0
  142. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +59 -0
  143. package/src/lib/components/organisms/navbar/index.ts +5 -0
  144. package/src/lib/components/organisms/table/Table.tsx +234 -0
  145. package/src/lib/components/organisms/table/TableContext.tsx +56 -0
  146. package/src/lib/components/organisms/table/index.ts +4 -0
  147. package/src/lib/constants/colors.constants.ts +133 -0
  148. package/src/lib/constants/index.ts +4 -0
  149. package/src/lib/enums/index.ts +4 -0
  150. package/src/lib/enums/screenSize.enums.ts +9 -0
  151. package/src/lib/index.ts +8 -0
  152. package/src/lib/styles/fonts.css +5 -0
  153. package/src/lib/styles/index.css +149 -0
  154. package/src/lib/tailwind/base.presets.ts +49 -0
  155. package/src/lib/tailwind/constants/fontSizes.constants.ts +201 -0
  156. package/src/lib/tailwind/constants/index.ts +6 -0
  157. package/src/lib/tailwind/constants/scaling.constants.ts +41 -0
  158. package/src/lib/tailwind/constants/variableSpacing.constants.ts +66 -0
  159. package/src/lib/tailwind/helpers.ts +20 -0
  160. package/src/lib/tailwind/index.ts +5 -0
  161. package/src/lib/tailwind/plugins.ts +8 -0
  162. package/src/lib/tailwind/responsive.presets.ts +36 -0
  163. package/src/lib/tailwind/static.presets.ts +25 -0
  164. package/src/lib/tailwind/types.ts +6 -0
  165. package/src/lib/utils/format.ts +8 -0
  166. package/src/lib/utils/index.ts +4 -0
  167. package/src/storybook/blocks/Showcase.tsx +20 -0
  168. package/src/storybook/blocks/TypeSet.tsx +34 -0
  169. package/src/storybook/blocks/TypeSetItem.tsx +74 -0
  170. package/src/storybook/blocks/index.ts +6 -0
  171. package/src/storybook/constants/index.ts +5 -0
  172. package/src/storybook/constants/typeset.constants.ts +39 -0
  173. package/src/storybook/constants/variableSpacing.constants.ts +6 -0
  174. package/src/storybook/helpers/getFontSizeLabel.ts +15 -0
  175. package/src/storybook/helpers/index.ts +4 -0
  176. package/src/storybook/stories/atoms/Badge.stories.tsx +32 -0
  177. package/src/storybook/stories/atoms/Button.stories.tsx +45 -0
  178. package/src/storybook/stories/atoms/ButtonSegment.stories.tsx +45 -0
  179. package/src/storybook/stories/atoms/Checkbox.stories.tsx +34 -0
  180. package/src/storybook/stories/atoms/CustomScrollbar.stories.tsx +22 -0
  181. package/src/storybook/stories/atoms/Divider.stories.tsx +41 -0
  182. package/src/storybook/stories/atoms/Header.stories.tsx +58 -0
  183. package/src/storybook/stories/atoms/InfoBox.stories.tsx +67 -0
  184. package/src/storybook/stories/atoms/KeyValueInfo.stories.tsx +59 -0
  185. package/src/storybook/stories/atoms/LabelText.stories.tsx +55 -0
  186. package/src/storybook/stories/atoms/ListItem.stories.tsx +41 -0
  187. package/src/storybook/stories/atoms/LoadingIndicator.stories.tsx +32 -0
  188. package/src/storybook/stories/atoms/Panel.stories.tsx +36 -0
  189. package/src/storybook/stories/atoms/Placeholder.stories.tsx +33 -0
  190. package/src/storybook/stories/atoms/RadioButton.stories.tsx +51 -0
  191. package/src/storybook/stories/atoms/Skeleton.stories.tsx +33 -0
  192. package/src/storybook/stories/atoms/Snackbar.stories.tsx +43 -0
  193. package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
  194. package/src/storybook/stories/atoms/Tooltip.stories.tsx +57 -0
  195. package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +56 -0
  196. package/src/storybook/stories/components/VariableSpacingShowcase.tsx +46 -0
  197. package/src/storybook/stories/components/index.ts +4 -0
  198. package/src/storybook/stories/design-tokens/colors.stories.mdx +23 -0
  199. package/src/storybook/stories/design-tokens/icons.stories.mdx +17 -0
  200. package/src/storybook/stories/design-tokens/typeset.stories.mdx +15 -0
  201. package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +10 -0
  202. package/src/storybook/stories/molecules/Account.stories.tsx +69 -0
  203. package/src/storybook/stories/molecules/Address.stories.tsx +39 -0
  204. package/src/storybook/stories/molecules/Card.stories.tsx +112 -0
  205. package/src/storybook/stories/molecules/Chip.stories.tsx +122 -0
  206. package/src/storybook/stories/molecules/DisplayStats.stories.tsx +63 -0
  207. package/src/storybook/stories/molecules/Dropdown.stories.tsx +38 -0
  208. package/src/storybook/stories/molecules/Input.stories.tsx +162 -0
  209. package/src/storybook/stories/molecules/NavbarItem.stories.tsx +45 -0
  210. package/src/storybook/stories/molecules/Search.stories.tsx +101 -0
  211. package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +108 -0
  212. package/src/storybook/stories/molecules/Select.stories.tsx +103 -0
  213. package/src/storybook/stories/molecules/TableCell.stories.tsx +46 -0
  214. package/src/storybook/stories/molecules/TableHeaderCell.stories.tsx +34 -0
  215. package/src/storybook/stories/molecules/TextArea.stories.tsx +80 -0
  216. package/src/storybook/stories/molecules/Title.stories.tsx +76 -0
  217. package/src/storybook/stories/organisms/Accordion.stories.tsx +70 -0
  218. package/src/storybook/stories/organisms/Dialog.stories.tsx +103 -0
  219. package/src/storybook/stories/organisms/Navbar.stories.tsx +78 -0
  220. package/src/storybook/stories/organisms/Table.stories.tsx +154 -0
@@ -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,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './VariableSpacingShowcase';
@@ -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,10 @@
1
+ import { Meta, Typeset, Unstyled } from '@storybook/blocks';
2
+ import { VariableSpacingShowcase } from '../components';
3
+
4
+ <Meta title="Design Tokens/Variable Spacing" />
5
+
6
+ # Variable Spacing
7
+
8
+ <Unstyled>
9
+ <VariableSpacingShowcase />
10
+ </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,112 @@
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 type { CardProps, CardImageProps, CardBodyProps, CardActionProps } from '@/components';
7
+ import {
8
+ Card,
9
+ CardImage,
10
+ CardAction,
11
+ CardBody,
12
+ CardActionType,
13
+ CardType,
14
+ ImageType,
15
+ ImageShape,
16
+ } from '@/components';
17
+
18
+ type CardCustomProps = CardProps & {
19
+ imageType: CardImageProps['type'];
20
+ imageUrl: CardImageProps['url'];
21
+ imageVariant: CardImageProps['shape'];
22
+ textTitle: CardBodyProps['title'];
23
+ textSubtitle: CardBodyProps['subtitle'];
24
+ actionTitle: CardActionProps['title'];
25
+ actionSubtitle: CardActionProps['subtitle'];
26
+ actionType: CardActionProps['type'];
27
+ };
28
+
29
+ const meta: Meta<CardCustomProps> = {
30
+ component: Card,
31
+ tags: ['autodocs'],
32
+ };
33
+
34
+ export default meta;
35
+
36
+ type Story = StoryObj<typeof meta>;
37
+
38
+ const COMMON_ARG_TYPES = {
39
+ imageType: {
40
+ control: 'select',
41
+ options: Object.values(ImageType),
42
+ },
43
+ imageVariant: {
44
+ control: 'select',
45
+ options: Object.values(ImageShape),
46
+ },
47
+ actionType: {
48
+ control: 'select',
49
+ options: Object.values(CardActionType),
50
+ },
51
+ onClick: {
52
+ action: 'clicked',
53
+ },
54
+ };
55
+
56
+ const COMMON_ARGS = {
57
+ textTitle: 'Card Title',
58
+ textSubtitle: 'Card Subtitle',
59
+ actionTitle: 'Action title',
60
+ actionSubtitle: 'Action subtitle',
61
+ actionType: CardActionType.Link,
62
+ variant: CardType.Default,
63
+ isDisabled: false,
64
+ imageVariant: ImageShape.Rounded,
65
+ };
66
+
67
+ export const Default: Story = {
68
+ args: {
69
+ ...COMMON_ARGS,
70
+ imageType: ImageType.Placeholder,
71
+ imageUrl: 'https://via.placeholder.com/150.png',
72
+ },
73
+ argTypes: COMMON_ARG_TYPES,
74
+ render: (args) => {
75
+ return (
76
+ <Card isDisabled={args.isDisabled} type={args.type} onClick={args.onClick}>
77
+ <CardImage type={args.imageType} shape={args.imageVariant} url={args.imageUrl} />
78
+ <CardBody title={args.textTitle} subtitle={args.textSubtitle} />
79
+ <CardAction
80
+ title={args.actionTitle}
81
+ subtitle={args.actionSubtitle}
82
+ type={args.actionType}
83
+ onClick={args.onClick}
84
+ />
85
+ </Card>
86
+ );
87
+ },
88
+ };
89
+
90
+ export const WithIcon: Story = {
91
+ args: {
92
+ ...COMMON_ARGS,
93
+ imageType: ImageType.BgSolid,
94
+ },
95
+ argTypes: COMMON_ARG_TYPES,
96
+ render: (args) => {
97
+ return (
98
+ <Card isDisabled={args.isDisabled} type={args.type} onClick={args.onClick}>
99
+ <CardImage type={args.imageType} shape={args.imageVariant} url={args.imageUrl}>
100
+ <IotaLogoSmall />
101
+ </CardImage>
102
+ <CardBody title={args.textTitle} subtitle={args.textSubtitle} />
103
+ <CardAction
104
+ title={args.actionTitle}
105
+ subtitle={args.actionSubtitle}
106
+ type={args.actionType}
107
+ onClick={args.onClick}
108
+ />
109
+ </Card>
110
+ );
111
+ },
112
+ };
@@ -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
+ };
@@ -0,0 +1,38 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Dropdown, ListItem } from '@/components';
6
+ import type { ComponentProps } from 'react';
7
+
8
+ const meta = {
9
+ component: Dropdown,
10
+ tags: ['autodocs'],
11
+ render: (props) => {
12
+ return <Dropdown {...props} />;
13
+ },
14
+ } satisfies Meta<typeof Dropdown>;
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const Default: Story = {
21
+ args: {},
22
+ render: (args) => {
23
+ const options: ComponentProps<typeof ListItem>[] = new Array(5).fill(0).map((_, index) => ({
24
+ children: `Option ${index + 1}`,
25
+ onClick: () => {
26
+ alert(`Option ${index + 1} clicked`);
27
+ },
28
+ }));
29
+
30
+ return (
31
+ <Dropdown {...args}>
32
+ {options.map((option, index) => (
33
+ <ListItem key={index} {...option} hideBottomBorder />
34
+ ))}
35
+ </Dropdown>
36
+ );
37
+ },
38
+ };