@iota/apps-ui-kit 0.0.0-dev-20251015065834

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 (243) hide show
  1. package/CHANGELOG.md +145 -0
  2. package/LICENSE +201 -0
  3. package/README.md +16 -0
  4. package/dist/index.d.ts +1911 -0
  5. package/dist/index.es.js +6486 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/dist/index.umd.js +66 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/style.css +1 -0
  10. package/package.json +80 -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 +110 -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 +24 -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 +124 -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/image/Image.tsx +32 -0
  36. package/src/lib/components/atoms/image/index.ts +4 -0
  37. package/src/lib/components/atoms/index.ts +26 -0
  38. package/src/lib/components/atoms/info-box/InfoBox.tsx +68 -0
  39. package/src/lib/components/atoms/info-box/index.ts +5 -0
  40. package/src/lib/components/atoms/info-box/infoBox.classes.ts +18 -0
  41. package/src/lib/components/atoms/info-box/infoBox.enums.ts +14 -0
  42. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +157 -0
  43. package/src/lib/components/atoms/key-value-info/index.ts +6 -0
  44. package/src/lib/components/atoms/key-value-info/keyValue.enums.ts +7 -0
  45. package/src/lib/components/atoms/label-text/LabelText.tsx +92 -0
  46. package/src/lib/components/atoms/label-text/index.ts +5 -0
  47. package/src/lib/components/atoms/label-text/labelText.classes.ts +22 -0
  48. package/src/lib/components/atoms/label-text/labelText.enums.ts +8 -0
  49. package/src/lib/components/atoms/list-item/ListItem.tsx +88 -0
  50. package/src/lib/components/atoms/list-item/index.ts +4 -0
  51. package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +38 -0
  52. package/src/lib/components/atoms/loading-indicator/index.ts +4 -0
  53. package/src/lib/components/atoms/media-fallback/MediaFallback.tsx +12 -0
  54. package/src/lib/components/atoms/media-fallback/index.ts +4 -0
  55. package/src/lib/components/atoms/panel/Panel.tsx +28 -0
  56. package/src/lib/components/atoms/panel/index.ts +4 -0
  57. package/src/lib/components/atoms/placeholder/Placeholder.tsx +27 -0
  58. package/src/lib/components/atoms/placeholder/index.ts +4 -0
  59. package/src/lib/components/atoms/radio-button/RadioButton.tsx +64 -0
  60. package/src/lib/components/atoms/radio-button/index.ts +4 -0
  61. package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +29 -0
  62. package/src/lib/components/atoms/secondary-text/index.ts +4 -0
  63. package/src/lib/components/atoms/skeleton/Skeleton.tsx +30 -0
  64. package/src/lib/components/atoms/skeleton/index.ts +4 -0
  65. package/src/lib/components/atoms/snackbar/Snackbar.tsx +69 -0
  66. package/src/lib/components/atoms/snackbar/index.ts +5 -0
  67. package/src/lib/components/atoms/snackbar/snackbar.classes.ts +18 -0
  68. package/src/lib/components/atoms/snackbar/snackbar.enums.tsx +9 -0
  69. package/src/lib/components/atoms/toggle/Toggle.tsx +140 -0
  70. package/src/lib/components/atoms/toggle/index.ts +6 -0
  71. package/src/lib/components/atoms/toggle/toggle.classes.ts +41 -0
  72. package/src/lib/components/atoms/toggle/toggle.enums.ts +12 -0
  73. package/src/lib/components/atoms/tooltip/Tooltip.tsx +139 -0
  74. package/src/lib/components/atoms/tooltip/index.ts +5 -0
  75. package/src/lib/components/atoms/tooltip/tooltip.classes.ts +11 -0
  76. package/src/lib/components/atoms/tooltip/tooltip.enums.ts +9 -0
  77. package/src/lib/components/atoms/video/Video.tsx +33 -0
  78. package/src/lib/components/atoms/video/index.ts +4 -0
  79. package/src/lib/components/atoms/video/video.constants.ts +31 -0
  80. package/src/lib/components/index.ts +6 -0
  81. package/src/lib/components/molecules/account/Account.tsx +195 -0
  82. package/src/lib/components/molecules/account/index.ts +4 -0
  83. package/src/lib/components/molecules/address/Address.tsx +101 -0
  84. package/src/lib/components/molecules/address/index.ts +4 -0
  85. package/src/lib/components/molecules/asset-media-renderer/AssetMediaRenderer.tsx +50 -0
  86. package/src/lib/components/molecules/asset-media-renderer/index.ts +4 -0
  87. package/src/lib/components/molecules/card/Card.tsx +70 -0
  88. package/src/lib/components/molecules/card/CardAction.tsx +78 -0
  89. package/src/lib/components/molecules/card/CardBody.tsx +73 -0
  90. package/src/lib/components/molecules/card/CardImage.tsx +43 -0
  91. package/src/lib/components/molecules/card/CardImagePlaceholder.tsx +146 -0
  92. package/src/lib/components/molecules/card/card.classes.ts +27 -0
  93. package/src/lib/components/molecules/card/card.enums.ts +26 -0
  94. package/src/lib/components/molecules/card/index.ts +8 -0
  95. package/src/lib/components/molecules/chip/Chip.tsx +146 -0
  96. package/src/lib/components/molecules/chip/chip.classes.ts +54 -0
  97. package/src/lib/components/molecules/chip/chip.enums.ts +15 -0
  98. package/src/lib/components/molecules/chip/index.ts +5 -0
  99. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +142 -0
  100. package/src/lib/components/molecules/display-stats/displayStats.classes.ts +36 -0
  101. package/src/lib/components/molecules/display-stats/displayStats.enums.ts +13 -0
  102. package/src/lib/components/molecules/display-stats/index.ts +5 -0
  103. package/src/lib/components/molecules/dropdown/Dropdown.tsx +10 -0
  104. package/src/lib/components/molecules/dropdown/dropdownPosition.enums.ts +7 -0
  105. package/src/lib/components/molecules/dropdown/index.ts +5 -0
  106. package/src/lib/components/molecules/index.ts +19 -0
  107. package/src/lib/components/molecules/input/Input.tsx +261 -0
  108. package/src/lib/components/molecules/input/InputWrapper.tsx +97 -0
  109. package/src/lib/components/molecules/input/TextArea.tsx +148 -0
  110. package/src/lib/components/molecules/input/index.ts +8 -0
  111. package/src/lib/components/molecules/input/input.classes.ts +13 -0
  112. package/src/lib/components/molecules/input/input.enums.ts +14 -0
  113. package/src/lib/components/molecules/input/input.types.ts +29 -0
  114. package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +47 -0
  115. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +65 -0
  116. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +54 -0
  117. package/src/lib/components/molecules/navbar-item/index.ts +5 -0
  118. package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +16 -0
  119. package/src/lib/components/molecules/navbar-item/navbarItem.enums.ts +7 -0
  120. package/src/lib/components/molecules/search/Search.tsx +219 -0
  121. package/src/lib/components/molecules/search/index.ts +5 -0
  122. package/src/lib/components/molecules/search/search.classes.ts +20 -0
  123. package/src/lib/components/molecules/search/search.enums.ts +7 -0
  124. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +38 -0
  125. package/src/lib/components/molecules/segmented-button/index.ts +6 -0
  126. package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +12 -0
  127. package/src/lib/components/molecules/segmented-button/segmentedButton.enums.ts +8 -0
  128. package/src/lib/components/molecules/select/Select.tsx +235 -0
  129. package/src/lib/components/molecules/select/index.ts +5 -0
  130. package/src/lib/components/molecules/select/select.enums.ts +7 -0
  131. package/src/lib/components/molecules/table-cell/TableCell.tsx +62 -0
  132. package/src/lib/components/molecules/table-cell/index.ts +4 -0
  133. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +140 -0
  134. package/src/lib/components/molecules/table-header-cell/index.ts +5 -0
  135. package/src/lib/components/molecules/table-header-cell/tableHeaderCell.enums.ts +7 -0
  136. package/src/lib/components/molecules/title/Title.tsx +78 -0
  137. package/src/lib/components/molecules/title/index.ts +5 -0
  138. package/src/lib/components/molecules/title/titleClasses.constants.ts +14 -0
  139. package/src/lib/components/molecules/title/titleSize.enums.ts +7 -0
  140. package/src/lib/components/molecules/visual-asset-card/VisualAssetCard.tsx +89 -0
  141. package/src/lib/components/molecules/visual-asset-card/index.ts +5 -0
  142. package/src/lib/components/molecules/visual-asset-card/visualAssetCard.enums.ts +7 -0
  143. package/src/lib/components/organisms/accordion/Accordion.tsx +108 -0
  144. package/src/lib/components/organisms/accordion/accordion.classes.ts +4 -0
  145. package/src/lib/components/organisms/accordion/index.ts +4 -0
  146. package/src/lib/components/organisms/dialog/Dialog.tsx +157 -0
  147. package/src/lib/components/organisms/dialog/dialog.enums.ts +7 -0
  148. package/src/lib/components/organisms/dialog/index.ts +5 -0
  149. package/src/lib/components/organisms/index.ts +7 -0
  150. package/src/lib/components/organisms/navbar/Navbar.tsx +101 -0
  151. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +59 -0
  152. package/src/lib/components/organisms/navbar/index.ts +5 -0
  153. package/src/lib/components/organisms/table/Table.tsx +234 -0
  154. package/src/lib/components/organisms/table/TableContext.tsx +56 -0
  155. package/src/lib/components/organisms/table/index.ts +4 -0
  156. package/src/lib/constants/colors.constants.ts +239 -0
  157. package/src/lib/constants/index.ts +4 -0
  158. package/src/lib/enums/index.ts +5 -0
  159. package/src/lib/enums/screenSize.enums.ts +9 -0
  160. package/src/lib/enums/theme.enums.ts +8 -0
  161. package/src/lib/index.ts +10 -0
  162. package/src/lib/styles/base.css +144 -0
  163. package/src/lib/styles/components.css +735 -0
  164. package/src/lib/styles/fonts.css +7 -0
  165. package/src/lib/styles/index.css +18 -0
  166. package/src/lib/styles/utilities.css +61 -0
  167. package/src/lib/styles/variables/dark-variables.css +262 -0
  168. package/src/lib/styles/variables/general-variables.css +9 -0
  169. package/src/lib/styles/variables/light-variables.css +276 -0
  170. package/src/lib/styles/variables/names-variables.css +270 -0
  171. package/src/lib/tailwind/base.presets.ts +58 -0
  172. package/src/lib/tailwind/constants/customColors.constants.ts +13 -0
  173. package/src/lib/tailwind/constants/fontFamily.constants.ts +8 -0
  174. package/src/lib/tailwind/constants/fontSizes.constants.ts +201 -0
  175. package/src/lib/tailwind/constants/gradients.constants.ts +6 -0
  176. package/src/lib/tailwind/constants/index.ts +7 -0
  177. package/src/lib/tailwind/constants/scaling.constants.ts +41 -0
  178. package/src/lib/tailwind/constants/variableSpacing.constants.ts +66 -0
  179. package/src/lib/tailwind/helpers.ts +20 -0
  180. package/src/lib/tailwind/index.ts +5 -0
  181. package/src/lib/tailwind/plugins.ts +12 -0
  182. package/src/lib/tailwind/responsive.presets.ts +36 -0
  183. package/src/lib/tailwind/static.presets.ts +25 -0
  184. package/src/lib/tailwind/types.ts +6 -0
  185. package/src/lib/utils/format.ts +8 -0
  186. package/src/lib/utils/index.ts +4 -0
  187. package/src/storybook/blocks/Showcase.tsx +20 -0
  188. package/src/storybook/blocks/TypeSet.tsx +34 -0
  189. package/src/storybook/blocks/TypeSetItem.tsx +74 -0
  190. package/src/storybook/blocks/index.ts +6 -0
  191. package/src/storybook/constants/gradients.constants.ts +8 -0
  192. package/src/storybook/constants/index.ts +5 -0
  193. package/src/storybook/constants/typeset.constants.ts +39 -0
  194. package/src/storybook/constants/variableSpacing.constants.ts +6 -0
  195. package/src/storybook/helpers/formatGradientNames.ts +15 -0
  196. package/src/storybook/helpers/getFontSizeLabel.ts +15 -0
  197. package/src/storybook/helpers/index.ts +4 -0
  198. package/src/storybook/stories/atoms/Badge.stories.tsx +32 -0
  199. package/src/storybook/stories/atoms/Button.stories.tsx +45 -0
  200. package/src/storybook/stories/atoms/ButtonSegment.stories.tsx +45 -0
  201. package/src/storybook/stories/atoms/Checkbox.stories.tsx +34 -0
  202. package/src/storybook/stories/atoms/CustomScrollbar.stories.tsx +22 -0
  203. package/src/storybook/stories/atoms/Divider.stories.tsx +41 -0
  204. package/src/storybook/stories/atoms/Header.stories.tsx +58 -0
  205. package/src/storybook/stories/atoms/InfoBox.stories.tsx +67 -0
  206. package/src/storybook/stories/atoms/KeyValueInfo.stories.tsx +59 -0
  207. package/src/storybook/stories/atoms/LabelText.stories.tsx +55 -0
  208. package/src/storybook/stories/atoms/ListItem.stories.tsx +41 -0
  209. package/src/storybook/stories/atoms/LoadingIndicator.stories.tsx +32 -0
  210. package/src/storybook/stories/atoms/Panel.stories.tsx +36 -0
  211. package/src/storybook/stories/atoms/Placeholder.stories.tsx +33 -0
  212. package/src/storybook/stories/atoms/RadioButton.stories.tsx +51 -0
  213. package/src/storybook/stories/atoms/Skeleton.stories.tsx +33 -0
  214. package/src/storybook/stories/atoms/Snackbar.stories.tsx +43 -0
  215. package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
  216. package/src/storybook/stories/atoms/Tooltip.stories.tsx +59 -0
  217. package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +57 -0
  218. package/src/storybook/stories/components/DocsSyncTheme.tsx +20 -0
  219. package/src/storybook/stories/components/VariableSpacingShowcase.tsx +46 -0
  220. package/src/storybook/stories/components/index.ts +5 -0
  221. package/src/storybook/stories/design-tokens/colors.stories.mdx +44 -0
  222. package/src/storybook/stories/design-tokens/icons.stories.mdx +19 -0
  223. package/src/storybook/stories/design-tokens/typeset.stories.mdx +17 -0
  224. package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +11 -0
  225. package/src/storybook/stories/molecules/Account.stories.tsx +71 -0
  226. package/src/storybook/stories/molecules/Address.stories.tsx +39 -0
  227. package/src/storybook/stories/molecules/Card.stories.tsx +112 -0
  228. package/src/storybook/stories/molecules/Chip.stories.tsx +127 -0
  229. package/src/storybook/stories/molecules/DisplayStats.stories.tsx +63 -0
  230. package/src/storybook/stories/molecules/Dropdown.stories.tsx +38 -0
  231. package/src/storybook/stories/molecules/Input.stories.tsx +239 -0
  232. package/src/storybook/stories/molecules/NavbarItem.stories.tsx +45 -0
  233. package/src/storybook/stories/molecules/Search.stories.tsx +101 -0
  234. package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +108 -0
  235. package/src/storybook/stories/molecules/Select.stories.tsx +103 -0
  236. package/src/storybook/stories/molecules/TableCell.stories.tsx +46 -0
  237. package/src/storybook/stories/molecules/TableHeaderCell.stories.tsx +34 -0
  238. package/src/storybook/stories/molecules/TextArea.stories.tsx +80 -0
  239. package/src/storybook/stories/molecules/Title.stories.tsx +76 -0
  240. package/src/storybook/stories/organisms/Accordion.stories.tsx +70 -0
  241. package/src/storybook/stories/organisms/Dialog.stories.tsx +129 -0
  242. package/src/storybook/stories/organisms/Navbar.stories.tsx +78 -0
  243. package/src/storybook/stories/organisms/Table.stories.tsx +154 -0
@@ -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-iota-neutral-90 names:bg-names-neutral-12 dark:bg-iota-neutral-12" />
21
+ <Skeleton className="h-10 w-10 rounded-none" />
22
+ </CardImage>
23
+ <div className="flex flex-col gap-y-xs">
24
+ <Skeleton className="h-3.5 w-40" />
25
+ <Skeleton className="h-3 w-32" hasSecondaryColors />
26
+ </div>
27
+ <div className="ml-auto flex flex-col gap-y-xs">
28
+ <Skeleton className="h-3.5 w-20" />
29
+ <Skeleton className="h-3 w-16" 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,59 @@
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-iota-neutral-10 names:text-names-neutral-92 dark:text-names-neutral-92">
16
+ Hover me
17
+ </span>
18
+ </Tooltip>
19
+ </div>
20
+ );
21
+ },
22
+ } satisfies Meta<typeof Tooltip>;
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ text: 'This is a tooltip',
31
+ },
32
+ argTypes: {
33
+ text: {
34
+ control: {
35
+ type: 'text',
36
+ },
37
+ },
38
+ position: {
39
+ control: {
40
+ type: 'select',
41
+ options: Object.values(TooltipPosition),
42
+ },
43
+ },
44
+ },
45
+ };
46
+
47
+ export const WithIcon: Story = {
48
+ args: {
49
+ text: 'This is a tooltip',
50
+ position: TooltipPosition.Right,
51
+ },
52
+ render: (props) => {
53
+ return (
54
+ <Tooltip {...props}>
55
+ <Info className="text-iota-neutral-10 names:text-names-neutral-92 dark:text-names-neutral-92" />
56
+ </Tooltip>
57
+ );
58
+ },
59
+ };
@@ -0,0 +1,57 @@
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
+ assetType: VisualAssetType.Image,
26
+ src: 'https://d315pvdvxi2gex.cloudfront.net/528399e23c1bb7b14cced0b89.png',
27
+ altText: 'IOTA Logo',
28
+ onIconClick: () => {
29
+ console.log('Icon clicked');
30
+ },
31
+ onClick: () => {
32
+ console.log('Card clicked');
33
+ },
34
+ assetTitle: 'IOTA Logo',
35
+ },
36
+ argTypes: {
37
+ src: {
38
+ control: 'text',
39
+ },
40
+ altText: {
41
+ control: 'text',
42
+ },
43
+ icon: {
44
+ control: 'none',
45
+ },
46
+ onIconClick: {
47
+ control: 'none',
48
+ },
49
+ assetType: { control: 'select', options: Object.values(VisualAssetType) },
50
+ onClick: {
51
+ control: 'none',
52
+ },
53
+ assetTitle: {
54
+ control: 'text',
55
+ },
56
+ },
57
+ };
@@ -0,0 +1,20 @@
1
+ // Copyright (c) 2025 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { UIKitTheme } from '../../../lib/enums/theme.enums';
5
+ import { useEffect } from 'react';
6
+
7
+ export function DocsSyncTheme() {
8
+ useEffect(() => {
9
+ const docsUrl = new URL(document.location.href);
10
+ const globals = docsUrl.searchParams.get('globals');
11
+
12
+ const currentTheme = globals?.replace('theme:', '') || UIKitTheme.Light;
13
+
14
+ for (const theme of Object.values(UIKitTheme)) {
15
+ document.documentElement.classList.toggle(theme, theme === currentTheme);
16
+ }
17
+ }, []);
18
+
19
+ return null;
20
+ }