@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,58 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { Header } from '@/lib/components/atoms/header';
5
+ import type { Meta, StoryObj } from '@storybook/react';
6
+
7
+ const meta: Meta<typeof Header> = {
8
+ component: Header,
9
+ tags: ['autodocs'],
10
+ render: (props) => {
11
+ return (
12
+ <div className="flex flex-col items-start gap-2">
13
+ <Header {...props} />
14
+ </div>
15
+ );
16
+ },
17
+ } satisfies Meta<typeof Header>;
18
+
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {
24
+ args: {
25
+ title: 'Header',
26
+ onBack: undefined,
27
+ onClose: undefined,
28
+ },
29
+ argTypes: {
30
+ titleCentered: {
31
+ control: 'boolean',
32
+ },
33
+ },
34
+ };
35
+
36
+ export const Centered: Story = {
37
+ args: {
38
+ title: 'Header',
39
+ titleCentered: true,
40
+ },
41
+ };
42
+
43
+ export const CenteredNoIcon: Story = {
44
+ args: {
45
+ title: 'Header',
46
+ titleCentered: true,
47
+ onBack: undefined,
48
+ onClose: undefined,
49
+ },
50
+ };
51
+
52
+ export const NoIcon: Story = {
53
+ args: {
54
+ title: 'Header',
55
+ onBack: undefined,
56
+ onClose: undefined,
57
+ },
58
+ };
@@ -0,0 +1,67 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { InfoBox, InfoBoxStyle, InfoBoxType } from '@/components';
6
+ import { Info } from '@iota/apps-ui-icons';
7
+
8
+ const meta: Meta<typeof InfoBox> = {
9
+ component: InfoBox,
10
+ tags: ['autodocs'],
11
+ render: (props) => {
12
+ return <InfoBox {...props} />;
13
+ },
14
+ } satisfies Meta<typeof InfoBox>;
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ type: InfoBoxType.Default,
23
+ title: 'Title',
24
+ supportingText: 'This is an info box',
25
+ style: InfoBoxStyle.Default,
26
+ icon: <Info />,
27
+ },
28
+ argTypes: {
29
+ type: {
30
+ control: {
31
+ type: 'select',
32
+ options: Object.values(InfoBoxType),
33
+ },
34
+ },
35
+ title: {
36
+ control: {
37
+ type: 'text',
38
+ },
39
+ },
40
+ supportingText: {
41
+ control: {
42
+ type: 'text',
43
+ },
44
+ },
45
+ icon: {
46
+ control: 'none',
47
+ },
48
+ style: {
49
+ control: {
50
+ type: 'select',
51
+ options: Object.values(InfoBoxStyle),
52
+ },
53
+ },
54
+ },
55
+ };
56
+
57
+ export const WithoutIcon: Story = {
58
+ args: {
59
+ type: InfoBoxType.Default,
60
+ title: 'Title',
61
+ supportingText: 'This is an info box without an icon',
62
+ style: InfoBoxStyle.Default,
63
+ },
64
+ render: (props) => {
65
+ return <InfoBox {...props} />;
66
+ },
67
+ };
@@ -0,0 +1,59 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { KeyValueInfo, TooltipPosition, ValueSize } from '@/components';
6
+
7
+ const meta: Meta<typeof KeyValueInfo> = {
8
+ component: KeyValueInfo,
9
+ tags: ['autodocs'],
10
+ render: (props) => {
11
+ return (
12
+ <div className="w-1/2">
13
+ <KeyValueInfo {...props} />
14
+ </div>
15
+ );
16
+ },
17
+ } satisfies Meta<typeof KeyValueInfo>;
18
+
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {
24
+ args: {
25
+ keyText: 'Label',
26
+ value: 'Value',
27
+ supportingLabel: 'IOTA',
28
+ size: ValueSize.Small,
29
+ },
30
+ argTypes: {
31
+ keyText: {
32
+ control: 'text',
33
+ },
34
+ value: {
35
+ control: 'text',
36
+ },
37
+ copyText: {
38
+ control: 'text',
39
+ },
40
+ tooltipText: {
41
+ control: 'text',
42
+ },
43
+ tooltipPosition: {
44
+ control: {
45
+ type: 'select',
46
+ options: Object.values(TooltipPosition),
47
+ },
48
+ },
49
+ supportingLabel: {
50
+ control: 'text',
51
+ },
52
+ size: {
53
+ control: {
54
+ type: 'select',
55
+ options: Object.values(ValueSize),
56
+ },
57
+ },
58
+ },
59
+ };
@@ -0,0 +1,55 @@
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 { LabelText, LabelTextSize, TooltipPosition } from '@/components';
7
+
8
+ const meta: Meta<typeof LabelText> = {
9
+ component: LabelText,
10
+ tags: ['autodocs'],
11
+ render: (props) => {
12
+ return <LabelText {...props} />;
13
+ },
14
+ } satisfies Meta<typeof LabelText>;
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<typeof meta>;
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ text: '12,000.00',
23
+ label: 'Label',
24
+ size: LabelTextSize.Medium,
25
+ supportingLabel: 'IOTA',
26
+ isCentered: false,
27
+ },
28
+ argTypes: {
29
+ size: {
30
+ control: 'select',
31
+ options: Object.values(LabelTextSize),
32
+ },
33
+ label: {
34
+ control: 'text',
35
+ },
36
+ isCentered: {
37
+ control: 'boolean',
38
+ },
39
+ supportingLabel: {
40
+ control: 'text',
41
+ },
42
+ text: {
43
+ control: 'text',
44
+ },
45
+ tooltipText: {
46
+ control: 'text',
47
+ },
48
+ tooltipPosition: {
49
+ control: {
50
+ type: 'select',
51
+ options: Object.values(TooltipPosition),
52
+ },
53
+ },
54
+ },
55
+ };
@@ -0,0 +1,41 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { ListItem } from '@/components';
5
+ import { Seed } from '@iota/apps-ui-icons';
6
+ import type { Meta, StoryObj } from '@storybook/react';
7
+
8
+ const meta = {
9
+ component: ListItem,
10
+ tags: ['autodocs'],
11
+ render: (props) => {
12
+ return (
13
+ <div className="flex flex-col">
14
+ <ListItem {...props}>
15
+ <div className="flex flex-row items-center gap-2">
16
+ <Seed />
17
+ <div>Item 1</div>
18
+ </div>
19
+ </ListItem>
20
+ </div>
21
+ );
22
+ },
23
+ } satisfies Meta<typeof ListItem>;
24
+
25
+ export default meta;
26
+
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ export const Default: Story = {
30
+ argTypes: {
31
+ showRightIcon: {
32
+ control: 'boolean',
33
+ },
34
+ isDisabled: {
35
+ control: 'boolean',
36
+ },
37
+ hideBottomBorder: {
38
+ control: 'boolean',
39
+ },
40
+ },
41
+ };
@@ -0,0 +1,32 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { LoadingIndicator } from '@/lib/components/atoms';
5
+ import type { Meta, StoryObj } from '@storybook/react';
6
+
7
+ const meta: Meta<typeof LoadingIndicator> = {
8
+ component: LoadingIndicator,
9
+ tags: ['autodocs'],
10
+ render: (props) => {
11
+ return <LoadingIndicator {...props} />;
12
+ },
13
+ } satisfies Meta<typeof LoadingIndicator>;
14
+
15
+ export default meta;
16
+
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ export const Default: Story = {
20
+ args: {},
21
+ argTypes: {
22
+ color: {
23
+ control: 'text',
24
+ },
25
+ size: {
26
+ control: 'text',
27
+ },
28
+ text: {
29
+ control: 'text',
30
+ },
31
+ },
32
+ };
@@ -0,0 +1,36 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Address, Panel, Title } from '@/components';
6
+
7
+ const meta: Meta<typeof Panel> = {
8
+ component: Panel,
9
+ tags: ['autodocs'],
10
+ render: (props) => {
11
+ return (
12
+ <Panel {...props}>
13
+ <div className="flex flex-col items-start gap-2">
14
+ <Title title="Title" subtitle="subtitle" />
15
+ <div className=" px-md--rs pb-sm--rs">
16
+ <Address text="0x0d7...3f34" isCopyable />
17
+ <Address text="0x0d7...3f35" isCopyable />
18
+ <Address text="0x0d7...3f36" isCopyable />
19
+ </div>
20
+ </div>
21
+ </Panel>
22
+ );
23
+ },
24
+ } satisfies Meta<typeof Panel>;
25
+
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof meta>;
29
+
30
+ export const Default: Story = {
31
+ argTypes: {
32
+ hasBorder: {
33
+ control: 'boolean',
34
+ },
35
+ },
36
+ };
@@ -0,0 +1,33 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Placeholder } from '@/components';
6
+
7
+ const meta: Meta<typeof Placeholder> = {
8
+ component: Placeholder,
9
+ tags: ['autodocs'],
10
+ render: (props) => {
11
+ return <Placeholder {...props} />;
12
+ },
13
+ } satisfies Meta<typeof Placeholder>;
14
+
15
+ export default meta;
16
+
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ export const Default: Story = {
20
+ args: {},
21
+ argTypes: {
22
+ width: {
23
+ control: {
24
+ type: 'text',
25
+ },
26
+ },
27
+ height: {
28
+ control: {
29
+ type: 'text',
30
+ },
31
+ },
32
+ },
33
+ };
@@ -0,0 +1,51 @@
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 { RadioButton } from '@/components/atoms';
7
+ import { useEffect, useState } from 'react';
8
+
9
+ const meta: Meta<typeof RadioButton> = {
10
+ component: RadioButton,
11
+ tags: ['autodocs'],
12
+ render: (props) => {
13
+ const { isChecked } = props;
14
+ const [checked, setIsChecked] = useState<boolean>(isChecked ?? false);
15
+
16
+ useEffect(() => {
17
+ setIsChecked(isChecked ?? false);
18
+ }, [isChecked]);
19
+
20
+ return (
21
+ <RadioButton
22
+ {...props}
23
+ isChecked={checked}
24
+ onChange={(e) => setIsChecked(e.target.checked)}
25
+ />
26
+ );
27
+ },
28
+ } satisfies Meta<typeof RadioButton>;
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ export const Default: Story = {
35
+ args: {
36
+ label: 'Radio Button',
37
+ isChecked: false,
38
+ isDisabled: false,
39
+ },
40
+ argTypes: {
41
+ label: {
42
+ control: 'text',
43
+ },
44
+ isChecked: {
45
+ control: 'boolean',
46
+ },
47
+ isDisabled: {
48
+ control: 'boolean',
49
+ },
50
+ },
51
+ };
@@ -0,0 +1,33 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Card, CardImage, ImageShape, Skeleton } from '@/components';
6
+
7
+ const meta: Meta<typeof Skeleton> = {
8
+ component: Skeleton,
9
+ tags: ['autodocs'],
10
+ } satisfies Meta<typeof Skeleton>;
11
+
12
+ export default meta;
13
+
14
+ type Story = StoryObj<typeof meta>;
15
+
16
+ export const SkeletonCard: Story = {
17
+ render: () => (
18
+ <Card>
19
+ <CardImage shape={ImageShape.SquareRounded}>
20
+ <div className="h-10 w-10 animate-pulse bg-neutral-90 dark:bg-neutral-12" />
21
+ <Skeleton widthClass="w-10" heightClass="h-10" isRounded={false} />
22
+ </CardImage>
23
+ <div className="flex flex-col gap-y-xs">
24
+ <Skeleton widthClass="w-40" heightClass="h-3.5" />
25
+ <Skeleton widthClass="w-32" heightClass="h-3" hasSecondaryColors />
26
+ </div>
27
+ <div className="ml-auto flex flex-col gap-y-xs">
28
+ <Skeleton widthClass="w-20" heightClass="h-3.5" />
29
+ <Skeleton widthClass="w-16" heightClass="h-3" hasSecondaryColors />
30
+ </div>
31
+ </Card>
32
+ ),
33
+ };
@@ -0,0 +1,43 @@
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 type { SnackbarProps } from '@/components/atoms';
7
+ import { Snackbar, SnackbarType, Button } from '@/components/atoms';
8
+
9
+ const meta: Meta<SnackbarProps> = {
10
+ component: Snackbar,
11
+ tags: ['autodocs'],
12
+ } satisfies Meta<typeof Snackbar>;
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj<typeof meta>;
17
+
18
+ export const Default: Story = {
19
+ args: {
20
+ type: SnackbarType.Default,
21
+ text: 'Test message',
22
+ showClose: false,
23
+ duration: 2000,
24
+ },
25
+ argTypes: {},
26
+ render: (props) => {
27
+ const [isOpen, setIsOpen] = useState(false);
28
+
29
+ const onClose = () => {
30
+ setIsOpen(false);
31
+ };
32
+
33
+ return (
34
+ <>
35
+ <Button
36
+ onClick={() => setIsOpen(!isOpen)}
37
+ text={isOpen ? 'Close Snackbar' : 'Open Snackbar'}
38
+ />
39
+ {isOpen && <Snackbar {...props} onClose={onClose} />}
40
+ </>
41
+ );
42
+ },
43
+ };
@@ -0,0 +1,59 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Toggle, ToggleLabelPosition, ToggleSize } from '@/components';
6
+ import { useState } from 'react';
7
+
8
+ const meta: Meta<typeof Toggle> = {
9
+ component: Toggle,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ isToggled: {
13
+ control: { type: 'boolean' },
14
+ },
15
+ label: {
16
+ control: { type: 'text' },
17
+ },
18
+ labelPosition: {
19
+ control: { type: 'select' },
20
+ options: Object.values(ToggleLabelPosition),
21
+ },
22
+ isDisabled: {
23
+ control: { type: 'boolean' },
24
+ },
25
+ size: {
26
+ control: { type: 'select' },
27
+ options: Object.values(ToggleSize),
28
+ },
29
+ onChange: {
30
+ action: 'changed',
31
+ },
32
+ },
33
+ args: {
34
+ isToggled: false,
35
+ isDisabled: false,
36
+ size: ToggleSize.Default,
37
+ labelPosition: ToggleLabelPosition.Right,
38
+ },
39
+ } satisfies Meta<typeof Toggle>;
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Default: Story = {
46
+ args: {
47
+ label: 'Label',
48
+ },
49
+ render: (args) => {
50
+ const [isToggled, setIsToggled] = useState(args.isToggled);
51
+
52
+ const handleToggleChange = (newState: boolean) => {
53
+ console.log('Toggle state changed:', newState);
54
+ setIsToggled(newState);
55
+ };
56
+
57
+ return <Toggle {...args} isToggled={isToggled} onChange={handleToggleChange} />;
58
+ },
59
+ };
@@ -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
+ };