@octaviaflow/themes 1.0.1

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 (46) hide show
  1. package/README.md +122 -0
  2. package/docs/sass.md +189 -0
  3. package/index.scss +11 -0
  4. package/lib/index.js +5634 -0
  5. package/package.json +49 -0
  6. package/scss/_component-tokens.scss +10 -0
  7. package/scss/_config.scss +11 -0
  8. package/scss/_theme.scss +120 -0
  9. package/scss/_themes.scss +8 -0
  10. package/scss/_tokens.scss +8 -0
  11. package/scss/_utilities.scss +18 -0
  12. package/scss/compat/_themes.scss +8 -0
  13. package/scss/compat/_tokens.scss +8 -0
  14. package/scss/compat/generated/_themes.scss +271 -0
  15. package/scss/compat/generated/_tokens.scss +206 -0
  16. package/src/component-tokens/button/index.js +10 -0
  17. package/src/component-tokens/button/tokens.js +132 -0
  18. package/src/component-tokens/notification/index.js +10 -0
  19. package/src/component-tokens/notification/tokens.js +107 -0
  20. package/src/component-tokens/tag/index.js +10 -0
  21. package/src/component-tokens/tag/tokens.js +362 -0
  22. package/src/g10.js +346 -0
  23. package/src/g100.js +349 -0
  24. package/src/g90.js +350 -0
  25. package/src/index.js +42 -0
  26. package/src/tokens/Token.js +37 -0
  27. package/src/tokens/TokenFormat.js +91 -0
  28. package/src/tokens/TokenGroup.js +164 -0
  29. package/src/tokens/TokenSet.js +80 -0
  30. package/src/tokens/components.js +97 -0
  31. package/src/tokens/index.js +71 -0
  32. package/src/tokens/layout.js +42 -0
  33. package/src/tokens/type.js +52 -0
  34. package/src/tokens/v10.js +191 -0
  35. package/src/tokens/v11TokenGroup.js +436 -0
  36. package/src/tokens/v11TokenSet.js +94 -0
  37. package/src/tools.js +80 -0
  38. package/src/v10/g10.js +352 -0
  39. package/src/v10/g100.js +351 -0
  40. package/src/v10/g90.js +353 -0
  41. package/src/v10/index.js +25 -0
  42. package/src/v10/metadata.yml +217 -0
  43. package/src/v10/tokens.js +400 -0
  44. package/src/v10/white.js +355 -0
  45. package/src/white.js +349 -0
  46. package/telemetry.yml +17 -0
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@octaviaflow/themes",
3
+ "description": "Themes for applying color in the OctaviaFlow Design System",
4
+ "version": "1.0.1",
5
+ "license": "Apache-2.0",
6
+ "main": "lib/index.js",
7
+ "module": "es/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/octaviaflow-design-system.git",
11
+ "directory": "packages/themes"
12
+ },
13
+ "bugs": "https://github.com/octaviaflow-design-system/issues",
14
+ "keywords": [
15
+ "octaviaflow",
16
+ "themes",
17
+ "components",
18
+ "react"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "ci-check": "octaviaflow-cli check \"scss/**/*.scss\" -i \"**/generated/**\" -i \"**/compat/**\"",
25
+ "clean": "rimraf es lib umd scss/generated scss/compat/generated",
26
+ "build": "bun run clean && octaviaflow-cli bundle src/index.js --name OctaviaFlowThemes && bun tasks/build.js && octaviaflow-cli check \"scss/*.scss\""
27
+ },
28
+ "dependencies": {
29
+ "@octaviaflow/colors": "^1.0.0",
30
+ "@octaviaflow/grid": "^1.0.0",
31
+ "@octaviaflow/layout": "^1.0.0",
32
+ "@octaviaflow/type": "^1.0.0",
33
+ "color": "^4.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/node": "^7.24.7",
37
+ "@babel/preset-env": "^7.24.7",
38
+ "@octaviaflow/cli": "^1.0.0",
39
+ "@octaviaflow/cli-reporter": "^1.0.0",
40
+ "@octaviaflow/scss-generator": "^1.0.0",
41
+ "@octaviaflow/test-utils": "^1.0.0",
42
+ "change-case": "^4.1.1",
43
+ "core-js": "^3.16.0",
44
+ "fs-extra": "^11.0.0",
45
+ "js-yaml": "^3.13.0",
46
+ "rimraf": "^6.0.0"
47
+ },
48
+ "sideEffects": false
49
+ }
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright IBM Corp. 2022, 2023
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @forward 'generated/button-tokens';
9
+ @forward 'generated/tag-tokens';
10
+ @forward 'generated/notification-tokens';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ $prefix: 'cds' !default;
9
+
10
+ /// Specify if a fallback value should be provided for the CSS Custom Property
11
+ $use-fallback-value: true !default;
@@ -0,0 +1,120 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use 'sass:map';
9
+ @use 'sass:meta';
10
+ @use 'config';
11
+ @use 'themes';
12
+
13
+ /// Specify the fallback theme, used as a catch-all for tokens that you may not
14
+ /// have defined in your custom theme
15
+ $fallback: themes.$white !default;
16
+
17
+ /// Specify the current theme. This can override existing tokens, or add new
18
+ /// tokens. If you are adding new tokens, it's recommended that you set the
19
+ /// fallback for your current theme
20
+ $theme: () !default;
21
+ $theme: map.merge($fallback, $theme);
22
+
23
+ /// Local component tokens that can be updated with `@mixin add-component-tokens`.
24
+ $-component-tokens: ();
25
+
26
+ /// Include the CSS Custom Properties for the active theme or a given theme on
27
+ /// a selector
28
+ @mixin theme($active-theme: $theme, $component-tokens...) {
29
+ @each $token, $value in $active-theme {
30
+ @include -custom-property($token, $value);
31
+ }
32
+
33
+ @each $group in $component-tokens {
34
+ @each $token, $value in $group {
35
+ @include -custom-property($token, $value);
36
+ }
37
+ }
38
+
39
+ @each $token, $value in $-component-tokens {
40
+ @include -custom-property(
41
+ $token,
42
+ -resolve-token-value($active-theme, $value)
43
+ );
44
+ }
45
+ }
46
+
47
+ /// Retrieve the value for the given $token from the current $theme
48
+ /// @param {String} $token
49
+ @function get($token) {
50
+ @if map.has-key($theme, $token) {
51
+ @return map.get($theme, $token);
52
+ }
53
+ @error "Unable to find token: #{$token} in current $theme";
54
+ }
55
+
56
+ /// Compare two themes to see if the second theme is a superset of the first
57
+ /// theme. In other words, this function will return true if every token in the
58
+ /// first theme is available in the second theme and has the same value. The
59
+ /// second theme is allowed to have additional values and it will still match.
60
+ /// @param {Map} $a
61
+ /// @param {Map} $b
62
+ /// @returns {Boolean}
63
+ @function matches($a, $b) {
64
+ @each $key, $value in $a {
65
+ @if map.has-key($b, $key) == false {
66
+ @return false;
67
+ }
68
+
69
+ @if map.get($b, $key) != $value {
70
+ @return false;
71
+ }
72
+ }
73
+
74
+ @return true;
75
+ }
76
+
77
+ /// Add component tokens which will be included any time the theme mixin is
78
+ /// called
79
+ @mixin add-component-tokens($token-map) {
80
+ $-component-tokens: map.merge($-component-tokens, $token-map) !global;
81
+ }
82
+
83
+ /// Determine the value from a component token that matches the given theme.
84
+ /// This is helpful when a component token may change depending on what theme the
85
+ /// component is being rendered in.
86
+ @function -resolve-token-value($active-theme: $theme, $token-value) {
87
+ @if meta.type-of($token-value) == map and map.has-key($token-value, values) {
88
+ $fallback: map.get($token-value, fallback);
89
+ $theme-values: map.get($token-value, values);
90
+
91
+ @each $theme-value in $theme-values {
92
+ $theme-to-match: map.get($theme-value, theme);
93
+ $value: map.get($theme-value, value);
94
+
95
+ @if matches($theme-to-match, $active-theme) {
96
+ @return $value;
97
+ }
98
+ }
99
+
100
+ @return $fallback;
101
+ }
102
+
103
+ @return $token-value;
104
+ }
105
+
106
+ /// @access private
107
+ /// @group @octaviaflow/themes
108
+ @mixin -custom-property($name, $value) {
109
+ @if meta.type-of($value) == map {
110
+ @each $property, $property-value in $value {
111
+ // Only support one-level of depth for values that are maps. This is to
112
+ // avoid bringing properties like `breakpoints` on type tokens
113
+ @if type-of($property-value) != map {
114
+ @include -custom-property('#{$name}-#{$property}', $property-value);
115
+ }
116
+ }
117
+ } @else {
118
+ --#{config.$prefix}-#{$name}: #{$value};
119
+ }
120
+ }
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @forward 'generated/themes';
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @forward 'generated/tokens';
@@ -0,0 +1,18 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use 'sass:map';
9
+
10
+ /// @access private
11
+ /// @group @octaviaflow/themes
12
+ @function merge($map, $maps...) {
13
+ $result: $map;
14
+ @each $map in $maps {
15
+ $result: map.merge($result, $map);
16
+ }
17
+ @return $result;
18
+ }
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @forward 'generated/themes';
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @forward 'generated/tokens';
@@ -0,0 +1,271 @@
1
+ // Code generated by @octaviaflow/themes. DO NOT EDIT.
2
+ //
3
+ // Copyright OctaviaFlow. 2025
4
+ //
5
+ // This source code is licensed under the Apache-2.0 license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ /// Token values for the white theme
10
+ $white: (
11
+ active-danger: #750e13,
12
+ active-light-ui: #c6c6c6,
13
+ active-primary: #002d9c,
14
+ active-secondary: #6f6f6f,
15
+ active-tertiary: #002d9c,
16
+ active-ui: #c6c6c6,
17
+ button-separator: #e0e0e0,
18
+ danger-01: #da1e28,
19
+ danger-02: #da1e28,
20
+ decorative-01: #e0e0e0,
21
+ disabled-01: #f4f4f4,
22
+ disabled-02: #c6c6c6,
23
+ disabled-03: #8d8d8d,
24
+ hover-danger: #b81921,
25
+ hover-field: #e5e5e5,
26
+ hover-light-ui: #e5e5e5,
27
+ hover-primary: #0353e9,
28
+ hover-primary-text: #0043ce,
29
+ hover-row: #e5e5e5,
30
+ hover-secondary: #4c4c4c,
31
+ hover-selected-ui: #cacaca,
32
+ hover-tertiary: #0353e9,
33
+ hover-ui: #e5e5e5,
34
+ icon-01: #161616,
35
+ icon-02: #525252,
36
+ icon-03: #ffffff,
37
+ interactive-01: #0f62fe,
38
+ interactive-02: #393939,
39
+ interactive-03: #0f62fe,
40
+ interactive-04: #0f62fe,
41
+ inverse-01: #ffffff,
42
+ inverse-02: #393939,
43
+ inverse-focus-ui: #ffffff,
44
+ inverse-hover-ui: #4c4c4c,
45
+ inverse-link: #78a9ff,
46
+ inverse-support-01: #fa4d56,
47
+ inverse-support-02: #42be65,
48
+ inverse-support-03: #f1c21b,
49
+ inverse-support-04: #4589ff,
50
+ link-01: #0f62fe,
51
+ link-02: #0043ce,
52
+ overlay-01: rgba(22, 22, 22, 0.5),
53
+ selected-light-ui: #e0e0e0,
54
+ selected-ui: #e0e0e0,
55
+ skeleton-01: #e5e5e5,
56
+ skeleton-02: #c6c6c6,
57
+ support-01: #da1e28,
58
+ support-02: #198038,
59
+ support-03: #f1c21b,
60
+ support-04: #0043ce,
61
+ text-01: #161616,
62
+ text-02: #525252,
63
+ text-03: #a8a8a8,
64
+ text-04: #ffffff,
65
+ text-05: #6f6f6f,
66
+ ui-01: #f4f4f4,
67
+ ui-02: #ffffff,
68
+ ui-03: #e0e0e0,
69
+ ui-04: #8d8d8d,
70
+ ui-05: #161616,
71
+ ui-background: #ffffff,
72
+ visited-link: #8a3ffc,
73
+ ) !default;
74
+
75
+ /// Token values for the g10 theme
76
+ $g10: (
77
+ active-danger: #750e13,
78
+ active-light-ui: #c6c6c6,
79
+ active-primary: #002d9c,
80
+ active-secondary: #6f6f6f,
81
+ active-tertiary: #002d9c,
82
+ active-ui: #c6c6c6,
83
+ button-separator: #e0e0e0,
84
+ danger-01: #da1e28,
85
+ danger-02: #da1e28,
86
+ decorative-01: #e0e0e0,
87
+ disabled-01: #ffffff,
88
+ disabled-02: #c6c6c6,
89
+ disabled-03: #8d8d8d,
90
+ hover-danger: #b81921,
91
+ hover-field: #e5e5e5,
92
+ hover-light-ui: #e5e5e5,
93
+ hover-primary: #0353e9,
94
+ hover-primary-text: #0043ce,
95
+ hover-row: #e5e5e5,
96
+ hover-secondary: #4c4c4c,
97
+ hover-selected-ui: #cacaca,
98
+ hover-tertiary: #0353e9,
99
+ hover-ui: #e5e5e5,
100
+ icon-01: #161616,
101
+ icon-02: #525252,
102
+ icon-03: #ffffff,
103
+ interactive-01: #0f62fe,
104
+ interactive-02: #393939,
105
+ interactive-03: #0f62fe,
106
+ interactive-04: #0f62fe,
107
+ inverse-01: #ffffff,
108
+ inverse-02: #393939,
109
+ inverse-focus-ui: #ffffff,
110
+ inverse-hover-ui: #4c4c4c,
111
+ inverse-link: #78a9ff,
112
+ inverse-support-01: #fa4d56,
113
+ inverse-support-02: #42be65,
114
+ inverse-support-03: #f1c21b,
115
+ inverse-support-04: #4589ff,
116
+ link-01: #0f62fe,
117
+ link-02: #0043ce,
118
+ overlay-01: rgba(22, 22, 22, 0.5),
119
+ selected-light-ui: #e0e0e0,
120
+ selected-ui: #e0e0e0,
121
+ skeleton-01: #e5e5e5,
122
+ skeleton-02: #c6c6c6,
123
+ support-01: #da1e28,
124
+ support-02: #198038,
125
+ support-03: #f1c21b,
126
+ support-04: #0043ce,
127
+ text-01: #161616,
128
+ text-02: #525252,
129
+ text-03: #a8a8a8,
130
+ text-04: #ffffff,
131
+ text-05: #6f6f6f,
132
+ ui-01: #ffffff,
133
+ ui-02: #f4f4f4,
134
+ ui-03: #e0e0e0,
135
+ ui-04: #8d8d8d,
136
+ ui-05: #161616,
137
+ ui-background: #f4f4f4,
138
+ visited-link: #8a3ffc,
139
+ ) !default;
140
+
141
+ /// Token values for the g90 theme
142
+ $g90: (
143
+ active-danger: #750e13,
144
+ active-light-ui: #8d8d8d,
145
+ active-primary: #002d9c,
146
+ active-secondary: #393939,
147
+ active-tertiary: #c6c6c6,
148
+ active-ui: #6f6f6f,
149
+ button-separator: #161616,
150
+ danger-01: #da1e28,
151
+ danger-02: #ff8389,
152
+ decorative-01: #6f6f6f,
153
+ disabled-01: #393939,
154
+ disabled-02: #6f6f6f,
155
+ disabled-03: #a8a8a8,
156
+ hover-danger: #b81921,
157
+ hover-field: #4c4c4c,
158
+ hover-light-ui: #656565,
159
+ hover-primary: #0353e9,
160
+ hover-primary-text: #a6c8ff,
161
+ hover-row: #4c4c4c,
162
+ hover-secondary: #606060,
163
+ hover-selected-ui: #656565,
164
+ hover-tertiary: #f4f4f4,
165
+ hover-ui: #4c4c4c,
166
+ icon-01: #f4f4f4,
167
+ icon-02: #c6c6c6,
168
+ icon-03: #ffffff,
169
+ interactive-01: #0f62fe,
170
+ interactive-02: #6f6f6f,
171
+ interactive-03: #ffffff,
172
+ interactive-04: #4589ff,
173
+ inverse-01: #161616,
174
+ inverse-02: #f4f4f4,
175
+ inverse-focus-ui: #0f62fe,
176
+ inverse-hover-ui: #e5e5e5,
177
+ inverse-link: #0f62fe,
178
+ inverse-support-01: #da1e28,
179
+ inverse-support-02: #24a148,
180
+ inverse-support-03: #f1c21b,
181
+ inverse-support-04: #0f62fe,
182
+ link-01: #78a9ff,
183
+ link-02: #a6c8ff,
184
+ overlay-01: rgba(0, 0, 0, 0.65),
185
+ selected-light-ui: #6f6f6f,
186
+ selected-ui: #525252,
187
+ skeleton-01: #353535,
188
+ skeleton-02: #525252,
189
+ support-01: #ff8389,
190
+ support-02: #42be65,
191
+ support-03: #f1c21b,
192
+ support-04: #4589ff,
193
+ text-01: #f4f4f4,
194
+ text-02: #c6c6c6,
195
+ text-03: #6f6f6f,
196
+ text-04: #ffffff,
197
+ text-05: #8d8d8d,
198
+ ui-01: #393939,
199
+ ui-02: #525252,
200
+ ui-03: #525252,
201
+ ui-04: #8d8d8d,
202
+ ui-05: #f4f4f4,
203
+ ui-background: #262626,
204
+ visited-link: #be95ff,
205
+ ) !default;
206
+
207
+ /// Token values for the g100 theme
208
+ $g100: (
209
+ active-danger: #750e13,
210
+ active-light-ui: #6f6f6f,
211
+ active-primary: #002d9c,
212
+ active-secondary: #393939,
213
+ active-tertiary: #c6c6c6,
214
+ active-ui: #525252,
215
+ button-separator: #161616,
216
+ danger-01: #da1e28,
217
+ danger-02: #fa4d56,
218
+ decorative-01: #525252,
219
+ disabled-01: #262626,
220
+ disabled-02: #525252,
221
+ disabled-03: #8d8d8d,
222
+ hover-danger: #b81921,
223
+ hover-field: #353535,
224
+ hover-light-ui: #4c4c4c,
225
+ hover-primary: #0353e9,
226
+ hover-primary-text: #a6c8ff,
227
+ hover-row: #353535,
228
+ hover-secondary: #606060,
229
+ hover-selected-ui: #4c4c4c,
230
+ hover-tertiary: #f4f4f4,
231
+ hover-ui: #353535,
232
+ icon-01: #f4f4f4,
233
+ icon-02: #c6c6c6,
234
+ icon-03: #ffffff,
235
+ interactive-01: #0f62fe,
236
+ interactive-02: #6f6f6f,
237
+ interactive-03: #ffffff,
238
+ interactive-04: #4589ff,
239
+ inverse-01: #161616,
240
+ inverse-02: #f4f4f4,
241
+ inverse-focus-ui: #0f62fe,
242
+ inverse-hover-ui: #e5e5e5,
243
+ inverse-link: #0f62fe,
244
+ inverse-support-01: #da1e28,
245
+ inverse-support-02: #24a148,
246
+ inverse-support-03: #f1c21b,
247
+ inverse-support-04: #0f62fe,
248
+ link-01: #78a9ff,
249
+ link-02: #a6c8ff,
250
+ overlay-01: rgba(0, 0, 0, 0.65),
251
+ selected-light-ui: #525252,
252
+ selected-ui: #393939,
253
+ skeleton-01: #353535,
254
+ skeleton-02: #525252,
255
+ support-01: #fa4d56,
256
+ support-02: #42be65,
257
+ support-03: #f1c21b,
258
+ support-04: #4589ff,
259
+ text-01: #f4f4f4,
260
+ text-02: #c6c6c6,
261
+ text-03: #6f6f6f,
262
+ text-04: #ffffff,
263
+ text-05: #8d8d8d,
264
+ ui-01: #262626,
265
+ ui-02: #393939,
266
+ ui-03: #393939,
267
+ ui-04: #6f6f6f,
268
+ ui-05: #f4f4f4,
269
+ ui-background: #161616,
270
+ visited-link: #be95ff,
271
+ ) !default;