@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.
- package/README.md +122 -0
- package/docs/sass.md +189 -0
- package/index.scss +11 -0
- package/lib/index.js +5634 -0
- package/package.json +49 -0
- package/scss/_component-tokens.scss +10 -0
- package/scss/_config.scss +11 -0
- package/scss/_theme.scss +120 -0
- package/scss/_themes.scss +8 -0
- package/scss/_tokens.scss +8 -0
- package/scss/_utilities.scss +18 -0
- package/scss/compat/_themes.scss +8 -0
- package/scss/compat/_tokens.scss +8 -0
- package/scss/compat/generated/_themes.scss +271 -0
- package/scss/compat/generated/_tokens.scss +206 -0
- package/src/component-tokens/button/index.js +10 -0
- package/src/component-tokens/button/tokens.js +132 -0
- package/src/component-tokens/notification/index.js +10 -0
- package/src/component-tokens/notification/tokens.js +107 -0
- package/src/component-tokens/tag/index.js +10 -0
- package/src/component-tokens/tag/tokens.js +362 -0
- package/src/g10.js +346 -0
- package/src/g100.js +349 -0
- package/src/g90.js +350 -0
- package/src/index.js +42 -0
- package/src/tokens/Token.js +37 -0
- package/src/tokens/TokenFormat.js +91 -0
- package/src/tokens/TokenGroup.js +164 -0
- package/src/tokens/TokenSet.js +80 -0
- package/src/tokens/components.js +97 -0
- package/src/tokens/index.js +71 -0
- package/src/tokens/layout.js +42 -0
- package/src/tokens/type.js +52 -0
- package/src/tokens/v10.js +191 -0
- package/src/tokens/v11TokenGroup.js +436 -0
- package/src/tokens/v11TokenSet.js +94 -0
- package/src/tools.js +80 -0
- package/src/v10/g10.js +352 -0
- package/src/v10/g100.js +351 -0
- package/src/v10/g90.js +353 -0
- package/src/v10/index.js +25 -0
- package/src/v10/metadata.yml +217 -0
- package/src/v10/tokens.js +400 -0
- package/src/v10/white.js +355 -0
- package/src/white.js +349 -0
- package/telemetry.yml +17 -0
package/src/tools.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import Color from 'color';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Adjust a given token's lightness by a specified percentage
|
|
14
|
+
* Example: token = hsl(10, 10, 10);
|
|
15
|
+
* adjustLightness(token, 5) === hsl(10, 10, 15);
|
|
16
|
+
* adjustLightness(token, -5) === hsl(10, 10, 5);
|
|
17
|
+
* @param {string} token
|
|
18
|
+
* @param {integer} shift The number of percentage points (positive or negative) by which to shift the lightness of a token.
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function adjustLightness(token, shift) {
|
|
22
|
+
const original = Color(token).hsl().object();
|
|
23
|
+
|
|
24
|
+
return Color({ ...original, l: (original.l += shift) })
|
|
25
|
+
.round()
|
|
26
|
+
.hex()
|
|
27
|
+
.toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Adjust a given token's alpha by a specified amount
|
|
32
|
+
* Example: token = rgba(10, 10, 10, 1.0);
|
|
33
|
+
* adjustAlpha(token, 0.3) === rgba(10, 10, 10, 0.3);
|
|
34
|
+
* @param {string} token
|
|
35
|
+
* @param {float} alpha
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
export function adjustAlpha(token, alpha) {
|
|
39
|
+
return Color(token).rgb().alpha(alpha).string();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Format a given token into the format expected in CSS/SCSS-based projects.
|
|
46
|
+
* @param {string} token
|
|
47
|
+
* @returns {string}
|
|
48
|
+
*/
|
|
49
|
+
export function formatTokenName(token) {
|
|
50
|
+
let string = '';
|
|
51
|
+
|
|
52
|
+
for (let i = 0; i < token.length; i++) {
|
|
53
|
+
// If we run into a number, we hit the scale step at the end of a token name
|
|
54
|
+
// and can safely truncate the rest of the token
|
|
55
|
+
if (numbers.indexOf(token[i]) !== -1) {
|
|
56
|
+
string += '-' + token.slice(i);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// When encountering an uppercase name, we will want to start adding `-`
|
|
61
|
+
// between words
|
|
62
|
+
if (token[i] === token[i].toUpperCase()) {
|
|
63
|
+
// Check backwards to see if previous letter was also capitalized, if so
|
|
64
|
+
// we are in a special case like UI where each piece should be connected
|
|
65
|
+
if (token[i - 1] && token[i - 1] === token[i - 1].toUpperCase()) {
|
|
66
|
+
string += token[i].toLowerCase();
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Otherwise, just concatenate this new part on to the existing string
|
|
71
|
+
string += '-' + token[i].toLowerCase();
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// By default, we add the current character to the output string
|
|
76
|
+
string += token[i];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return string;
|
|
80
|
+
}
|
package/src/v10/g10.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright OctaviaFlow
|
|
3
|
+
* Author: Vishal Kumar
|
|
4
|
+
* Created: 11/November/2025
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import { adjustLightness } from '../tools';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
// Blue
|
|
15
|
+
blue20,
|
|
16
|
+
blue40,
|
|
17
|
+
blue60,
|
|
18
|
+
blue70,
|
|
19
|
+
blue80,
|
|
20
|
+
|
|
21
|
+
// Gray
|
|
22
|
+
gray10,
|
|
23
|
+
gray20,
|
|
24
|
+
gray30,
|
|
25
|
+
gray40,
|
|
26
|
+
gray50,
|
|
27
|
+
gray60,
|
|
28
|
+
gray70,
|
|
29
|
+
gray80,
|
|
30
|
+
gray100,
|
|
31
|
+
|
|
32
|
+
// Support
|
|
33
|
+
blue50,
|
|
34
|
+
green40,
|
|
35
|
+
green60,
|
|
36
|
+
yellow30,
|
|
37
|
+
red50,
|
|
38
|
+
red60,
|
|
39
|
+
red80,
|
|
40
|
+
purple60,
|
|
41
|
+
|
|
42
|
+
// Constants
|
|
43
|
+
white,
|
|
44
|
+
black,
|
|
45
|
+
|
|
46
|
+
// Tools
|
|
47
|
+
rgba,
|
|
48
|
+
} from '@octaviaflow/colors';
|
|
49
|
+
|
|
50
|
+
export const interactive01 = blue60;
|
|
51
|
+
export const interactive02 = gray80;
|
|
52
|
+
export const interactive03 = blue60;
|
|
53
|
+
export const interactive04 = blue60;
|
|
54
|
+
|
|
55
|
+
export const uiBackground = gray10;
|
|
56
|
+
|
|
57
|
+
export const ui01 = white;
|
|
58
|
+
export const ui02 = gray10;
|
|
59
|
+
export const ui03 = gray20;
|
|
60
|
+
export const ui04 = gray50;
|
|
61
|
+
export const ui05 = gray100;
|
|
62
|
+
|
|
63
|
+
export const text01 = gray100;
|
|
64
|
+
export const text02 = gray70;
|
|
65
|
+
export const text03 = gray40;
|
|
66
|
+
export const text04 = white;
|
|
67
|
+
export const text05 = gray60;
|
|
68
|
+
export const textError = red60;
|
|
69
|
+
|
|
70
|
+
export const icon01 = gray100;
|
|
71
|
+
export const icon02 = gray70;
|
|
72
|
+
export const icon03 = white;
|
|
73
|
+
|
|
74
|
+
export const link01 = blue60;
|
|
75
|
+
export const link02 = blue70;
|
|
76
|
+
|
|
77
|
+
export const inverseLink = blue40;
|
|
78
|
+
|
|
79
|
+
export const field01 = white;
|
|
80
|
+
export const field02 = gray10;
|
|
81
|
+
|
|
82
|
+
export const inverse01 = white;
|
|
83
|
+
export const inverse02 = gray80;
|
|
84
|
+
|
|
85
|
+
export const support01 = red60;
|
|
86
|
+
export const support02 = green60;
|
|
87
|
+
export const support03 = yellow30;
|
|
88
|
+
export const support04 = blue70;
|
|
89
|
+
|
|
90
|
+
export const inverseSupport01 = red50;
|
|
91
|
+
export const inverseSupport02 = green40;
|
|
92
|
+
export const inverseSupport03 = yellow30;
|
|
93
|
+
export const inverseSupport04 = blue50;
|
|
94
|
+
|
|
95
|
+
export const overlay01 = rgba(gray100, 0.5);
|
|
96
|
+
|
|
97
|
+
export const danger01 = red60;
|
|
98
|
+
export const danger02 = red60;
|
|
99
|
+
|
|
100
|
+
// Interaction states
|
|
101
|
+
export const focus = blue60;
|
|
102
|
+
export const inverseFocusUi = white;
|
|
103
|
+
|
|
104
|
+
export const hoverPrimary = '#0353e9';
|
|
105
|
+
export const activePrimary = blue80;
|
|
106
|
+
|
|
107
|
+
export const hoverPrimaryText = blue70;
|
|
108
|
+
|
|
109
|
+
export const hoverSecondary = '#4c4c4c';
|
|
110
|
+
export const activeSecondary = gray60;
|
|
111
|
+
|
|
112
|
+
export const hoverTertiary = '#0353e9';
|
|
113
|
+
export const activeTertiary = blue80;
|
|
114
|
+
|
|
115
|
+
export const hoverUI = '#e5e5e5';
|
|
116
|
+
export const hoverLightUI = '#e5e5e5';
|
|
117
|
+
export const activeUI = gray30;
|
|
118
|
+
export const activeLightUI = gray30;
|
|
119
|
+
export const selectedUI = gray20;
|
|
120
|
+
export const selectedLightUI = gray20;
|
|
121
|
+
export const inverseHoverUI = '#4c4c4c';
|
|
122
|
+
|
|
123
|
+
export const hoverSelectedUI = '#cacaca';
|
|
124
|
+
|
|
125
|
+
export const hoverDanger = adjustLightness(danger01, -8);
|
|
126
|
+
export const activeDanger = red80;
|
|
127
|
+
|
|
128
|
+
export const hoverRow = '#e5e5e5';
|
|
129
|
+
|
|
130
|
+
export const visitedLink = purple60;
|
|
131
|
+
|
|
132
|
+
export const disabled01 = white;
|
|
133
|
+
export const disabled02 = gray30;
|
|
134
|
+
export const disabled03 = gray50;
|
|
135
|
+
|
|
136
|
+
export const highlight = blue20;
|
|
137
|
+
|
|
138
|
+
export const decorative01 = gray20;
|
|
139
|
+
|
|
140
|
+
export const buttonSeparator = '#e0e0e0';
|
|
141
|
+
|
|
142
|
+
export const skeleton01 = '#e5e5e5';
|
|
143
|
+
export const skeleton02 = gray30;
|
|
144
|
+
|
|
145
|
+
// New color tokens
|
|
146
|
+
// TO-DO: remove fallback color when v11 is released and assign carbon colors to new tokens
|
|
147
|
+
export const background = uiBackground;
|
|
148
|
+
export const layer = ui01;
|
|
149
|
+
export const layerAccent = ui03;
|
|
150
|
+
export const layerAccentActive = gray40;
|
|
151
|
+
export const layerAccentHover = adjustLightness(layerAccent, -6);
|
|
152
|
+
export const field = field01;
|
|
153
|
+
export const backgroundInverse = inverse02;
|
|
154
|
+
export const backgroundBrand = interactive01;
|
|
155
|
+
export const interactive = interactive04;
|
|
156
|
+
|
|
157
|
+
export const borderSubtle = ui03;
|
|
158
|
+
export const borderStrong = ui04;
|
|
159
|
+
export const borderInverse = ui05;
|
|
160
|
+
export const borderInteractive = interactive04;
|
|
161
|
+
|
|
162
|
+
export const textPrimary = text01;
|
|
163
|
+
export const textSecondary = text02;
|
|
164
|
+
export const textPlaceholder = text03;
|
|
165
|
+
export const textHelper = text05;
|
|
166
|
+
export const textOnColor = text04;
|
|
167
|
+
export const textInverse = inverse01;
|
|
168
|
+
|
|
169
|
+
export const linkPrimary = link01;
|
|
170
|
+
export const linkSecondary = link02;
|
|
171
|
+
export const linkVisited = visitedLink;
|
|
172
|
+
export const linkInverse = inverseLink;
|
|
173
|
+
|
|
174
|
+
export const iconPrimary = icon01;
|
|
175
|
+
export const iconSecondary = icon02;
|
|
176
|
+
export const iconOnColor = icon03;
|
|
177
|
+
export const iconInverse = inverse01;
|
|
178
|
+
|
|
179
|
+
export const supportError = support01;
|
|
180
|
+
export const supportSuccess = support02;
|
|
181
|
+
export const supportWarning = support03;
|
|
182
|
+
export const supportInfo = support04;
|
|
183
|
+
export const supportErrorInverse = inverseSupport01;
|
|
184
|
+
export const supportSuccessInverse = inverseSupport02;
|
|
185
|
+
export const supportWarningInverse = inverseSupport03;
|
|
186
|
+
export const supportInfoInverse = inverseSupport04;
|
|
187
|
+
|
|
188
|
+
export const overlay = overlay01;
|
|
189
|
+
export const toggleOff = ui04;
|
|
190
|
+
export const shadow = rgba(black, 0.3);
|
|
191
|
+
|
|
192
|
+
export const buttonPrimary = interactive01;
|
|
193
|
+
export const buttonSecondary = interactive02;
|
|
194
|
+
export const buttonTertiary = interactive03;
|
|
195
|
+
export const buttonDangerPrimary = danger01;
|
|
196
|
+
export const buttonDangerSecondary = danger02;
|
|
197
|
+
|
|
198
|
+
export const backgroundActive = activeUI;
|
|
199
|
+
export const layerActive = activeUI;
|
|
200
|
+
|
|
201
|
+
export const buttonDangerActive = activeDanger;
|
|
202
|
+
export const buttonPrimaryActive = activePrimary;
|
|
203
|
+
export const buttonSecondaryActive = activeSecondary;
|
|
204
|
+
export const buttonTertiaryActive = activeTertiary;
|
|
205
|
+
|
|
206
|
+
export const focusInset = inverse01;
|
|
207
|
+
export const focusInverse = inverseFocusUi;
|
|
208
|
+
|
|
209
|
+
export const backgroundHover = hoverUI;
|
|
210
|
+
export const layerHover = hoverUI;
|
|
211
|
+
export const fieldHover = hoverUI;
|
|
212
|
+
export const backgroundInverseHover = inverseHoverUI;
|
|
213
|
+
export const linkPrimaryHover = hoverPrimaryText;
|
|
214
|
+
export const buttonDangerHover = hoverDanger;
|
|
215
|
+
export const buttonPrimaryHover = hoverPrimary;
|
|
216
|
+
export const buttonSecondaryHover = hoverSecondary;
|
|
217
|
+
export const buttonTertiaryHover = hoverTertiary;
|
|
218
|
+
|
|
219
|
+
export const backgroundSelected = selectedUI;
|
|
220
|
+
export const backgroundSelectedHover = hoverSelectedUI;
|
|
221
|
+
export const layerSelected = selectedUI;
|
|
222
|
+
export const layerSelectedHover = hoverSelectedUI;
|
|
223
|
+
export const layerSelectedInverse = ui05;
|
|
224
|
+
export const borderSubtleSelected = activeUI;
|
|
225
|
+
|
|
226
|
+
export const borderDisabled = disabled01;
|
|
227
|
+
|
|
228
|
+
export const textDisabled = disabled02;
|
|
229
|
+
export const buttonDisabled = disabled02;
|
|
230
|
+
export const iconDisabled = disabled02;
|
|
231
|
+
|
|
232
|
+
export const textOnColorDisabled = disabled03;
|
|
233
|
+
export const iconOnColorDisabled = disabled03;
|
|
234
|
+
export const layerSelectedDisabled = disabled03;
|
|
235
|
+
|
|
236
|
+
export const skeletonBackground = skeleton01;
|
|
237
|
+
export const skeletonElement = skeleton02;
|
|
238
|
+
|
|
239
|
+
export {
|
|
240
|
+
// Type
|
|
241
|
+
caption01,
|
|
242
|
+
caption02,
|
|
243
|
+
label01,
|
|
244
|
+
label02,
|
|
245
|
+
helperText01,
|
|
246
|
+
helperText02,
|
|
247
|
+
bodyShort01,
|
|
248
|
+
bodyLong01,
|
|
249
|
+
bodyShort02,
|
|
250
|
+
bodyLong02,
|
|
251
|
+
code01,
|
|
252
|
+
code02,
|
|
253
|
+
heading01,
|
|
254
|
+
productiveHeading01,
|
|
255
|
+
heading02,
|
|
256
|
+
productiveHeading02,
|
|
257
|
+
productiveHeading03,
|
|
258
|
+
productiveHeading04,
|
|
259
|
+
productiveHeading05,
|
|
260
|
+
productiveHeading06,
|
|
261
|
+
productiveHeading07,
|
|
262
|
+
expressiveHeading01,
|
|
263
|
+
expressiveHeading02,
|
|
264
|
+
expressiveHeading03,
|
|
265
|
+
expressiveHeading04,
|
|
266
|
+
expressiveHeading05,
|
|
267
|
+
expressiveHeading06,
|
|
268
|
+
expressiveParagraph01,
|
|
269
|
+
quotation01,
|
|
270
|
+
quotation02,
|
|
271
|
+
display01,
|
|
272
|
+
display02,
|
|
273
|
+
display03,
|
|
274
|
+
display04,
|
|
275
|
+
// V11 Tokens
|
|
276
|
+
legal01,
|
|
277
|
+
legal02,
|
|
278
|
+
bodyCompact01,
|
|
279
|
+
bodyCompact02,
|
|
280
|
+
body01,
|
|
281
|
+
body02,
|
|
282
|
+
headingCompact01,
|
|
283
|
+
headingCompact02,
|
|
284
|
+
heading03,
|
|
285
|
+
heading04,
|
|
286
|
+
heading05,
|
|
287
|
+
heading06,
|
|
288
|
+
heading07,
|
|
289
|
+
fluidHeading03,
|
|
290
|
+
fluidHeading04,
|
|
291
|
+
fluidHeading05,
|
|
292
|
+
fluidHeading06,
|
|
293
|
+
fluidParagraph01,
|
|
294
|
+
fluidQuotation01,
|
|
295
|
+
fluidQuotation02,
|
|
296
|
+
fluidDisplay01,
|
|
297
|
+
fluidDisplay02,
|
|
298
|
+
fluidDisplay03,
|
|
299
|
+
fluidDisplay04,
|
|
300
|
+
// Layout
|
|
301
|
+
// Spacing
|
|
302
|
+
spacing01,
|
|
303
|
+
spacing02,
|
|
304
|
+
spacing03,
|
|
305
|
+
spacing04,
|
|
306
|
+
spacing05,
|
|
307
|
+
spacing06,
|
|
308
|
+
spacing07,
|
|
309
|
+
spacing08,
|
|
310
|
+
spacing09,
|
|
311
|
+
spacing10,
|
|
312
|
+
spacing11,
|
|
313
|
+
spacing12,
|
|
314
|
+
spacing13,
|
|
315
|
+
// Fluid spacing
|
|
316
|
+
fluidSpacing01,
|
|
317
|
+
fluidSpacing02,
|
|
318
|
+
fluidSpacing03,
|
|
319
|
+
fluidSpacing04,
|
|
320
|
+
// Containers
|
|
321
|
+
container01,
|
|
322
|
+
container02,
|
|
323
|
+
container03,
|
|
324
|
+
container04,
|
|
325
|
+
container05,
|
|
326
|
+
sizeXSmall,
|
|
327
|
+
sizeSmall,
|
|
328
|
+
sizeMedium,
|
|
329
|
+
sizeLarge,
|
|
330
|
+
sizeXLarge,
|
|
331
|
+
size2XLarge,
|
|
332
|
+
// Icon sizes
|
|
333
|
+
iconSize01,
|
|
334
|
+
iconSize02,
|
|
335
|
+
// Layout
|
|
336
|
+
// Deprecated ☠️
|
|
337
|
+
layout01,
|
|
338
|
+
layout02,
|
|
339
|
+
layout03,
|
|
340
|
+
layout04,
|
|
341
|
+
layout05,
|
|
342
|
+
layout06,
|
|
343
|
+
layout07,
|
|
344
|
+
} from './white';
|
|
345
|
+
|
|
346
|
+
// Deprecated ☠️
|
|
347
|
+
export const brand01 = interactive01;
|
|
348
|
+
export const brand02 = interactive02;
|
|
349
|
+
export const brand03 = interactive03;
|
|
350
|
+
export const active01 = activeUI;
|
|
351
|
+
export const hoverField = hoverUI;
|
|
352
|
+
export const danger = danger01;
|