@iota/apps-ui-kit 0.7.0 → 0.7.2

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 (53) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.d.ts +51 -25
  3. package/dist/index.es.js +2213 -2151
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +10 -10
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +3 -2
  9. package/src/lib/components/atoms/button/Button.tsx +1 -0
  10. package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +1 -1
  11. package/src/lib/components/atoms/checkbox/Checkbox.tsx +0 -1
  12. package/src/lib/components/atoms/index.ts +1 -0
  13. package/src/lib/components/atoms/list-item/ListItem.tsx +1 -1
  14. package/src/lib/components/atoms/radio-button/RadioButton.tsx +1 -1
  15. package/src/lib/components/atoms/skeleton/Skeleton.tsx +5 -20
  16. package/src/lib/components/index.ts +0 -2
  17. package/src/lib/components/molecules/chip/Chip.tsx +51 -17
  18. package/src/lib/components/molecules/chip/chip.classes.ts +36 -14
  19. package/src/lib/components/molecules/chip/chip.enums.ts +6 -3
  20. package/src/lib/components/molecules/input/Input.tsx +34 -17
  21. package/src/lib/components/molecules/input/TextArea.tsx +5 -4
  22. package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +0 -1
  23. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +1 -1
  24. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +1 -1
  25. package/src/lib/components/molecules/select/Select.tsx +24 -4
  26. package/src/lib/components/organisms/dialog/Dialog.tsx +37 -22
  27. package/src/lib/constants/colors.constants.ts +12 -5
  28. package/src/lib/enums/index.ts +1 -0
  29. package/src/lib/enums/theme.enums.ts +8 -0
  30. package/src/lib/index.ts +2 -0
  31. package/src/lib/styles/base.css +40 -0
  32. package/src/lib/styles/components.css +52 -4
  33. package/src/lib/styles/index.css +4 -753
  34. package/src/lib/styles/utilities.css +11 -3
  35. package/src/lib/styles/variables/dark-variables.css +262 -0
  36. package/src/lib/styles/variables/general-variables.css +9 -0
  37. package/src/lib/styles/variables/light-variables.css +276 -0
  38. package/src/lib/styles/variables/names-variables.css +270 -0
  39. package/src/lib/tailwind/base.presets.ts +4 -0
  40. package/src/lib/tailwind/constants/gradients.constants.ts +6 -0
  41. package/src/storybook/blocks/TypeSet.tsx +3 -3
  42. package/src/storybook/constants/gradients.constants.ts +8 -0
  43. package/src/storybook/helpers/formatGradientNames.ts +15 -0
  44. package/src/storybook/stories/atoms/Skeleton.stories.tsx +5 -5
  45. package/src/storybook/stories/components/DocsSyncTheme.tsx +20 -0
  46. package/src/storybook/stories/components/index.ts +1 -0
  47. package/src/storybook/stories/design-tokens/colors.stories.mdx +12 -0
  48. package/src/storybook/stories/design-tokens/icons.stories.mdx +2 -0
  49. package/src/storybook/stories/design-tokens/typeset.stories.mdx +2 -0
  50. package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +2 -1
  51. package/src/storybook/stories/molecules/Chip.stories.tsx +5 -0
  52. package/src/storybook/stories/molecules/Input.stories.tsx +79 -2
  53. package/src/storybook/stories/organisms/Dialog.stories.tsx +54 -28
@@ -0,0 +1,270 @@
1
+ :root.names {
2
+ /* FONTS */
3
+ --font-family-heading: theme('fontFamily.roboto-flex');
4
+ --font-family-text: theme('fontFamily.inter');
5
+ --display-lg-font-weight: 700;
6
+ --display-lg-line-height: 100%;
7
+ --display-md-font-weight: 700;
8
+ --display-md-line-height: 100%;
9
+ --display-sm-font-weight: 700;
10
+ --display-sm-line-height: 100%;
11
+ --headline-lg-font-weight: 600;
12
+ --headline-md-font-weight: 600;
13
+ --headline-sm-font-weight: 600;
14
+
15
+ /* COLORS */
16
+ --warning-surface: theme('colors.names-warning.20');
17
+ --on-warning: theme('colors.names-warning.90');
18
+ --error-surface: theme('colors.names-error.20');
19
+ --on-error: theme('colors.names-error.90');
20
+ --success-surface: theme('colors.names-tertiary.20');
21
+ --on-success: theme('colors.names-tertiary.90');
22
+ --default-surface: theme('colors.names-primary.20');
23
+ --on-default: theme('colors.names-neutral.90');
24
+
25
+ /* STATE LAYER */
26
+ --state-layer-bg-color: theme('colors.names-primary.60');
27
+ --state-layer-secondary-bg-color: theme('colors.shader-primary-dark.100');
28
+ --state-layer-inverted-bg-color: theme('colors.names-primary.80');
29
+
30
+ /* ---------------- ATOMS ---------------- */
31
+
32
+ /* BADGE */
33
+ --badge-bg-color-neutral: theme('colors.names-neutral.12');
34
+ --badge-text-color-neutral: theme('colors.names-neutral.92');
35
+ --badge-border-color-neutral: theme('colors.names-neutral.12');
36
+ --badge-bg-color-primary: theme('colors.names-primary.30');
37
+ --badge-border-color-primary: theme('colors.names-primary.30');
38
+ --badge-text-color-primary: theme('colors.names-neutral.100');
39
+ --badge-bg-color-primary-soft: theme('colors.names-primary.20');
40
+ --badge-text-color-primary-soft: theme('colors.names-primary.90');
41
+ --badge-border-color-soft: theme('colors.names-primary.20');
42
+
43
+ /* INFOBOX */
44
+ --infobox-text-title: theme('colors.names-neutral.92');
45
+ --infobox-supporting-text: theme('colors.names-neutral.92');
46
+
47
+ /* BUTTON */
48
+ --button-bg-color-primary: theme('colors.names-primary.30');
49
+ --button-bg-color-disabled-primary: theme('colors.names-neutral.30');
50
+ --button-bg-color-secondary: theme('colors.names-neutral.20');
51
+ --button-bg-color-error: theme('colors.names-error.20');
52
+ --button-border-color-outline: theme('colors.names-neutral.60');
53
+ --button-text-color-primary: theme('colors.names-primary.100');
54
+ --button-text-color-neutral: theme('colors.names-neutral.92');
55
+ --button-text-color-error: theme('colors.names-error.90');
56
+
57
+ /* BUTTON PILL */
58
+ --button-pill-border-color: theme('colors.names-neutral.40');
59
+ --button-pill-text-color: theme('colors.names-neutral.60');
60
+
61
+ /* HEADER */
62
+ --header-bg-color: theme('colors.names-neutral.6');
63
+ --header-text-color: theme('colors.names-neutral.92');
64
+
65
+ /* LABEL */
66
+ --label-text-primary-neutral: theme('colors.names-neutral.92');
67
+ --label-text-secondary-neutral: theme('colors.names-neutral.50');
68
+
69
+ /* KEY VALUE */
70
+ --key-supporting-text-color: theme('colors.names-neutral.50');
71
+ --key-value-hover-text-color: theme('colors.iota-neutral.92');
72
+ --key-value-key-text-color: theme('colors.names-neutral.70');
73
+
74
+ /* CHECKBOX */
75
+ --checkbox-border-color-default: theme('colors.names-neutral.20');
76
+ --checkbox-border-color-checked: theme('colors.names-primary.30');
77
+ --checkbox-border-color-disabled: theme('colors.names-neutral.30');
78
+ --checkbox-border-color-disabled-checked: theme('colors.names-neutral.50');
79
+ --checkbox-bg-color-checked: theme('colors.names-primary.30');
80
+ --checkbox-bg-color-disabled-checked: theme('colors.names-neutral.50');
81
+ --checkbox-text-color: theme('colors.names-neutral.70');
82
+ --checkbox-text-color-checked: theme('colors.names-neutral.100');
83
+ --checkbox-label-text-color: theme('colors.names-neutral.70');
84
+
85
+ /* DIVIDER */
86
+ --divider-bg-color: theme('colors.shader-neutral-dark.8');
87
+
88
+ /* BUTTON SEGMENT */
89
+ --button-segment-text-color-default: theme('colors.names-neutral.50');
90
+ --button-segment-text-color-hover: theme('colors.names-neutral.70');
91
+ --button-segment-text-color-focused: theme('colors.names-neutral.70');
92
+ --button-segment-text-color-selected: theme('colors.names-neutral.92');
93
+ --button-segment-underline-default-color: theme('colors.shader-neutral-dark.8');
94
+ --button-segment-underline-hover-color: theme('colors.names-neutral.40');
95
+ --button-segment-underline-selected-color: theme('colors.names-primary.80');
96
+ --button-segment-bg-color-selected: theme('colors.names-neutral.6');
97
+
98
+ /* LOADING INDICATOR */
99
+ --loading-indicator-color: theme('colors.names-primary.80');
100
+
101
+ /* LIST ITEM */
102
+ --list-item-color: theme('colors.names-neutral.92');
103
+ --list-item-border-color: theme('colors.shader-neutral-dark.8');
104
+ --list-item-highlight-bg: theme('colors.shader-primary-dark.12');
105
+
106
+ /* PANEL */
107
+ --panel-bg: theme('colors.names-neutral.6');
108
+ --panel-border-color: theme('colors.shader-neutral-dark.8');
109
+
110
+ /* RADIO BUTTON */
111
+ --radio-icon-color: theme('colors.names-neutral.70');
112
+ --radio-icon-checked-color: theme('colors.names-primary.30');
113
+ --radio-icon-checked-disabled-color: theme('colors.names-neutral.70');
114
+ --radio-label-color: theme('colors.names-neutral.70');
115
+
116
+ /* SECONDARY TEXT */
117
+ --secondary-text-color: theme('colors.names-neutral.70');
118
+ --secondary-text-error-color: theme('colors.names-error.80');
119
+
120
+ /* SKELETON */
121
+ --skeleton-bg: theme('colors.names-neutral.12');
122
+ --skeleton-secondary-bg: theme('colors.names-neutral.10');
123
+
124
+ /* TOGGLE */
125
+ --toggle-bg-active: theme('colors.names-primary.30');
126
+ --toggle-border-active: theme('colors.names-primary.30');
127
+ --toggle-bg-inactive: theme('colors.names-neutral.6');
128
+ --toggle-border-inactive: theme('colors.names-neutral.50');
129
+ --toggle-bg-disabled-active: theme('colors.names-neutral.50');
130
+ --toggle-border-disabled-active: theme('colors.names-neutral.50');
131
+ --toggle-thumb-color: theme('colors.names-neutral.50');
132
+ --toggle-thumb-color-checked: theme('colors.names-neutral.6');
133
+ --toggle-label-color: theme('colors.names-neutral.70');
134
+
135
+ /* TOOLTIP */
136
+ --tooltip-bg: theme('colors.names-neutral.0');
137
+ --tooltip-text-color: theme('colors.names-neutral.100');
138
+
139
+ /* VISUAL ASSET CARD */
140
+ --visual-asset-placeholder-bg: theme('colors.names-neutral.10');
141
+ --visual-asset-placeholder-icon: theme('colors.names-neutral.60');
142
+ --visual-asset-title-color: theme('colors.names-neutral.100');
143
+ --visual-asset-icon-color: theme('colors.names-neutral.100');
144
+
145
+ /* ACCOUNT */
146
+ --account-title-color: theme('colors.names-neutral.92');
147
+ --account-icon-color: theme('colors.names-neutral.70');
148
+ --account-check-active-color: theme('colors.names-primary.80');
149
+ --account-check-inactive-color: theme('colors.names-neutral.60');
150
+
151
+ /* ADDRESS */
152
+ --address-text-color: theme('colors.names-neutral.70');
153
+
154
+ /* CARD */
155
+ --card-filled-bg: theme('colors.names-neutral.10');
156
+ --card-image-bg-solid: theme('colors.names-neutral.10');
157
+ --card-image-bg-white: theme('colors.names-neutral.6');
158
+ --card-action-link-color: theme('colors.names-neutral.92');
159
+ --card-action-title-color: theme('colors.names-neutral.92');
160
+ --card-action-subtitle-color: theme('colors.names-neutral.40');
161
+ --card-body-title-color: theme('colors.names-neutral.92');
162
+ --card-body-subtitle-color: theme('colors.names-neutral.70');
163
+
164
+ /* CHIP */
165
+ --chip-bg-selected-outline: theme('colors.shader-primary-dark.16');
166
+ --chip-bg-elevated: theme('colors.names-neutral.12');
167
+ --chip-bg-brand: theme('colors.names-primary.30');
168
+ --chip-border-default: theme('colors.names-neutral.20');
169
+ --chip-text-default: theme('colors.names-neutral.92');
170
+ --chip-text-secondary: theme('colors.names-neutral.92');
171
+ --chip-focus-ring: theme('colors.names-primary.80');
172
+ --chip-border-color-brand: theme('colors.names-primary.30');
173
+ --chip-text-brand: theme('colors.names-primary.100');
174
+ --chip-bg-selected-overlay: theme('colors.shader-primary-dark.16');
175
+ --chip-close-icon-opacity: 0.4;
176
+
177
+ --chip-outline-color: theme('colors.shader-primary-dark.16');
178
+ --chip-outline-color-hover: theme('colors.shader-primary-dark.8');
179
+ --chip-outline-color-active: theme('colors.shader-primary-dark.12');
180
+
181
+ --chip-bg-color-hover: theme('colors.shader-primary-dark.8');
182
+ --chip-bg-color-active: theme('colors.shader-primary-dark.12');
183
+ --chip-bg-color-focus: theme('colors.shader-primary-dark.12');
184
+
185
+ /* DISPLAY STATS */
186
+ --display-stats-bg-default: theme('colors.names-neutral.10');
187
+ --display-stats-bg-highlight: theme('colors.names-primary.80');
188
+ --display-stats-bg-secondary: theme('colors.names-secondary.10');
189
+ --display-stats-text-default: theme('colors.names-neutral.92');
190
+ --display-stats-text-highlight: theme('colors.names-primary.10');
191
+ --display-stats-text-secondary: theme('colors.names-neutral.92');
192
+ --display-stats-icon-color: theme('colors.names-neutral.92');
193
+ --display-stats-copy-icon-color: theme('colors.names-neutral.40');
194
+
195
+ /* DROPDOWN */
196
+ --dropdown-bg: theme('colors.names-neutral.6');
197
+ --dropdown-border-color: theme('colors.names-neutral.20');
198
+
199
+ /* INPUT */
200
+ --input-text-color: theme('colors.names-neutral.92');
201
+ --input-placeholder-color: rgba(136, 146, 161, 0.4); /* neutral.60 with 40% opacity */
202
+ --input-label-color: theme('colors.names-neutral.60');
203
+ --input-border-color: theme('colors.names-neutral.20');
204
+ --input-border-hover-color: theme('colors.names-neutral.60');
205
+ --input-border-error-color: theme('colors.names-error.80');
206
+ --input-border-focus-color: theme('colors.names-primary.80');
207
+ --input-caret-color: theme('colors.names-primary.80');
208
+ --input-icon-color: theme('colors.names-neutral.92');
209
+ --input-copy-icon-color: theme('colors.names-neutral.40');
210
+ --input-visibility-bar-color: rgba(24, 27, 49, 0.6); /* neutral.10 with 60% opacity */
211
+
212
+ /* NAVBAR ITEM */
213
+ --navbar-item-icon-color: theme('colors.names-neutral.70');
214
+ --navbar-item-icon-selected-color: theme('colors.names-neutral.92');
215
+ --navbar-item-label-color: theme('colors.names-neutral.50');
216
+ --navbar-item-label-selected-color: theme('colors.names-neutral.92');
217
+
218
+ /* SEARCH */
219
+ --search-text-color: theme('colors.names-neutral.92');
220
+ --search-placeholder-color: theme('colors.names-neutral.70');
221
+ --search-border-color: theme('colors.names-neutral.40');
222
+ --search-bg-color-filled: theme('colors.names-neutral.12');
223
+ --search-suggestion-bg-color: theme('colors.names-neutral.12');
224
+ --search-selected-index-bg-color: theme('colors.shader-inverted-dark.16');
225
+
226
+ /* SEGMENTED BUTTON */
227
+ --segmented-filled-bg-color: theme('colors.names-neutral.10');
228
+ --segmented-outlined-border-color: theme('colors.names-neutral.40');
229
+
230
+ /* SELECT */
231
+ --select-border-color: theme('colors.names-neutral.20');
232
+ --select-border-hover-color: theme('colors.names-neutral.60');
233
+ --select-border-focus-color: theme('colors.names-primary.80');
234
+ --select-border-error-color: theme('colors.names-error.80');
235
+ --select-icon-color: theme('colors.names-neutral.92');
236
+ --select-label-color: theme('colors.names-neutral.92');
237
+
238
+ /* TABLE CELL */
239
+ --table-cell-supporting-label-color: theme('colors.names-neutral.40');
240
+ --table-cell-border-color: theme('colors.shader-neutral-dark.8');
241
+
242
+ /* TABLE HEADER CELL */
243
+ --table-header-text-color: theme('colors.names-neutral.92');
244
+
245
+ /* TITLE */
246
+ --title-main-color: theme('colors.names-neutral.92');
247
+ --title-subtitle-color: theme('colors.names-neutral.50');
248
+ --title-icon-color: theme('colors.names-neutral.50');
249
+
250
+ /* ---------------- ORGANISMS ---------------- */
251
+
252
+ /* ACCORDION */
253
+ --accordion-bg: theme('colors.names-neutral.6');
254
+ --accordion-icon-color: theme('colors.names-neutral.92');
255
+ --accordion-border-color: theme('colors.shader-neutral-dark.8');
256
+
257
+ /* DIALOG */
258
+ --dialog-content-bg: theme('colors.names-neutral.6');
259
+ --dialog-title-color: theme('colors.names-neutral.92');
260
+ --dialog-body-color: theme('colors.names-neutral.70');
261
+ --dialog-outline: 1px solid theme('colors.names-neutral.20');
262
+ --dialog-overlay-bg: theme('colors.names-neutral.0/0.12');
263
+
264
+ /* NAVBAR */
265
+ --navbar-icon-color: theme('colors.names-neutral.92');
266
+ --navbar-slideout-bg: theme('colors.names-neutral.6');
267
+
268
+ /* TABLE */
269
+ --table-text-color: theme('colors.names-neutral.70');
270
+ }
@@ -17,6 +17,7 @@ import {
17
17
  } from './constants';
18
18
  import { THEMED_CUSTOM_COLORS } from './constants/customColors.constants';
19
19
  import { firefoxPlugin, namesVariant } from './plugins';
20
+ import { NAMES_GRADIENTS } from './constants/gradients.constants';
20
21
 
21
22
  export const BASE_CONFIG: Config = {
22
23
  content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
@@ -49,6 +50,9 @@ export const BASE_CONFIG: Config = {
49
50
  ...THEMED_CUSTOM_COLORS,
50
51
  },
51
52
  fontFamily: FONT_FAMILIES,
53
+ backgroundImage: {
54
+ ...NAMES_GRADIENTS,
55
+ },
52
56
  },
53
57
  },
54
58
  };
@@ -0,0 +1,6 @@
1
+ // Copyright (c) 2025 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const NAMES_GRADIENTS = {
5
+ 'names-gradient-primary': `var(--names-gradient-primary)`,
6
+ };
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import React from 'react';
4
5
  import { TypeSetItem } from './TypeSetItem';
5
6
  import { getFontSizeLabelFromClass } from '../helpers';
6
7
  import type { TailwindCustomFonts } from '@/lib/tailwind/constants';
@@ -17,16 +18,15 @@ export function TypeSet({ typeset, label }: TypeSetProps) {
17
18
  {textClasses.map(([fontClass, [_, fontConfig]], index) => {
18
19
  const sizeText = getFontSizeLabelFromClass(fontClass);
19
20
  return (
20
- <>
21
+ <React.Fragment key={index}>
21
22
  <TypeSetItem
22
- key={index}
23
23
  sampleText={label}
24
24
  fontClass={fontClass}
25
25
  sizeText={sizeText}
26
26
  {...fontConfig}
27
27
  />
28
28
  {index !== textClasses.length - 1 && <hr className="mb-sm mt-xxs" />}
29
- </>
29
+ </React.Fragment>
30
30
  );
31
31
  })}
32
32
  </div>
@@ -0,0 +1,8 @@
1
+ // Copyright (c) 2025 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { NAMES_GRADIENTS } from '@/lib/tailwind/constants/gradients.constants';
5
+
6
+ export const COLOR_GRADIENTS = {
7
+ names: NAMES_GRADIENTS,
8
+ };
@@ -0,0 +1,15 @@
1
+ // Copyright (c) 2025 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export function formatGradientNames(
5
+ title: string,
6
+ colors: Record<string, string>,
7
+ ): Record<string, string> {
8
+ const formattedColors: Record<string, string> = {};
9
+
10
+ Object.entries(colors).forEach(([key, value]) => {
11
+ formattedColors[key.replace(`${title}-`, '')] = value;
12
+ });
13
+
14
+ return formattedColors;
15
+ }
@@ -18,15 +18,15 @@ export const SkeletonCard: Story = {
18
18
  <Card>
19
19
  <CardImage shape={ImageShape.SquareRounded}>
20
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 widthClass="w-10" heightClass="h-10" isRounded={false} />
21
+ <Skeleton className="h-10 w-10 rounded-none" />
22
22
  </CardImage>
23
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 />
24
+ <Skeleton className="h-3.5 w-40" />
25
+ <Skeleton className="h-3 w-32" hasSecondaryColors />
26
26
  </div>
27
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 />
28
+ <Skeleton className="h-3.5 w-20" />
29
+ <Skeleton className="h-3 w-16" hasSecondaryColors />
30
30
  </div>
31
31
  </Card>
32
32
  ),
@@ -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
+ }
@@ -2,3 +2,4 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export * from './VariableSpacingShowcase';
5
+ export * from './DocsSyncTheme';
@@ -4,7 +4,11 @@ import {
4
4
  IOTA_NAMES_COLOR_PALETTE,
5
5
  SHADER_COLOR_PALETTE,
6
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';
7
10
 
11
+ <DocsSyncTheme />
8
12
  <Meta title="Design Tokens/Colors" />
9
13
 
10
14
  ## Primitives
@@ -23,6 +27,14 @@ import {
23
27
  })}
24
28
  </ColorPalette>
25
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
+
26
38
  ## Shaders
27
39
 
28
40
  <ColorPalette>
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Meta, Title, IconGallery, IconItem } from '@storybook/blocks';
3
3
  import * as Icons from '@iota/apps-ui-icons';
4
+ import { DocsSyncTheme } from '../components';
4
5
 
6
+ <DocsSyncTheme />
5
7
  <Meta title="Design Tokens/Icon Gallery" />
6
8
 
7
9
  # Icon Gallery
@@ -1,7 +1,9 @@
1
1
  import { Meta, Typeset, Unstyled } from '@storybook/blocks';
2
2
  import { TYPESETS } from '../../constants';
3
3
  import { TypeSet, TypeSetItem } from '../../blocks';
4
+ import { DocsSyncTheme } from '../components';
4
5
 
6
+ <DocsSyncTheme />
5
7
  <Meta title="Design Tokens/Typesets" />
6
8
 
7
9
  # Typesets
@@ -1,6 +1,7 @@
1
1
  import { Meta, Typeset, Unstyled } from '@storybook/blocks';
2
- import { VariableSpacingShowcase } from '../components';
2
+ import { VariableSpacingShowcase, DocsSyncTheme } from '../components';
3
3
 
4
+ <DocsSyncTheme />
4
5
  <Meta title="Design Tokens/Variable Spacing" />
5
6
 
6
7
  # Variable Spacing
@@ -5,6 +5,7 @@ import type { Meta, StoryObj } from '@storybook/react';
5
5
 
6
6
  import { Chip } from '@/components/molecules/chip/Chip';
7
7
  import { PlaceholderReplace } from '@iota/apps-ui-icons';
8
+ import { ChipType } from '@/lib';
8
9
 
9
10
  const meta: Meta<typeof Chip> = {
10
11
  component: Chip,
@@ -25,6 +26,7 @@ type Story = StoryObj<typeof meta>;
25
26
  export const Default: Story = {
26
27
  args: {
27
28
  label: 'Label',
29
+ type: ChipType.Outline,
28
30
  },
29
31
  argTypes: {
30
32
  label: {
@@ -33,6 +35,9 @@ export const Default: Story = {
33
35
  showClose: {
34
36
  control: 'boolean',
35
37
  },
38
+ type: {
39
+ control: 'select',
40
+ },
36
41
  selected: {
37
42
  control: 'boolean',
38
43
  },
@@ -4,10 +4,11 @@
4
4
  import type { Meta, StoryObj } from '@storybook/react';
5
5
 
6
6
  import { Input, InputType } from '@/lib/components/molecules/input';
7
- import { PlaceholderReplace } from '@iota/apps-ui-icons';
7
+ import { CheckmarkFilled, Close, Loader2, PlaceholderReplace } from '@iota/apps-ui-icons';
8
8
  import type { ComponentProps } from 'react';
9
9
  import { useCallback, useEffect, useState } from 'react';
10
- import { ButtonPill } from '@/lib/components/atoms/button';
10
+ import { ButtonPill, ButtonUnstyled } from '@/lib/components/atoms/button';
11
+ import classNames from 'classnames';
11
12
 
12
13
  type CustomStoryProps = {
13
14
  withLeadingIcon?: boolean;
@@ -160,3 +161,79 @@ export const NumericFormatInput: Story = {
160
161
  );
161
162
  },
162
163
  };
164
+
165
+ export const NameResolverInput: Story = {
166
+ args: {
167
+ type: InputType.Text,
168
+ },
169
+ render: ({ type }) => {
170
+ const [value, setValue] = useState<string>('');
171
+ const { address, isLoading, error } = useNameResolver(value);
172
+
173
+ const ICON_COLORS =
174
+ 'text-iota-primary-30 dark:text-iota-primary-70 names:text-names-primary-70';
175
+
176
+ return (
177
+ <Input
178
+ type={type}
179
+ placeholder="@name"
180
+ label="Name Resolver"
181
+ caption="Enter the name to resolve"
182
+ value={value}
183
+ onInput={(e) => setValue(e.currentTarget.value)}
184
+ supportingValue={address}
185
+ errorMessage={error || undefined}
186
+ trailingElement={
187
+ <>
188
+ {value.length > 0 && (
189
+ <ButtonUnstyled
190
+ className="input-icon-color"
191
+ onClick={() => setValue('')}
192
+ tabIndex={-1}
193
+ >
194
+ <Close className="h-5 w-5" />
195
+ </ButtonUnstyled>
196
+ )}
197
+ {isLoading ? (
198
+ <Loader2 className={classNames('h-5 w-5 animate-spin', ICON_COLORS)} />
199
+ ) : address ? (
200
+ <CheckmarkFilled className={classNames('h-5 w-5', ICON_COLORS)} />
201
+ ) : null}
202
+ </>
203
+ }
204
+ />
205
+ );
206
+ },
207
+ };
208
+
209
+ function useNameResolver(name: string) {
210
+ const [address, setAddress] = useState<string | null>(null);
211
+ const [isLoading, setIsLoading] = useState<boolean>(true);
212
+ const [error, setError] = useState<string | null>(null);
213
+
214
+ useEffect(() => {
215
+ setAddress(null);
216
+ setError(null);
217
+
218
+ if (!name) {
219
+ setIsLoading(false);
220
+ return;
221
+ }
222
+
223
+ setIsLoading(true);
224
+
225
+ const id = setTimeout(() => {
226
+ if (name.includes('@')) {
227
+ setAddress(`0x3c14…187b`);
228
+ } else {
229
+ setError("Only names with '@' are supported");
230
+ setAddress(null);
231
+ }
232
+ setIsLoading(false);
233
+ }, 1500);
234
+
235
+ return () => clearTimeout(id);
236
+ }, [name]);
237
+
238
+ return { address, isLoading, error };
239
+ }