@iota/apps-ui-kit 0.6.0 → 0.7.1

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 (121) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/index.d.ts +219 -34
  3. package/dist/index.es.js +3429 -6082
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +28 -160
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +11 -4
  9. package/src/lib/components/atoms/badge/badge.classes.ts +18 -18
  10. package/src/lib/components/atoms/badge/badge.enums.ts +1 -1
  11. package/src/lib/components/atoms/button/Button.tsx +1 -0
  12. package/src/lib/components/atoms/button/button-variants/ButtonPill.tsx +1 -1
  13. package/src/lib/components/atoms/button/button.classes.ts +12 -12
  14. package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +1 -1
  15. package/src/lib/components/atoms/button-segment/buttonSegment.classes.ts +15 -36
  16. package/src/lib/components/atoms/checkbox/Checkbox.tsx +19 -9
  17. package/src/lib/components/atoms/divider/divider.classes.ts +1 -1
  18. package/src/lib/components/atoms/header/Header.tsx +1 -1
  19. package/src/lib/components/atoms/image/Image.tsx +32 -0
  20. package/src/lib/components/atoms/image/index.ts +4 -0
  21. package/src/lib/components/atoms/index.ts +4 -1
  22. package/src/lib/components/atoms/info-box/InfoBox.tsx +2 -8
  23. package/src/lib/components/atoms/info-box/infoBox.classes.ts +8 -9
  24. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +5 -5
  25. package/src/lib/components/atoms/label-text/LabelText.tsx +4 -6
  26. package/src/lib/components/atoms/list-item/ListItem.tsx +4 -5
  27. package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +1 -1
  28. package/src/lib/components/atoms/media-fallback/MediaFallback.tsx +12 -0
  29. package/src/lib/components/atoms/media-fallback/index.ts +4 -0
  30. package/src/lib/components/atoms/panel/Panel.tsx +2 -4
  31. package/src/lib/components/atoms/radio-button/RadioButton.tsx +5 -9
  32. package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +3 -2
  33. package/src/lib/components/atoms/skeleton/Skeleton.tsx +6 -23
  34. package/src/lib/components/atoms/snackbar/snackbar.classes.ts +8 -8
  35. package/src/lib/components/atoms/toggle/toggle.classes.ts +6 -6
  36. package/src/lib/components/atoms/tooltip/Tooltip.tsx +3 -2
  37. package/src/lib/components/atoms/video/Video.tsx +33 -0
  38. package/src/lib/components/atoms/video/index.ts +4 -0
  39. package/src/lib/components/atoms/video/video.constants.ts +31 -0
  40. package/src/lib/components/index.ts +0 -2
  41. package/src/lib/components/molecules/account/Account.tsx +4 -4
  42. package/src/lib/components/molecules/address/Address.tsx +1 -1
  43. package/src/lib/components/molecules/asset-media-renderer/AssetMediaRenderer.tsx +50 -0
  44. package/src/lib/components/molecules/asset-media-renderer/index.ts +4 -0
  45. package/src/lib/components/molecules/card/CardAction.tsx +3 -5
  46. package/src/lib/components/molecules/card/CardBody.tsx +3 -2
  47. package/src/lib/components/molecules/card/card.classes.ts +3 -3
  48. package/src/lib/components/molecules/chip/Chip.tsx +59 -18
  49. package/src/lib/components/molecules/chip/chip.classes.ts +37 -15
  50. package/src/lib/components/molecules/chip/chip.enums.ts +10 -2
  51. package/src/lib/components/molecules/chip/index.ts +1 -0
  52. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +2 -2
  53. package/src/lib/components/molecules/display-stats/displayStats.classes.ts +6 -6
  54. package/src/lib/components/molecules/dropdown/Dropdown.tsx +1 -1
  55. package/src/lib/components/molecules/index.ts +2 -0
  56. package/src/lib/components/molecules/input/Input.tsx +37 -22
  57. package/src/lib/components/molecules/input/InputWrapper.tsx +1 -1
  58. package/src/lib/components/molecules/input/TextArea.tsx +4 -8
  59. package/src/lib/components/molecules/input/input.classes.ts +7 -8
  60. package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +0 -1
  61. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +1 -1
  62. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +1 -1
  63. package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +4 -4
  64. package/src/lib/components/molecules/search/Search.tsx +10 -7
  65. package/src/lib/components/molecules/search/search.classes.ts +5 -5
  66. package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +2 -2
  67. package/src/lib/components/molecules/select/Select.tsx +29 -16
  68. package/src/lib/components/molecules/table-cell/TableCell.tsx +2 -2
  69. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +2 -2
  70. package/src/lib/components/molecules/title/Title.tsx +3 -3
  71. package/src/lib/components/{atoms → molecules}/visual-asset-card/VisualAssetCard.tsx +26 -40
  72. package/src/lib/components/organisms/accordion/Accordion.tsx +2 -3
  73. package/src/lib/components/organisms/accordion/accordion.classes.ts +1 -1
  74. package/src/lib/components/organisms/dialog/Dialog.tsx +39 -24
  75. package/src/lib/components/organisms/navbar/Navbar.tsx +2 -2
  76. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +1 -1
  77. package/src/lib/components/organisms/table/Table.tsx +2 -2
  78. package/src/lib/constants/colors.constants.ts +114 -8
  79. package/src/lib/enums/index.ts +1 -0
  80. package/src/lib/enums/theme.enums.ts +8 -0
  81. package/src/lib/index.ts +2 -0
  82. package/src/lib/styles/base.css +137 -0
  83. package/src/lib/styles/components.css +735 -0
  84. package/src/lib/styles/fonts.css +2 -0
  85. package/src/lib/styles/index.css +10 -141
  86. package/src/lib/styles/utilities.css +61 -0
  87. package/src/lib/styles/variables/dark-variables.css +262 -0
  88. package/src/lib/styles/variables/general-variables.css +9 -0
  89. package/src/lib/styles/variables/light-variables.css +276 -0
  90. package/src/lib/styles/variables/names-variables.css +270 -0
  91. package/src/lib/tailwind/base.presets.ts +17 -8
  92. package/src/lib/tailwind/constants/customColors.constants.ts +13 -0
  93. package/src/lib/tailwind/constants/fontFamily.constants.ts +8 -0
  94. package/src/lib/tailwind/constants/fontSizes.constants.ts +9 -9
  95. package/src/lib/tailwind/constants/gradients.constants.ts +6 -0
  96. package/src/lib/tailwind/constants/index.ts +1 -0
  97. package/src/lib/tailwind/plugins.ts +4 -0
  98. package/src/storybook/blocks/Showcase.tsx +2 -2
  99. package/src/storybook/blocks/TypeSet.tsx +3 -3
  100. package/src/storybook/blocks/TypeSetItem.tsx +3 -3
  101. package/src/storybook/constants/gradients.constants.ts +8 -0
  102. package/src/storybook/helpers/formatGradientNames.ts +15 -0
  103. package/src/storybook/stories/atoms/Skeleton.stories.tsx +6 -6
  104. package/src/storybook/stories/atoms/Tooltip.stories.tsx +4 -2
  105. package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +3 -2
  106. package/src/storybook/stories/components/DocsSyncTheme.tsx +20 -0
  107. package/src/storybook/stories/components/VariableSpacingShowcase.tsx +2 -2
  108. package/src/storybook/stories/components/index.ts +1 -0
  109. package/src/storybook/stories/design-tokens/colors.stories.mdx +21 -0
  110. package/src/storybook/stories/design-tokens/icons.stories.mdx +2 -0
  111. package/src/storybook/stories/design-tokens/typeset.stories.mdx +2 -0
  112. package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +2 -1
  113. package/src/storybook/stories/molecules/Account.stories.tsx +3 -1
  114. package/src/storybook/stories/molecules/Chip.stories.tsx +5 -0
  115. package/src/storybook/stories/molecules/Input.stories.tsx +79 -2
  116. package/src/storybook/stories/molecules/Search.stories.tsx +2 -2
  117. package/src/storybook/stories/molecules/TableCell.stories.tsx +1 -1
  118. package/src/storybook/stories/molecules/TextArea.stories.tsx +1 -1
  119. package/src/storybook/stories/organisms/Dialog.stories.tsx +54 -28
  120. /package/src/lib/components/{atoms → molecules}/visual-asset-card/index.ts +0 -0
  121. /package/src/lib/components/{atoms → molecules}/visual-asset-card/visualAssetCard.enums.ts +0 -0
@@ -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
+ };
@@ -4,3 +4,4 @@
4
4
  export * from './scaling.constants';
5
5
  export * from './fontSizes.constants';
6
6
  export * from './variableSpacing.constants';
7
+ export * from './fontFamily.constants';
@@ -6,3 +6,7 @@ import plugin from 'tailwindcss/plugin';
6
6
  export const firefoxPlugin = plugin(({ addVariant }) => {
7
7
  addVariant('firefox', '@-moz-document url-prefix()');
8
8
  });
9
+
10
+ export const namesVariant = plugin(({ addVariant }) => {
11
+ addVariant('names', '&:is(.names *)');
12
+ });
@@ -9,9 +9,9 @@ interface ShowcaseProps {
9
9
  export function Showcase({ children, title }: ShowcaseProps) {
10
10
  return (
11
11
  <div className="flex flex-col gap-2">
12
- <code className="inline w-fit rounded-md bg-neutral-96 px-xxs">{title}</code>
12
+ <code className="inline w-fit rounded-md bg-iota-neutral-96 px-xxs">{title}</code>
13
13
  <div className="flex">
14
- <div className="flex flex-row items-center justify-center rounded-xl border border-neutral-70 p-md">
14
+ <div className="flex flex-row items-center justify-center rounded-xl border border-iota-neutral-70 p-md">
15
15
  {children}
16
16
  </div>
17
17
  </div>
@@ -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>
@@ -44,7 +44,7 @@ export function TypeSetItem({ sampleText, sizeText, fontClass }: TypeSetItemProp
44
44
  return (
45
45
  <div className="flex flex-row items-start gap-x-md">
46
46
  {styles && (
47
- <div className="text-xs text-neutral-60">
47
+ <div className="text-xs text-iota-neutral-60">
48
48
  {styles[FontStyleProperties.FontSize]}
49
49
  </div>
50
50
  )}
@@ -59,9 +59,9 @@ export function TypeSetItem({ sampleText, sizeText, fontClass }: TypeSetItemProp
59
59
  .map(([key, value], index) => (
60
60
  <Fragment key={index}>
61
61
  {index > 0 && (
62
- <span className="text-xs text-neutral-60">|</span>
62
+ <span className="text-xs text-iota-neutral-60">|</span>
63
63
  )}
64
- <span className="text-xs text-neutral-60">
64
+ <span className="text-xs text-iota-neutral-60">
65
65
  {key}: {value}
66
66
  </span>
67
67
  </Fragment>
@@ -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
+ }
@@ -17,16 +17,16 @@ export const SkeletonCard: Story = {
17
17
  render: () => (
18
18
  <Card>
19
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} />
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
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
  ),
@@ -12,7 +12,9 @@ const meta: Meta<typeof Tooltip> = {
12
12
  return (
13
13
  <div className="flex h-20 items-center p-sm">
14
14
  <Tooltip {...props}>
15
- <span className="text-neutral-10 dark:text-neutral-92">Hover me</span>
15
+ <span className="text-iota-neutral-10 names:text-names-neutral-92 dark:text-names-neutral-92">
16
+ Hover me
17
+ </span>
16
18
  </Tooltip>
17
19
  </div>
18
20
  );
@@ -50,7 +52,7 @@ export const WithIcon: Story = {
50
52
  render: (props) => {
51
53
  return (
52
54
  <Tooltip {...props}>
53
- <Info className="text-neutral-10 dark:text-neutral-92" />
55
+ <Info className="text-iota-neutral-10 names:text-names-neutral-92 dark:text-names-neutral-92" />
54
56
  </Tooltip>
55
57
  );
56
58
  },
@@ -22,7 +22,8 @@ type Story = StoryObj<typeof meta>;
22
22
 
23
23
  export const Default: Story = {
24
24
  args: {
25
- assetSrc: 'https://d315pvdvxi2gex.cloudfront.net/528399e23c1bb7b14cced0b89.png',
25
+ assetType: VisualAssetType.Image,
26
+ src: 'https://d315pvdvxi2gex.cloudfront.net/528399e23c1bb7b14cced0b89.png',
26
27
  altText: 'IOTA Logo',
27
28
  onIconClick: () => {
28
29
  console.log('Icon clicked');
@@ -33,7 +34,7 @@ export const Default: Story = {
33
34
  assetTitle: 'IOTA Logo',
34
35
  },
35
36
  argTypes: {
36
- assetSrc: {
37
+ src: {
37
38
  control: 'text',
38
39
  },
39
40
  altText: {
@@ -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
+ }
@@ -8,7 +8,7 @@ import { VARIABLE_GAP_CLASSES, VARIABLE_PADDING_CLASSES } from '@/storybook/cons
8
8
  export function VariableSpacingShowcase() {
9
9
  return (
10
10
  <div className="flex flex-col gap-10">
11
- <p className="text-headline-sm text-neutral-10">
11
+ <p className="text-headline-sm text-iota-neutral-10">
12
12
  The variable spacing changes based on the screen size.
13
13
  </p>
14
14
 
@@ -39,7 +39,7 @@ export function VariableSpacingShowcase() {
39
39
  function DocumentedBlock({ title, children }: React.PropsWithChildren<{ title: string }>) {
40
40
  return (
41
41
  <div className="flex flex-col gap-y-4">
42
- <h2 className="text-headline-md text-neutral-10">{title}</h2>
42
+ <h2 className="text-headline-md text-iota-neutral-10">{title}</h2>
43
43
  <div className="flex flex-row flex-wrap gap-10">{children}</div>
44
44
  </div>
45
45
  );
@@ -2,3 +2,4 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export * from './VariableSpacingShowcase';
5
+ export * from './DocsSyncTheme';
@@ -1,9 +1,14 @@
1
1
  import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
2
2
  import {
3
3
  IOTA_PRIMITIVES_COLOR_PALETTE,
4
+ IOTA_NAMES_COLOR_PALETTE,
4
5
  SHADER_COLOR_PALETTE,
5
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';
6
10
 
11
+ <DocsSyncTheme />
7
12
  <Meta title="Design Tokens/Colors" />
8
13
 
9
14
  ## Primitives
@@ -14,6 +19,22 @@ import {
14
19
  })}
15
20
  </ColorPalette>
16
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
+
17
38
  ## Shaders
18
39
 
19
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
@@ -22,7 +22,9 @@ export default meta;
22
22
  type Story = StoryObj<typeof meta>;
23
23
 
24
24
  const Avatar = ({ isLocked }: { isLocked?: boolean }) => {
25
- const circleFillClass = isLocked ? 'fill-neutral-80 dark:fill-neutral-30' : 'fill-primary-30';
25
+ const circleFillClass = isLocked
26
+ ? 'fill-iota-neutral-80 dark:fill-iota-neutral-30 names:fill-names-neutral-30'
27
+ : 'fill-iota-primary-30';
26
28
  return (
27
29
  <svg
28
30
  xmlns="http://www.w3.org/2000/svg"
@@ -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
+ }
@@ -49,10 +49,10 @@ const meta: Meta<typeof Search> = {
49
49
  suggestion.supportingText ? 'justify-between' : 'justify-start',
50
50
  )}
51
51
  >
52
- <span className="text-body-lg text-neutral-10 dark:text-neutral-92">
52
+ <span className="text-body-lg text-iota-neutral-10 names:text-names-neutral-92 dark:text-iota-neutral-92">
53
53
  {suggestion.label}
54
54
  </span>
55
- <span className="text-body-md text-neutral-40 dark:text-neutral-60">
55
+ <span className="text-body-md text-iota-neutral-40 names:text-names-neutral-60 dark:text-iota-neutral-60">
56
56
  {suggestion.supportingText}
57
57
  </span>
58
58
  </div>
@@ -38,7 +38,7 @@ const Avatar = () => {
38
38
  viewBox="0 0 33 32"
39
39
  fill="none"
40
40
  >
41
- <circle cx="16.5" cy="16" r="16" className="fill-primary-40" />
41
+ <circle cx="16.5" cy="16" r="16" className="fill-iota-primary-40" />
42
42
  </svg>
43
43
  );
44
44
  };
@@ -71,7 +71,7 @@ export const Default: Story = {
71
71
  isVisibilityToggleEnabled
72
72
  {...storyProps}
73
73
  />
74
- <div className="flex w-full justify-end">
74
+ <div className="flex w-full justify-end pt-2">
75
75
  <Button onClick={() => onSubmit()} text="Submit" />
76
76
  </div>
77
77
  </div>
@@ -63,36 +63,62 @@ export const RightDialog: Story = {
63
63
  <Button size={ButtonSize.Small} text="Open Dialog" onClick={() => setOpen(true)} />
64
64
  <Dialog open={open} onOpenChange={setOpen}>
65
65
  <DialogContent showCloseOnOverlay position={DialogPosition.Right}>
66
- <div className="h-full w-full">
67
- <Header
68
- title="Connect Ledger Wallet"
69
- titleCentered
70
- onClose={() => setOpen(false)}
71
- onBack={() => setOpen(false)}
72
- />
73
- <div className="flex h-full w-full flex-col items-center justify-center">
74
- <DialogBody>
75
- <div className="flex flex-col items-center gap-2">
76
- <div className="mt-4.5">Logo</div>
77
- <div className="mt-4.5 break-words text-center">
78
- Connect your ledger to your computer, unlock it, and
79
- launch the IOTA app. Click Continue when done.
80
- </div>
81
- <div className="mt-4.5">
82
- {' '}
83
- Need more help? View tutorial.
84
- </div>
66
+ <Header
67
+ title="Connect Ledger Wallet"
68
+ titleCentered
69
+ onClose={() => setOpen(false)}
70
+ onBack={() => setOpen(false)}
71
+ />
72
+ <div className="flex h-full w-full flex-col items-center justify-center">
73
+ <DialogBody>
74
+ <div className="flex flex-col items-center gap-2">
75
+ <div className="mt-4.5">Logo</div>
76
+ <div className="mt-4.5 break-words text-center">
77
+ Connect your ledger to your computer, unlock it, and launch
78
+ the IOTA app. Click Continue when done.
79
+ </div>
80
+ <div className="mt-4.5"> Need more help? View tutorial.</div>
81
+ </div>
82
+ </DialogBody>
83
+ <div className="flex w-full flex-row justify-center gap-2 px-md--rs pb-md--rs pt-sm--rs">
84
+ <Button
85
+ size={ButtonSize.Small}
86
+ type={ButtonType.Outlined}
87
+ text="Cancel"
88
+ onClick={() => setOpen(false)}
89
+ />
90
+ <Button size={ButtonSize.Small} text="Connect" />
91
+ </div>
92
+ </div>
93
+ </DialogContent>
94
+ </Dialog>
95
+ <Dialog open={open} onOpenChange={setOpen}>
96
+ <DialogContent showCloseOnOverlay position={DialogPosition.Right}>
97
+ <Header
98
+ title="Connect Ledger Wallet"
99
+ titleCentered
100
+ onClose={() => setOpen(false)}
101
+ onBack={() => setOpen(false)}
102
+ />
103
+ <div className="flex h-full w-full flex-col items-center justify-center">
104
+ <DialogBody>
105
+ <div className="flex flex-col items-center gap-2">
106
+ <div className="mt-4.5">Logo</div>
107
+ <div className="mt-4.5 break-words text-center">
108
+ Connect your ledger to your computer, unlock it, and launch
109
+ the IOTA app. Click Continue when done.
85
110
  </div>
86
- </DialogBody>
87
- <div className="flex w-full flex-row justify-center gap-2 px-md--rs pb-md--rs pt-sm--rs">
88
- <Button
89
- size={ButtonSize.Small}
90
- type={ButtonType.Outlined}
91
- text="Cancel"
92
- onClick={() => setOpen(false)}
93
- />
94
- <Button size={ButtonSize.Small} text="Connect" />
111
+ <div className="mt-4.5"> Need more help? View tutorial.</div>
95
112
  </div>
113
+ </DialogBody>
114
+ <div className="flex w-full flex-row justify-center gap-2 px-md--rs pb-md--rs pt-sm--rs">
115
+ <Button
116
+ size={ButtonSize.Small}
117
+ type={ButtonType.Outlined}
118
+ text="Cancel"
119
+ onClick={() => setOpen(false)}
120
+ />
121
+ <Button size={ButtonSize.Small} text="Connect" />
96
122
  </div>
97
123
  </div>
98
124
  </DialogContent>