@apify/ui-library 0.71.1-featcolortokens-178953.70 → 0.72.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 (95) hide show
  1. package/.stylelintrc +12 -0
  2. package/CHANGELOG.md +3356 -0
  3. package/CODEOWNERS +7 -0
  4. package/README.md +5 -18
  5. package/dist/src/components/button.d.ts +1 -1
  6. package/dist/src/components/button.d.ts.map +1 -1
  7. package/dist/src/components/button.js +9 -7
  8. package/dist/src/components/button.js.map +1 -1
  9. package/dist/src/components/message.js +1 -1
  10. package/dist/src/components/message.js.map +1 -1
  11. package/dist/src/components/tabs/tab.d.ts.map +1 -1
  12. package/dist/src/components/tabs/tab.js +1 -2
  13. package/dist/src/components/tabs/tab.js.map +1 -1
  14. package/dist/src/components/tabs/tabs.d.ts.map +1 -1
  15. package/dist/src/components/tabs/tabs.js +1 -0
  16. package/dist/src/components/tabs/tabs.js.map +1 -1
  17. package/dist/src/components/to_consolidate/pagination.js +1 -1
  18. package/dist/src/components/to_consolidate/pagination.js.map +1 -1
  19. package/dist/src/design_system/colors_theme.d.ts +213 -0
  20. package/dist/src/design_system/colors_theme.d.ts.map +1 -0
  21. package/dist/src/design_system/colors_theme.js +213 -0
  22. package/dist/src/design_system/colors_theme.js.map +1 -0
  23. package/dist/src/design_system/{colors/generated/properties_theme.d.ts → properties_theme.d.ts} +14 -18
  24. package/dist/src/design_system/properties_theme.d.ts.map +1 -0
  25. package/dist/src/design_system/{colors/generated/properties_theme.js → properties_theme.js} +154 -18
  26. package/dist/src/design_system/properties_theme.js.map +1 -0
  27. package/dist/src/design_system/theme.d.ts +87 -88
  28. package/dist/src/design_system/theme.d.ts.map +1 -1
  29. package/dist/src/design_system/theme.js +2 -1
  30. package/dist/src/design_system/theme.js.map +1 -1
  31. package/dist/src/index.d.ts +0 -1
  32. package/dist/src/index.d.ts.map +1 -1
  33. package/dist/src/index.js +0 -1
  34. package/dist/src/index.js.map +1 -1
  35. package/dist/tsconfig.build.tsbuildinfo +1 -1
  36. package/eslint.config.mjs +44 -0
  37. package/package.json +4 -10
  38. package/src/codemods/generate_color_property_tokens.mjs +98 -0
  39. package/src/codemods/generate_color_theme_files.mjs +47 -0
  40. package/src/components/button.tsx +20 -13
  41. package/src/components/message.tsx +1 -1
  42. package/src/components/tabs/tab.tsx +1 -2
  43. package/src/components/tabs/tabs.tsx +1 -0
  44. package/src/components/to_consolidate/pagination.tsx +1 -1
  45. package/src/design_system/{colors/generated/colors_theme.light.ts → colors_theme.ts} +143 -40
  46. package/src/design_system/generate_color_definitions.js +44 -0
  47. package/src/design_system/{colors/generated/properties_theme.ts → properties_theme.ts} +293 -19
  48. package/src/design_system/supernova_color_tokens.json +1766 -0
  49. package/src/design_system/theme.ts +2 -1
  50. package/src/index.ts +0 -1
  51. package/tsconfig.build.json +17 -0
  52. package/tsconfig.json +10 -0
  53. package/dist/src/design_system/colors/generated/colors_theme.dark.d.ts +0 -110
  54. package/dist/src/design_system/colors/generated/colors_theme.dark.d.ts.map +0 -1
  55. package/dist/src/design_system/colors/generated/colors_theme.dark.js +0 -110
  56. package/dist/src/design_system/colors/generated/colors_theme.dark.js.map +0 -1
  57. package/dist/src/design_system/colors/generated/colors_theme.light.d.ts +0 -110
  58. package/dist/src/design_system/colors/generated/colors_theme.light.d.ts.map +0 -1
  59. package/dist/src/design_system/colors/generated/colors_theme.light.js +0 -110
  60. package/dist/src/design_system/colors/generated/colors_theme.light.js.map +0 -1
  61. package/dist/src/design_system/colors/generated/css_variables.dark.d.ts +0 -5
  62. package/dist/src/design_system/colors/generated/css_variables.dark.d.ts.map +0 -1
  63. package/dist/src/design_system/colors/generated/css_variables.dark.js +0 -147
  64. package/dist/src/design_system/colors/generated/css_variables.dark.js.map +0 -1
  65. package/dist/src/design_system/colors/generated/css_variables.light.d.ts +0 -5
  66. package/dist/src/design_system/colors/generated/css_variables.light.d.ts.map +0 -1
  67. package/dist/src/design_system/colors/generated/css_variables.light.js +0 -147
  68. package/dist/src/design_system/colors/generated/css_variables.light.js.map +0 -1
  69. package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts +0 -5
  70. package/dist/src/design_system/colors/generated/css_variables_palette.dark.d.ts.map +0 -1
  71. package/dist/src/design_system/colors/generated/css_variables_palette.dark.js +0 -74
  72. package/dist/src/design_system/colors/generated/css_variables_palette.dark.js.map +0 -1
  73. package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts +0 -5
  74. package/dist/src/design_system/colors/generated/css_variables_palette.light.d.ts.map +0 -1
  75. package/dist/src/design_system/colors/generated/css_variables_palette.light.js +0 -74
  76. package/dist/src/design_system/colors/generated/css_variables_palette.light.js.map +0 -1
  77. package/dist/src/design_system/colors/generated/properties_theme.d.ts.map +0 -1
  78. package/dist/src/design_system/colors/generated/properties_theme.js.map +0 -1
  79. package/dist/src/design_system/colors/index.d.ts +0 -8
  80. package/dist/src/design_system/colors/index.d.ts.map +0 -1
  81. package/dist/src/design_system/colors/index.js +0 -8
  82. package/dist/src/design_system/colors/index.js.map +0 -1
  83. package/src/design_system/colors/build_color_tokens.js +0 -183
  84. package/src/design_system/colors/figma_color_tokens.dark.json +0 -886
  85. package/src/design_system/colors/figma_color_tokens.light.json +0 -886
  86. package/src/design_system/colors/generated/colors_theme.dark.ts +0 -110
  87. package/src/design_system/colors/generated/css_variables.dark.ts +0 -147
  88. package/src/design_system/colors/generated/css_variables.light.ts +0 -147
  89. package/src/design_system/colors/generated/css_variables_palette.dark.ts +0 -74
  90. package/src/design_system/colors/generated/css_variables_palette.light.ts +0 -74
  91. package/src/design_system/colors/index.ts +0 -7
  92. package/style/colors/dark.scss +0 -148
  93. package/style/colors/light.scss +0 -148
  94. package/style/colors/palette.dark.scss +0 -75
  95. package/style/colors/palette.light.scss +0 -75
@@ -0,0 +1,44 @@
1
+ import react from 'eslint-plugin-react';
2
+ import reactHooks from 'eslint-plugin-react-hooks';
3
+ import sonarjs from 'eslint-plugin-sonarjs';
4
+
5
+ import apifyJestConfig from '@apify/eslint-config/jest.js';
6
+ import apifyTypescriptConfig from '@apify/eslint-config/ts.js';
7
+
8
+ // eslint-disable-next-line import/no-default-export
9
+ export default [
10
+ { ignores: ['**/dist'] }, // Ignores need to happen first
11
+ ...apifyTypescriptConfig,
12
+ ...apifyJestConfig,
13
+
14
+ {
15
+ files: ['**/*.ts', '**/*.tsx'],
16
+ settings: {
17
+ react: {
18
+ version: 'detect',
19
+ },
20
+ },
21
+ ...react.configs.flat.recommended,
22
+ },
23
+ {
24
+ plugins: {
25
+ sonarjs,
26
+ 'react-hooks': reactHooks,
27
+ },
28
+ languageOptions: {
29
+ sourceType: 'module',
30
+
31
+ parserOptions: {
32
+ projectService: true,
33
+ tsconfigRootDir: import.meta.dirname,
34
+ },
35
+ },
36
+ rules: {
37
+ 'react/react-in-jsx-scope': 'off',
38
+ 'no-void': 'off',
39
+ 'react/display-name': 'off',
40
+ 'react-hooks/exhaustive-deps': 'error',
41
+ ...reactHooks.configs.recommended.rules,
42
+ },
43
+ },
44
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/ui-library",
3
- "version": "0.71.1-featcolortokens-178953.70+6c2ae39f4a2",
3
+ "version": "0.72.0",
4
4
  "description": "React UI library used by apify.com",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -17,8 +17,8 @@
17
17
  "build": "npm run clean && npm run compile",
18
18
  "clean": "rimraf ./dist",
19
19
  "compile": "tsc -p tsconfig.build.json",
20
- "generate-theme": "node src/codemods/generate_typograpy_tokens_files.mjs && npm run lint:fix",
21
- "build-color-tokens": "node src/design_system/colors/build_color_tokens.js",
20
+ "generate-theme": "node ./src/codemods/generate_color_theme_files.mjs && node src/codemods/generate_color_property_tokens.mjs && node src/codemods/generate_typograpy_tokens_files.mjs && npm run lint:fix",
21
+ "generate-color-definition": "node ./src/design_system/generate_color_definitions.js",
22
22
  "postpublish": "npm run clean"
23
23
  },
24
24
  "//": [
@@ -63,14 +63,8 @@
63
63
  "eslint-plugin-react-hooks": "^4.6.0",
64
64
  "eslint-plugin-sonarjs": "^1.0.3",
65
65
  "recast": "^0.23.9",
66
- "style-dictionary": "^4.4.0",
67
66
  "typescript": "^5.1.6",
68
67
  "typescript-eslint": "^8.24.0"
69
68
  },
70
- "files": [
71
- "dist",
72
- "src",
73
- "style"
74
- ],
75
- "gitHead": "6c2ae39f4a2f422e75ad9b1648cc07fc8e1bd701"
69
+ "gitHead": "f8569562bb250e8d86523ad05e5c54e662b6636b"
76
70
  }
@@ -0,0 +1,98 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ import { print, types } from 'recast';
5
+
6
+ const { builders } = types;
7
+
8
+ const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
9
+
10
+ const lightColorTokens = JSON.parse(code).light;
11
+
12
+ const getObjectValueByPath = (obj, path) => {
13
+ return path.split('.').reduce((acc, part) => acc && acc[part], obj);
14
+ };
15
+
16
+ const getColorPropertyName = (semanticCategory, property) => {
17
+ const semanticColorName = `${property.split(/[_ ]/).map((semanticPartName) => semanticPartName.toLowerCase()).join('-')}`;
18
+
19
+ // lower case and replace spaces with dashes
20
+ const semanticCategoryName = semanticCategory.toLowerCase().split(' ').join('-');
21
+
22
+ return `--color-${semanticCategoryName}-${semanticColorName}`;
23
+ };
24
+
25
+ const generateColorPropertyTokens = (supernovaColorsDefinitions) => {
26
+ const mergedPalettes = { ...supernovaColorsDefinitions.Semantic, ...supernovaColorsDefinitions.Decorative };
27
+
28
+ const colorTheme = {};
29
+ for (const [category, palette] of Object.entries(mergedPalettes)) {
30
+ // convert to camelCase if there are multiple words in the category name
31
+ const categoryName = category
32
+ .split(' ')
33
+ .map((word, i) => (i === 0
34
+ ? word.toLocaleLowerCase()
35
+ : `${word.charAt(0).toUpperCase()}${word.slice(1)}`),
36
+ )
37
+ .join('');
38
+ colorTheme[categoryName] = {};
39
+
40
+ for (const [key, { value }] of Object.entries(palette)) {
41
+ const [firstPart, ...rest] = key.split(' ');
42
+ const propertyName = `${firstPart.toLowerCase()}${rest.join('')}`;
43
+
44
+ const hexLocator = value.slice(1, -1);
45
+ const hex = value.startsWith('#') ? value : getObjectValueByPath(supernovaColorsDefinitions, hexLocator)?.value;
46
+
47
+ colorTheme[categoryName][propertyName] = {
48
+ variable: `var(${getColorPropertyName(category, key)})`,
49
+ hex,
50
+ };
51
+ }
52
+ }
53
+
54
+ return colorTheme;
55
+ };
56
+
57
+ const createPropertyDeclaration = (tokens) => {
58
+ const paletteArray = [];
59
+
60
+ for (const [paletteName, paletteProps] of [...Object.entries(tokens)]) {
61
+ const paletteItemsArray = [];
62
+
63
+ for (const [paletteItemName, { variable, hex }] of Object.entries(paletteProps)) {
64
+ const objectPropertyItem = builders.property(
65
+ 'init',
66
+ builders.identifier(paletteItemName),
67
+ builders.literal(variable),
68
+ );
69
+
70
+ objectPropertyItem.comments = [builders.commentBlock(` ${hex} `)];
71
+
72
+ paletteItemsArray.push(objectPropertyItem);
73
+ }
74
+
75
+ paletteArray.push(builders.property(
76
+ 'init',
77
+ builders.identifier(paletteName),
78
+ builders.objectExpression(paletteItemsArray),
79
+ ));
80
+ }
81
+
82
+ return builders.exportNamedDeclaration(
83
+ builders.variableDeclaration('const', [
84
+ builders.variableDeclarator(
85
+ builders.identifier('colorProperties'),
86
+ builders.tsAsExpression(builders.objectExpression(paletteArray), builders.tsTypeReference(builders.identifier('const'))),
87
+ )]),
88
+ [],
89
+ );
90
+ };
91
+
92
+ const generatedTokens = generateColorPropertyTokens(lightColorTokens);
93
+
94
+ const lightThemeDeclaration = createPropertyDeclaration(generatedTokens);
95
+
96
+ const printedCode = print(builders.program([lightThemeDeclaration])).code;
97
+
98
+ writeFileSync('./src/design_system/properties_theme.ts', printedCode);
@@ -0,0 +1,47 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs';
2
+
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ import { print, types } from 'recast';
5
+
6
+ const { builders } = types;
7
+
8
+ const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
9
+
10
+ const colorTokens = JSON.parse(code);
11
+
12
+ const lightThemeProperty = colorTokens.light;
13
+ const darkThemeProperty = colorTokens.dark;
14
+
15
+ function createThemeDeclaration(themeProperty, variableName) {
16
+ const paletteArray = [];
17
+
18
+ const { Decorative, Palette } = themeProperty;
19
+
20
+ for (const [paletteName, paletteProps] of [...Object.entries(Palette), ...Object.entries(Decorative)]) {
21
+ for (const [paletteItemName, paletteItem] of Object.entries(paletteProps)) {
22
+ paletteArray.push(
23
+ builders.property(
24
+ 'init',
25
+ builders.identifier(`${paletteName.toLowerCase()}${paletteItemName}`),
26
+ builders.literal(paletteItem.value),
27
+ ),
28
+ );
29
+ }
30
+ }
31
+
32
+ return builders.exportNamedDeclaration(
33
+ builders.variableDeclaration('const', [
34
+ builders.variableDeclarator(
35
+ builders.identifier(variableName),
36
+ builders.tsAsExpression(builders.objectExpression(paletteArray), builders.tsTypeReference(builders.identifier('const'))),
37
+ )]),
38
+ [],
39
+ );
40
+ }
41
+
42
+ const lightThemeDeclaration = createThemeDeclaration(lightThemeProperty, 'lightTheme');
43
+ const darkThemeDeclaration = createThemeDeclaration(darkThemeProperty, 'darkTheme');
44
+
45
+ const printedCode = print(builders.program([lightThemeDeclaration, darkThemeDeclaration])).code;
46
+
47
+ writeFileSync('./src/design_system/colors_theme.ts', printedCode);
@@ -11,7 +11,7 @@ import { isUrlExternal, Link, type LinkProps } from './link.js';
11
11
 
12
12
  type ButtonSize = 'medium' | 'small';
13
13
  type ButtonColor = 'default' | 'success' | 'danger';
14
- type ButtonVariant = 'primary' | 'secondary' | 'text';
14
+ type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
15
15
 
16
16
  export interface TransientButtonProps {
17
17
  size?: ButtonSize;
@@ -46,13 +46,17 @@ type ButtonColorCombinations = {
46
46
  borderColor: string
47
47
  backgroundColor: string,
48
48
 
49
- // hover & active state affects both border & background.
50
- hoverColor?: string,
51
- activeColor?: string,
49
+ // hover & active state effects
52
50
  actionTextColor?: string,
53
-
54
51
  // only exception is primary outlined button
55
52
  actionBorderColor?: string
53
+
54
+ // hover state effects override
55
+ hoverColor?: string,
56
+
57
+ // active state effects override
58
+ activeColor?: string,
59
+ activeTextColor?: string,
56
60
  }
57
61
  };
58
62
  };
@@ -110,12 +114,13 @@ const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
110
114
  textColor: theme.color.danger.text,
111
115
  backgroundColor: theme.color.neutral.backgroundMuted,
112
116
  borderColor: theme.color.neutral.border,
113
- hoverColor: theme.color.danger.actionHover,
117
+ hoverColor: theme.color.danger.backgroundHover,
118
+ actionBorderColor: theme.color.danger.borderSubtle,
114
119
  activeColor: theme.color.danger.actionActive,
115
- actionTextColor: theme.color.neutral.background,
120
+ activeTextColor: theme.color.neutral.textOnPrimary,
116
121
  },
117
122
  },
118
- text: {
123
+ tertiary: {
119
124
  default: {
120
125
  textColor: theme.color.neutral.text,
121
126
  backgroundColor: 'transparent',
@@ -144,7 +149,7 @@ const BUTTON_COLOR_VARIANTS_CSS: ButtonColorCombinations = {
144
149
  export const BUTTON_SIZE_VARIANTS_CSS: ButtonSizeCombinations = {
145
150
  medium: {
146
151
  fontSize: 14,
147
- height: 36,
152
+ height: 32,
148
153
  horizontalPadding: 12,
149
154
  },
150
155
  small: {
@@ -159,10 +164,11 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
159
164
  backgroundColor,
160
165
  borderColor,
161
166
  textColor,
167
+ actionBorderColor,
162
168
  actionTextColor,
163
- activeColor,
164
169
  hoverColor,
165
- actionBorderColor,
170
+ activeColor,
171
+ activeTextColor,
166
172
  } = BUTTON_COLOR_VARIANTS_CSS[variant][color];
167
173
 
168
174
  return css`
@@ -177,7 +183,7 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
177
183
  }
178
184
 
179
185
  &:active {
180
- color: ${actionTextColor || textColor};
186
+ color: ${activeTextColor || actionTextColor || textColor};
181
187
  background-color: ${activeColor};
182
188
  border-color: ${actionBorderColor || activeColor};
183
189
  }
@@ -185,7 +191,7 @@ export const getButtonColorStyles = (variant: ButtonVariant = 'primary', color:
185
191
  &:disabled {
186
192
  color: ${theme.color.neutral.textDisabled};
187
193
  background-color: ${theme.color.neutral.disabled};
188
- border-color: ${variant === 'text' ? 'transparent' : theme.color.neutral.disabled};
194
+ border-color: ${variant === 'tertiary' ? 'transparent' : theme.color.neutral.disabled};
189
195
 
190
196
  cursor: default;
191
197
  }
@@ -260,6 +266,7 @@ export const Button = forwardRef<HTMLElement, ButtonProps | AnchorButtonProps>((
260
266
  };
261
267
 
262
268
  const iconSize = size === 'medium' ? '16' : '12';
269
+ console.log('variant', variant);
263
270
 
264
271
  if (isAnchorButton(props)) {
265
272
  const isExternal = isUrlExternal(props.to, windowLocationHost);
@@ -133,7 +133,7 @@ export const Message: React.FC<MessageProps> = ({
133
133
  {onDismissClick && (
134
134
  <Button
135
135
  size='small'
136
- variant='text'
136
+ variant='tertiary'
137
137
  trackingId={dismissTrackingId}
138
138
  onClick={onDismissClick}
139
139
  className={messageClassNames.dismiss}
@@ -118,11 +118,10 @@ const tabVariantStyle = {
118
118
  `,
119
119
  buttoned: css`
120
120
  height: 3.2rem;
121
- margin: 0 ${theme.space.space4};
122
121
  padding: 0 ${theme.space.space8};
123
122
  background-color: transparent;
124
123
  border: 1px solid transparent;
125
- border-radius: ${theme.radius.radius8};
124
+ border-radius: ${theme.radius.radius6};
126
125
  color: ${theme.color.neutral.textMuted};
127
126
 
128
127
  &:hover {
@@ -53,6 +53,7 @@ const tabsVariantStyle = {
53
53
  `,
54
54
  buttoned: css`
55
55
  align-items: center;
56
+ gap: ${theme.space.space4};
56
57
  `,
57
58
  } satisfies Record<TabVariant, FlattenSimpleInterpolation>;
58
59
 
@@ -11,7 +11,7 @@ import { Button } from '../button.js';
11
11
  const LEADING_THREE_DOTS_PAGE_KEY = -1;
12
12
  const TRAILING_THREE_DOTS_PAGE_KEY = -2;
13
13
 
14
- const PaginationButtonBase = styled(Button).attrs({ variant: 'text' })`
14
+ const PaginationButtonBase = styled(Button).attrs({ variant: 'tertiary' })`
15
15
  padding: 0;
16
16
  height: 28px;
17
17
  min-width: 28px;
@@ -1,44 +1,4 @@
1
- /**
2
- * Do not edit directly, this file was auto-generated.
3
- */
4
-
5
1
  export const lightTheme = {
6
- roseLight: '#f483b5',
7
- roseBase: '#c6387d',
8
- roseDark: '#781552',
9
- roseText: '#b6006b',
10
- buttercupLight: '#ffdd96',
11
- buttercupBase: '#f0b21b',
12
- buttercupDark: '#c37319',
13
- buttercupText: '#a65d00',
14
- paprikaLight: '#e44467',
15
- paprikaBase: '#9b0238',
16
- paprikaDark: '#4a0018',
17
- paprikaText: '#ba0044',
18
- tealLight: '#a7f2ed',
19
- tealBase: '#30c0bb',
20
- tealDark: '#297774',
21
- tealText: '#018181',
22
- indigoLight: '#a1b7ff',
23
- indigoBase: '#5d85e1',
24
- indigoDark: '#365494',
25
- indigoText: '#2563c1',
26
- slateLight: '#c1c5e1',
27
- slateBase: '#8490c4',
28
- slateDark: '#525c85',
29
- slateText: '#566087',
30
- coralLight: '#ffc89f',
31
- coralBase: '#fa8136',
32
- coralDark: '#bb4511',
33
- coralText: '#c74000',
34
- lavenderLight: '#bf97ed',
35
- lavenderBase: '#6a14de',
36
- lavenderDark: '#330276',
37
- lavenderText: '#6e00f4',
38
- bambooLight: '#64cda5',
39
- bambooBase: '#12966f',
40
- bambooDark: '#195d46',
41
- bambooText: '#007455',
42
2
  neutral0: '#ffffff',
43
3
  neutral25: '#f8f9fc',
44
4
  neutral50: '#f3f4fa',
@@ -107,4 +67,147 @@ export const lightTheme = {
107
67
  blue500: '#1672eb',
108
68
  blue600: '#1a57da',
109
69
  blue700: '#224ed5',
70
+ roseLight: '#f483b5',
71
+ roseBase: '#c6387d',
72
+ roseDark: '#781552',
73
+ roseText: '#b6006b',
74
+ buttercupLight: '#ffdd96',
75
+ buttercupBase: '#f0b21b',
76
+ buttercupDark: '#c37319',
77
+ buttercupText: '#a65d00',
78
+ paprikaLight: '#e44467',
79
+ paprikaBase: '#9b0238',
80
+ paprikaDark: '#4a0018',
81
+ paprikaText: '#ba0044',
82
+ tealLight: '#a7f2ed',
83
+ tealBase: '#30c0bb',
84
+ tealDark: '#297774',
85
+ tealText: '#018181',
86
+ indigoLight: '#a1b7ff',
87
+ indigoBase: '#5d85e1',
88
+ indigoDark: '#365494',
89
+ indigoText: '#2563c1',
90
+ slateLight: '#c1c5e1',
91
+ slateBase: '#8490c4',
92
+ slateDark: '#525c85',
93
+ slateText: '#566087',
94
+ coralLight: '#ffc89f',
95
+ coralBase: '#fa8136',
96
+ coralDark: '#bb4511',
97
+ coralText: '#c74000',
98
+ lavenderLight: '#bf97ed',
99
+ lavenderBase: '#6a14de',
100
+ lavenderDark: '#330276',
101
+ lavenderText: '#6e00f4',
102
+ bambooLight: '#64cda5',
103
+ bambooBase: '#12966f',
104
+ bambooDark: '#195d46',
105
+ bambooText: '#007455',
106
+ } as const;
107
+
108
+ export const darkTheme = {
109
+ neutral0: '#ffffff',
110
+ neutral25: '#f8f9fc',
111
+ neutral50: '#f3f4fa',
112
+ neutral75: '#eef0f8',
113
+ neutral100: '#e1e3ed',
114
+ neutral150: '#d1d5e4',
115
+ neutral200: '#c1c6d9',
116
+ neutral250: '#b2b8cc',
117
+ neutral300: '#a5abc0',
118
+ neutral350: '#989eb3',
119
+ neutral400: '#8c93a8',
120
+ neutral450: '#7d8499',
121
+ neutral500: '#6e758a',
122
+ neutral550: '#646a7f',
123
+ neutral600: '#575d71',
124
+ neutral650: '#4d5265',
125
+ neutral700: '#414758',
126
+ neutral750: '#343847',
127
+ neutral775: '#2d313e',
128
+ neutral800: '#2a2d39',
129
+ neutral850: '#252832',
130
+ neutral875: '#1e2027',
131
+ neutral900: '#1a1b21',
132
+ neutral950: '#101114',
133
+ yellow25: '#fcdc73',
134
+ yellow50: '#ffd761',
135
+ yellow75: '#f9ce4b',
136
+ yellow100: '#f5bc38',
137
+ yellow200: '#cf9117',
138
+ yellow300: '#a56909',
139
+ yellow350: '#8a4f05',
140
+ yellow400: '#6d3806',
141
+ yellow500: '#5d2e0e',
142
+ yellow600: '#3f1b07',
143
+ yellow700: '#301806',
144
+ red25: '#f5a790',
145
+ red50: '#fe9e8a',
146
+ red75: '#ff8770',
147
+ red100: '#ff7157',
148
+ red200: '#ef6045',
149
+ red300: '#cf4436',
150
+ red350: '#aa3229',
151
+ red400: '#812420',
152
+ red500: '#672523',
153
+ red600: '#40191b',
154
+ red700: '#381719',
155
+ green25: '#74d584',
156
+ green50: '#6ccd7c',
157
+ green75: '#55c06a',
158
+ green100: '#3bb358',
159
+ green200: '#23a64a',
160
+ green300: '#068a35',
161
+ green350: '#006e29',
162
+ green400: '#00531e',
163
+ green500: '#14441f',
164
+ green600: '#0f2b14',
165
+ green700: '#09260f',
166
+ blue25: '#92C0ff',
167
+ blue50: '#8ebcff',
168
+ blue75: '#80a9ff',
169
+ blue100: '#6f9dff',
170
+ blue200: '#5990ff',
171
+ blue300: '#3970d7',
172
+ blue350: '#295cbb',
173
+ blue400: '#194594',
174
+ blue500: '#1a3a78',
175
+ blue600: '#0d2550',
176
+ blue700: '#151d34',
177
+ roseLight: '#e88bb3',
178
+ roseBase: '#b8487b',
179
+ roseDark: '#6f234f',
180
+ roseText: '#ed8bb5',
181
+ buttercupLight: '#f9deaa',
182
+ buttercupBase: '#e5b557',
183
+ buttercupDark: '#b87939',
184
+ buttercupText: '#ebbf6c',
185
+ paprikaLight: '#e26c7d',
186
+ paprikaBase: '#9e384b',
187
+ paprikaDark: '#511d27',
188
+ paprikaText: '#f67c8d',
189
+ tealLight: '#aef0f5',
190
+ tealBase: '#58bcc4',
191
+ tealDark: '#408288',
192
+ tealText: '#62c1c8',
193
+ indigoLight: '#a8b7ed',
194
+ indigoBase: '#6d85ca',
195
+ indigoDark: '#425484',
196
+ indigoText: '#a2b2eb',
197
+ slateLight: '#c2c5dc',
198
+ slateBase: '#8690bf',
199
+ slateDark: '#535c81',
200
+ slateText: '#afb2c9',
201
+ coralLight: '#f3ccb0',
202
+ coralBase: '#f08848',
203
+ coralDark: '#9a4e2d',
204
+ coralText: '#f9b27b',
205
+ lavenderLight: '#b482ed',
206
+ lavenderBase: '#8148c9',
207
+ lavenderDark: '#48296f',
208
+ lavenderText: '#be8af9',
209
+ bambooLight: '#7acaa9',
210
+ bambooBase: '#439274',
211
+ bambooDark: '#305b4a',
212
+ bambooText: '#65bc99',
110
213
  } as const;
@@ -0,0 +1,44 @@
1
+ import { readFileSync } from 'node:fs';
2
+
3
+ const code = readFileSync('./src/design_system/supernova_color_tokens.json', 'utf-8');
4
+
5
+ const colorsDefinitions = JSON.parse(code);
6
+
7
+ const getObjectValueByPath = (obj, path) => {
8
+ return path.split('.').reduce((acc, part) => {
9
+ return acc && acc[part];
10
+ }, obj);
11
+ };
12
+
13
+ const getColorPropertyName = (semanticCategory, property) => {
14
+ const semanticColorName = `${property.split(/[_ ]/).map((semanticPartName) => semanticPartName.toLowerCase()).join('-')}`;
15
+
16
+ // lower case and replace spaces with dashes
17
+ const semanticCategoryName = semanticCategory.toLowerCase().split(' ').join('-');
18
+
19
+ return `--color-${semanticCategoryName}-${semanticColorName}`;
20
+ };
21
+
22
+ const generateColorDefinitions = (themeVariant) => {
23
+ const mergedPalette = {
24
+ ...colorsDefinitions[themeVariant].Semantic,
25
+ ...colorsDefinitions[themeVariant].Decorative,
26
+ };
27
+
28
+ const colorDefinitions = [];
29
+ for (const [semanticCategory, palette] of Object.entries(mergedPalette)) {
30
+ for (const [key, { value }] of Object.entries(palette)) {
31
+ colorDefinitions.push(
32
+
33
+ `${getColorPropertyName(semanticCategory, key)}: ${value.startsWith('#') ? value : getObjectValueByPath(colorsDefinitions[themeVariant], value.slice(1, -1)).value};`,
34
+ );
35
+ }
36
+ }
37
+
38
+ return colorDefinitions.join('\n');
39
+ };
40
+
41
+ ['light', 'dark'].forEach((themeVariant) => {
42
+ // eslint-disable-next-line no-console
43
+ console.log(`\n*** CSS variables from ${themeVariant} mode ***\n`, generateColorDefinitions(themeVariant));
44
+ });