@iota/apps-ui-kit 0.5.1 → 0.7.0

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 (99) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/index.d.ts +186 -20
  3. package/dist/index.es.js +3701 -6345
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +33 -165
  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-variants/ButtonPill.tsx +1 -1
  12. package/src/lib/components/atoms/button/button.classes.ts +12 -12
  13. package/src/lib/components/atoms/button-segment/ButtonSegment.tsx +15 -3
  14. package/src/lib/components/atoms/button-segment/buttonSegment.classes.ts +15 -36
  15. package/src/lib/components/atoms/checkbox/Checkbox.tsx +20 -9
  16. package/src/lib/components/atoms/divider/divider.classes.ts +1 -1
  17. package/src/lib/components/atoms/header/Header.tsx +1 -1
  18. package/src/lib/components/atoms/image/Image.tsx +32 -0
  19. package/src/lib/components/atoms/image/index.ts +4 -0
  20. package/src/lib/components/atoms/index.ts +3 -1
  21. package/src/lib/components/atoms/info-box/InfoBox.tsx +2 -8
  22. package/src/lib/components/atoms/info-box/infoBox.classes.ts +8 -9
  23. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +5 -5
  24. package/src/lib/components/atoms/label-text/LabelText.tsx +4 -6
  25. package/src/lib/components/atoms/list-item/ListItem.tsx +3 -4
  26. package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +1 -1
  27. package/src/lib/components/atoms/media-fallback/MediaFallback.tsx +12 -0
  28. package/src/lib/components/atoms/media-fallback/index.ts +4 -0
  29. package/src/lib/components/atoms/panel/Panel.tsx +2 -4
  30. package/src/lib/components/atoms/radio-button/RadioButton.tsx +4 -8
  31. package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +3 -2
  32. package/src/lib/components/atoms/skeleton/Skeleton.tsx +1 -3
  33. package/src/lib/components/atoms/snackbar/snackbar.classes.ts +8 -8
  34. package/src/lib/components/atoms/toggle/toggle.classes.ts +6 -6
  35. package/src/lib/components/atoms/tooltip/Tooltip.tsx +115 -13
  36. package/src/lib/components/atoms/video/Video.tsx +33 -0
  37. package/src/lib/components/atoms/video/index.ts +4 -0
  38. package/src/lib/components/atoms/video/video.constants.ts +31 -0
  39. package/src/lib/components/molecules/account/Account.tsx +4 -4
  40. package/src/lib/components/molecules/address/Address.tsx +1 -1
  41. package/src/lib/components/molecules/asset-media-renderer/AssetMediaRenderer.tsx +50 -0
  42. package/src/lib/components/molecules/asset-media-renderer/index.ts +4 -0
  43. package/src/lib/components/molecules/card/CardAction.tsx +3 -5
  44. package/src/lib/components/molecules/card/CardBody.tsx +3 -2
  45. package/src/lib/components/molecules/card/card.classes.ts +3 -3
  46. package/src/lib/components/molecules/chip/Chip.tsx +9 -2
  47. package/src/lib/components/molecules/chip/chip.classes.ts +5 -5
  48. package/src/lib/components/molecules/chip/chip.enums.ts +5 -0
  49. package/src/lib/components/molecules/chip/index.ts +1 -0
  50. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +2 -2
  51. package/src/lib/components/molecules/display-stats/displayStats.classes.ts +6 -6
  52. package/src/lib/components/molecules/dropdown/Dropdown.tsx +1 -1
  53. package/src/lib/components/molecules/index.ts +2 -0
  54. package/src/lib/components/molecules/input/Input.tsx +3 -5
  55. package/src/lib/components/molecules/input/InputWrapper.tsx +1 -1
  56. package/src/lib/components/molecules/input/TextArea.tsx +2 -5
  57. package/src/lib/components/molecules/input/input.classes.ts +7 -8
  58. package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +4 -4
  59. package/src/lib/components/molecules/search/Search.tsx +10 -7
  60. package/src/lib/components/molecules/search/search.classes.ts +5 -5
  61. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +5 -1
  62. package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +2 -2
  63. package/src/lib/components/molecules/select/Select.tsx +6 -13
  64. package/src/lib/components/molecules/table-cell/TableCell.tsx +2 -2
  65. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +2 -2
  66. package/src/lib/components/molecules/title/Title.tsx +3 -3
  67. package/src/lib/components/{atoms → molecules}/visual-asset-card/VisualAssetCard.tsx +26 -40
  68. package/src/lib/components/organisms/accordion/Accordion.tsx +2 -3
  69. package/src/lib/components/organisms/accordion/accordion.classes.ts +1 -1
  70. package/src/lib/components/organisms/dialog/Dialog.tsx +4 -4
  71. package/src/lib/components/organisms/navbar/Navbar.tsx +2 -2
  72. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +1 -1
  73. package/src/lib/components/organisms/table/Table.tsx +4 -4
  74. package/src/lib/constants/colors.constants.ts +107 -8
  75. package/src/lib/styles/base.css +97 -0
  76. package/src/lib/styles/components.css +687 -0
  77. package/src/lib/styles/fonts.css +2 -0
  78. package/src/lib/styles/index.css +754 -136
  79. package/src/lib/styles/utilities.css +53 -0
  80. package/src/lib/tailwind/base.presets.ts +14 -9
  81. package/src/lib/tailwind/constants/customColors.constants.ts +13 -0
  82. package/src/lib/tailwind/constants/fontFamily.constants.ts +8 -0
  83. package/src/lib/tailwind/constants/fontSizes.constants.ts +9 -9
  84. package/src/lib/tailwind/constants/index.ts +1 -0
  85. package/src/lib/tailwind/plugins.ts +4 -0
  86. package/src/lib/tailwind/responsive.presets.ts +1 -1
  87. package/src/storybook/blocks/Showcase.tsx +2 -2
  88. package/src/storybook/blocks/TypeSetItem.tsx +3 -3
  89. package/src/storybook/stories/atoms/Skeleton.stories.tsx +1 -1
  90. package/src/storybook/stories/atoms/Tooltip.stories.tsx +4 -2
  91. package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +3 -2
  92. package/src/storybook/stories/components/VariableSpacingShowcase.tsx +2 -2
  93. package/src/storybook/stories/design-tokens/colors.stories.mdx +9 -0
  94. package/src/storybook/stories/molecules/Account.stories.tsx +3 -1
  95. package/src/storybook/stories/molecules/Search.stories.tsx +2 -2
  96. package/src/storybook/stories/molecules/TableCell.stories.tsx +1 -1
  97. package/src/storybook/stories/molecules/TextArea.stories.tsx +1 -1
  98. /package/src/lib/components/{atoms → molecules}/visual-asset-card/index.ts +0 -0
  99. /package/src/lib/components/{atoms → molecules}/visual-asset-card/visualAssetCard.enums.ts +0 -0
@@ -74,7 +74,7 @@ export function InputWrapper({
74
74
  <div
75
75
  className={cx(
76
76
  'flex flex-row items-center',
77
- caption || errorMessage ? 'justify-between' : 'justify-end',
77
+ caption || errorMessage ? 'justify-between gap-md' : 'justify-end',
78
78
  )}
79
79
  >
80
80
  {(errorMessage || caption) && (
@@ -115,7 +115,7 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextFieldBaseProps>(func
115
115
  <span className="absolute bottom-4 right-4 flex">
116
116
  <ButtonUnstyled
117
117
  onClick={onToggleButtonClick}
118
- className="text-neutral-10 dark:text-neutral-92 [&_svg]:h-5 [&_svg]:w-5"
118
+ className="input-icon-color [&_svg]:h-5 [&_svg]:w-5"
119
119
  tabIndex={-1}
120
120
  >
121
121
  {isInputContentVisible ? <VisibilityOn /> : <VisibilityOff />}
@@ -139,10 +139,7 @@ function VisibilityOffBar({ rows, halfWidthRow }: VisibilityOffBarProps) {
139
139
  const isHalfWidth = halfWidthRow === index + 1;
140
140
  const width = isHalfWidth ? 'w-1/2' : 'w-full';
141
141
  return (
142
- <div
143
- key={index}
144
- className={`h-2.5 rounded bg-neutral-92/60 dark:bg-neutral-10/60 ${width}`}
145
- />
142
+ <div key={index} className={`input-visibility-bar h-2.5 rounded ${width}`} />
146
143
  );
147
144
  })}
148
145
  </>
@@ -2,13 +2,12 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  export const INPUT_CLASSES =
5
- 'w-full bg-transparent text-body-lg caret-primary-30 dark:caret-primary-80 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed';
6
- export const INPUT_TEXT_CLASSES = 'text-neutral-10 dark:text-neutral-92';
7
- export const INPUT_PLACEHOLDER_CLASSES =
8
- 'enabled:placeholder:text-neutral-40/40 dark:placeholder:text-neutral-60/40 enabled:dark:placeholder:text-neutral-60/40';
9
- export const BORDER_CLASSES =
10
- 'px-md py-sm rounded-lg border border-neutral-80 group-[.enabled]:cursor-text group-[.errored]:border-error-30 hover:group-[.enabled]:border-neutral-50 dark:border-neutral-20 dark:hover:border-neutral-60 dark:group-[.errored]:border-error-80 [&:has(input:focus)]:!border-primary-30 [&:has(input:focus)]:dark:!border-primary-80';
5
+ 'w-full input-caret-color bg-transparent text-body-lg caret-input-caret-color focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed';
6
+ export const INPUT_TEXT_CLASSES = 'input-text-color';
7
+ export const INPUT_PLACEHOLDER_CLASSES = 'input-placeholder-color';
11
8
  export const INPUT_NUMBER_CLASSES =
12
9
  '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none disabled:cursor-not-allowed';
13
- export const LABEL_CLASSES =
14
- 'flex flex-col gap-y-2 text-label-lg text-neutral-40 dark:text-neutral-60';
10
+ export const BORDER_CLASSES =
11
+ 'px-md py-sm rounded-lg border input-border-color input-border-color-disabled group-[.enabled]:cursor-text input-border-error-color hover:group-[.enabled]:input-border-color-hover input-border-color-focus';
12
+
13
+ export const LABEL_CLASSES = 'flex flex-col gap-y-2 text-label-lg input-label-color';
@@ -1,8 +1,8 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- export const SELECTED_ICON = 'text-neutral-10 dark:text-neutral-92';
5
- export const UNSELECTED_ICON = 'text-neutral-40 dark:text-neutral-60';
4
+ export const SELECTED_ICON = 'navbar-item-icon-selected-color';
5
+ export const UNSELECTED_ICON = 'navbar-item-icon-color';
6
6
 
7
7
  export const PADDING_WITH_TEXT = 'py-xxs px-sm';
8
8
  export const PADDING_WITHOUT_TEXT = 'p-sm';
@@ -12,5 +12,5 @@ export const SELECTED_BACKGROUND = 'bg-shader-primary-light-12 dark:bg-shader-pr
12
12
  export const BADGE_WITH_TEXT = '-top-3 right-3';
13
13
  export const BADGE_WITHOUT_TEXT = '-top-1 right-3';
14
14
 
15
- export const SELECTED_TEXT = 'text-neutral-10 dark:text-neutral-92';
16
- export const UNSELECTED_TEXT = 'text-neutral-60 dark:text-neutral-40';
15
+ export const SELECTED_TEXT = 'navbar-item-label-selected-color';
16
+ export const UNSELECTED_TEXT = 'navbar-item-label-color';
@@ -116,7 +116,12 @@ export function Search({
116
116
  const showSuggestions = isSuggestionsVisible && suggestions && suggestions.length > 0;
117
117
 
118
118
  const roundedStyleWithSuggestions = showSuggestions
119
- ? 'rounded-t-3xl border-b border-b-transparent'
119
+ ? cx(
120
+ 'rounded-t-3xl border-b',
121
+ type === SearchBarType.Outlined
122
+ ? '[&:not(.dark_*,.names_*)]:border-b-transparent'
123
+ : 'border-b-transparent',
124
+ )
120
125
  : type === SearchBarType.Outlined
121
126
  ? 'rounded-3xl border-b'
122
127
  : 'rounded-full';
@@ -159,7 +164,7 @@ export function Search({
159
164
  <div className="relative w-full">
160
165
  <div
161
166
  className={cx(
162
- 'flex items-center overflow-hidden px-md py-sm text-neutral-10 dark:text-neutral-92 [&_svg]:h-6 [&_svg]:w-6',
167
+ 'search-text-color flex items-center overflow-hidden px-md py-sm [&_svg]:h-6 [&_svg]:w-6',
163
168
  roundedStyleWithSuggestions,
164
169
  searchTypeClass,
165
170
  )}
@@ -173,7 +178,7 @@ export function Search({
173
178
  onFocus={() => setIsSuggestionsVisible(true)}
174
179
  placeholder={placeholder}
175
180
  className={cx(
176
- 'w-full flex-1 outline-none placeholder:text-neutral-40 placeholder:dark:text-neutral-60',
181
+ 'search-placeholder-color w-full flex-1 outline-none',
177
182
  backgroundColorClass,
178
183
  )}
179
184
  />
@@ -183,7 +188,7 @@ export function Search({
183
188
  <div
184
189
  ref={suggestionsListRef}
185
190
  className={cx(
186
- 'absolute left-0 top-full flex w-full flex-col items-center overflow-hidden bg-neutral-100 dark:bg-neutral-10',
191
+ 'absolute left-0 top-full flex w-full flex-col items-center overflow-hidden',
187
192
  suggestionsStyle,
188
193
  )}
189
194
  >
@@ -200,9 +205,7 @@ export function Search({
200
205
  onMouseEnter={() => setSelectedIndex(index)}
201
206
  className={cx(
202
207
  'w-full cursor-pointer px-md py-sm',
203
- selectedIndex === index
204
- ? 'bg-shader-primary-dark-16 dark:bg-shader-inverted-dark-16'
205
- : '',
208
+ selectedIndex === index ? 'search-selected-index-bg-color' : '',
206
209
  )}
207
210
  >
208
211
  {renderSuggestion(suggestion, index)}
@@ -5,16 +5,16 @@ import { SearchBarType } from './search.enums';
5
5
 
6
6
  export const BACKGROUND_COLORS: Record<SearchBarType, string> = {
7
7
  [SearchBarType.Outlined]: 'bg-transparent',
8
- [SearchBarType.Filled]: 'bg-neutral-92 dark:bg-neutral-12',
8
+ [SearchBarType.Filled]: 'search-bg-color-filled',
9
9
  };
10
10
 
11
11
  export const SEARCH_WRAPPER_STYLE: Record<SearchBarType, string> = {
12
- [SearchBarType.Outlined]: 'border-l border-r border-t border-neutral-70 dark:border-neutral-40',
13
- [SearchBarType.Filled]: 'bg-neutral-92 dark:bg-neutral-12',
12
+ [SearchBarType.Outlined]: 'border-l border-r border-t search-border-color',
13
+ [SearchBarType.Filled]: 'search-bg-color-filled',
14
14
  };
15
15
 
16
16
  export const SUGGESTIONS_WRAPPER_STYLE: Record<SearchBarType, string> = {
17
17
  [SearchBarType.Outlined]:
18
- 'rounded-b-3xl border-b border-l border-r border-neutral-70 dark:border-neutral-40',
19
- [SearchBarType.Filled]: 'rounded-b-3xl bg-neutral-92 dark:bg-neutral-12',
18
+ 'rounded-b-3xl border-b border-l border-r search-border-color search-suggestion-bg-color',
19
+ [SearchBarType.Filled]: 'rounded-b-3xl search-bg-color-filled',
20
20
  };
@@ -26,8 +26,12 @@ export function SegmentedButton({
26
26
  const backgroundColors = BACKGROUND_COLORS[type];
27
27
  const borderColors = type === SegmentedButtonType.Outlined ? OUTLINED_BORDER : '';
28
28
  const borderShape = shape === ButtonSegmentType.Rounded ? 'rounded-full gap-1 p-xxs' : '';
29
+ const scrollable =
30
+ shape === ButtonSegmentType.Rounded ? 'flex-wrap' : 'flex-nowrap overflow-x-auto';
29
31
  return (
30
- <div className={cx('flex flex-row flex-wrap', backgroundColors, borderColors, borderShape)}>
32
+ <div
33
+ className={cx('flex flex-row', backgroundColors, borderColors, borderShape, scrollable)}
34
+ >
31
35
  {children}
32
36
  </div>
33
37
  );
@@ -5,8 +5,8 @@ import { SegmentedButtonType } from './segmentedButton.enums';
5
5
 
6
6
  export const BACKGROUND_COLORS: Record<SegmentedButtonType, string> = {
7
7
  [SegmentedButtonType.Outlined]: 'bg-transparent',
8
- [SegmentedButtonType.Filled]: 'bg-neutral-96 dark:bg-neutral-10',
8
+ [SegmentedButtonType.Filled]: 'segmented-filled-bg-color',
9
9
  [SegmentedButtonType.Transparent]: 'bg-transparent',
10
10
  };
11
11
 
12
- export const OUTLINED_BORDER = 'border border-neutral-70 dark:border-neutral-40';
12
+ export const OUTLINED_BORDER = 'border segmented-outlined-border';
@@ -137,21 +137,17 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(
137
137
  onClick={onSelectorClick}
138
138
  disabled={disabled}
139
139
  className={cx(
140
- 'flex flex-row items-center gap-x-3 rounded-lg border border-neutral-80 py-sm hover:enabled:border-neutral-50 focus-visible:enabled:border-primary-30 active:enabled:border-primary-30 disabled:cursor-not-allowed group-[.errored]:border-error-30 group-[.opened]:border-primary-30 dark:border-neutral-20 dark:hover:enabled:border-neutral-60 dark:group-[.errored]:border-error-80 dark:group-[.opened]:border-primary-80 [&:is(:focus,_:focus-visible,_:active)]:enabled:border-primary-30 dark:[&:is(:focus,_:focus-visible,_:active)]:enabled:border-primary-80 [&_svg]:h-5 [&_svg]:w-5',
140
+ 'select-border-color focus-visible:enabled:select-border-focus-color active:enabled:select-border-focus-color group-[.errored]:select-border-error-color group-[.opened]:select-border-focus-color [&:is(:focus,_:focus-visible,_:active)]:enabled:select-border-focus-color hover:enabled:select-border-hover-color flex flex-row items-center gap-x-3 rounded-lg border py-sm disabled:cursor-not-allowed [&_svg]:h-5 [&_svg]:w-5',
141
141
  selectPadding,
142
142
  )}
143
143
  >
144
- {leadingIcon && (
145
- <span className="text-neutral-10 dark:text-neutral-92">
146
- {leadingIcon}
147
- </span>
148
- )}
144
+ {leadingIcon && <span className="select-icon-color">{leadingIcon}</span>}
149
145
 
150
146
  <div className="flex w-full flex-row items-baseline gap-x-3">
151
147
  {selectorText && (
152
148
  <div
153
149
  className={cx(
154
- 'block w-full text-start text-neutral-10 dark:text-neutral-92',
150
+ 'select-label-color block w-full text-start',
155
151
  textSize,
156
152
  )}
157
153
  >
@@ -167,12 +163,9 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(
167
163
  </div>
168
164
 
169
165
  <TriangleDown
170
- className={cx(
171
- 'text-neutral-10 transition-transform dark:text-neutral-92',
172
- {
173
- ' rotate-180': isOpen,
174
- },
175
- )}
166
+ className={cx('select-icon-color transition-transform', {
167
+ ' rotate-180': isOpen,
168
+ })}
176
169
  />
177
170
  </ButtonUnstyled>
178
171
 
@@ -27,7 +27,7 @@ export function TableCellBase({
27
27
  return (
28
28
  <td
29
29
  className={cx(
30
- 'h-14 border-b border-shader-neutral-light-8 px-md dark:border-shader-neutral-dark-8',
30
+ 'table-cell-border-color h-14 border-b px-md',
31
31
  { 'last:border-none': hasLastBorderNoneClass },
32
32
  { 'flex items-center justify-center': isContentCentered },
33
33
  )}
@@ -49,7 +49,7 @@ export function TableCellText({
49
49
  <div className="flex flex-row items-baseline gap-1">
50
50
  <span>{children}</span>
51
51
  {supportingLabel && (
52
- <span className="text-body-sm text-neutral-60 dark:text-neutral-40">
52
+ <span className="table-cell-supporting-label-color text-body-sm">
53
53
  {supportingLabel}
54
54
  </span>
55
55
  )}
@@ -79,7 +79,7 @@ export function TableHeaderCell({
79
79
  }
80
80
  };
81
81
 
82
- const textColorClass = 'text-neutral-10 dark:text-neutral-92';
82
+ const textColorClass = 'table-header-text-color';
83
83
  const textSizeClass = 'text-label-lg';
84
84
 
85
85
  const sortElement = (() => {
@@ -102,7 +102,7 @@ export function TableHeaderCell({
102
102
  <th
103
103
  onClick={hasSort ? handleSort : undefined}
104
104
  className={cx(
105
- 'state-layer group relative h-14 border-b border-shader-neutral-light-8 px-md after:pointer-events-none dark:border-shader-neutral-dark-8',
105
+ 'state-layer table-cell-border-color group relative h-14 border-b px-md after:pointer-events-none',
106
106
  {
107
107
  'cursor-pointer': hasSort,
108
108
  },
@@ -60,15 +60,15 @@ export function Title({
60
60
  >
61
61
  <div className="flex flex-row items-center gap-x-xxxs">
62
62
  <div className="flex flex-col justify-start">
63
- <div className="flex flex-row items-center gap-x-0.5 text-neutral-10 dark:text-neutral-92">
63
+ <div className="title-main-color flex flex-row items-center gap-x-0.5">
64
64
  <h4 className={cx(TITLE_SIZE[size])}>{title}</h4>
65
65
  {tooltipText && (
66
66
  <Tooltip text={tooltipText} position={tooltipPosition}>
67
- <Info />
67
+ <Info className="title-icon-color" />
68
68
  </Tooltip>
69
69
  )}
70
70
  </div>
71
- <p className="text-label-md text-neutral-60 dark:text-neutral-40">{subtitle}</p>
71
+ <p className="title-subtitle-color text-label-md">{subtitle}</p>
72
72
  </div>
73
73
  {supportingElement}
74
74
  </div>
@@ -1,25 +1,13 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { VisualAssetType } from './visualAssetCard.enums';
5
- import { ButtonUnstyled } from '../button';
6
- import { MoreHoriz, PlaceholderReplace } from '@iota/apps-ui-icons';
4
+ import { ButtonUnstyled } from '../../atoms/button';
5
+ import { MoreHoriz } from '@iota/apps-ui-icons';
7
6
  import cx from 'classnames';
8
- import { useState } from 'react';
7
+ import { AssetMediaRenderer } from '../../molecules/asset-media-renderer';
8
+ import type { AssetMediaRendererProps } from '../../molecules/asset-media-renderer';
9
9
 
10
- export interface VisualAssetCardProps {
11
- /**
12
- * The type of the asset to be displayed.
13
- */
14
- assetType?: VisualAssetType;
15
- /**
16
- * The source of the image to be displayed.
17
- */
18
- assetSrc: string;
19
- /**
20
- * Alt text for the image.
21
- */
22
- altText: string;
10
+ interface VisualAssetBaseProps {
23
11
  /**
24
12
  * The onClick event for the icon.
25
13
  */
@@ -42,23 +30,31 @@ export interface VisualAssetCardProps {
42
30
  isHoverable?: boolean;
43
31
  }
44
32
 
33
+ interface CustomAssetDisplayProps {
34
+ /**
35
+ * The media to be displayed inside the card.
36
+ */
37
+ renderAsset?: React.ReactNode;
38
+ }
39
+
40
+ export type VisualAssetCardProps = VisualAssetBaseProps &
41
+ (AssetMediaRendererProps | CustomAssetDisplayProps);
42
+
45
43
  export function VisualAssetCard({
46
- assetType = VisualAssetType.Image,
47
- assetSrc,
48
- altText,
49
44
  onIconClick,
50
45
  onClick,
51
46
  icon = <MoreHoriz />,
52
47
  assetTitle,
53
48
  isHoverable = true,
54
- }: VisualAssetCardProps): React.JSX.Element {
55
- const [imageError, setImageError] = useState(false);
56
-
49
+ ...assetProps
50
+ }: VisualAssetBaseProps & (AssetMediaRendererProps | CustomAssetDisplayProps)): React.JSX.Element {
57
51
  const handleIconClick = (event: React.MouseEvent<HTMLButtonElement>) => {
58
52
  onIconClick?.(event);
59
53
  event?.stopPropagation();
60
54
  };
61
55
 
56
+ const isCustomAsset = !('src' in assetProps);
57
+
62
58
  return (
63
59
  <div
64
60
  className={cx('relative aspect-square w-full overflow-hidden rounded-xl', {
@@ -66,26 +62,16 @@ export function VisualAssetCard({
66
62
  })}
67
63
  onClick={onClick}
68
64
  >
69
- {assetType === VisualAssetType.Video ? (
70
- <video src={assetSrc} className="h-full w-full object-cover" autoPlay loop muted />
71
- ) : imageError ? (
72
- <div className="flex h-full w-full items-center justify-center bg-neutral-96 dark:bg-neutral-10">
73
- <PlaceholderReplace className="h-4 w-4 text-neutral-40 dark:text-neutral-60" />
74
- </div>
75
- ) : (
76
- <img
77
- src={assetSrc}
78
- alt={altText}
79
- className="h-full w-full object-cover"
80
- onError={() => setImageError(true)}
81
- />
82
- )}
65
+ {!isCustomAsset && <AssetMediaRenderer {...assetProps} />}
66
+
67
+ {isCustomAsset && assetProps.renderAsset}
68
+
83
69
  {isHoverable && (
84
- <div className="absolute left-0 top-0 h-full w-full bg-cover bg-center bg-no-repeat group-hover:bg-shader-neutral-light-48 group-hover:transition group-hover:duration-300 group-hover:ease-in-out group-hover:dark:bg-shader-primary-dark-48" />
70
+ <div className="absolute left-0 top-0 h-full w-full bg-cover bg-center bg-no-repeat group-hover:bg-shader-neutral-light-48 group-hover:transition group-hover:duration-300 group-hover:ease-in-out group-hover:names:bg-shader-inverted-light-48 group-hover:dark:bg-shader-primary-dark-48" />
85
71
  )}
86
72
  {isHoverable && onIconClick && (
87
73
  <ButtonUnstyled
88
- className="absolute right-2 top-2 h-9 w-9 cursor-pointer rounded-full p-xs opacity-0 transition-opacity duration-300 group-hover:bg-shader-neutral-light-72 group-hover:opacity-100 [&_svg]:h-5 [&_svg]:w-5 [&_svg]:text-primary-100"
74
+ className="visual-asset-icon-color absolute right-2 top-2 h-9 w-9 cursor-pointer rounded-full p-xs opacity-0 transition-opacity duration-300 group-hover:bg-shader-neutral-light-72 group-hover:opacity-100 [&_svg]:h-5 [&_svg]:w-5"
89
75
  onClick={handleIconClick}
90
76
  >
91
77
  {icon}
@@ -93,7 +79,7 @@ export function VisualAssetCard({
93
79
  )}
94
80
  {isHoverable && assetTitle && (
95
81
  <div className="absolute bottom-0 flex items-center justify-center p-xs opacity-0 transition-opacity duration-300 group-hover:opacity-100">
96
- <span className="text-title-md text-neutral-100">{assetTitle}</span>
82
+ <span className="visual-asset-title-color text-title-md">{assetTitle}</span>
97
83
  </div>
98
84
  )}
99
85
  </div>
@@ -98,9 +98,8 @@ export function Accordion({
98
98
  }): React.JSX.Element {
99
99
  return (
100
100
  <div
101
- className={cx('rounded-xl bg-neutral-100 dark:bg-neutral-6', {
102
- 'border border-shader-neutral-light-8 dark:border-shader-neutral-dark-8':
103
- !hideBorder,
101
+ className={cx('accordion-bg rounded-xl', {
102
+ 'accordion-border-color border': !hideBorder,
104
103
  })}
105
104
  >
106
105
  {children}
@@ -1,4 +1,4 @@
1
1
  // Copyright (c) 2024 IOTA Stiftung
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- export const ICON_STYLE = 'text-neutral-10 dark:text-neutral-92 transition-transform ease-linear';
4
+ export const ICON_STYLE = 'accordion-icon-color transition-transform ease-linear';
@@ -41,7 +41,7 @@ const DialogOverlay = React.forwardRef<
41
41
  >(({ showCloseIcon, position, ...props }, ref) => (
42
42
  <RadixDialog.Overlay
43
43
  ref={ref}
44
- className={cx('inset-0 z-[99998] bg-shader-neutral-light-48 backdrop-blur-md', {
44
+ className={cx('dialog-overlay-bg inset-0 z-[99998] backdrop-blur-md', {
45
45
  fixed: position === DialogPosition.Right,
46
46
  absolute: position === DialogPosition.Center,
47
47
  })}
@@ -98,7 +98,7 @@ const DialogContent = React.forwardRef<
98
98
  <RadixDialog.Content
99
99
  ref={ref}
100
100
  className={cx(
101
- 'fixed z-[99999] flex flex-col justify-center bg-primary-100 dark:bg-neutral-6',
101
+ 'dialog-content-bg dialog-outline fixed z-[99999] flex flex-col justify-center',
102
102
  positionClass,
103
103
  widthClass,
104
104
  )}
@@ -122,7 +122,7 @@ const DialogTitle = React.forwardRef<
122
122
  >((props, ref) => (
123
123
  <RadixDialog.Title
124
124
  ref={ref}
125
- className="font-inter text-title-lg text-neutral-10 dark:text-neutral-92"
125
+ className="dialog-title-color font-inter text-title-lg"
126
126
  {...props}
127
127
  />
128
128
  ));
@@ -132,7 +132,7 @@ const DialogBody = React.forwardRef<React.ElementRef<'div'>, React.ComponentProp
132
132
  (props, ref) => (
133
133
  <div
134
134
  ref={ref}
135
- className="flex-1 overflow-y-auto p-md--rs text-body-sm text-neutral-40 dark:text-neutral-60"
135
+ className="dialog-body-color flex-1 overflow-y-auto p-md--rs text-body-sm"
136
136
  {...props}
137
137
  />
138
138
  ),
@@ -56,10 +56,10 @@ export function Navbar({
56
56
  {isCollapsible && (
57
57
  <div className="flex w-full items-center justify-between sm:mb-[48px] sm:flex-col">
58
58
  <div className="flex justify-center [&_svg]:h-[38px] [&_svg]:w-[38px]">
59
- <IotaLogoMark className="text-neutral-10 dark:text-neutral-92" />
59
+ <IotaLogoMark className="navbar-icon-color" />
60
60
  </div>
61
61
  <div
62
- className="state-layer relative rounded-full p-xs hover:cursor-pointer dark:text-neutral-92 sm:hidden [&_svg]:h-6 [&_svg]:w-6"
62
+ className="state-layer navbar-icon-color relative rounded-full p-xs hover:cursor-pointer sm:hidden [&_svg]:h-6 [&_svg]:w-6"
63
63
  onClick={onToggleNavbar}
64
64
  >
65
65
  <MenuIcon />
@@ -25,7 +25,7 @@ export function NavbarSlideout({
25
25
  />
26
26
  <div
27
27
  className={cx(
28
- 'z-999 rounded-tb-3xl fixed left-0 top-0 h-full w-11/12 rounded-tr-3xl bg-white px-lg py-lg transition-transform duration-300 ease-out dark:bg-neutral-6',
28
+ 'z-999 rounded-tb-3xl navbar-slideout-bg fixed left-0 top-0 h-full w-11/12 rounded-tr-3xl px-lg py-lg transition-transform duration-300 ease-out',
29
29
  {
30
30
  'translate-x-0': isOpen,
31
31
  '-translate-x-full': !isOpen,
@@ -103,9 +103,9 @@ export function Table({
103
103
  </table>
104
104
  </div>
105
105
  <div
106
- className={cx('flex w-full items-center gap-2 pt-md', {
106
+ className={cx('flex w-full items-center gap-sm pt-md', {
107
107
  hidden: !supportingLabel && !paginationOptions && !action,
108
- 'justify-between': paginationOptions,
108
+ 'flex-col justify-between sm:flex-row': paginationOptions,
109
109
  'justify-end': !paginationOptions && action,
110
110
  })}
111
111
  >
@@ -149,7 +149,7 @@ export function Table({
149
149
  {supportingLabel || pageSizeSelector ? (
150
150
  <div className="flex flex-row items-center gap-x-sm">
151
151
  {supportingLabel && (
152
- <span className=" text-label-md text-neutral-40 dark:text-neutral-60">
152
+ <span className="table-text-color text-label-md">
153
153
  {supportingLabel}
154
154
  </span>
155
155
  )}
@@ -182,7 +182,7 @@ export function TableRow({
182
182
  );
183
183
  }
184
184
 
185
- const TEXT_COLOR_CLASS = 'text-neutral-40 dark:text-neutral-60';
185
+ const TEXT_COLOR_CLASS = 'table-text-color';
186
186
  const TEXT_SIZE_CLASS = 'text-body-md';
187
187
 
188
188
  export function TableBody({ children }: PropsWithChildren): JSX.Element {