@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,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-iota-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-iota-neutral-10">{title}</h2>
43
+ <div className="flex flex-row flex-wrap gap-10">{children}</div>
44
+ </div>
45
+ );
46
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './VariableSpacingShowcase';
5
+ export * from './DocsSyncTheme';
@@ -0,0 +1,44 @@
1
+ import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
2
+ import {
3
+ IOTA_PRIMITIVES_COLOR_PALETTE,
4
+ IOTA_NAMES_COLOR_PALETTE,
5
+ SHADER_COLOR_PALETTE,
6
+ } from '../../../lib/constants/colors.constants';
7
+ import { COLOR_GRADIENTS } from '../../constants/gradients.constants';
8
+ import { DocsSyncTheme } from '../components';
9
+ import { formatGradientNames } from '../../helpers/formatGradientNames';
10
+
11
+ <DocsSyncTheme />
12
+ <Meta title="Design Tokens/Colors" />
13
+
14
+ ## Primitives
15
+
16
+ <ColorPalette>
17
+ {Object.entries(IOTA_PRIMITIVES_COLOR_PALETTE).map(([color, values]) => {
18
+ return <ColorItem key={color} title={color} colors={values} />;
19
+ })}
20
+ </ColorPalette>
21
+
22
+ ## Names
23
+
24
+ <ColorPalette>
25
+ {Object.entries(IOTA_NAMES_COLOR_PALETTE).map(([color, values]) => {
26
+ return <ColorItem key={color} title={color} colors={values} />;
27
+ })}
28
+ </ColorPalette>
29
+
30
+ ## Gradients
31
+
32
+ <ColorPalette>
33
+ {Object.entries(COLOR_GRADIENTS).map(([color, values]) => {
34
+ return <ColorItem key={color} title={color} colors={formatGradientNames(color, values)} />;
35
+ })}
36
+ </ColorPalette>
37
+
38
+ ## Shaders
39
+
40
+ <ColorPalette>
41
+ {Object.entries(SHADER_COLOR_PALETTE).map(([color, values]) => {
42
+ return <ColorItem key={color} title={color} colors={values} />;
43
+ })}
44
+ </ColorPalette>
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Meta, Title, IconGallery, IconItem } from '@storybook/blocks';
3
+ import * as Icons from '@iota/apps-ui-icons';
4
+ import { DocsSyncTheme } from '../components';
5
+
6
+ <DocsSyncTheme />
7
+ <Meta title="Design Tokens/Icon Gallery" />
8
+
9
+ # Icon Gallery
10
+
11
+ <br />
12
+
13
+ <IconGallery>
14
+ {Object.keys(Icons).map((icon) => (
15
+ <IconItem key={icon} name={icon}>
16
+ {React.createElement(Icons[icon])}
17
+ </IconItem>
18
+ ))}
19
+ </IconGallery>
@@ -0,0 +1,17 @@
1
+ import { Meta, Typeset, Unstyled } from '@storybook/blocks';
2
+ import { TYPESETS } from '../../constants';
3
+ import { TypeSet, TypeSetItem } from '../../blocks';
4
+ import { DocsSyncTheme } from '../components';
5
+
6
+ <DocsSyncTheme />
7
+ <Meta title="Design Tokens/Typesets" />
8
+
9
+ # Typesets
10
+
11
+ <Unstyled>
12
+ <div className="flex flex-col gap-y-12">
13
+ {TYPESETS.map((typeset, typeSetIndex) => (
14
+ <TypeSet key={typeSetIndex} {...typeset} />
15
+ ))}
16
+ </div>
17
+ </Unstyled>
@@ -0,0 +1,11 @@
1
+ import { Meta, Typeset, Unstyled } from '@storybook/blocks';
2
+ import { VariableSpacingShowcase, DocsSyncTheme } from '../components';
3
+
4
+ <DocsSyncTheme />
5
+ <Meta title="Design Tokens/Variable Spacing" />
6
+
7
+ # Variable Spacing
8
+
9
+ <Unstyled>
10
+ <VariableSpacingShowcase />
11
+ </Unstyled>
@@ -0,0 +1,71 @@
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
26
+ ? 'fill-iota-neutral-80 dark:fill-iota-neutral-30 names:fill-names-neutral-30'
27
+ : 'fill-iota-primary-30';
28
+ return (
29
+ <svg
30
+ xmlns="http://www.w3.org/2000/svg"
31
+ width="33"
32
+ height="32"
33
+ viewBox="0 0 33 32"
34
+ fill="none"
35
+ >
36
+ <circle cx="16.5" cy="16" r="16" className={cx(circleFillClass)} />
37
+ </svg>
38
+ );
39
+ };
40
+
41
+ export const Default: Story = {
42
+ args: {
43
+ title: 'Account',
44
+ subtitle: '0x0d7...3f37',
45
+ isLocked: true,
46
+ avatarContent: Avatar,
47
+ },
48
+ argTypes: {
49
+ badgeType: {
50
+ control: 'select',
51
+ options: Object.values(BadgeType),
52
+ },
53
+ isLocked: {
54
+ control: 'boolean',
55
+ },
56
+ onOptionsClick: {
57
+ action: 'onOptionsClick',
58
+ control: 'none',
59
+ },
60
+ onLockAccountClick: {
61
+ action: 'onLockAccount',
62
+ control: 'none',
63
+ },
64
+ avatarContent: {
65
+ control: 'none',
66
+ },
67
+ badgeText: {
68
+ control: 'text',
69
+ },
70
+ },
71
+ };
@@ -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,127 @@
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
+ import { ChipType } from '@/lib';
9
+
10
+ const meta: Meta<typeof Chip> = {
11
+ component: Chip,
12
+ tags: ['autodocs'],
13
+ render: (props) => {
14
+ return (
15
+ <div className="flex">
16
+ <Chip {...props} />
17
+ </div>
18
+ );
19
+ },
20
+ } satisfies Meta<typeof Chip>;
21
+
22
+ export default meta;
23
+
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Default: Story = {
27
+ args: {
28
+ label: 'Label',
29
+ type: ChipType.Outline,
30
+ },
31
+ argTypes: {
32
+ label: {
33
+ control: 'text',
34
+ },
35
+ showClose: {
36
+ control: 'boolean',
37
+ },
38
+ type: {
39
+ control: 'select',
40
+ },
41
+ selected: {
42
+ control: 'boolean',
43
+ },
44
+ },
45
+ };
46
+
47
+ export const WithIcon: Story = {
48
+ args: {
49
+ label: 'Label',
50
+ leadingElement: <PlaceholderReplace />,
51
+ },
52
+ render: (props) => {
53
+ return (
54
+ <div className="flex flex-row gap-x-4">
55
+ <Chip {...props} />
56
+ <Chip {...props} showClose />
57
+ </div>
58
+ );
59
+ },
60
+ };
61
+
62
+ export const WithAvatar: Story = {
63
+ args: {
64
+ label: 'Label',
65
+ avatar: <Avatar />,
66
+ },
67
+ render: (props) => {
68
+ return (
69
+ <div className="flex flex-row gap-x-4">
70
+ <Chip {...props} />
71
+ <Chip {...props} showClose />
72
+ </div>
73
+ );
74
+ },
75
+ };
76
+
77
+ function Avatar() {
78
+ return (
79
+ <svg
80
+ xmlns="http://www.w3.org/2000/svg"
81
+ width="24"
82
+ height="24"
83
+ viewBox="0 0 24 24"
84
+ fill="none"
85
+ >
86
+ <circle cx="12" cy="12" r="12" fill="#0101FF" />
87
+ <circle
88
+ cx="12"
89
+ cy="12"
90
+ r="12"
91
+ fill="url(#paint0_linear_288_11913)"
92
+ fill-opacity="0.2"
93
+ />
94
+ <circle
95
+ cx="12"
96
+ cy="12"
97
+ r="12"
98
+ fill="url(#paint1_linear_288_11913)"
99
+ fill-opacity="0.2"
100
+ />
101
+ <defs>
102
+ <linearGradient
103
+ id="paint0_linear_288_11913"
104
+ x1="12"
105
+ y1="0"
106
+ x2="17.7143"
107
+ y2="13.4286"
108
+ gradientUnits="userSpaceOnUse"
109
+ >
110
+ <stop offset="0.990135" stop-opacity="0" />
111
+ <stop offset="1" />
112
+ </linearGradient>
113
+ <linearGradient
114
+ id="paint1_linear_288_11913"
115
+ x1="12"
116
+ y1="0"
117
+ x2="6.85714"
118
+ y2="5.42857"
119
+ gradientUnits="userSpaceOnUse"
120
+ >
121
+ <stop offset="0.9999" stop-opacity="0" />
122
+ <stop offset="1" />
123
+ </linearGradient>
124
+ </defs>
125
+ </svg>
126
+ );
127
+ }
@@ -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
+ };