@primer/primitives 7.17.0-rc.39874fc0 → 7.17.0-rc.3aa69fdf

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 (134) hide show
  1. package/dist/docs/functional/typography/typography.json +39 -3
  2. package/dist/figma/figma.json +10 -1
  3. package/dist/figma/typography/typography.json +32 -0
  4. package/dist/styleLint/functional/typography/typography.json +39 -3
  5. package/package.json +2 -2
  6. package/src/PrimerStyleDictionary.ts +6 -0
  7. package/src/platforms/figma.ts +6 -0
  8. package/src/tokens/functional/typography/typography.json +21 -3
  9. package/src/transformers/fontFamilyToCss.ts +3 -4
  10. package/src/transformers/fontFamilyToFigma.ts +47 -0
  11. package/src/transformers/index.ts +1 -0
  12. package/src/transformers/utilities/hasSpaceInString.ts +6 -0
  13. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  14. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  15. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  16. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  17. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  18. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  19. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  20. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  21. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  22. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  23. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  24. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  25. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  26. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  27. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  28. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  29. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  30. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  31. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  32. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  33. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  34. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  35. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  36. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  37. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  38. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  39. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  40. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  41. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  42. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  43. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  44. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  45. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  46. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  47. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  48. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  49. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  50. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  51. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  52. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  53. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  54. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  55. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  56. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  57. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  58. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  59. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  60. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  61. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  62. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  63. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  64. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  65. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
  66. package/dist/deprecated/colors.json +0 -7
  67. package/dist/js/colors/dark.d.ts +0 -516
  68. package/dist/js/colors/dark.js +0 -616
  69. package/dist/js/colors/dark_colorblind.d.ts +0 -516
  70. package/dist/js/colors/dark_colorblind.js +0 -616
  71. package/dist/js/colors/dark_dimmed.d.ts +0 -516
  72. package/dist/js/colors/dark_dimmed.js +0 -616
  73. package/dist/js/colors/dark_high_contrast.d.ts +0 -516
  74. package/dist/js/colors/dark_high_contrast.js +0 -616
  75. package/dist/js/colors/dark_tritanopia.d.ts +0 -516
  76. package/dist/js/colors/dark_tritanopia.js +0 -616
  77. package/dist/js/colors/index.d.ts +0 -4638
  78. package/dist/js/colors/index.js +0 -15
  79. package/dist/js/colors/light.d.ts +0 -516
  80. package/dist/js/colors/light.js +0 -616
  81. package/dist/js/colors/light_colorblind.d.ts +0 -516
  82. package/dist/js/colors/light_colorblind.js +0 -616
  83. package/dist/js/colors/light_high_contrast.d.ts +0 -516
  84. package/dist/js/colors/light_high_contrast.js +0 -616
  85. package/dist/js/colors/light_tritanopia.d.ts +0 -516
  86. package/dist/js/colors/light_tritanopia.js +0 -616
  87. package/dist/js/index.d.ts +0 -4655
  88. package/dist/js/index.js +0 -9
  89. package/dist/js/spacing/index.d.ts +0 -6
  90. package/dist/js/spacing/index.js +0 -7
  91. package/dist/js/spacing/normal.d.ts +0 -4
  92. package/dist/js/spacing/normal.js +0 -13
  93. package/dist/js/typography/index.d.ts +0 -11
  94. package/dist/js/typography/index.js +0 -7
  95. package/dist/js/typography/normal.d.ts +0 -9
  96. package/dist/js/typography/normal.js +0 -19
  97. package/dist/json/colors/dark.json +0 -614
  98. package/dist/json/colors/dark_colorblind.json +0 -614
  99. package/dist/json/colors/dark_dimmed.json +0 -614
  100. package/dist/json/colors/dark_high_contrast.json +0 -614
  101. package/dist/json/colors/dark_tritanopia.json +0 -614
  102. package/dist/json/colors/light.json +0 -614
  103. package/dist/json/colors/light_colorblind.json +0 -614
  104. package/dist/json/colors/light_high_contrast.json +0 -614
  105. package/dist/json/colors/light_tritanopia.json +0 -614
  106. package/dist/json/spacing/normal.json +0 -11
  107. package/dist/json/typography/normal.json +0 -17
  108. package/dist/removed/colors.json +0 -432
  109. package/dist/scss/colors/_dark.scss +0 -452
  110. package/dist/scss/colors/_dark_colorblind.scss +0 -452
  111. package/dist/scss/colors/_dark_dimmed.scss +0 -452
  112. package/dist/scss/colors/_dark_high_contrast.scss +0 -452
  113. package/dist/scss/colors/_dark_tritanopia.scss +0 -452
  114. package/dist/scss/colors/_light.scss +0 -452
  115. package/dist/scss/colors/_light_colorblind.scss +0 -452
  116. package/dist/scss/colors/_light_high_contrast.scss +0 -452
  117. package/dist/scss/colors/_light_tritanopia.scss +0 -452
  118. package/dist/scss/spacing/_normal.scss +0 -11
  119. package/dist/scss/typography/_normal.scss +0 -15
  120. package/dist/ts/colors/dark.ts +0 -614
  121. package/dist/ts/colors/dark_colorblind.ts +0 -614
  122. package/dist/ts/colors/dark_dimmed.ts +0 -614
  123. package/dist/ts/colors/dark_high_contrast.ts +0 -614
  124. package/dist/ts/colors/dark_tritanopia.ts +0 -614
  125. package/dist/ts/colors/index.ts +0 -10
  126. package/dist/ts/colors/light.ts +0 -614
  127. package/dist/ts/colors/light_colorblind.ts +0 -614
  128. package/dist/ts/colors/light_high_contrast.ts +0 -614
  129. package/dist/ts/colors/light_tritanopia.ts +0 -614
  130. package/dist/ts/index.ts +0 -4
  131. package/dist/ts/spacing/index.ts +0 -2
  132. package/dist/ts/spacing/normal.ts +0 -11
  133. package/dist/ts/typography/index.ts +0 -2
  134. package/dist/ts/typography/normal.ts +0 -17
@@ -2,11 +2,23 @@
2
2
  "fontStack-system": {
3
3
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
4
4
  "$type": "fontFamily",
5
+ "$extensions": {
6
+ "org.primer.figma": {
7
+ "collection": "typography",
8
+ "scopes": ["all"]
9
+ }
10
+ },
5
11
  "filePath": "src/tokens/functional/typography/typography.json",
6
12
  "isSource": true,
7
13
  "original": {
8
14
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
9
- "$type": "fontFamily"
15
+ "$type": "fontFamily",
16
+ "$extensions": {
17
+ "org.primer.figma": {
18
+ "collection": "typography",
19
+ "scopes": ["all"]
20
+ }
21
+ }
10
22
  },
11
23
  "name": "fontStack-system",
12
24
  "attributes": {},
@@ -15,11 +27,23 @@
15
27
  "fontStack-sansSerif": {
16
28
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
17
29
  "$type": "fontFamily",
30
+ "$extensions": {
31
+ "org.primer.figma": {
32
+ "collection": "typography",
33
+ "scopes": ["all"]
34
+ }
35
+ },
18
36
  "filePath": "src/tokens/functional/typography/typography.json",
19
37
  "isSource": true,
20
38
  "original": {
21
39
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
22
- "$type": "fontFamily"
40
+ "$type": "fontFamily",
41
+ "$extensions": {
42
+ "org.primer.figma": {
43
+ "collection": "typography",
44
+ "scopes": ["all"]
45
+ }
46
+ }
23
47
  },
24
48
  "name": "fontStack-sansSerif",
25
49
  "attributes": {},
@@ -28,11 +52,23 @@
28
52
  "fontStack-monospace": {
29
53
  "value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
30
54
  "$type": "fontFamily",
55
+ "$extensions": {
56
+ "org.primer.figma": {
57
+ "collection": "typography",
58
+ "scopes": ["all"]
59
+ }
60
+ },
31
61
  "filePath": "src/tokens/functional/typography/typography.json",
32
62
  "isSource": true,
33
63
  "original": {
34
64
  "value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
35
- "$type": "fontFamily"
65
+ "$type": "fontFamily",
66
+ "$extensions": {
67
+ "org.primer.figma": {
68
+ "collection": "typography",
69
+ "scopes": ["all"]
70
+ }
71
+ }
36
72
  },
37
73
  "name": "fontStack-monospace",
38
74
  "attributes": {},
@@ -85,6 +85,14 @@
85
85
  "component",
86
86
  "component (internal)"
87
87
  ]
88
+ },
89
+ "typography": {
90
+ "modes": [
91
+ "default"
92
+ ],
93
+ "groups": [
94
+ "typography"
95
+ ]
88
96
  }
89
97
  },
90
98
  "files": [
@@ -111,6 +119,7 @@
111
119
  "dist/figma/themes/light-colorblind.json",
112
120
  "dist/figma/themes/light-high-contrast.json",
113
121
  "dist/figma/themes/light-tritanopia.json",
114
- "dist/figma/themes/light.json"
122
+ "dist/figma/themes/light.json",
123
+ "dist/figma/typography/typography.json"
115
124
  ]
116
125
  }
@@ -0,0 +1,32 @@
1
+ [
2
+ {
3
+ "name": "fontStack/monospace",
4
+ "value": "SF Mono",
5
+ "type": "STRING",
6
+ "refId": "typography/fontStack/monospace",
7
+ "collection": "typography",
8
+ "mode": "default",
9
+ "group": "typography",
10
+ "scopes": ["ALL_SCOPES"]
11
+ },
12
+ {
13
+ "name": "fontStack/sansSerif",
14
+ "value": "SF Pro Text",
15
+ "type": "STRING",
16
+ "refId": "typography/fontStack/sansSerif",
17
+ "collection": "typography",
18
+ "mode": "default",
19
+ "group": "typography",
20
+ "scopes": ["ALL_SCOPES"]
21
+ },
22
+ {
23
+ "name": "fontStack/system",
24
+ "value": "SF Pro Text",
25
+ "type": "STRING",
26
+ "refId": "typography/fontStack/system",
27
+ "collection": "typography",
28
+ "mode": "default",
29
+ "group": "typography",
30
+ "scopes": ["ALL_SCOPES"]
31
+ }
32
+ ]
@@ -2,11 +2,23 @@
2
2
  "fontStack-system": {
3
3
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
4
4
  "$type": "fontFamily",
5
+ "$extensions": {
6
+ "org.primer.figma": {
7
+ "collection": "typography",
8
+ "scopes": ["all"]
9
+ }
10
+ },
5
11
  "filePath": "src/tokens/functional/typography/typography.json",
6
12
  "isSource": true,
7
13
  "original": {
8
14
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
9
- "$type": "fontFamily"
15
+ "$type": "fontFamily",
16
+ "$extensions": {
17
+ "org.primer.figma": {
18
+ "collection": "typography",
19
+ "scopes": ["all"]
20
+ }
21
+ }
10
22
  },
11
23
  "name": "fontStack-system",
12
24
  "attributes": {},
@@ -15,11 +27,23 @@
15
27
  "fontStack-sansSerif": {
16
28
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
17
29
  "$type": "fontFamily",
30
+ "$extensions": {
31
+ "org.primer.figma": {
32
+ "collection": "typography",
33
+ "scopes": ["all"]
34
+ }
35
+ },
18
36
  "filePath": "src/tokens/functional/typography/typography.json",
19
37
  "isSource": true,
20
38
  "original": {
21
39
  "value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
22
- "$type": "fontFamily"
40
+ "$type": "fontFamily",
41
+ "$extensions": {
42
+ "org.primer.figma": {
43
+ "collection": "typography",
44
+ "scopes": ["all"]
45
+ }
46
+ }
23
47
  },
24
48
  "name": "fontStack-sansSerif",
25
49
  "attributes": {},
@@ -28,11 +52,23 @@
28
52
  "fontStack-monospace": {
29
53
  "value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
30
54
  "$type": "fontFamily",
55
+ "$extensions": {
56
+ "org.primer.figma": {
57
+ "collection": "typography",
58
+ "scopes": ["all"]
59
+ }
60
+ },
31
61
  "filePath": "src/tokens/functional/typography/typography.json",
32
62
  "isSource": true,
33
63
  "original": {
34
64
  "value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
35
- "$type": "fontFamily"
65
+ "$type": "fontFamily",
66
+ "$extensions": {
67
+ "org.primer.figma": {
68
+ "collection": "typography",
69
+ "scopes": ["all"]
70
+ }
71
+ }
36
72
  },
37
73
  "name": "fontStack-monospace",
38
74
  "attributes": {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/primitives",
3
- "version": "7.17.0-rc.39874fc0",
3
+ "version": "7.17.0-rc.3aa69fdf",
4
4
  "description": "Typography, spacing, and color primitives for Primer design system",
5
5
  "files": [
6
6
  "dist",
@@ -45,7 +45,7 @@
45
45
  "lint:tokens": "ts-node ./scripts/validateTokenJson.ts",
46
46
  "prebuild": "rm -rf dist",
47
47
  "prebuild:tokens": "rm -rf tokens-v2-private",
48
- "prebuild:next": "rm -rf tokens-next-private",
48
+ "prebuild:next": "rm -rf dist",
49
49
  "prepack": "npm run build && npm run build:tokens && npm run build:next",
50
50
  "prepare": "husky",
51
51
  "release": "changeset publish",
@@ -12,6 +12,7 @@ import {
12
12
  durationToCss,
13
13
  figmaAttributes,
14
14
  fontFamilyToCss,
15
+ fontFamilyToFigma,
15
16
  fontWeightToNumber,
16
17
  jsonDeprecated,
17
18
  namePathToDotNotation,
@@ -216,6 +217,11 @@ StyleDictionary.registerTransform({
216
217
  ...fontFamilyToCss,
217
218
  })
218
219
 
220
+ StyleDictionary.registerTransform({
221
+ name: 'fontFamily/figma',
222
+ ...fontFamilyToFigma,
223
+ })
224
+
219
225
  /**
220
226
  * @name {@link PrimerStyleDictionary}
221
227
  * @description Returns style dictionary object with primer preset that includes parsers, formats and transformers
@@ -25,6 +25,7 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
25
25
  'name/pathToFigma',
26
26
  // 'name/pathToSlashNotation',
27
27
  'figma/attributes',
28
+ 'fontFamily/figma',
28
29
  'dimension/pixelUnitless',
29
30
  // 'border/figma',
30
31
  // 'typography/figma',
@@ -32,6 +33,11 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
32
33
  ],
33
34
  options: {
34
35
  basePxFontSize: 16,
36
+ fontFamilies: {
37
+ 'fontStack/system': 'SF Pro Text',
38
+ 'fontStack/sansSerif': 'SF Pro Text',
39
+ 'fontStack/monospace': 'SF Mono',
40
+ },
35
41
  ...options,
36
42
  },
37
43
  files: [
@@ -2,15 +2,33 @@
2
2
  "fontStack": {
3
3
  "system": {
4
4
  "$value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
5
- "$type": "fontFamily"
5
+ "$type": "fontFamily",
6
+ "$extensions": {
7
+ "org.primer.figma": {
8
+ "collection": "typography",
9
+ "scopes": ["all"]
10
+ }
11
+ }
6
12
  },
7
13
  "sansSerif": {
8
14
  "$value": "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
9
- "$type": "fontFamily"
15
+ "$type": "fontFamily",
16
+ "$extensions": {
17
+ "org.primer.figma": {
18
+ "collection": "typography",
19
+ "scopes": ["all"]
20
+ }
21
+ }
10
22
  },
11
23
  "monospace": {
12
24
  "$value": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
13
- "$type": "fontFamily"
25
+ "$type": "fontFamily",
26
+ "$extensions": {
27
+ "org.primer.figma": {
28
+ "collection": "typography",
29
+ "scopes": ["all"]
30
+ }
31
+ }
14
32
  }
15
33
  },
16
34
  "text": {
@@ -1,8 +1,7 @@
1
1
  import type StyleDictionary from 'style-dictionary'
2
2
  import {isFontFamily} from '../filters'
3
3
  import {getTokenValue} from './utilities/getTokenValue'
4
-
5
- const hasSpaceInName = (string: string) => /\s/g.test(string)
4
+ import {hasSpaceInString} from './utilities/hasSpaceInString'
6
5
  /**
7
6
  * takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
8
7
  * @param value
@@ -18,7 +17,7 @@ export const parseFontFamily = (value: unknown): string => {
18
17
  if (typeof string !== 'string') {
19
18
  throw new Error(`Invalid value in array ${string}, must be a string`)
20
19
  }
21
- return hasSpaceInName(string) ? `'${string}'` : string
20
+ return hasSpaceInString(string) ? `'${string}'` : string
22
21
  })
23
22
  .join(', ')
24
23
  }
@@ -28,7 +27,7 @@ export const parseFontFamily = (value: unknown): string => {
28
27
  * @description converts fontFamily tokens value to string
29
28
  * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
30
29
  * @matcher matches all tokens of $type `fontFamily`
31
- * @transformer returns a number
30
+ * @transformer returns a string
32
31
  */
33
32
  export const fontFamilyToCss: StyleDictionary.Transform = {
34
33
  type: `value`,
@@ -0,0 +1,47 @@
1
+ import type StyleDictionary from 'style-dictionary'
2
+ import {isFontFamily} from '../filters'
3
+ import {hasSpaceInString} from './utilities/hasSpaceInString'
4
+ /**
5
+ * takes a value and returns it if its a string or concats strings in an array quoting strings with spaces
6
+ * @param value
7
+ * @returns string
8
+ */
9
+ export const parseFontFamily = (
10
+ token: StyleDictionary.TransformedToken,
11
+ fontFamilies: Record<string, string> = {},
12
+ ): string => {
13
+ // return value from fontFamilies
14
+ if (token.name in fontFamilies) {
15
+ return fontFamilies[token.name]
16
+ }
17
+ // return string
18
+ if (typeof token.value === 'string') {
19
+ return token.value
20
+ }
21
+ // return stringified array
22
+ if (Array.isArray(token.value)) {
23
+ return token.value
24
+ .map((string: string) => {
25
+ if (typeof string !== 'string') {
26
+ throw new Error(`Invalid value in array ${string}, must be a string`)
27
+ }
28
+ return hasSpaceInString(string) ? `'${string}'` : string
29
+ })
30
+ .join(', ')
31
+ }
32
+ // invalid value
33
+ throw new Error(`Invalid value ${token.value}, should be a string or array of strings`)
34
+ }
35
+ /**
36
+ * @description converts fontFamily tokens value to string
37
+ * @type value transformer — [StyleDictionary.ValueTransform](https://github.com/amzn/style-dictionary/blob/main/types/Transform.d.ts)
38
+ * @matcher matches all tokens of $type `fontFamily`
39
+ * @transformer returns a string
40
+ */
41
+ export const fontFamilyToFigma: StyleDictionary.Transform = {
42
+ type: `value`,
43
+ transitive: true,
44
+ matcher: isFontFamily,
45
+ transformer: (token: StyleDictionary.TransformedToken, platform: StyleDictionary.Platform): string =>
46
+ parseFontFamily(token, platform.options?.fontFamilies),
47
+ }
@@ -10,6 +10,7 @@ export {dimensionToPixelUnitless} from './dimensionToPixelUnitless'
10
10
  export {durationToCss} from './durationToCss'
11
11
  export {figmaAttributes} from './figmaAttributes'
12
12
  export {fontFamilyToCss} from './fontFamilyToCss'
13
+ export {fontFamilyToFigma} from './fontFamilyToFigma'
13
14
  export {fontWeightToNumber} from './fontWeightToNumber'
14
15
  export {jsonDeprecated} from './jsonDeprecated'
15
16
  export {namePathToCamelCase} from './namePathToCamelCase'
@@ -0,0 +1,6 @@
1
+ export const hasSpaceInString = (string: string): boolean => {
2
+ if (typeof string !== 'string') {
3
+ throw new TypeError(`Invalid input. Input must be a string, ${typeof string} provided`)
4
+ }
5
+ return /\s/g.test(string)
6
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const BaseSize4 = "0.25rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const BaseTextWeightLight = "300";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerBorderInsetThin = "inset 0 0 0 max(1px, 0.0625rem)";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerBreakpointXsmall = "20rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetAuto = "2.75rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetAuto = "1rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerControlMinTargetFine = "1rem";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerViewportRangeNarrow = "(max-width: calc(48rem - 0.02px))";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ * Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
  */
5
5
 
6
6
  export const PrimerFontStackSystem = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ // Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
 
5
5
  $base-size-128: 8rem;
6
6
  $base-size-112: 7rem;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 18 Apr 2024 06:46:04 GMT
3
+ // Generated on Thu, 18 Apr 2024 12:05:02 GMT
4
4
 
5
5
  $base-text-weight-semibold: 600;
6
6
  $base-text-weight-medium: 500;