@primer/primitives 8.1.0-rc.313f1fc7 → 8.1.1-rc.29cfc4ea

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 (68) hide show
  1. package/dist/css/base/size/size.css +2 -0
  2. package/dist/css/functional/themes/dark-colorblind.css +38 -18
  3. package/dist/css/functional/themes/dark-dimmed.css +38 -18
  4. package/dist/css/functional/themes/dark-high-contrast.css +20 -0
  5. package/dist/css/functional/themes/dark-tritanopia.css +38 -18
  6. package/dist/css/functional/themes/dark.css +38 -18
  7. package/dist/css/functional/themes/light-colorblind.css +20 -0
  8. package/dist/css/functional/themes/light-high-contrast.css +20 -0
  9. package/dist/css/functional/themes/light-tritanopia.css +20 -0
  10. package/dist/css/functional/themes/light.css +20 -0
  11. package/dist/deprecated/size.json +8 -0
  12. package/dist/docs/base/size/size.json +50 -0
  13. package/dist/docs/functional/size/size.json +12 -0
  14. package/dist/docs/functional/themes/dark-colorblind.json +304 -14
  15. package/dist/docs/functional/themes/dark-dimmed.json +304 -14
  16. package/dist/docs/functional/themes/dark-high-contrast.json +290 -0
  17. package/dist/docs/functional/themes/dark-tritanopia.json +304 -14
  18. package/dist/docs/functional/themes/dark.json +304 -14
  19. package/dist/docs/functional/themes/light-colorblind.json +290 -0
  20. package/dist/docs/functional/themes/light-high-contrast.json +290 -0
  21. package/dist/docs/functional/themes/light-tritanopia.json +290 -0
  22. package/dist/docs/functional/themes/light.json +290 -0
  23. package/dist/docs/functional/typography/typography.json +19 -1
  24. package/dist/fallbacks/base/size/size.json +2 -0
  25. package/dist/figma/dimension/dimension.json +20 -0
  26. package/dist/figma/themes/dark-colorblind.json +188 -28
  27. package/dist/figma/themes/dark-dimmed.json +188 -28
  28. package/dist/figma/themes/dark-high-contrast.json +160 -0
  29. package/dist/figma/themes/dark-tritanopia.json +188 -28
  30. package/dist/figma/themes/dark.json +188 -28
  31. package/dist/figma/themes/light-colorblind.json +160 -0
  32. package/dist/figma/themes/light-high-contrast.json +160 -0
  33. package/dist/figma/themes/light-tritanopia.json +160 -0
  34. package/dist/figma/themes/light.json +160 -0
  35. package/dist/figma/typography/typography.json +22 -11
  36. package/dist/internalCss/dark-colorblind.css +38 -18
  37. package/dist/internalCss/dark-dimmed.css +38 -18
  38. package/dist/internalCss/dark-high-contrast.css +20 -0
  39. package/dist/internalCss/dark-tritanopia.css +38 -18
  40. package/dist/internalCss/dark.css +38 -18
  41. package/dist/internalCss/light-colorblind.css +20 -0
  42. package/dist/internalCss/light-high-contrast.css +20 -0
  43. package/dist/internalCss/light-tritanopia.css +20 -0
  44. package/dist/internalCss/light.css +20 -0
  45. package/dist/styleLint/base/size/size.json +50 -0
  46. package/dist/styleLint/functional/size/size.json +12 -0
  47. package/dist/styleLint/functional/themes/dark-colorblind.json +304 -14
  48. package/dist/styleLint/functional/themes/dark-dimmed.json +304 -14
  49. package/dist/styleLint/functional/themes/dark-high-contrast.json +290 -0
  50. package/dist/styleLint/functional/themes/dark-tritanopia.json +304 -14
  51. package/dist/styleLint/functional/themes/dark.json +304 -14
  52. package/dist/styleLint/functional/themes/light-colorblind.json +290 -0
  53. package/dist/styleLint/functional/themes/light-high-contrast.json +290 -0
  54. package/dist/styleLint/functional/themes/light-tritanopia.json +290 -0
  55. package/dist/styleLint/functional/themes/light.json +290 -0
  56. package/dist/styleLint/functional/typography/typography.json +19 -1
  57. package/package.json +1 -1
  58. package/src/PrimerStyleDictionary.ts +6 -0
  59. package/src/platforms/figma.ts +1 -1
  60. package/src/schemas/baseToken.ts +1 -0
  61. package/src/tokens/base/size/size.json +20 -0
  62. package/src/tokens/functional/color/dark/display-dark.json5 +132 -0
  63. package/src/tokens/functional/color/dark/primitives-dark.json5 +3 -3
  64. package/src/tokens/functional/color/light/display-light.json5 +132 -0
  65. package/src/tokens/functional/size/size.json +6 -0
  66. package/src/tokens/functional/typography/typography.json +10 -1
  67. package/src/transformers/floatToPixel.ts +9 -2
  68. package/src/transformers/index.ts +1 -0
@@ -3,5 +3,6 @@ import {z} from 'zod'
3
3
  export const baseToken = z
4
4
  .object({
5
5
  $description: z.string().optional(),
6
+ deprecated: z.union([z.string(), z.boolean()]).optional(),
6
7
  })
7
8
  .strict()
@@ -1,6 +1,16 @@
1
1
  {
2
2
  "base": {
3
3
  "size": {
4
+ "2": {
5
+ "$value": "2px",
6
+ "$type": "dimension",
7
+ "$extensions": {
8
+ "org.primer.figma": {
9
+ "collection": "base/size",
10
+ "scopes": ["size"]
11
+ }
12
+ }
13
+ },
4
14
  "4": {
5
15
  "$value": "4px",
6
16
  "$type": "dimension",
@@ -11,6 +21,16 @@
11
21
  }
12
22
  }
13
23
  },
24
+ "6": {
25
+ "$value": "6px",
26
+ "$type": "dimension",
27
+ "$extensions": {
28
+ "org.primer.figma": {
29
+ "collection": "base/size",
30
+ "scopes": ["size"]
31
+ }
32
+ }
33
+ },
14
34
  "8": {
15
35
  "$value": "8px",
16
36
  "$type": "dimension",
@@ -264,6 +264,72 @@
264
264
  },
265
265
  },
266
266
  },
267
+ plum: {
268
+ bgColor: {
269
+ muted: {
270
+ $value: '{base.display.color.plum.0}',
271
+ $type: 'color',
272
+ $extensions: {
273
+ 'org.primer.figma': {
274
+ collection: 'mode',
275
+ mode: 'light',
276
+ group: 'component (internal)',
277
+ scopes: ['bgColor'],
278
+ },
279
+ },
280
+ },
281
+ emphasis: {
282
+ $value: '{base.display.color.plum.5}',
283
+ $type: 'color',
284
+ $extensions: {
285
+ 'org.primer.figma': {
286
+ collection: 'mode',
287
+ mode: 'light',
288
+ group: 'component (internal)',
289
+ scopes: ['bgColor'],
290
+ },
291
+ },
292
+ },
293
+ },
294
+ fgColor: {
295
+ $value: '{base.display.color.plum.6}',
296
+ $type: 'color',
297
+ $extensions: {
298
+ 'org.primer.figma': {
299
+ collection: 'mode',
300
+ mode: 'light',
301
+ group: 'component (internal)',
302
+ scopes: ['fgColor'],
303
+ },
304
+ },
305
+ },
306
+ borderColor: {
307
+ muted: {
308
+ $value: '{base.display.color.plum.1}',
309
+ $type: 'color',
310
+ $extensions: {
311
+ 'org.primer.figma': {
312
+ collection: 'mode',
313
+ mode: 'light',
314
+ group: 'component (internal)',
315
+ scopes: ['borderColor'],
316
+ },
317
+ },
318
+ },
319
+ emphasis: {
320
+ $value: '{base.display.color.plum.5}',
321
+ $type: 'color',
322
+ $extensions: {
323
+ 'org.primer.figma': {
324
+ collection: 'mode',
325
+ mode: 'light',
326
+ group: 'component (internal)',
327
+ scopes: ['borderColor'],
328
+ },
329
+ },
330
+ },
331
+ },
332
+ },
267
333
  red: {
268
334
  bgColor: {
269
335
  muted: {
@@ -330,6 +396,72 @@
330
396
  },
331
397
  },
332
398
  },
399
+ coral: {
400
+ bgColor: {
401
+ muted: {
402
+ $value: '{base.display.color.red.0}',
403
+ $type: 'color',
404
+ $extensions: {
405
+ 'org.primer.figma': {
406
+ collection: 'mode',
407
+ mode: 'light',
408
+ group: 'component (internal)',
409
+ scopes: ['bgColor'],
410
+ },
411
+ },
412
+ },
413
+ emphasis: {
414
+ $value: '{base.display.color.red.5}',
415
+ $type: 'color',
416
+ $extensions: {
417
+ 'org.primer.figma': {
418
+ collection: 'mode',
419
+ mode: 'light',
420
+ group: 'component (internal)',
421
+ scopes: ['bgColor'],
422
+ },
423
+ },
424
+ },
425
+ },
426
+ fgColor: {
427
+ $value: '{base.display.color.red.6}',
428
+ $type: 'color',
429
+ $extensions: {
430
+ 'org.primer.figma': {
431
+ collection: 'mode',
432
+ mode: 'light',
433
+ group: 'component (internal)',
434
+ scopes: ['fgColor'],
435
+ },
436
+ },
437
+ },
438
+ borderColor: {
439
+ muted: {
440
+ $value: '{base.display.color.red.1}',
441
+ $type: 'color',
442
+ $extensions: {
443
+ 'org.primer.figma': {
444
+ collection: 'mode',
445
+ mode: 'light',
446
+ group: 'component (internal)',
447
+ scopes: ['borderColor'],
448
+ },
449
+ },
450
+ },
451
+ emphasis: {
452
+ $value: '{base.display.color.red.5}',
453
+ $type: 'color',
454
+ $extensions: {
455
+ 'org.primer.figma': {
456
+ collection: 'mode',
457
+ mode: 'light',
458
+ group: 'component (internal)',
459
+ scopes: ['borderColor'],
460
+ },
461
+ },
462
+ },
463
+ },
464
+ },
333
465
  yellow: {
334
466
  bgColor: {
335
467
  muted: {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  },
22
22
  muted: {
23
- $value: '{base.color.neutral.3}',
23
+ $value: '{base.color.neutral.2}',
24
24
  $type: 'color',
25
25
  $extensions: {
26
26
  'org.primer.figma': {
@@ -34,8 +34,8 @@
34
34
  },
35
35
  },
36
36
  mix: {
37
- color: '{base.color.neutral.4}',
38
- weight: 0.25,
37
+ color: '{base.color.neutral.3}',
38
+ weight: 0.95,
39
39
  },
40
40
  },
41
41
  onEmphasis: {
@@ -264,6 +264,72 @@
264
264
  },
265
265
  },
266
266
  },
267
+ plum: {
268
+ bgColor: {
269
+ muted: {
270
+ $value: '{base.display.color.plum.0}',
271
+ $type: 'color',
272
+ $extensions: {
273
+ 'org.primer.figma': {
274
+ collection: 'mode',
275
+ mode: 'light',
276
+ group: 'component (internal)',
277
+ scopes: ['bgColor'],
278
+ },
279
+ },
280
+ },
281
+ emphasis: {
282
+ $value: '{base.display.color.plum.5}',
283
+ $type: 'color',
284
+ $extensions: {
285
+ 'org.primer.figma': {
286
+ collection: 'mode',
287
+ mode: 'light',
288
+ group: 'component (internal)',
289
+ scopes: ['bgColor'],
290
+ },
291
+ },
292
+ },
293
+ },
294
+ fgColor: {
295
+ $value: '{base.display.color.plum.6}',
296
+ $type: 'color',
297
+ $extensions: {
298
+ 'org.primer.figma': {
299
+ collection: 'mode',
300
+ mode: 'light',
301
+ group: 'component (internal)',
302
+ scopes: ['fgColor'],
303
+ },
304
+ },
305
+ },
306
+ borderColor: {
307
+ muted: {
308
+ $value: '{base.display.color.plum.1}',
309
+ $type: 'color',
310
+ $extensions: {
311
+ 'org.primer.figma': {
312
+ collection: 'mode',
313
+ mode: 'light',
314
+ group: 'component (internal)',
315
+ scopes: ['borderColor'],
316
+ },
317
+ },
318
+ },
319
+ emphasis: {
320
+ $value: '{base.display.color.plum.5}',
321
+ $type: 'color',
322
+ $extensions: {
323
+ 'org.primer.figma': {
324
+ collection: 'mode',
325
+ mode: 'light',
326
+ group: 'component (internal)',
327
+ scopes: ['borderColor'],
328
+ },
329
+ },
330
+ },
331
+ },
332
+ },
267
333
  red: {
268
334
  bgColor: {
269
335
  muted: {
@@ -330,6 +396,72 @@
330
396
  },
331
397
  },
332
398
  },
399
+ coral: {
400
+ bgColor: {
401
+ muted: {
402
+ $value: '{base.display.color.coral.0}',
403
+ $type: 'color',
404
+ $extensions: {
405
+ 'org.primer.figma': {
406
+ collection: 'mode',
407
+ mode: 'light',
408
+ group: 'component (internal)',
409
+ scopes: ['bgColor'],
410
+ },
411
+ },
412
+ },
413
+ emphasis: {
414
+ $value: '{base.display.color.coral.5}',
415
+ $type: 'color',
416
+ $extensions: {
417
+ 'org.primer.figma': {
418
+ collection: 'mode',
419
+ mode: 'light',
420
+ group: 'component (internal)',
421
+ scopes: ['bgColor'],
422
+ },
423
+ },
424
+ },
425
+ },
426
+ fgColor: {
427
+ $value: '{base.display.color.coral.6}',
428
+ $type: 'color',
429
+ $extensions: {
430
+ 'org.primer.figma': {
431
+ collection: 'mode',
432
+ mode: 'light',
433
+ group: 'component (internal)',
434
+ scopes: ['fgColor'],
435
+ },
436
+ },
437
+ },
438
+ borderColor: {
439
+ muted: {
440
+ $value: '{base.display.color.coral.1}',
441
+ $type: 'color',
442
+ $extensions: {
443
+ 'org.primer.figma': {
444
+ collection: 'mode',
445
+ mode: 'light',
446
+ group: 'component (internal)',
447
+ scopes: ['borderColor'],
448
+ },
449
+ },
450
+ },
451
+ emphasis: {
452
+ $value: '{base.display.color.coral.5}',
453
+ $type: 'color',
454
+ $extensions: {
455
+ 'org.primer.figma': {
456
+ collection: 'mode',
457
+ mode: 'light',
458
+ group: 'component (internal)',
459
+ scopes: ['borderColor'],
460
+ },
461
+ },
462
+ },
463
+ },
464
+ },
333
465
  yellow: {
334
466
  bgColor: {
335
467
  muted: {
@@ -3,6 +3,7 @@
3
3
  "xxsmall": {
4
4
  "$value": "2px",
5
5
  "$type": "dimension",
6
+ "deprecated": "Use --base-size-2 instead",
6
7
  "$extensions": {
7
8
  "org.primer.figma": {
8
9
  "collection": "functional/size",
@@ -13,6 +14,7 @@
13
14
  "xsmall": {
14
15
  "$value": "{base.size.4}",
15
16
  "$type": "dimension",
17
+ "deprecated": "Use --base-size-4 instead",
16
18
  "$extensions": {
17
19
  "org.primer.figma": {
18
20
  "collection": "functional/size",
@@ -23,6 +25,7 @@
23
25
  "small": {
24
26
  "$value": "6px",
25
27
  "$type": "dimension",
28
+ "deprecated": "Use --base-size-6 instead",
26
29
  "$extensions": {
27
30
  "org.primer.figma": {
28
31
  "collection": "functional/size",
@@ -33,6 +36,7 @@
33
36
  "medium": {
34
37
  "$value": "{base.size.8}",
35
38
  "$type": "dimension",
39
+ "deprecated": "Use --base-size-8 instead",
36
40
  "$extensions": {
37
41
  "org.primer.figma": {
38
42
  "collection": "functional/size",
@@ -43,6 +47,7 @@
43
47
  "large": {
44
48
  "$value": "{base.size.12}",
45
49
  "$type": "dimension",
50
+ "deprecated": "Use --base-size-12 instead",
46
51
  "$extensions": {
47
52
  "org.primer.figma": {
48
53
  "collection": "functional/size",
@@ -53,6 +58,7 @@
53
58
  "xlarge": {
54
59
  "$value": "{base.size.16}",
55
60
  "$type": "dimension",
61
+ "deprecated": "Use --base-size-16 instead",
56
62
  "$extensions": {
57
63
  "org.primer.figma": {
58
64
  "collection": "functional/size",
@@ -245,6 +245,9 @@
245
245
  "$value": 1.6,
246
246
  "$type": "number",
247
247
  "$extensions": {
248
+ "org.primer.data": {
249
+ "fontSize": 20
250
+ },
248
251
  "org.primer.figma": {
249
252
  "collection": "typography",
250
253
  "scopes": ["all"]
@@ -348,7 +351,13 @@
348
351
  },
349
352
  "weight": {
350
353
  "$value": "{base.text.weight.normal}",
351
- "$type": "fontWeight"
354
+ "$type": "fontWeight",
355
+ "$extensions": {
356
+ "org.primer.figma": {
357
+ "collection": "typography",
358
+ "scopes": ["all"]
359
+ }
360
+ }
352
361
  },
353
362
  "shorthand": {
354
363
  "large": {
@@ -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'