@iota/apps-ui-kit 0.0.0-experimental-20250613144451

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 (220) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/LICENSE +201 -0
  3. package/README.md +16 -0
  4. package/dist/index.d.ts +1726 -0
  5. package/dist/index.es.js +6923 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/dist/index.umd.js +118 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/style.css +1 -0
  10. package/package.json +75 -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 +99 -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 +45 -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 +114 -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/index.ts +23 -0
  36. package/src/lib/components/atoms/info-box/InfoBox.tsx +74 -0
  37. package/src/lib/components/atoms/info-box/index.ts +5 -0
  38. package/src/lib/components/atoms/info-box/infoBox.classes.ts +19 -0
  39. package/src/lib/components/atoms/info-box/infoBox.enums.ts +14 -0
  40. package/src/lib/components/atoms/key-value-info/KeyValueInfo.tsx +157 -0
  41. package/src/lib/components/atoms/key-value-info/index.ts +6 -0
  42. package/src/lib/components/atoms/key-value-info/keyValue.enums.ts +7 -0
  43. package/src/lib/components/atoms/label-text/LabelText.tsx +94 -0
  44. package/src/lib/components/atoms/label-text/index.ts +5 -0
  45. package/src/lib/components/atoms/label-text/labelText.classes.ts +22 -0
  46. package/src/lib/components/atoms/label-text/labelText.enums.ts +8 -0
  47. package/src/lib/components/atoms/list-item/ListItem.tsx +89 -0
  48. package/src/lib/components/atoms/list-item/index.ts +4 -0
  49. package/src/lib/components/atoms/loading-indicator/LoadingIndicator.tsx +38 -0
  50. package/src/lib/components/atoms/loading-indicator/index.ts +4 -0
  51. package/src/lib/components/atoms/panel/Panel.tsx +30 -0
  52. package/src/lib/components/atoms/panel/index.ts +4 -0
  53. package/src/lib/components/atoms/placeholder/Placeholder.tsx +27 -0
  54. package/src/lib/components/atoms/placeholder/index.ts +4 -0
  55. package/src/lib/components/atoms/radio-button/RadioButton.tsx +68 -0
  56. package/src/lib/components/atoms/radio-button/index.ts +4 -0
  57. package/src/lib/components/atoms/secondary-text/SecondaryText.tsx +28 -0
  58. package/src/lib/components/atoms/secondary-text/index.ts +4 -0
  59. package/src/lib/components/atoms/skeleton/Skeleton.tsx +47 -0
  60. package/src/lib/components/atoms/skeleton/index.ts +4 -0
  61. package/src/lib/components/atoms/snackbar/Snackbar.tsx +69 -0
  62. package/src/lib/components/atoms/snackbar/index.ts +5 -0
  63. package/src/lib/components/atoms/snackbar/snackbar.classes.ts +18 -0
  64. package/src/lib/components/atoms/snackbar/snackbar.enums.tsx +9 -0
  65. package/src/lib/components/atoms/toggle/Toggle.tsx +140 -0
  66. package/src/lib/components/atoms/toggle/index.ts +6 -0
  67. package/src/lib/components/atoms/toggle/toggle.classes.ts +41 -0
  68. package/src/lib/components/atoms/toggle/toggle.enums.ts +12 -0
  69. package/src/lib/components/atoms/tooltip/Tooltip.tsx +138 -0
  70. package/src/lib/components/atoms/tooltip/index.ts +5 -0
  71. package/src/lib/components/atoms/tooltip/tooltip.classes.ts +11 -0
  72. package/src/lib/components/atoms/tooltip/tooltip.enums.ts +9 -0
  73. package/src/lib/components/atoms/visual-asset-card/VisualAssetCard.tsx +101 -0
  74. package/src/lib/components/atoms/visual-asset-card/index.ts +5 -0
  75. package/src/lib/components/atoms/visual-asset-card/visualAssetCard.enums.ts +7 -0
  76. package/src/lib/components/index.ts +8 -0
  77. package/src/lib/components/molecules/account/Account.tsx +192 -0
  78. package/src/lib/components/molecules/account/index.ts +4 -0
  79. package/src/lib/components/molecules/address/Address.tsx +101 -0
  80. package/src/lib/components/molecules/address/index.ts +4 -0
  81. package/src/lib/components/molecules/card/Card.tsx +70 -0
  82. package/src/lib/components/molecules/card/CardAction.tsx +80 -0
  83. package/src/lib/components/molecules/card/CardBody.tsx +72 -0
  84. package/src/lib/components/molecules/card/CardImage.tsx +43 -0
  85. package/src/lib/components/molecules/card/CardImagePlaceholder.tsx +146 -0
  86. package/src/lib/components/molecules/card/card.classes.ts +27 -0
  87. package/src/lib/components/molecules/card/card.enums.ts +26 -0
  88. package/src/lib/components/molecules/card/index.ts +8 -0
  89. package/src/lib/components/molecules/chip/Chip.tsx +105 -0
  90. package/src/lib/components/molecules/chip/chip.classes.ts +32 -0
  91. package/src/lib/components/molecules/chip/chip.enums.ts +7 -0
  92. package/src/lib/components/molecules/chip/index.ts +4 -0
  93. package/src/lib/components/molecules/display-stats/DisplayStats.tsx +142 -0
  94. package/src/lib/components/molecules/display-stats/displayStats.classes.ts +36 -0
  95. package/src/lib/components/molecules/display-stats/displayStats.enums.ts +13 -0
  96. package/src/lib/components/molecules/display-stats/index.ts +5 -0
  97. package/src/lib/components/molecules/dropdown/Dropdown.tsx +10 -0
  98. package/src/lib/components/molecules/dropdown/dropdownPosition.enums.ts +7 -0
  99. package/src/lib/components/molecules/dropdown/index.ts +5 -0
  100. package/src/lib/components/molecules/index.ts +17 -0
  101. package/src/lib/components/molecules/input/Input.tsx +246 -0
  102. package/src/lib/components/molecules/input/InputWrapper.tsx +97 -0
  103. package/src/lib/components/molecules/input/TextArea.tsx +150 -0
  104. package/src/lib/components/molecules/input/index.ts +8 -0
  105. package/src/lib/components/molecules/input/input.classes.ts +14 -0
  106. package/src/lib/components/molecules/input/input.enums.ts +14 -0
  107. package/src/lib/components/molecules/input/input.types.ts +29 -0
  108. package/src/lib/components/molecules/navbar-item/NavbarItem.tsx +48 -0
  109. package/src/lib/components/molecules/navbar-item/NavbarItemHorizontal.tsx +65 -0
  110. package/src/lib/components/molecules/navbar-item/NavbarItemVertical.tsx +54 -0
  111. package/src/lib/components/molecules/navbar-item/index.ts +5 -0
  112. package/src/lib/components/molecules/navbar-item/navbarItem.classes.ts +16 -0
  113. package/src/lib/components/molecules/navbar-item/navbarItem.enums.ts +7 -0
  114. package/src/lib/components/molecules/search/Search.tsx +216 -0
  115. package/src/lib/components/molecules/search/index.ts +5 -0
  116. package/src/lib/components/molecules/search/search.classes.ts +20 -0
  117. package/src/lib/components/molecules/search/search.enums.ts +7 -0
  118. package/src/lib/components/molecules/segmented-button/SegmentedButton.tsx +38 -0
  119. package/src/lib/components/molecules/segmented-button/index.ts +6 -0
  120. package/src/lib/components/molecules/segmented-button/segmentedButton.classes.ts +12 -0
  121. package/src/lib/components/molecules/segmented-button/segmentedButton.enums.ts +8 -0
  122. package/src/lib/components/molecules/select/Select.tsx +222 -0
  123. package/src/lib/components/molecules/select/index.ts +5 -0
  124. package/src/lib/components/molecules/select/select.enums.ts +7 -0
  125. package/src/lib/components/molecules/table-cell/TableCell.tsx +62 -0
  126. package/src/lib/components/molecules/table-cell/index.ts +4 -0
  127. package/src/lib/components/molecules/table-header-cell/TableHeaderCell.tsx +140 -0
  128. package/src/lib/components/molecules/table-header-cell/index.ts +5 -0
  129. package/src/lib/components/molecules/table-header-cell/tableHeaderCell.enums.ts +7 -0
  130. package/src/lib/components/molecules/title/Title.tsx +78 -0
  131. package/src/lib/components/molecules/title/index.ts +5 -0
  132. package/src/lib/components/molecules/title/titleClasses.constants.ts +14 -0
  133. package/src/lib/components/molecules/title/titleSize.enums.ts +7 -0
  134. package/src/lib/components/organisms/accordion/Accordion.tsx +109 -0
  135. package/src/lib/components/organisms/accordion/accordion.classes.ts +4 -0
  136. package/src/lib/components/organisms/accordion/index.ts +4 -0
  137. package/src/lib/components/organisms/dialog/Dialog.tsx +142 -0
  138. package/src/lib/components/organisms/dialog/dialog.enums.ts +7 -0
  139. package/src/lib/components/organisms/dialog/index.ts +5 -0
  140. package/src/lib/components/organisms/index.ts +7 -0
  141. package/src/lib/components/organisms/navbar/Navbar.tsx +101 -0
  142. package/src/lib/components/organisms/navbar/NavbarSlideout.tsx +59 -0
  143. package/src/lib/components/organisms/navbar/index.ts +5 -0
  144. package/src/lib/components/organisms/table/Table.tsx +234 -0
  145. package/src/lib/components/organisms/table/TableContext.tsx +56 -0
  146. package/src/lib/components/organisms/table/index.ts +4 -0
  147. package/src/lib/constants/colors.constants.ts +133 -0
  148. package/src/lib/constants/index.ts +4 -0
  149. package/src/lib/enums/index.ts +4 -0
  150. package/src/lib/enums/screenSize.enums.ts +9 -0
  151. package/src/lib/index.ts +8 -0
  152. package/src/lib/styles/fonts.css +5 -0
  153. package/src/lib/styles/index.css +149 -0
  154. package/src/lib/tailwind/base.presets.ts +49 -0
  155. package/src/lib/tailwind/constants/fontSizes.constants.ts +201 -0
  156. package/src/lib/tailwind/constants/index.ts +6 -0
  157. package/src/lib/tailwind/constants/scaling.constants.ts +41 -0
  158. package/src/lib/tailwind/constants/variableSpacing.constants.ts +66 -0
  159. package/src/lib/tailwind/helpers.ts +20 -0
  160. package/src/lib/tailwind/index.ts +5 -0
  161. package/src/lib/tailwind/plugins.ts +8 -0
  162. package/src/lib/tailwind/responsive.presets.ts +36 -0
  163. package/src/lib/tailwind/static.presets.ts +25 -0
  164. package/src/lib/tailwind/types.ts +6 -0
  165. package/src/lib/utils/format.ts +8 -0
  166. package/src/lib/utils/index.ts +4 -0
  167. package/src/storybook/blocks/Showcase.tsx +20 -0
  168. package/src/storybook/blocks/TypeSet.tsx +34 -0
  169. package/src/storybook/blocks/TypeSetItem.tsx +74 -0
  170. package/src/storybook/blocks/index.ts +6 -0
  171. package/src/storybook/constants/index.ts +5 -0
  172. package/src/storybook/constants/typeset.constants.ts +39 -0
  173. package/src/storybook/constants/variableSpacing.constants.ts +6 -0
  174. package/src/storybook/helpers/getFontSizeLabel.ts +15 -0
  175. package/src/storybook/helpers/index.ts +4 -0
  176. package/src/storybook/stories/atoms/Badge.stories.tsx +32 -0
  177. package/src/storybook/stories/atoms/Button.stories.tsx +45 -0
  178. package/src/storybook/stories/atoms/ButtonSegment.stories.tsx +45 -0
  179. package/src/storybook/stories/atoms/Checkbox.stories.tsx +34 -0
  180. package/src/storybook/stories/atoms/CustomScrollbar.stories.tsx +22 -0
  181. package/src/storybook/stories/atoms/Divider.stories.tsx +41 -0
  182. package/src/storybook/stories/atoms/Header.stories.tsx +58 -0
  183. package/src/storybook/stories/atoms/InfoBox.stories.tsx +67 -0
  184. package/src/storybook/stories/atoms/KeyValueInfo.stories.tsx +59 -0
  185. package/src/storybook/stories/atoms/LabelText.stories.tsx +55 -0
  186. package/src/storybook/stories/atoms/ListItem.stories.tsx +41 -0
  187. package/src/storybook/stories/atoms/LoadingIndicator.stories.tsx +32 -0
  188. package/src/storybook/stories/atoms/Panel.stories.tsx +36 -0
  189. package/src/storybook/stories/atoms/Placeholder.stories.tsx +33 -0
  190. package/src/storybook/stories/atoms/RadioButton.stories.tsx +51 -0
  191. package/src/storybook/stories/atoms/Skeleton.stories.tsx +33 -0
  192. package/src/storybook/stories/atoms/Snackbar.stories.tsx +43 -0
  193. package/src/storybook/stories/atoms/Toggle.stories.tsx +59 -0
  194. package/src/storybook/stories/atoms/Tooltip.stories.tsx +57 -0
  195. package/src/storybook/stories/atoms/VisualAssetCard.stories.tsx +56 -0
  196. package/src/storybook/stories/components/VariableSpacingShowcase.tsx +46 -0
  197. package/src/storybook/stories/components/index.ts +4 -0
  198. package/src/storybook/stories/design-tokens/colors.stories.mdx +23 -0
  199. package/src/storybook/stories/design-tokens/icons.stories.mdx +17 -0
  200. package/src/storybook/stories/design-tokens/typeset.stories.mdx +15 -0
  201. package/src/storybook/stories/design-tokens/variable-spacing.stories.mdx +10 -0
  202. package/src/storybook/stories/molecules/Account.stories.tsx +69 -0
  203. package/src/storybook/stories/molecules/Address.stories.tsx +39 -0
  204. package/src/storybook/stories/molecules/Card.stories.tsx +112 -0
  205. package/src/storybook/stories/molecules/Chip.stories.tsx +122 -0
  206. package/src/storybook/stories/molecules/DisplayStats.stories.tsx +63 -0
  207. package/src/storybook/stories/molecules/Dropdown.stories.tsx +38 -0
  208. package/src/storybook/stories/molecules/Input.stories.tsx +162 -0
  209. package/src/storybook/stories/molecules/NavbarItem.stories.tsx +45 -0
  210. package/src/storybook/stories/molecules/Search.stories.tsx +101 -0
  211. package/src/storybook/stories/molecules/SegmentedButton.stories.tsx +108 -0
  212. package/src/storybook/stories/molecules/Select.stories.tsx +103 -0
  213. package/src/storybook/stories/molecules/TableCell.stories.tsx +46 -0
  214. package/src/storybook/stories/molecules/TableHeaderCell.stories.tsx +34 -0
  215. package/src/storybook/stories/molecules/TextArea.stories.tsx +80 -0
  216. package/src/storybook/stories/molecules/Title.stories.tsx +76 -0
  217. package/src/storybook/stories/organisms/Accordion.stories.tsx +70 -0
  218. package/src/storybook/stories/organisms/Dialog.stories.tsx +103 -0
  219. package/src/storybook/stories/organisms/Navbar.stories.tsx +78 -0
  220. package/src/storybook/stories/organisms/Table.stories.tsx +154 -0
@@ -0,0 +1,56 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { PropsWithChildren } from 'react';
5
+ import { createContext, useContext } from 'react';
6
+
7
+ export interface TableProviderProps {
8
+ /**
9
+ * Numeric indexes of the selected rows.
10
+ */
11
+ selectedRowIndexes: Set<number>;
12
+ /**
13
+ * Numeric indexes of all the rows.
14
+ */
15
+ rowIndexes: number[];
16
+ }
17
+
18
+ type TableContextProps = {
19
+ isHeaderChecked: boolean;
20
+ selectedRowIndexes: Set<number>;
21
+ isHeaderIndeterminate: boolean;
22
+ };
23
+
24
+ export const TableContext = createContext<TableContextProps>({
25
+ isHeaderChecked: false,
26
+ selectedRowIndexes: new Set(),
27
+ isHeaderIndeterminate: false,
28
+ });
29
+
30
+ export const useTableContext = () => {
31
+ const context = useContext(TableContext);
32
+ return context;
33
+ };
34
+
35
+ export function TableProvider({
36
+ children,
37
+ selectedRowIndexes,
38
+ rowIndexes,
39
+ ...props
40
+ }: PropsWithChildren<TableProviderProps>) {
41
+ const isHeaderChecked = rowIndexes.length === selectedRowIndexes.size;
42
+ const isHeaderIndeterminate = !isHeaderChecked && selectedRowIndexes.size > 0;
43
+
44
+ return (
45
+ <TableContext.Provider
46
+ value={{
47
+ ...props,
48
+ isHeaderChecked,
49
+ selectedRowIndexes,
50
+ isHeaderIndeterminate,
51
+ }}
52
+ >
53
+ {children}
54
+ </TableContext.Provider>
55
+ );
56
+ }
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './Table';
@@ -0,0 +1,133 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const IOTA_PRIMITIVES_COLOR_PALETTE = {
5
+ primary: {
6
+ '0': '#000000',
7
+ '10': '#061244',
8
+ '20': '#182b8a',
9
+ '30': '#3131ff',
10
+ '40': '#2563f5',
11
+ '50': '#3f80f0',
12
+ '60': '#5b9cfe',
13
+ '70': '#85b5fb',
14
+ '80': '#adceff',
15
+ '90': '#d5e8ff',
16
+ '100': '#ffffff',
17
+ },
18
+ secondary: {
19
+ '0': '#000000',
20
+ '10': '#051631',
21
+ '20': '#17345f',
22
+ '30': '#2d4c7a',
23
+ '40': '#4b648a',
24
+ '50': '#637ca2',
25
+ '60': '#7e97bd',
26
+ '70': '#96b3d5',
27
+ '80': '#b6cde8',
28
+ '90': '#dde9f7',
29
+ '100': '#ffffff',
30
+ },
31
+ tertiary: {
32
+ '0': '#000000',
33
+ '10': '#071f22',
34
+ '20': '#18393b',
35
+ '30': '#185b60',
36
+ '40': '#317479',
37
+ '50': '#498c91',
38
+ '60': '#64a7ac',
39
+ '70': '#7fc2c7',
40
+ '80': '#9adde2',
41
+ '90': '#c2f1f4',
42
+ '100': '#ffffff',
43
+ },
44
+ error: {
45
+ '0': '#000000',
46
+ '10': '#330009',
47
+ '20': '#610012',
48
+ '30': '#b51431',
49
+ '40': '#ce2d4a',
50
+ '50': '#e64562',
51
+ '60': '#ff607d',
52
+ '70': '#ff889e',
53
+ '80': '#ffb0be',
54
+ '90': '#ffd9e0',
55
+ '100': '#ffffff',
56
+ },
57
+ neutral: {
58
+ '0': '#000000',
59
+ '4': '#0a0f17',
60
+ '6': '#0f141c',
61
+ '10': '#171d26',
62
+ '12': '#1c212b',
63
+ '20': '#253041',
64
+ '30': '#3c4656',
65
+ '40': '#545e6e',
66
+ '50': '#6e7787',
67
+ '60': '#8892a1',
68
+ '70': '#a8b2c0',
69
+ '80': '#cad4e2',
70
+ '90': '#dde4f0',
71
+ '92': '#e3eaf6',
72
+ '96': '#eff4fa',
73
+ '98': '#f8fafc',
74
+ '100': '#ffffff',
75
+ },
76
+ warning: {
77
+ '10': '#422C00',
78
+ '20': '#2D1E00',
79
+ '60': '#BE8F32',
80
+ '90': '#FFE3AB',
81
+ },
82
+ };
83
+
84
+ export const SHADER_COLOR_PALETTE = {
85
+ 'shader-primary-dark': {
86
+ '0': '#bed8ff00',
87
+ '8': '#bed8ff14',
88
+ '12': '#bed8ff1e',
89
+ '16': '#bed8ff28',
90
+ '48': '#bed8ff7a',
91
+ '72': '#bed8ffb7',
92
+ },
93
+ 'shader-inverted-dark': {
94
+ '0': '#002f6d00',
95
+ '8': '#002f6d14',
96
+ '12': '#002f6d1e',
97
+ '16': '#002f6d28',
98
+ '48': '#002f6d7a',
99
+ '72': '#002f6db7',
100
+ },
101
+ 'shader-neutral-dark': {
102
+ '0': '#bed8ff00',
103
+ '8': '#bed8ff14',
104
+ '12': '#bed8ff1e',
105
+ '16': '#bed8ff28',
106
+ '48': '#bed8ff7a',
107
+ '72': '#bed8ffb7',
108
+ },
109
+ 'shader-primary-light': {
110
+ 0: '#0067ee00',
111
+ 8: '#0067ee14',
112
+ 12: '#0067ee1e',
113
+ 16: '#0067ee28',
114
+ 48: '#0067ee7a',
115
+ 72: '#0067eeb7',
116
+ },
117
+ 'shader-inverted-light': {
118
+ 0: '#bed8ff00',
119
+ 8: '#bed8ff14',
120
+ 12: '#bed8ff1e',
121
+ 16: '#bed8ff28',
122
+ 48: '#bed8ff7a',
123
+ 72: '#bed8ffb7',
124
+ },
125
+ 'shader-neutral-light': {
126
+ 0: '#002f6d00',
127
+ 8: '#002f6d14',
128
+ 12: '#002f6d1e',
129
+ 16: '#002f6d28',
130
+ 48: '#002f6d7a',
131
+ 72: '#002f6db7',
132
+ },
133
+ };
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './colors.constants';
@@ -0,0 +1,4 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './screenSize.enums';
@@ -0,0 +1,9 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export enum ScreenSize {
5
+ Sm = 'sm',
6
+ Md = 'md',
7
+ Lg = 'lg',
8
+ Xl = 'xl',
9
+ }
@@ -0,0 +1,8 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './tailwind';
5
+ export * from './components';
6
+ export * from './constants';
7
+ export * from './enums';
8
+ export * from './utils';
@@ -0,0 +1,5 @@
1
+ /* Copyright (c) 2024 IOTA Stiftung
2
+ SPDX-License-Identifier: Apache-2.0 */
3
+
4
+ @import '@fontsource/inter/400.css';
5
+ @import '@fontsource/inter/500.css';
@@ -0,0 +1,149 @@
1
+ /* Copyright (c) 2024 IOTA Stiftung
2
+ SPDX-License-Identifier: Apache-2.0 */
3
+
4
+ @import './fonts.css';
5
+
6
+ @tailwind base;
7
+ @tailwind components;
8
+ @tailwind utilities;
9
+
10
+ @layer base {
11
+ .text-display-lg,
12
+ .text-display-md,
13
+ .text-display-sm,
14
+ .text-headline-lg,
15
+ .text-headline-md,
16
+ .text-headline-sm {
17
+ @apply font-alliance-no2;
18
+ }
19
+
20
+ .text-title-lg,
21
+ .text-title-md,
22
+ .text-title-sm,
23
+ .text-body-lg,
24
+ .text-body-md,
25
+ .text-body-sm,
26
+ .text-body-ds-lg,
27
+ .text-body-ds-md,
28
+ .text-body-ds-sm,
29
+ .text-label-lg,
30
+ .text-label-md,
31
+ .text-label-sm {
32
+ @apply font-inter;
33
+ }
34
+
35
+ .text-display-lg,
36
+ .text-display-md,
37
+ .text-display-sm,
38
+ .text-headline-lg,
39
+ .text-headline-md,
40
+ .text-headline-sm,
41
+ .text-body-ds-lg {
42
+ font-variant-alternates: 'ss02';
43
+ }
44
+
45
+ .text-label-md {
46
+ font-variant-alternates: 'ss01';
47
+ }
48
+
49
+ input:-webkit-autofill,
50
+ input:-webkit-autofill:enabled,
51
+ input:-webkit-autofill:hover,
52
+ input:-webkit-autofill:focus {
53
+ @apply appearance-none !bg-transparent !bg-none;
54
+ @apply !text-neutral-92 dark:!text-neutral-10;
55
+ transition: background-color 5000s ease-in-out 0s;
56
+ -webkit-text-fill-color: theme('colors.neutral.92') !important;
57
+ }
58
+
59
+ :root:not(.dark) {
60
+ input:-webkit-autofill,
61
+ input:-webkit-autofill:enabled,
62
+ input:-webkit-autofill:hover,
63
+ input:-webkit-autofill:focus {
64
+ -webkit-text-fill-color: theme('colors.neutral.10') !important;
65
+ }
66
+ }
67
+ }
68
+
69
+ @layer utilities {
70
+ .state-layer,
71
+ .state-layer-inverted,
72
+ .state-active {
73
+ &::after {
74
+ content: '';
75
+ border-radius: inherit;
76
+ @apply absolute;
77
+ @apply h-full w-full;
78
+ @apply left-0 top-0;
79
+ @apply transition-opacity duration-75;
80
+ @apply pointer-events-none;
81
+ }
82
+ }
83
+
84
+ .state-layer,
85
+ .state-layer-inverted {
86
+ &::after {
87
+ @apply opacity-0;
88
+ }
89
+
90
+ &:hover::after {
91
+ @apply opacity-8;
92
+ }
93
+
94
+ &:active::after {
95
+ @apply opacity-12;
96
+ }
97
+
98
+ &:disabled::after {
99
+ @apply opacity-0;
100
+ }
101
+ }
102
+
103
+ .state-active,
104
+ .state-layer {
105
+ &::after {
106
+ @apply bg-primary-60;
107
+ }
108
+ }
109
+
110
+ .state-layer-inverted {
111
+ &::after {
112
+ @apply bg-primary-80;
113
+ }
114
+ }
115
+
116
+ .state-active {
117
+ &::after {
118
+ @apply opacity-12;
119
+ }
120
+ }
121
+ }
122
+
123
+ @-moz-document url-prefix() {
124
+ * {
125
+ scrollbar-width: thin;
126
+ scrollbar-color: theme('colors.neutral.30') transparent;
127
+ }
128
+
129
+ :root:not(.dark) {
130
+ * {
131
+ scrollbar-color: theme('colors.neutral.80') transparent;
132
+ }
133
+ }
134
+ }
135
+
136
+ @supports selector(::-webkit-scrollbar) {
137
+ *::-webkit-scrollbar {
138
+ @apply w-3.5;
139
+ }
140
+
141
+ *::-webkit-scrollbar-track {
142
+ @apply rounded-xl bg-transparent;
143
+ }
144
+
145
+ *::-webkit-scrollbar-thumb {
146
+ @apply shadow-[inset_0_0_10px_10px] shadow-neutral-80 dark:shadow-neutral-30;
147
+ @apply rounded-xl border-4 border-solid border-transparent;
148
+ }
149
+ }
@@ -0,0 +1,49 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Config } from 'tailwindcss';
5
+ import { IOTA_PRIMITIVES_COLOR_PALETTE, SHADER_COLOR_PALETTE } from '../constants/colors.constants';
6
+ import {
7
+ CUSTOM_FONT_SIZES,
8
+ BORDER_RADIUS,
9
+ CUSTOM_SPACING,
10
+ OPACITY,
11
+ generateVariableSpacing,
12
+ } from './constants';
13
+ import { firefoxPlugin } from './plugins';
14
+
15
+ export const BASE_CONFIG: Config = {
16
+ content: ['./src/**/*.{html,js,jsx,ts,tsx}'],
17
+ darkMode: 'class',
18
+ plugins: [firefoxPlugin],
19
+ theme: {
20
+ extend: {
21
+ fontSize: {
22
+ ...CUSTOM_FONT_SIZES,
23
+ },
24
+ borderRadius: {
25
+ ...BORDER_RADIUS,
26
+ },
27
+ spacing: (utils) => {
28
+ const screens = utils.theme('screens');
29
+ const variableSpacing = generateVariableSpacing(screens);
30
+ return {
31
+ ...CUSTOM_SPACING,
32
+ ...variableSpacing,
33
+ };
34
+ },
35
+ opacity: {
36
+ ...OPACITY,
37
+ 30: '0.3',
38
+ },
39
+ colors: {
40
+ ...IOTA_PRIMITIVES_COLOR_PALETTE,
41
+ ...SHADER_COLOR_PALETTE,
42
+ },
43
+ fontFamily: {
44
+ 'alliance-no2': ['AllianceNo2', 'sans-serif'],
45
+ inter: ['Inter', 'sans-serif'],
46
+ },
47
+ },
48
+ },
49
+ };
@@ -0,0 +1,201 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { ThemeConfig } from 'tailwindcss/types/config';
5
+
6
+ type TailwindFontSize = ThemeConfig['fontSize'];
7
+
8
+ export type TailwindFontSizeConfig = Partial<{
9
+ lineHeight: string;
10
+ letterSpacing: string;
11
+ fontWeight: string | number;
12
+ }>;
13
+
14
+ export type TailwindCustomFonts = Record<
15
+ string,
16
+ [
17
+ string,
18
+ Partial<{
19
+ lineHeight: string;
20
+ letterSpacing: string;
21
+ fontWeight: string | number;
22
+ }>,
23
+ ]
24
+ >;
25
+
26
+ export const TEXT_LABEL_CLASSES: TailwindCustomFonts = {
27
+ 'text-label-sm': [
28
+ '11px',
29
+ {
30
+ lineHeight: '16px',
31
+ letterSpacing: '0.2px',
32
+ fontWeight: 500,
33
+ },
34
+ ],
35
+ 'text-label-md': [
36
+ '12px',
37
+ {
38
+ lineHeight: '16px',
39
+ letterSpacing: '-0.1px',
40
+ fontWeight: 500,
41
+ },
42
+ ],
43
+ 'text-label-lg': [
44
+ '14px',
45
+ {
46
+ lineHeight: '20px',
47
+ letterSpacing: '-0.1px',
48
+ fontWeight: 500,
49
+ },
50
+ ],
51
+ } satisfies TailwindFontSize;
52
+
53
+ export const TEXT_BODY_CLASSES: TailwindCustomFonts = {
54
+ 'text-body-sm': [
55
+ '12px',
56
+ {
57
+ lineHeight: '16px',
58
+ letterSpacing: '0.1px',
59
+ fontWeight: 400,
60
+ },
61
+ ],
62
+ 'text-body-md': [
63
+ '14px',
64
+ {
65
+ lineHeight: '20px',
66
+ letterSpacing: '-0.1px',
67
+ fontWeight: 400,
68
+ },
69
+ ],
70
+ 'text-body-lg': [
71
+ '16px',
72
+ {
73
+ lineHeight: '24px',
74
+ letterSpacing: '0.1px',
75
+ fontWeight: 400,
76
+ },
77
+ ],
78
+ };
79
+
80
+ export const TEXT_BODY_DISAMBIGUOUS_CLASSES: TailwindCustomFonts = {
81
+ 'text-body-ds-sm': [
82
+ '12px',
83
+ {
84
+ lineHeight: '16px',
85
+ letterSpacing: '0.1px',
86
+ fontWeight: 400,
87
+ },
88
+ ],
89
+ 'text-body-ds-md': [
90
+ '14px',
91
+ {
92
+ lineHeight: '20px',
93
+ letterSpacing: '-0.1px',
94
+ fontWeight: 400,
95
+ },
96
+ ],
97
+ 'text-body-ds-lg': [
98
+ '16px',
99
+ {
100
+ lineHeight: '24px',
101
+ letterSpacing: '0.2px',
102
+ fontWeight: 400,
103
+ },
104
+ ],
105
+ };
106
+
107
+ export const TEXT_TITLE_CLASSES: TailwindCustomFonts = {
108
+ 'text-title-sm': [
109
+ '14px',
110
+ {
111
+ lineHeight: '120%',
112
+ letterSpacing: '-0.1px',
113
+ fontWeight: 500,
114
+ },
115
+ ],
116
+ 'text-title-md': [
117
+ '16px',
118
+ {
119
+ lineHeight: '120%',
120
+ letterSpacing: '-0.15px',
121
+ fontWeight: 500,
122
+ },
123
+ ],
124
+ 'text-title-lg': [
125
+ '20px',
126
+ {
127
+ lineHeight: '120%',
128
+ letterSpacing: '-0.4px',
129
+ fontWeight: 500,
130
+ },
131
+ ],
132
+ };
133
+
134
+ export const TEXT_HEADLINE_CLASSES: TailwindCustomFonts = {
135
+ 'text-headline-sm': [
136
+ '24px',
137
+ {
138
+ lineHeight: '120%',
139
+ letterSpacing: '-0.2px',
140
+ fontWeight: 500,
141
+ },
142
+ ],
143
+ 'text-headline-md': [
144
+ '28px',
145
+ {
146
+ lineHeight: '120%',
147
+ letterSpacing: '-0.4px',
148
+ fontWeight: 500,
149
+ },
150
+ ],
151
+ 'text-headline-lg': [
152
+ '32px',
153
+ {
154
+ lineHeight: '120%',
155
+ letterSpacing: '-0.4px',
156
+ fontWeight: 500,
157
+ },
158
+ ],
159
+ };
160
+
161
+ export const TEXT_DISPLAY_CLASSES: TailwindCustomFonts = {
162
+ 'text-display-sm': [
163
+ '36px',
164
+ {
165
+ lineHeight: '120%',
166
+ fontWeight: 500,
167
+ },
168
+ ],
169
+ 'text-display-md': [
170
+ '48px',
171
+ {
172
+ lineHeight: '120%',
173
+ fontWeight: 500,
174
+ },
175
+ ],
176
+ 'text-display-lg': [
177
+ '60px',
178
+ {
179
+ lineHeight: '120%',
180
+ fontWeight: 500,
181
+ },
182
+ ],
183
+ };
184
+
185
+ const CUSTOM_TEXT_CLASSES: TailwindCustomFonts = {
186
+ ...TEXT_LABEL_CLASSES,
187
+ ...TEXT_BODY_CLASSES,
188
+ ...TEXT_BODY_DISAMBIGUOUS_CLASSES,
189
+ ...TEXT_TITLE_CLASSES,
190
+ ...TEXT_HEADLINE_CLASSES,
191
+ ...TEXT_DISPLAY_CLASSES,
192
+ };
193
+
194
+ // Remove the 'text-' prefix from the keys to match the TailwindCSS font size keys
195
+ export const CUSTOM_FONT_SIZES: TailwindCustomFonts = Object.entries(CUSTOM_TEXT_CLASSES).reduce(
196
+ (acc, [className, properties]) => {
197
+ const key = className.startsWith('text-') ? className.replace('text-', '') : className;
198
+ return { ...acc, [key]: properties };
199
+ },
200
+ {},
201
+ );
@@ -0,0 +1,6 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './scaling.constants';
5
+ export * from './fontSizes.constants';
6
+ export * from './variableSpacing.constants';
@@ -0,0 +1,41 @@
1
+ // Copyright (c) 2024 IOTA Stiftung
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { pxToRem } from '../helpers';
5
+
6
+ type TailwindScale = Record<string, string> & { DEFAULT?: string };
7
+
8
+ export const BORDER_RADIUS: TailwindScale = {
9
+ none: pxToRem(0),
10
+ sm: pxToRem(2),
11
+ DEFAULT: pxToRem(4),
12
+ md: pxToRem(6),
13
+ lg: pxToRem(8),
14
+ xl: pxToRem(12),
15
+ '2xl': pxToRem(16),
16
+ '3xl': pxToRem(24),
17
+ full: pxToRem(120),
18
+ };
19
+
20
+ export const CUSTOM_SPACING: TailwindScale = {
21
+ none: pxToRem(0),
22
+ xxxs: pxToRem(2),
23
+ xxs: pxToRem(4),
24
+ xs: pxToRem(8),
25
+ sm: pxToRem(12),
26
+ md: pxToRem(16),
27
+ lg: pxToRem(24),
28
+ xl: pxToRem(32),
29
+ '2xl': pxToRem(48),
30
+ };
31
+
32
+ export const OPACITY: TailwindScale = {
33
+ 0: '0',
34
+ 8: '0.08',
35
+ 12: '0.12',
36
+ 16: '0.16',
37
+ 40: '0.4',
38
+ 60: '0.6',
39
+ 80: '0.8',
40
+ 100: '1',
41
+ };