@primer/primitives 8.1.0-rc.313f1fc7 → 8.1.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.
- package/dist/css/functional/themes/dark-colorblind.css +10 -0
- package/dist/css/functional/themes/dark-dimmed.css +10 -0
- package/dist/css/functional/themes/dark-high-contrast.css +10 -0
- package/dist/css/functional/themes/dark-tritanopia.css +10 -0
- package/dist/css/functional/themes/dark.css +10 -0
- package/dist/css/functional/themes/light-colorblind.css +10 -0
- package/dist/css/functional/themes/light-high-contrast.css +10 -0
- package/dist/css/functional/themes/light-tritanopia.css +10 -0
- package/dist/css/functional/themes/light.css +10 -0
- package/dist/docs/functional/themes/dark-colorblind.json +145 -0
- package/dist/docs/functional/themes/dark-dimmed.json +145 -0
- package/dist/docs/functional/themes/dark-high-contrast.json +145 -0
- package/dist/docs/functional/themes/dark-tritanopia.json +145 -0
- package/dist/docs/functional/themes/dark.json +145 -0
- package/dist/docs/functional/themes/light-colorblind.json +145 -0
- package/dist/docs/functional/themes/light-high-contrast.json +145 -0
- package/dist/docs/functional/themes/light-tritanopia.json +145 -0
- package/dist/docs/functional/themes/light.json +145 -0
- package/dist/figma/themes/dark-colorblind.json +80 -0
- package/dist/figma/themes/dark-dimmed.json +80 -0
- package/dist/figma/themes/dark-high-contrast.json +80 -0
- package/dist/figma/themes/dark-tritanopia.json +80 -0
- package/dist/figma/themes/dark.json +80 -0
- package/dist/figma/themes/light-colorblind.json +80 -0
- package/dist/figma/themes/light-high-contrast.json +80 -0
- package/dist/figma/themes/light-tritanopia.json +80 -0
- package/dist/figma/themes/light.json +80 -0
- package/dist/figma/typography/typography.json +10 -10
- package/dist/internalCss/dark-colorblind.css +10 -0
- package/dist/internalCss/dark-dimmed.css +10 -0
- package/dist/internalCss/dark-high-contrast.css +10 -0
- package/dist/internalCss/dark-tritanopia.css +10 -0
- package/dist/internalCss/dark.css +10 -0
- package/dist/internalCss/light-colorblind.css +10 -0
- package/dist/internalCss/light-high-contrast.css +10 -0
- package/dist/internalCss/light-tritanopia.css +10 -0
- package/dist/internalCss/light.css +10 -0
- package/dist/styleLint/functional/themes/dark-colorblind.json +145 -0
- package/dist/styleLint/functional/themes/dark-dimmed.json +145 -0
- package/dist/styleLint/functional/themes/dark-high-contrast.json +145 -0
- package/dist/styleLint/functional/themes/dark-tritanopia.json +145 -0
- package/dist/styleLint/functional/themes/dark.json +145 -0
- package/dist/styleLint/functional/themes/light-colorblind.json +145 -0
- package/dist/styleLint/functional/themes/light-high-contrast.json +145 -0
- package/dist/styleLint/functional/themes/light-tritanopia.json +145 -0
- package/dist/styleLint/functional/themes/light.json +145 -0
- package/package.json +1 -1
- package/src/PrimerStyleDictionary.ts +6 -0
- package/src/platforms/figma.ts +1 -1
- package/src/tokens/functional/color/dark/display-dark.json5 +66 -0
- package/src/tokens/functional/color/light/display-light.json5 +66 -0
- package/src/transformers/floatToPixel.ts +9 -2
- package/src/transformers/index.ts +1 -0
|
@@ -2188,6 +2188,151 @@
|
|
|
2188
2188
|
"attributes": {},
|
|
2189
2189
|
"path": ["display", "red", "borderColor", "emphasis"]
|
|
2190
2190
|
},
|
|
2191
|
+
"display-coral-bgColor-muted": {
|
|
2192
|
+
"value": "#ffe5db",
|
|
2193
|
+
"$type": "color",
|
|
2194
|
+
"$extensions": {
|
|
2195
|
+
"org.primer.figma": {
|
|
2196
|
+
"collection": "mode",
|
|
2197
|
+
"mode": "light",
|
|
2198
|
+
"group": "component (internal)",
|
|
2199
|
+
"scopes": ["bgColor"]
|
|
2200
|
+
}
|
|
2201
|
+
},
|
|
2202
|
+
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
2203
|
+
"isSource": true,
|
|
2204
|
+
"original": {
|
|
2205
|
+
"value": "{base.display.color.coral.0}",
|
|
2206
|
+
"$type": "color",
|
|
2207
|
+
"$extensions": {
|
|
2208
|
+
"org.primer.figma": {
|
|
2209
|
+
"collection": "mode",
|
|
2210
|
+
"mode": "light",
|
|
2211
|
+
"group": "component (internal)",
|
|
2212
|
+
"scopes": ["bgColor"]
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
},
|
|
2216
|
+
"name": "display-coral-bgColor-muted",
|
|
2217
|
+
"attributes": {},
|
|
2218
|
+
"path": ["display", "coral", "bgColor", "muted"]
|
|
2219
|
+
},
|
|
2220
|
+
"display-coral-bgColor-emphasis": {
|
|
2221
|
+
"value": "#d43511",
|
|
2222
|
+
"$type": "color",
|
|
2223
|
+
"$extensions": {
|
|
2224
|
+
"org.primer.figma": {
|
|
2225
|
+
"collection": "mode",
|
|
2226
|
+
"mode": "light",
|
|
2227
|
+
"group": "component (internal)",
|
|
2228
|
+
"scopes": ["bgColor"]
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2231
|
+
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
2232
|
+
"isSource": true,
|
|
2233
|
+
"original": {
|
|
2234
|
+
"value": "{base.display.color.coral.5}",
|
|
2235
|
+
"$type": "color",
|
|
2236
|
+
"$extensions": {
|
|
2237
|
+
"org.primer.figma": {
|
|
2238
|
+
"collection": "mode",
|
|
2239
|
+
"mode": "light",
|
|
2240
|
+
"group": "component (internal)",
|
|
2241
|
+
"scopes": ["bgColor"]
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
},
|
|
2245
|
+
"name": "display-coral-bgColor-emphasis",
|
|
2246
|
+
"attributes": {},
|
|
2247
|
+
"path": ["display", "coral", "bgColor", "emphasis"]
|
|
2248
|
+
},
|
|
2249
|
+
"display-coral-fgColor": {
|
|
2250
|
+
"value": "#ba2e12",
|
|
2251
|
+
"$type": "color",
|
|
2252
|
+
"$extensions": {
|
|
2253
|
+
"org.primer.figma": {
|
|
2254
|
+
"collection": "mode",
|
|
2255
|
+
"mode": "light",
|
|
2256
|
+
"group": "component (internal)",
|
|
2257
|
+
"scopes": ["fgColor"]
|
|
2258
|
+
}
|
|
2259
|
+
},
|
|
2260
|
+
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
2261
|
+
"isSource": true,
|
|
2262
|
+
"original": {
|
|
2263
|
+
"value": "{base.display.color.coral.6}",
|
|
2264
|
+
"$type": "color",
|
|
2265
|
+
"$extensions": {
|
|
2266
|
+
"org.primer.figma": {
|
|
2267
|
+
"collection": "mode",
|
|
2268
|
+
"mode": "light",
|
|
2269
|
+
"group": "component (internal)",
|
|
2270
|
+
"scopes": ["fgColor"]
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
},
|
|
2274
|
+
"name": "display-coral-fgColor",
|
|
2275
|
+
"attributes": {},
|
|
2276
|
+
"path": ["display", "coral", "fgColor"]
|
|
2277
|
+
},
|
|
2278
|
+
"display-coral-borderColor-muted": {
|
|
2279
|
+
"value": "#fecebe",
|
|
2280
|
+
"$type": "color",
|
|
2281
|
+
"$extensions": {
|
|
2282
|
+
"org.primer.figma": {
|
|
2283
|
+
"collection": "mode",
|
|
2284
|
+
"mode": "light",
|
|
2285
|
+
"group": "component (internal)",
|
|
2286
|
+
"scopes": ["borderColor"]
|
|
2287
|
+
}
|
|
2288
|
+
},
|
|
2289
|
+
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
2290
|
+
"isSource": true,
|
|
2291
|
+
"original": {
|
|
2292
|
+
"value": "{base.display.color.coral.1}",
|
|
2293
|
+
"$type": "color",
|
|
2294
|
+
"$extensions": {
|
|
2295
|
+
"org.primer.figma": {
|
|
2296
|
+
"collection": "mode",
|
|
2297
|
+
"mode": "light",
|
|
2298
|
+
"group": "component (internal)",
|
|
2299
|
+
"scopes": ["borderColor"]
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
},
|
|
2303
|
+
"name": "display-coral-borderColor-muted",
|
|
2304
|
+
"attributes": {},
|
|
2305
|
+
"path": ["display", "coral", "borderColor", "muted"]
|
|
2306
|
+
},
|
|
2307
|
+
"display-coral-borderColor-emphasis": {
|
|
2308
|
+
"value": "#d43511",
|
|
2309
|
+
"$type": "color",
|
|
2310
|
+
"$extensions": {
|
|
2311
|
+
"org.primer.figma": {
|
|
2312
|
+
"collection": "mode",
|
|
2313
|
+
"mode": "light",
|
|
2314
|
+
"group": "component (internal)",
|
|
2315
|
+
"scopes": ["borderColor"]
|
|
2316
|
+
}
|
|
2317
|
+
},
|
|
2318
|
+
"filePath": "src/tokens/functional/color/light/display-light.json5",
|
|
2319
|
+
"isSource": true,
|
|
2320
|
+
"original": {
|
|
2321
|
+
"value": "{base.display.color.coral.5}",
|
|
2322
|
+
"$type": "color",
|
|
2323
|
+
"$extensions": {
|
|
2324
|
+
"org.primer.figma": {
|
|
2325
|
+
"collection": "mode",
|
|
2326
|
+
"mode": "light",
|
|
2327
|
+
"group": "component (internal)",
|
|
2328
|
+
"scopes": ["borderColor"]
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
"name": "display-coral-borderColor-emphasis",
|
|
2333
|
+
"attributes": {},
|
|
2334
|
+
"path": ["display", "coral", "borderColor", "emphasis"]
|
|
2335
|
+
},
|
|
2191
2336
|
"display-yellow-bgColor-muted": {
|
|
2192
2337
|
"value": "#ffec9e",
|
|
2193
2338
|
"$type": "color",
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
typographyToCss,
|
|
25
25
|
dimensionToRemPxArray,
|
|
26
26
|
floatToPixel,
|
|
27
|
+
floatToPixelUnitless,
|
|
27
28
|
} from './transformers'
|
|
28
29
|
import {
|
|
29
30
|
javascriptCommonJs,
|
|
@@ -126,6 +127,11 @@ StyleDictionary.registerTransform({
|
|
|
126
127
|
...floatToPixel,
|
|
127
128
|
})
|
|
128
129
|
|
|
130
|
+
StyleDictionary.registerTransform({
|
|
131
|
+
name: 'float/pixelUnitless',
|
|
132
|
+
...floatToPixelUnitless,
|
|
133
|
+
})
|
|
134
|
+
|
|
129
135
|
StyleDictionary.registerTransform({
|
|
130
136
|
name: 'dimension/rem',
|
|
131
137
|
...dimensionToRem,
|
package/src/platforms/figma.ts
CHANGED
|
@@ -28,7 +28,7 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
|
|
|
28
28
|
// 'name/pathToSlashNotation',
|
|
29
29
|
'figma/attributes',
|
|
30
30
|
'fontFamily/figma',
|
|
31
|
-
'float/
|
|
31
|
+
'float/pixelUnitless',
|
|
32
32
|
'dimension/pixelUnitless',
|
|
33
33
|
// 'border/figma',
|
|
34
34
|
// 'typography/figma',
|
|
@@ -330,6 +330,72 @@
|
|
|
330
330
|
},
|
|
331
331
|
},
|
|
332
332
|
},
|
|
333
|
+
coral: {
|
|
334
|
+
bgColor: {
|
|
335
|
+
muted: {
|
|
336
|
+
$value: '{base.display.color.red.0}',
|
|
337
|
+
$type: 'color',
|
|
338
|
+
$extensions: {
|
|
339
|
+
'org.primer.figma': {
|
|
340
|
+
collection: 'mode',
|
|
341
|
+
mode: 'light',
|
|
342
|
+
group: 'component (internal)',
|
|
343
|
+
scopes: ['bgColor'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
emphasis: {
|
|
348
|
+
$value: '{base.display.color.red.5}',
|
|
349
|
+
$type: 'color',
|
|
350
|
+
$extensions: {
|
|
351
|
+
'org.primer.figma': {
|
|
352
|
+
collection: 'mode',
|
|
353
|
+
mode: 'light',
|
|
354
|
+
group: 'component (internal)',
|
|
355
|
+
scopes: ['bgColor'],
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
fgColor: {
|
|
361
|
+
$value: '{base.display.color.red.6}',
|
|
362
|
+
$type: 'color',
|
|
363
|
+
$extensions: {
|
|
364
|
+
'org.primer.figma': {
|
|
365
|
+
collection: 'mode',
|
|
366
|
+
mode: 'light',
|
|
367
|
+
group: 'component (internal)',
|
|
368
|
+
scopes: ['fgColor'],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
borderColor: {
|
|
373
|
+
muted: {
|
|
374
|
+
$value: '{base.display.color.red.1}',
|
|
375
|
+
$type: 'color',
|
|
376
|
+
$extensions: {
|
|
377
|
+
'org.primer.figma': {
|
|
378
|
+
collection: 'mode',
|
|
379
|
+
mode: 'light',
|
|
380
|
+
group: 'component (internal)',
|
|
381
|
+
scopes: ['borderColor'],
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
emphasis: {
|
|
386
|
+
$value: '{base.display.color.red.5}',
|
|
387
|
+
$type: 'color',
|
|
388
|
+
$extensions: {
|
|
389
|
+
'org.primer.figma': {
|
|
390
|
+
collection: 'mode',
|
|
391
|
+
mode: 'light',
|
|
392
|
+
group: 'component (internal)',
|
|
393
|
+
scopes: ['borderColor'],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
},
|
|
333
399
|
yellow: {
|
|
334
400
|
bgColor: {
|
|
335
401
|
muted: {
|
|
@@ -330,6 +330,72 @@
|
|
|
330
330
|
},
|
|
331
331
|
},
|
|
332
332
|
},
|
|
333
|
+
coral: {
|
|
334
|
+
bgColor: {
|
|
335
|
+
muted: {
|
|
336
|
+
$value: '{base.display.color.coral.0}',
|
|
337
|
+
$type: 'color',
|
|
338
|
+
$extensions: {
|
|
339
|
+
'org.primer.figma': {
|
|
340
|
+
collection: 'mode',
|
|
341
|
+
mode: 'light',
|
|
342
|
+
group: 'component (internal)',
|
|
343
|
+
scopes: ['bgColor'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
emphasis: {
|
|
348
|
+
$value: '{base.display.color.coral.5}',
|
|
349
|
+
$type: 'color',
|
|
350
|
+
$extensions: {
|
|
351
|
+
'org.primer.figma': {
|
|
352
|
+
collection: 'mode',
|
|
353
|
+
mode: 'light',
|
|
354
|
+
group: 'component (internal)',
|
|
355
|
+
scopes: ['bgColor'],
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
fgColor: {
|
|
361
|
+
$value: '{base.display.color.coral.6}',
|
|
362
|
+
$type: 'color',
|
|
363
|
+
$extensions: {
|
|
364
|
+
'org.primer.figma': {
|
|
365
|
+
collection: 'mode',
|
|
366
|
+
mode: 'light',
|
|
367
|
+
group: 'component (internal)',
|
|
368
|
+
scopes: ['fgColor'],
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
borderColor: {
|
|
373
|
+
muted: {
|
|
374
|
+
$value: '{base.display.color.coral.1}',
|
|
375
|
+
$type: 'color',
|
|
376
|
+
$extensions: {
|
|
377
|
+
'org.primer.figma': {
|
|
378
|
+
collection: 'mode',
|
|
379
|
+
mode: 'light',
|
|
380
|
+
group: 'component (internal)',
|
|
381
|
+
scopes: ['borderColor'],
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
emphasis: {
|
|
386
|
+
$value: '{base.display.color.coral.5}',
|
|
387
|
+
$type: 'color',
|
|
388
|
+
$extensions: {
|
|
389
|
+
'org.primer.figma': {
|
|
390
|
+
collection: 'mode',
|
|
391
|
+
mode: 'light',
|
|
392
|
+
group: 'component (internal)',
|
|
393
|
+
scopes: ['borderColor'],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
},
|
|
333
399
|
yellow: {
|
|
334
400
|
bgColor: {
|
|
335
401
|
muted: {
|
|
@@ -5,7 +5,7 @@ import {isNumber} from '../filters'
|
|
|
5
5
|
* @param value
|
|
6
6
|
* @returns string
|
|
7
7
|
*/
|
|
8
|
-
export const convertFloatToPixel = (token: StyleDictionary.TransformedToken) => {
|
|
8
|
+
export const convertFloatToPixel = (token: StyleDictionary.TransformedToken, unitless = false) => {
|
|
9
9
|
// short circut if value is not a number
|
|
10
10
|
if (
|
|
11
11
|
typeof token.value !== 'number' ||
|
|
@@ -17,7 +17,7 @@ export const convertFloatToPixel = (token: StyleDictionary.TransformedToken) =>
|
|
|
17
17
|
// convert value
|
|
18
18
|
const convertedValue = token.$extensions?.['org.primer.data']?.fontSize * token.value
|
|
19
19
|
// return converted value
|
|
20
|
-
return convertedValue === 0 ? 0 : `${Math.round(convertedValue)}px`
|
|
20
|
+
return convertedValue === 0 ? 0 : unitless ? Math.round(convertedValue) : `${Math.round(convertedValue)}px`
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* @description converts a float value to a pixel value based on the provided fontSize on the tokersn extension
|
|
@@ -31,3 +31,10 @@ export const floatToPixel: StyleDictionary.Transform = {
|
|
|
31
31
|
matcher: isNumber,
|
|
32
32
|
transformer: (token: StyleDictionary.TransformedToken): string => convertFloatToPixel(token),
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export const floatToPixelUnitless: StyleDictionary.Transform = {
|
|
36
|
+
type: `value`,
|
|
37
|
+
transitive: true,
|
|
38
|
+
matcher: isNumber,
|
|
39
|
+
transformer: (token: StyleDictionary.TransformedToken): string => convertFloatToPixel(token, true),
|
|
40
|
+
}
|
|
@@ -5,6 +5,7 @@ export {colorToHexMix} from './colorToHexMix'
|
|
|
5
5
|
export {colorToRgbAlpha} from './colorToRgbAlpha'
|
|
6
6
|
export {colorToRgbaFloat} from './colorToRgbaFloat'
|
|
7
7
|
export {floatToPixel} from './floatToPixel'
|
|
8
|
+
export {floatToPixelUnitless} from './floatToPixel'
|
|
8
9
|
export {dimensionToRem} from './dimensionToRem'
|
|
9
10
|
export {dimensionToRemPxArray} from './dimensionToRemPxArray'
|
|
10
11
|
export {dimensionToPixelUnitless} from './dimensionToPixelUnitless'
|