@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,62 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import type { PropsWithChildren } from 'react';
4
+ import cx from 'classnames';
5
+ import { Placeholder } from '@/components/atoms';
6
+
7
+ interface TableCellBaseProps {
8
+ /**
9
+ * The label of the cell.
10
+ */
11
+ label?: string;
12
+ /**
13
+ * If the cell is the last in the row and should not have a border.
14
+ */
15
+ hasLastBorderNoneClass?: boolean;
16
+ /**
17
+ * Whether the cell content should be centered.
18
+ */
19
+ isContentCentered?: boolean;
20
+ }
21
+
22
+ export function TableCellBase({
23
+ children,
24
+ hasLastBorderNoneClass,
25
+ isContentCentered,
26
+ }: PropsWithChildren<TableCellBaseProps>) {
27
+ return (
28
+ <td
29
+ className={cx(
30
+ 'table-cell-border-color h-14 border-b px-md',
31
+ { 'last:border-none': hasLastBorderNoneClass },
32
+ { 'flex items-center justify-center': isContentCentered },
33
+ )}
34
+ >
35
+ {children}
36
+ </td>
37
+ );
38
+ }
39
+
40
+ export interface TableCellTextProps {
41
+ supportingLabel?: string;
42
+ }
43
+
44
+ export function TableCellText({
45
+ children,
46
+ supportingLabel,
47
+ }: PropsWithChildren<TableCellTextProps>) {
48
+ return (
49
+ <div className="flex flex-row items-baseline gap-1">
50
+ <span>{children}</span>
51
+ {supportingLabel && (
52
+ <span className="table-cell-supporting-label-color text-body-sm">
53
+ {supportingLabel}
54
+ </span>
55
+ )}
56
+ </div>
57
+ );
58
+ }
59
+
60
+ export function TableCellPlaceholder() {
61
+ return <Placeholder />;
62
+ }
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './TableCell';
@@ -0,0 +1,140 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { SortByDown, SortByUp } from '@iota/apps-ui-icons';
5
+ import cx from 'classnames';
6
+ import { Checkbox } from '@/components/atoms/checkbox';
7
+ import { TableHeaderCellSortOrder } from './tableHeaderCell.enums';
8
+
9
+ export interface TableHeaderCellProps {
10
+ /**
11
+ * The column key.
12
+ */
13
+ columnKey: string | number;
14
+ /**
15
+ * The label of the Header cell.
16
+ */
17
+ label?: string;
18
+ /**
19
+ * Action component to be rendered on the left side.
20
+ */
21
+ actionLeft?: React.ReactNode;
22
+ /**
23
+ * Action component to be rendered on the right side.
24
+ */
25
+ actionRight?: React.ReactNode;
26
+ /**
27
+ * Has Sort icon.
28
+ */
29
+ hasSort?: boolean;
30
+ /**
31
+ * On Sort icon click.
32
+ */
33
+ onSortClick?: (columnKey: string | number, sortOrder: TableHeaderCellSortOrder) => void;
34
+ /**
35
+ * Has Checkbox.
36
+ */
37
+ hasCheckbox?: boolean;
38
+ /**
39
+ * Is Checkbox checked.
40
+ */
41
+ isChecked?: boolean;
42
+ /**
43
+ * Is Checkbox indeterminate.
44
+ */
45
+ isIndeterminate?: boolean;
46
+ /**
47
+ * On Checkbox change.
48
+ */
49
+ onCheckboxChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
50
+ /**
51
+ * Whether the cell content should be centered.
52
+ */
53
+ isContentCentered?: boolean;
54
+ /**
55
+ * Sort order when cell is initialized
56
+ */
57
+ sortOrder?: TableHeaderCellSortOrder;
58
+ }
59
+
60
+ export function TableHeaderCell({
61
+ label,
62
+ columnKey,
63
+ hasSort,
64
+ hasCheckbox,
65
+ isChecked,
66
+ isIndeterminate,
67
+ isContentCentered,
68
+ onSortClick,
69
+ onCheckboxChange,
70
+ sortOrder,
71
+ }: TableHeaderCellProps): JSX.Element {
72
+ const handleSort = () => {
73
+ const newSortOrder =
74
+ sortOrder === TableHeaderCellSortOrder.Asc
75
+ ? TableHeaderCellSortOrder.Desc
76
+ : TableHeaderCellSortOrder.Asc;
77
+ if (onSortClick) {
78
+ onSortClick(columnKey, newSortOrder);
79
+ }
80
+ };
81
+
82
+ const textColorClass = 'table-header-text-color';
83
+ const textSizeClass = 'text-label-lg';
84
+
85
+ const sortElement = (() => {
86
+ if (!hasSort) {
87
+ return null;
88
+ }
89
+
90
+ if (sortOrder === TableHeaderCellSortOrder.Asc) {
91
+ return <SortByUp className="shrink-0" />;
92
+ }
93
+
94
+ if (sortOrder === TableHeaderCellSortOrder.Desc) {
95
+ return <SortByDown className="shrink-0" />;
96
+ }
97
+
98
+ return <SortByUp className="invisible shrink-0 group-hover:visible" />;
99
+ })();
100
+
101
+ return (
102
+ <th
103
+ onClick={hasSort ? handleSort : undefined}
104
+ className={cx(
105
+ 'state-layer table-cell-border-color group relative h-14 border-b px-md after:pointer-events-none',
106
+ {
107
+ 'cursor-pointer': hasSort,
108
+ },
109
+ )}
110
+ >
111
+ <div
112
+ className={cx(
113
+ 'flex flex-row items-center gap-1 [&_svg]:h-4 [&_svg]:w-4',
114
+ textColorClass,
115
+ textSizeClass,
116
+ {
117
+ 'justify-center': isContentCentered,
118
+ },
119
+ )}
120
+ >
121
+ {hasCheckbox ? (
122
+ <Checkbox
123
+ isChecked={isChecked}
124
+ isIndeterminate={isIndeterminate}
125
+ onCheckedChange={onCheckboxChange}
126
+ />
127
+ ) : (
128
+ <span
129
+ className={cx({
130
+ 'text-left': !isContentCentered,
131
+ })}
132
+ >
133
+ {label}
134
+ </span>
135
+ )}
136
+ {sortElement}
137
+ </div>
138
+ </th>
139
+ );
140
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './TableHeaderCell';
5
+ export * from './tableHeaderCell.enums';
@@ -0,0 +1,7 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export enum TableHeaderCellSortOrder {
5
+ Asc = 'asc',
6
+ Desc = 'desc',
7
+ }
@@ -0,0 +1,78 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { TooltipPosition } from '@/components/atoms';
5
+ import { Tooltip } from '@/components/atoms';
6
+ import { Info } from '@iota/apps-ui-icons';
7
+ import { TitleSize } from './titleSize.enums';
8
+ import cx from 'classnames';
9
+ import { TITLE_PADDINGS, TITLE_SIZE } from './titleClasses.constants';
10
+
11
+ interface TitleProps {
12
+ /**
13
+ * The title of the component.
14
+ */
15
+ title: string;
16
+ /**
17
+ * The subtitle of the component.
18
+ */
19
+ subtitle?: string;
20
+ /**
21
+ * The trailing element.
22
+ */
23
+ trailingElement?: React.ReactNode;
24
+ /**
25
+ * The tooltip position.
26
+ */
27
+ tooltipPosition?: TooltipPosition;
28
+ /**
29
+ * The tooltip text.
30
+ */
31
+ tooltipText?: string;
32
+ /**
33
+ * Supporting Element
34
+ */
35
+ supportingElement?: React.ReactNode;
36
+ /**
37
+ * The size of the component
38
+ */
39
+ size?: TitleSize;
40
+ /**
41
+ * The 'data-testid' attribute value (used in e2e tests)
42
+ */
43
+ testId?: string;
44
+ }
45
+
46
+ export function Title({
47
+ title,
48
+ subtitle,
49
+ trailingElement,
50
+ tooltipText,
51
+ supportingElement,
52
+ tooltipPosition,
53
+ size = TitleSize.Medium,
54
+ testId,
55
+ }: TitleProps) {
56
+ return (
57
+ <div
58
+ className={cx('flex flex-row items-center justify-between', TITLE_PADDINGS[size])}
59
+ data-testid={testId}
60
+ >
61
+ <div className="flex flex-row items-center gap-x-xxxs">
62
+ <div className="flex flex-col justify-start">
63
+ <div className="title-main-color flex flex-row items-center gap-x-0.5">
64
+ <h4 className={cx(TITLE_SIZE[size])}>{title}</h4>
65
+ {tooltipText && (
66
+ <Tooltip text={tooltipText} position={tooltipPosition}>
67
+ <Info className="title-icon-color" />
68
+ </Tooltip>
69
+ )}
70
+ </div>
71
+ <p className="title-subtitle-color text-label-md">{subtitle}</p>
72
+ </div>
73
+ {supportingElement}
74
+ </div>
75
+ {trailingElement}
76
+ </div>
77
+ );
78
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './Title';
5
+ export { TitleSize } from './titleSize.enums';
@@ -0,0 +1,14 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { TitleSize } from './titleSize.enums';
5
+
6
+ export const TITLE_PADDINGS: Record<TitleSize, string> = {
7
+ [TitleSize.Small]: 'px-md py-sm--rs',
8
+ [TitleSize.Medium]: 'px-md--rs py-sm--rs',
9
+ };
10
+
11
+ export const TITLE_SIZE: Record<TitleSize, string> = {
12
+ [TitleSize.Small]: 'text-title-md',
13
+ [TitleSize.Medium]: 'text-title-lg',
14
+ };
@@ -0,0 +1,7 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export enum TitleSize {
5
+ Small = 'small',
6
+ Medium = 'medium',
7
+ }
@@ -0,0 +1,89 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { ButtonUnstyled } from '../../atoms/button';
5
+ import { MoreHoriz } from '@iota/apps-ui-icons';
6
+ import cx from 'classnames';
7
+ import { AssetMediaRenderer } from '../../molecules/asset-media-renderer';
8
+ import type { AssetMediaRendererProps } from '../../molecules/asset-media-renderer';
9
+
10
+ interface VisualAssetBaseProps {
11
+ /**
12
+ * The onClick event for the icon.
13
+ */
14
+ onIconClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
15
+ /**
16
+ * The onClick event for the card.
17
+ */
18
+ onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
19
+ /**
20
+ * The icon to be displayed.
21
+ */
22
+ icon?: React.ReactNode;
23
+ /**
24
+ * The title text to be displayed on hover.
25
+ */
26
+ assetTitle?: string;
27
+ /**
28
+ * Whether the card is hoverable.
29
+ */
30
+ isHoverable?: boolean;
31
+ }
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
+
43
+ export function VisualAssetCard({
44
+ onIconClick,
45
+ onClick,
46
+ icon = <MoreHoriz />,
47
+ assetTitle,
48
+ isHoverable = true,
49
+ ...assetProps
50
+ }: VisualAssetBaseProps & (AssetMediaRendererProps | CustomAssetDisplayProps)): React.JSX.Element {
51
+ const handleIconClick = (event: React.MouseEvent<HTMLButtonElement>) => {
52
+ onIconClick?.(event);
53
+ event?.stopPropagation();
54
+ };
55
+
56
+ const isCustomAsset = !('src' in assetProps);
57
+
58
+ return (
59
+ <div
60
+ className={cx('relative aspect-square w-full overflow-hidden rounded-xl', {
61
+ 'group cursor-pointer': isHoverable,
62
+ })}
63
+ onClick={onClick}
64
+ >
65
+ {!isCustomAsset && <AssetMediaRenderer {...assetProps} />}
66
+
67
+ {isCustomAsset && assetProps.renderAsset}
68
+
69
+ {isHoverable && (
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" />
71
+ )}
72
+ {isHoverable && onIconClick && (
73
+ <ButtonUnstyled
74
+ className="visual-asset-icon-color absolute right-2 top-2 z-10 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"
75
+ onClick={handleIconClick}
76
+ >
77
+ {icon}
78
+ </ButtonUnstyled>
79
+ )}
80
+ {isHoverable && assetTitle && (
81
+ <div className="absolute bottom-0 w-full p-xs opacity-0 transition-opacity duration-300 group-hover:opacity-100">
82
+ <span className="visual-asset-title-color break-words text-title-md">
83
+ {assetTitle}
84
+ </span>
85
+ </div>
86
+ )}
87
+ </div>
88
+ );
89
+ }
@@ -0,0 +1,5 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './VisualAssetCard';
5
+ export * from './visualAssetCard.enums';
@@ -0,0 +1,7 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export enum VisualAssetType {
5
+ Image = 'image',
6
+ Video = 'video',
7
+ }
@@ -0,0 +1,108 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { PropsWithChildren } from 'react';
5
+ import cx from 'classnames';
6
+ import { ArrowDown } from '@iota/apps-ui-icons';
7
+ import { Button, ButtonType } from '@/components/atoms';
8
+ import { ICON_STYLE } from './accordion.classes';
9
+
10
+ export interface AccordionHeaderProps {
11
+ /**
12
+ * Flag for show/hide content
13
+ */
14
+ isExpanded: boolean;
15
+
16
+ /**
17
+ * Action on toggle show/hide content
18
+ */
19
+ onToggle: () => void;
20
+
21
+ /**
22
+ * The type of the badge.
23
+ */
24
+ badge?: React.ReactNode;
25
+ /**
26
+ * Flag for hiding arrow.
27
+ */
28
+ hideArrow?: boolean;
29
+ /**
30
+ * Flag for hiding border.
31
+ */
32
+ hideBorder?: boolean;
33
+ }
34
+
35
+ interface AccordionContentProps {
36
+ /**
37
+ * Flag for show/hide content
38
+ */
39
+ isExpanded: boolean;
40
+ }
41
+
42
+ export function AccordionHeader({
43
+ onToggle,
44
+ children,
45
+ isExpanded,
46
+ hideArrow,
47
+ }: PropsWithChildren<AccordionHeaderProps>) {
48
+ return (
49
+ <div
50
+ onClick={onToggle}
51
+ className={cx(
52
+ 'state-layer relative flex cursor-pointer items-center justify-between gap-md overflow-hidden rounded-xl py-sm--rs',
53
+ {
54
+ 'pr-md--rs': !hideArrow,
55
+ },
56
+ )}
57
+ >
58
+ {children}
59
+ {!hideArrow && (
60
+ <div className="[&_svg]:h-5 [&_svg]:w-5">
61
+ <Button
62
+ type={ButtonType.Ghost}
63
+ icon={
64
+ <ArrowDown
65
+ className={cx(ICON_STYLE, {
66
+ 'rotate-180': isExpanded,
67
+ })}
68
+ />
69
+ }
70
+ />
71
+ </div>
72
+ )}
73
+ </div>
74
+ );
75
+ }
76
+
77
+ export function AccordionContent({
78
+ isExpanded,
79
+ children,
80
+ }: PropsWithChildren<AccordionContentProps>) {
81
+ return (
82
+ <div
83
+ className={cx({
84
+ hidden: !isExpanded,
85
+ })}
86
+ >
87
+ {children}
88
+ </div>
89
+ );
90
+ }
91
+
92
+ export function Accordion({
93
+ children,
94
+ hideBorder,
95
+ }: {
96
+ children: React.ReactNode;
97
+ hideBorder?: boolean;
98
+ }): React.JSX.Element {
99
+ return (
100
+ <div
101
+ className={cx('accordion-bg rounded-xl', {
102
+ 'accordion-border-color border': !hideBorder,
103
+ })}
104
+ >
105
+ {children}
106
+ </div>
107
+ );
108
+ }
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const ICON_STYLE = 'accordion-icon-color transition-transform ease-linear';
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './Accordion';