@carbon/themes 11.77.0 → 11.78.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 (64) hide show
  1. package/es/index.js +1360 -1722
  2. package/js/generated/component-tokens/button.d.ts +98 -0
  3. package/{src/component-tokens/button/tokens.ts → js/generated/component-tokens/button.js} +65 -97
  4. package/js/generated/component-tokens/content-switcher.d.ts +25 -0
  5. package/js/generated/component-tokens/content-switcher.js +25 -0
  6. package/js/generated/component-tokens/notification.d.ts +65 -0
  7. package/js/generated/component-tokens/notification.js +65 -0
  8. package/js/generated/component-tokens/status.d.ts +63 -0
  9. package/js/generated/component-tokens/status.js +63 -0
  10. package/js/generated/component-tokens/tag.d.ts +247 -0
  11. package/js/generated/component-tokens/tag.js +247 -0
  12. package/js/generated/themes/g10.d.ts +242 -0
  13. package/js/generated/themes/g10.js +242 -0
  14. package/js/generated/themes/g100.d.ts +242 -0
  15. package/js/generated/themes/g100.js +242 -0
  16. package/js/generated/themes/g90.d.ts +242 -0
  17. package/js/generated/themes/g90.js +242 -0
  18. package/js/generated/themes/white.d.ts +242 -0
  19. package/js/generated/themes/white.js +242 -0
  20. package/lib/index.d.ts +12 -10
  21. package/lib/index.js +1360 -1722
  22. package/package.json +12 -9
  23. package/scss/generated/_button-tokens.scss +2 -2
  24. package/src/dtcg/README.md +210 -0
  25. package/src/dtcg/color-palette.json +3204 -0
  26. package/src/dtcg/components/button.json +193 -0
  27. package/src/dtcg/components/content-switcher.json +60 -0
  28. package/src/dtcg/components/notification.json +130 -0
  29. package/src/dtcg/components/status.json +122 -0
  30. package/src/dtcg/components/tag.json +486 -0
  31. package/src/dtcg/g10.json +1453 -0
  32. package/src/dtcg/g100.json +1478 -0
  33. package/src/dtcg/g90.json +1478 -0
  34. package/src/dtcg/white.json +1345 -0
  35. package/src/index.ts +96 -10
  36. package/test-dtcg.scss +28 -0
  37. package/umd/index.js +1363 -1725
  38. package/lib/component-tokens/button/index.d.ts +0 -7
  39. package/lib/component-tokens/button/tokens.d.ts +0 -98
  40. package/lib/component-tokens/content-switcher/index.d.ts +0 -7
  41. package/lib/component-tokens/content-switcher/tokens.d.ts +0 -24
  42. package/lib/component-tokens/notification/index.d.ts +0 -7
  43. package/lib/component-tokens/notification/tokens.d.ts +0 -64
  44. package/lib/component-tokens/status/index.d.ts +0 -7
  45. package/lib/component-tokens/status/tokens.d.ts +0 -62
  46. package/lib/component-tokens/tag/index.d.ts +0 -7
  47. package/lib/component-tokens/tag/tokens.d.ts +0 -246
  48. package/lib/g10.d.ts +0 -242
  49. package/lib/g100.d.ts +0 -242
  50. package/lib/g90.d.ts +0 -242
  51. package/lib/white.d.ts +0 -243
  52. package/src/component-tokens/button/index.ts +0 -8
  53. package/src/component-tokens/content-switcher/index.ts +0 -7
  54. package/src/component-tokens/content-switcher/tokens.ts +0 -29
  55. package/src/component-tokens/notification/index.ts +0 -8
  56. package/src/component-tokens/notification/tokens.ts +0 -105
  57. package/src/component-tokens/status/index.ts +0 -8
  58. package/src/component-tokens/status/tokens.ts +0 -90
  59. package/src/component-tokens/tag/index.ts +0 -8
  60. package/src/component-tokens/tag/tokens.ts +0 -353
  61. package/src/g10.ts +0 -452
  62. package/src/g100.ts +0 -453
  63. package/src/g90.ts +0 -455
  64. package/src/white.ts +0 -455
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/themes",
3
3
  "description": "Themes for applying color in the Carbon Design System",
4
- "version": "11.77.0",
4
+ "version": "11.78.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -28,34 +28,37 @@
28
28
  },
29
29
  "scripts": {
30
30
  "ci-check": "carbon-cli check \"scss/**/*.scss\" -i \"**/generated/**\" -i \"**/compat/**\"",
31
- "clean": "rimraf es lib umd scss/generated scss/compat/generated",
31
+ "clean": "rimraf es lib umd scss/compat/generated scss/generated js/generated",
32
32
  "build:types": "tsc -p tsconfig.types.json",
33
- "build": "yarn clean && carbon-cli bundle src/index.ts --name CarbonThemes && babel-node --extensions '.js,.ts' --presets '@babel/preset-env,@babel/preset-typescript' tasks/build.js && yarn build:types && carbon-cli check \"scss/*.scss\"",
33
+ "build:js-tokens": "babel-node --extensions '.js,.ts' --presets '@babel/preset-env,@babel/preset-typescript' tasks/generate-js-tokens.js",
34
+ "build": "yarn clean && yarn build:js-tokens && carbon-cli bundle src/index.ts --name CarbonThemes && babel-node --extensions '.js,.ts' --presets '@babel/preset-env,@babel/preset-typescript' tasks/build.js && yarn build:types && carbon-cli check \"scss/*.scss\"",
34
35
  "postinstall": "ibmtelemetry --config=telemetry.yml"
35
36
  },
36
37
  "dependencies": {
37
- "@carbon/colors": "^11.54.0",
38
- "@carbon/layout": "^11.55.0",
39
- "@carbon/type": "^11.63.0",
38
+ "@carbon/colors": "^11.55.0",
39
+ "@carbon/layout": "^11.56.0",
40
+ "@carbon/type": "^11.64.0",
40
41
  "@ibm/telemetry-js": "^1.5.0",
41
42
  "color": "^4.0.0"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@babel/node": "^7.27.1",
45
46
  "@babel/preset-env": "^7.27.2",
46
- "@carbon/cli": "^11.46.0",
47
+ "@carbon/cli": "^11.47.0",
47
48
  "@carbon/cli-reporter": "^10.8.0",
48
49
  "@carbon/scss-generator": "^10.20.0",
49
50
  "@carbon/test-utils": "^10.41.0",
50
51
  "@types/color": "^4.2.1",
52
+ "ajv": "^8.20.0",
53
+ "ajv-formats": "^3.0.1",
51
54
  "change-case-all": "^2.1.0",
52
55
  "core-js": "^3.16.0",
53
56
  "fs-extra": "^11.0.0",
54
- "js-yaml": "^4.1.0",
57
+ "js-yaml": "^5.0.0",
55
58
  "rimraf": "^6.0.1",
56
59
  "typescript": "^6.0.3",
57
60
  "typescript-config-carbon": "^0.11.0"
58
61
  },
59
62
  "sideEffects": false,
60
- "gitHead": "5102bd860864c2580048183ffaf50d1ffd4400b5"
63
+ "gitHead": "a57cf8a896fe3fe09c5ab27648cd58947f37360a"
61
64
  }
@@ -40,8 +40,8 @@ $button-danger-secondary: (
40
40
  $button-disabled: (
41
41
  white-theme: #c6c6c6,
42
42
  g-10: #c6c6c6,
43
- g-90: rgb(141 141 141 / 30%),
44
- g-100: rgb(141 141 141 / 30%),
43
+ g-90: rgba(141, 141, 141, 0.3),
44
+ g-100: rgba(141, 141, 141, 0.3),
45
45
  ) !default;
46
46
 
47
47
  $button-primary: (
@@ -0,0 +1,210 @@
1
+ # Carbon Design Tokens (DTCG Format)
2
+
3
+ This directory contains Carbon Design System tokens in the
4
+ [Design Tokens Community Group (DTCG)](https://tr.designtokens.org/format/)
5
+ format. All Carbon themes and component tokens have been migrated to this
6
+ industry-standard format.
7
+
8
+ ## Structure
9
+
10
+ ```
11
+ dtcg/
12
+ ├── white.json # White theme (light, high contrast)
13
+ ├── g10.json # Gray 10 theme (light)
14
+ ├── g90.json # Gray 90 theme (dark)
15
+ ├── g100.json # Gray 100 theme (dark, high contrast)
16
+ └── components/
17
+ ├── button.json # Button component tokens
18
+ ├── tag.json # Tag component tokens
19
+ ├── notification.json # Notification component tokens
20
+ ├── status.json # Status indicator tokens
21
+ └── content-switcher.json # Content switcher tokens
22
+ ```
23
+
24
+ ## Token Format
25
+
26
+ All tokens follow the DTCG specification with a structured format using specific
27
+ keys:
28
+
29
+ ### DTCG Format Keys
30
+
31
+ #### Required Keys
32
+
33
+ - **`$schema`** - References the DTCG specification version. Always set to
34
+ `"https://tr.designtokens.org/format/"` at the root level.
35
+
36
+ - **`$type`** - Defines the token type (e.g., `"color"`, `"dimension"`,
37
+ `"fontFamily"`). This enables proper validation and tooling support.
38
+
39
+ - **`$value`** - The actual token value. Can be:
40
+
41
+ - A reference to another token: `"{blue.60}"`, `"{gray.80}"`
42
+ - References use curly brace syntax and resolve during build
43
+
44
+ - **`$description`** - Human-readable description explaining the token's purpose
45
+ and usage. Should be clear and actionable for designers and developers.
46
+
47
+ #### Optional Keys
48
+
49
+ - **`$extensions`** - Custom metadata and vendor-specific information. Carbon
50
+ uses this for:
51
+
52
+ - **`carbon.themes`** - Theme-specific values for component tokens:
53
+ ```json
54
+ "$extensions": {
55
+ "carbon.themes": {
56
+ "white": "{blue.60}",
57
+ "g10": "{blue.60}",
58
+ "g90": "{blue.60}",
59
+ "g100": "{blue.60}"
60
+ }
61
+ }
62
+ ```
63
+ - **`org.carbon`** - Carbon-specific metadata like alpha modifiers:
64
+ ```json
65
+ "$extensions": {
66
+ "org.carbon": {
67
+ "alphaModifier": 0.5,
68
+ "color-scheme": "light"
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Example: Theme Token
74
+
75
+ ```json
76
+ {
77
+ "$schema": "https://tr.designtokens.org/format/",
78
+ "$description": "White theme - Light theme with high contrast",
79
+ "background": {
80
+ "$type": "color",
81
+ "$value": "{white.default}",
82
+ "$description": "Default page background color. Use as the base surface for the entire application."
83
+ },
84
+ "background-hover": {
85
+ "$type": "color",
86
+ "$value": "{gray.50}",
87
+ "$description": "Background color for hover state. Use when user hovers over interactive elements.",
88
+ "$extensions": {
89
+ "org.carbon": {
90
+ "alphaModifier": 0.12
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ ### Example: Component Token
98
+
99
+ ```json
100
+ {
101
+ "$schema": "https://tr.designtokens.org/format/",
102
+ "$description": "Button component color tokens",
103
+ "button": {
104
+ "primary": {
105
+ "$type": "color",
106
+ "$description": "Background color for primary buttons in default state.",
107
+ "$extensions": {
108
+ "carbon.themes": {
109
+ "white": "{blue.60}",
110
+ "g10": "{blue.60}",
111
+ "g90": "{blue.60}",
112
+ "g100": "{blue.60}"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ ## Theme Tokens
121
+
122
+ All four Carbon themes are available in DTCG format:
123
+
124
+ - **white.json** - White theme (light, high contrast)
125
+ - **g10.json** - Gray 10 theme (light)
126
+ - **g90.json** - Gray 90 theme (dark)
127
+ - **g100.json** - Gray 100 theme (dark, high contrast)
128
+
129
+ Each theme file contains 250+ tokens organized into categories:
130
+
131
+ - **Color tokens**: Background, layer, field, border, text, link, icon, support
132
+ colors
133
+ - **Semantic tokens**: Focus, interactive, highlight, overlay, skeleton
134
+ - **AI tokens**: AI-specific colors for popover, chat, and skeleton states
135
+
136
+ ## Using These Tokens
137
+
138
+ ### Build Process
139
+
140
+ The DTCG tokens are automatically processed during the build:
141
+
142
+ ```bash
143
+ cd packages/themes
144
+ yarn build
145
+ ```
146
+
147
+ This generates SCSS files in `scss/generated/`:
148
+
149
+ - `_themes.scss` - All four theme token maps
150
+ - `_button-tokens.scss` - Button component tokens
151
+ - `_tag-tokens.scss` - Tag component tokens
152
+ - `_notification-tokens.scss` - Notification component tokens
153
+ - `_status-tokens.scss` - Status indicator tokens
154
+ - `_content-switcher-tokens.scss` - Content switcher tokens
155
+
156
+ These generated files are automatically forwarded by:
157
+
158
+ - `scss/_themes.scss` - Forwards theme tokens
159
+ - `scss/_component-tokens.scss` - Forwards component tokens
160
+
161
+ ## Validation
162
+
163
+ All DTCG token files are validated against the official DTCG JSON Schema during
164
+ the build process. The validation ensures:
165
+
166
+ - Correct `$schema` reference
167
+ - Valid `$type` values (color, dimension, etc.)
168
+ - Proper token structure
169
+ - Required fields are present
170
+
171
+ Manual validation can be performed using any JSON Schema validator:
172
+
173
+ ```bash
174
+ # Using ajv-cli
175
+ ajv validate -s https://tr.designtokens.org/format/schema.json -d white.json
176
+ ```
177
+
178
+ ## Contributing
179
+
180
+ When adding or modifying tokens:
181
+
182
+ 1. **Follow the DTCG specification** - Ensure all tokens conform to the official
183
+ spec
184
+ 2. **Include meaningful descriptions** - Every token should have a clear
185
+ `$description`
186
+ 3. **Use appropriate types** - Set correct `$type` values (color, dimension,
187
+ etc.)
188
+ 4. **Add theme-specific values** - Use `$extensions.carbon.themes` for component
189
+ tokens
190
+ 5. **Validate your changes** - Run `yarn build` to validate against DTCG schema
191
+ 6. **Test generated output** - Verify SCSS generation works correctly
192
+ 7. **Update documentation** - Update this README if adding new token categories
193
+ or components
194
+
195
+ ### Adding a New Component Token File
196
+
197
+ 1. Create `src/dtcg/components/your-component.json`
198
+ 2. Follow the structure of existing component token files
199
+ 3. Use `$extensions.carbon.themes` for theme-specific values
200
+ 4. Add the component to the build process in `tasks/build.js`
201
+ 5. Update this README to document the new component tokens
202
+
203
+ ## Resources
204
+
205
+ - [DTCG Specification](https://tr.designtokens.org/format/) - Official Design
206
+ Tokens Community Group format specification
207
+ - [DTCG JSON Schema](https://tr.designtokens.org/format/schema.json) - JSON
208
+ Schema for validation
209
+ - [Design Tokens Community Group](https://www.w3.org/community/design-tokens/) -
210
+ W3C Community Group