@primer/primitives 7.17.0-rc.1685583f → 7.17.0-rc.34cd1021

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 (313) hide show
  1. package/README.md +1 -1
  2. package/dist/css/functional/themes/dark-colorblind.css +24 -14
  3. package/dist/css/functional/themes/dark-dimmed.css +10 -0
  4. package/dist/css/functional/themes/dark-high-contrast.css +10 -0
  5. package/dist/css/functional/themes/dark-tritanopia.css +24 -14
  6. package/dist/css/functional/themes/dark.css +24 -14
  7. package/dist/css/functional/themes/light-colorblind.css +10 -0
  8. package/dist/css/functional/themes/light-high-contrast.css +10 -0
  9. package/dist/css/functional/themes/light-tritanopia.css +10 -0
  10. package/dist/css/functional/themes/light.css +10 -0
  11. package/dist/css/functional/typography/typography.css +1 -1
  12. package/dist/docs/base/typography/typography.json +52 -4
  13. package/dist/docs/functional/themes/dark-colorblind.json +230 -85
  14. package/dist/docs/functional/themes/dark-dimmed.json +218 -73
  15. package/dist/docs/functional/themes/dark-high-contrast.json +220 -75
  16. package/dist/docs/functional/themes/dark-tritanopia.json +230 -85
  17. package/dist/docs/functional/themes/dark.json +225 -80
  18. package/dist/docs/functional/themes/light-colorblind.json +221 -76
  19. package/dist/docs/functional/themes/light-high-contrast.json +215 -70
  20. package/dist/docs/functional/themes/light-tritanopia.json +221 -76
  21. package/dist/docs/functional/themes/light.json +216 -71
  22. package/dist/docs/functional/typography/typography.json +494 -36
  23. package/dist/fallbacks/functional/typography/typography.json +1 -1
  24. package/dist/figma/figma.json +18 -1
  25. package/dist/figma/scales/dark-dimmed.json +20 -20
  26. package/dist/figma/scales/dark-high-constrast.json +20 -20
  27. package/dist/figma/scales/dark.json +25 -25
  28. package/dist/figma/scales/light-high-constrast.json +20 -20
  29. package/dist/figma/scales/light.json +20 -20
  30. package/dist/figma/themes/dark-colorblind.json +170 -90
  31. package/dist/figma/themes/dark-dimmed.json +145 -65
  32. package/dist/figma/themes/dark-high-contrast.json +149 -69
  33. package/dist/figma/themes/dark-tritanopia.json +170 -90
  34. package/dist/figma/themes/dark.json +165 -85
  35. package/dist/figma/themes/light-colorblind.json +139 -59
  36. package/dist/figma/themes/light-high-contrast.json +135 -55
  37. package/dist/figma/themes/light-tritanopia.json +139 -59
  38. package/dist/figma/themes/light.json +134 -54
  39. package/dist/figma/typography/typography.json +370 -0
  40. package/dist/internalCss/dark-colorblind.css +48 -38
  41. package/dist/internalCss/dark-dimmed.css +30 -20
  42. package/dist/internalCss/dark-high-contrast.css +30 -20
  43. package/dist/internalCss/dark-tritanopia.css +48 -38
  44. package/dist/internalCss/dark.css +48 -38
  45. package/dist/internalCss/light-colorblind.css +30 -20
  46. package/dist/internalCss/light-high-contrast.css +30 -20
  47. package/dist/internalCss/light-tritanopia.css +30 -20
  48. package/dist/internalCss/light.css +30 -20
  49. package/dist/styleLint/base/typography/typography.json +52 -4
  50. package/dist/styleLint/functional/themes/dark-colorblind.json +230 -85
  51. package/dist/styleLint/functional/themes/dark-dimmed.json +218 -73
  52. package/dist/styleLint/functional/themes/dark-high-contrast.json +220 -75
  53. package/dist/styleLint/functional/themes/dark-tritanopia.json +230 -85
  54. package/dist/styleLint/functional/themes/dark.json +225 -80
  55. package/dist/styleLint/functional/themes/light-colorblind.json +221 -76
  56. package/dist/styleLint/functional/themes/light-high-contrast.json +215 -70
  57. package/dist/styleLint/functional/themes/light-tritanopia.json +221 -76
  58. package/dist/styleLint/functional/themes/light.json +216 -71
  59. package/dist/styleLint/functional/typography/typography.json +494 -36
  60. package/package.json +5 -13
  61. package/src/PrimerStyleDictionary.ts +12 -0
  62. package/src/filters/index.ts +1 -0
  63. package/src/filters/isNumber.ts +8 -0
  64. package/src/formats/jsonFigma.ts +3 -0
  65. package/src/platforms/figma.ts +10 -1
  66. package/src/schemas/collections.ts +2 -0
  67. package/src/schemas/dimensionToken.ts +1 -1
  68. package/src/schemas/fontFamilyToken.ts +10 -0
  69. package/src/schemas/fontWeightToken.ts +10 -0
  70. package/src/schemas/numberToken.ts +17 -0
  71. package/src/tokens/base/color/dark/dark.dimmed.json5 +1 -1
  72. package/src/tokens/base/color/dark/dark.high-contrast.json5 +1 -1
  73. package/src/tokens/base/color/dark/dark.json5 +3 -3
  74. package/src/tokens/base/color/light/light.high-contrast.json5 +1 -1
  75. package/src/tokens/base/color/light/light.json5 +1 -1
  76. package/src/tokens/base/typography/typography.json +28 -4
  77. package/src/tokens/functional/color/dark/app-dark.json5 +5 -5
  78. package/src/tokens/functional/color/dark/display-dark.json5 +66 -0
  79. package/src/tokens/functional/color/dark/overrides/dark.high-contrast.json5 +17 -17
  80. package/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +5 -5
  81. package/src/tokens/functional/color/dark/overrides/dark.tritanopia.json5 +5 -5
  82. package/src/tokens/functional/color/dark/patterns-dark.json5 +42 -42
  83. package/src/tokens/functional/color/dark/primitives-dark.json5 +16 -16
  84. package/src/tokens/functional/color/dark/syntax-dark.json5 +13 -13
  85. package/src/tokens/functional/color/light/app-light.json5 +5 -5
  86. package/src/tokens/functional/color/light/display-light.json5 +66 -0
  87. package/src/tokens/functional/color/light/overrides/light.high-contrast.json5 +25 -25
  88. package/src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5 +5 -5
  89. package/src/tokens/functional/color/light/overrides/light.tritanopia.json5 +5 -5
  90. package/src/tokens/functional/color/light/patterns-light.json5 +30 -30
  91. package/src/tokens/functional/color/light/primitives-light.json5 +15 -15
  92. package/src/tokens/functional/color/light/syntax-light.json5 +14 -14
  93. package/src/tokens/functional/shadow/dark.json5 +1 -1
  94. package/src/tokens/functional/shadow/light.json5 +11 -11
  95. package/src/tokens/functional/typography/typography.json +263 -34
  96. package/src/transformers/floatToPixel.ts +33 -0
  97. package/src/transformers/fontFamilyToCss.ts +3 -4
  98. package/src/transformers/fontFamilyToFigma.ts +47 -0
  99. package/src/transformers/index.ts +2 -0
  100. package/src/transformers/utilities/hasSpaceInString.ts +6 -0
  101. package/build.js +0 -578
  102. package/dist/deprecated/colors.json +0 -7
  103. package/dist/js/colors/dark.d.ts +0 -516
  104. package/dist/js/colors/dark.js +0 -616
  105. package/dist/js/colors/dark_colorblind.d.ts +0 -516
  106. package/dist/js/colors/dark_colorblind.js +0 -616
  107. package/dist/js/colors/dark_dimmed.d.ts +0 -516
  108. package/dist/js/colors/dark_dimmed.js +0 -616
  109. package/dist/js/colors/dark_high_contrast.d.ts +0 -516
  110. package/dist/js/colors/dark_high_contrast.js +0 -616
  111. package/dist/js/colors/dark_tritanopia.d.ts +0 -516
  112. package/dist/js/colors/dark_tritanopia.js +0 -616
  113. package/dist/js/colors/index.d.ts +0 -4638
  114. package/dist/js/colors/index.js +0 -15
  115. package/dist/js/colors/light.d.ts +0 -516
  116. package/dist/js/colors/light.js +0 -616
  117. package/dist/js/colors/light_colorblind.d.ts +0 -516
  118. package/dist/js/colors/light_colorblind.js +0 -616
  119. package/dist/js/colors/light_high_contrast.d.ts +0 -516
  120. package/dist/js/colors/light_high_contrast.js +0 -616
  121. package/dist/js/colors/light_tritanopia.d.ts +0 -516
  122. package/dist/js/colors/light_tritanopia.js +0 -616
  123. package/dist/js/index.d.ts +0 -4655
  124. package/dist/js/index.js +0 -9
  125. package/dist/js/spacing/index.d.ts +0 -6
  126. package/dist/js/spacing/index.js +0 -7
  127. package/dist/js/spacing/normal.d.ts +0 -4
  128. package/dist/js/spacing/normal.js +0 -13
  129. package/dist/js/typography/index.d.ts +0 -11
  130. package/dist/js/typography/index.js +0 -7
  131. package/dist/js/typography/normal.d.ts +0 -9
  132. package/dist/js/typography/normal.js +0 -19
  133. package/dist/json/colors/dark.json +0 -614
  134. package/dist/json/colors/dark_colorblind.json +0 -614
  135. package/dist/json/colors/dark_dimmed.json +0 -614
  136. package/dist/json/colors/dark_high_contrast.json +0 -614
  137. package/dist/json/colors/dark_tritanopia.json +0 -614
  138. package/dist/json/colors/light.json +0 -614
  139. package/dist/json/colors/light_colorblind.json +0 -614
  140. package/dist/json/colors/light_high_contrast.json +0 -614
  141. package/dist/json/colors/light_tritanopia.json +0 -614
  142. package/dist/json/spacing/normal.json +0 -11
  143. package/dist/json/typography/normal.json +0 -17
  144. package/dist/removed/colors.json +0 -432
  145. package/dist/scss/colors/_dark.scss +0 -452
  146. package/dist/scss/colors/_dark_colorblind.scss +0 -452
  147. package/dist/scss/colors/_dark_dimmed.scss +0 -452
  148. package/dist/scss/colors/_dark_high_contrast.scss +0 -452
  149. package/dist/scss/colors/_dark_tritanopia.scss +0 -452
  150. package/dist/scss/colors/_light.scss +0 -452
  151. package/dist/scss/colors/_light_colorblind.scss +0 -452
  152. package/dist/scss/colors/_light_high_contrast.scss +0 -452
  153. package/dist/scss/colors/_light_tritanopia.scss +0 -452
  154. package/dist/scss/spacing/_normal.scss +0 -11
  155. package/dist/scss/typography/_normal.scss +0 -15
  156. package/dist/ts/colors/dark.ts +0 -614
  157. package/dist/ts/colors/dark_colorblind.ts +0 -614
  158. package/dist/ts/colors/dark_dimmed.ts +0 -614
  159. package/dist/ts/colors/dark_high_contrast.ts +0 -614
  160. package/dist/ts/colors/dark_tritanopia.ts +0 -614
  161. package/dist/ts/colors/index.ts +0 -10
  162. package/dist/ts/colors/light.ts +0 -614
  163. package/dist/ts/colors/light_colorblind.ts +0 -614
  164. package/dist/ts/colors/light_high_contrast.ts +0 -614
  165. package/dist/ts/colors/light_tritanopia.ts +0 -614
  166. package/dist/ts/index.ts +0 -4
  167. package/dist/ts/spacing/index.ts +0 -2
  168. package/dist/ts/spacing/normal.ts +0 -11
  169. package/dist/ts/typography/index.ts +0 -2
  170. package/dist/ts/typography/normal.ts +0 -17
  171. package/tokens/base/size/size.json +0 -57
  172. package/tokens/base/typography/typography.json +0 -20
  173. package/tokens/functional/size/border.json +0 -48
  174. package/tokens/functional/size/breakpoints.json +0 -24
  175. package/tokens/functional/size/size-coarse.json +0 -27
  176. package/tokens/functional/size/size-fine.json +0 -27
  177. package/tokens/functional/size/size.json +0 -189
  178. package/tokens/functional/size/viewport.json +0 -24
  179. package/tokens/functional/typography/typography.json +0 -213
  180. package/tokens/removed/color.json +0 -421
  181. package/tokens-next-private/css/base/size/size.css +0 -19
  182. package/tokens-next-private/css/base/typography/typography.css +0 -6
  183. package/tokens-next-private/css/functional/motion/motion.css +0 -5
  184. package/tokens-next-private/css/functional/size/border.css +0 -14
  185. package/tokens-next-private/css/functional/size/breakpoints.css +0 -8
  186. package/tokens-next-private/css/functional/size/size-coarse.css +0 -7
  187. package/tokens-next-private/css/functional/size/size-fine.css +0 -7
  188. package/tokens-next-private/css/functional/size/size.css +0 -74
  189. package/tokens-next-private/css/functional/size/viewport.css +0 -6
  190. package/tokens-next-private/css/functional/themes/dark-colorblind.css +0 -1078
  191. package/tokens-next-private/css/functional/themes/dark-dimmed.css +0 -1078
  192. package/tokens-next-private/css/functional/themes/dark-high-contrast.css +0 -1078
  193. package/tokens-next-private/css/functional/themes/dark-tritanopia.css +0 -1078
  194. package/tokens-next-private/css/functional/themes/dark.css +0 -1078
  195. package/tokens-next-private/css/functional/themes/light-colorblind.css +0 -1078
  196. package/tokens-next-private/css/functional/themes/light-high-contrast.css +0 -1078
  197. package/tokens-next-private/css/functional/themes/light-tritanopia.css +0 -1078
  198. package/tokens-next-private/css/functional/themes/light.css +0 -1078
  199. package/tokens-next-private/css/functional/typography/typography.css +0 -47
  200. package/tokens-next-private/docs/base/size/size.json +0 -427
  201. package/tokens-next-private/docs/base/typography/typography.json +0 -54
  202. package/tokens-next-private/docs/functional/motion/motion.json +0 -47
  203. package/tokens-next-private/docs/functional/size/border.json +0 -234
  204. package/tokens-next-private/docs/functional/size/breakpoints.json +0 -152
  205. package/tokens-next-private/docs/functional/size/size-coarse.json +0 -41
  206. package/tokens-next-private/docs/functional/size/size-fine.json +0 -41
  207. package/tokens-next-private/docs/functional/size/size.json +0 -1838
  208. package/tokens-next-private/docs/functional/size/viewport.json +0 -80
  209. package/tokens-next-private/docs/functional/themes/dark-colorblind.json +0 -16155
  210. package/tokens-next-private/docs/functional/themes/dark-dimmed.json +0 -16159
  211. package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +0 -16175
  212. package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +0 -16161
  213. package/tokens-next-private/docs/functional/themes/dark.json +0 -16159
  214. package/tokens-next-private/docs/functional/themes/light-colorblind.json +0 -16123
  215. package/tokens-next-private/docs/functional/themes/light-high-contrast.json +0 -16125
  216. package/tokens-next-private/docs/functional/themes/light-tritanopia.json +0 -16115
  217. package/tokens-next-private/docs/functional/themes/light.json +0 -16113
  218. package/tokens-next-private/docs/functional/typography/typography.json +0 -663
  219. package/tokens-next-private/fallbacks/base/size/size.json +0 -19
  220. package/tokens-next-private/fallbacks/base/typography/typography.json +0 -6
  221. package/tokens-next-private/fallbacks/color-fallbacks.json +0 -260
  222. package/tokens-next-private/fallbacks/functional/motion/motion.json +0 -5
  223. package/tokens-next-private/fallbacks/functional/size/border.json +0 -14
  224. package/tokens-next-private/fallbacks/functional/size/breakpoints.json +0 -8
  225. package/tokens-next-private/fallbacks/functional/size/size-coarse.json +0 -5
  226. package/tokens-next-private/fallbacks/functional/size/size-fine.json +0 -5
  227. package/tokens-next-private/fallbacks/functional/size/size.json +0 -74
  228. package/tokens-next-private/fallbacks/functional/size/viewport.json +0 -8
  229. package/tokens-next-private/fallbacks/functional/typography/typography.json +0 -47
  230. package/tokens-next-private/internalCss/dark-colorblind.css +0 -1648
  231. package/tokens-next-private/internalCss/dark-dimmed.css +0 -1648
  232. package/tokens-next-private/internalCss/dark-high-contrast.css +0 -1648
  233. package/tokens-next-private/internalCss/dark-tritanopia.css +0 -1648
  234. package/tokens-next-private/internalCss/dark.css +0 -1648
  235. package/tokens-next-private/internalCss/light-colorblind.css +0 -1648
  236. package/tokens-next-private/internalCss/light-high-contrast.css +0 -1648
  237. package/tokens-next-private/internalCss/light-tritanopia.css +0 -1648
  238. package/tokens-next-private/internalCss/light.css +0 -1648
  239. package/tokens-next-private/removed/color.json +0 -421
  240. package/tokens-next-private/styleLint/base/size/size.json +0 -427
  241. package/tokens-next-private/styleLint/base/typography/typography.json +0 -54
  242. package/tokens-next-private/styleLint/functional/motion/motion.json +0 -47
  243. package/tokens-next-private/styleLint/functional/size/border.json +0 -234
  244. package/tokens-next-private/styleLint/functional/size/breakpoints.json +0 -152
  245. package/tokens-next-private/styleLint/functional/size/size-coarse.json +0 -41
  246. package/tokens-next-private/styleLint/functional/size/size-fine.json +0 -41
  247. package/tokens-next-private/styleLint/functional/size/size.json +0 -1838
  248. package/tokens-next-private/styleLint/functional/size/viewport.json +0 -80
  249. package/tokens-next-private/styleLint/functional/themes/dark-colorblind.json +0 -16155
  250. package/tokens-next-private/styleLint/functional/themes/dark-dimmed.json +0 -16159
  251. package/tokens-next-private/styleLint/functional/themes/dark-high-contrast.json +0 -16175
  252. package/tokens-next-private/styleLint/functional/themes/dark-tritanopia.json +0 -16161
  253. package/tokens-next-private/styleLint/functional/themes/dark.json +0 -16159
  254. package/tokens-next-private/styleLint/functional/themes/light-colorblind.json +0 -16123
  255. package/tokens-next-private/styleLint/functional/themes/light-high-contrast.json +0 -16125
  256. package/tokens-next-private/styleLint/functional/themes/light-tritanopia.json +0 -16115
  257. package/tokens-next-private/styleLint/functional/themes/light.json +0 -16113
  258. package/tokens-next-private/styleLint/functional/typography/typography.json +0 -663
  259. package/tokens-v2-private/css/tokens/base/size/size.css +0 -24
  260. package/tokens-v2-private/css/tokens/base/typography/typography.css +0 -11
  261. package/tokens-v2-private/css/tokens/functional/size/border.css +0 -17
  262. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +0 -13
  263. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +0 -11
  264. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +0 -11
  265. package/tokens-v2-private/css/tokens/functional/size/size.css +0 -54
  266. package/tokens-v2-private/css/tokens/functional/size/viewport.css +0 -6
  267. package/tokens-v2-private/css/tokens/functional/typography/typography.css +0 -47
  268. package/tokens-v2-private/docs/docValues.json +0 -2209
  269. package/tokens-v2-private/js/module/tokens/base/size/size.js +0 -266
  270. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +0 -77
  271. package/tokens-v2-private/js/module/tokens/functional/size/border.js +0 -165
  272. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +0 -101
  273. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +0 -73
  274. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +0 -73
  275. package/tokens-v2-private/js/module/tokens/functional/size/size.js +0 -824
  276. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +0 -101
  277. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +0 -809
  278. package/tokens-v2-private/js/tokens/base/size/size.js +0 -22
  279. package/tokens-v2-private/js/tokens/base/typography/typography.js +0 -9
  280. package/tokens-v2-private/js/tokens/functional/size/border.js +0 -15
  281. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +0 -11
  282. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +0 -8
  283. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +0 -8
  284. package/tokens-v2-private/js/tokens/functional/size/size.js +0 -52
  285. package/tokens-v2-private/js/tokens/functional/size/viewport.js +0 -11
  286. package/tokens-v2-private/js/tokens/functional/typography/typography.js +0 -45
  287. package/tokens-v2-private/scss/tokens/base/size/size.scss +0 -21
  288. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +0 -8
  289. package/tokens-v2-private/scss/tokens/functional/size/border.scss +0 -14
  290. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +0 -10
  291. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +0 -7
  292. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +0 -7
  293. package/tokens-v2-private/scss/tokens/functional/size/size.scss +0 -51
  294. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +0 -10
  295. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +0 -44
  296. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +0 -31
  297. package/tokens-v2-private/ts/tokens/base/size/size.js +0 -30
  298. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +0 -20
  299. package/tokens-v2-private/ts/tokens/base/typography/typography.js +0 -19
  300. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +0 -28
  301. package/tokens-v2-private/ts/tokens/functional/size/border.js +0 -27
  302. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +0 -20
  303. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +0 -19
  304. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +0 -29
  305. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +0 -28
  306. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +0 -29
  307. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +0 -28
  308. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +0 -103
  309. package/tokens-v2-private/ts/tokens/functional/size/size.js +0 -102
  310. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +0 -20
  311. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +0 -19
  312. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +0 -131
  313. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +0 -130
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@primer/primitives",
3
- "version": "7.17.0-rc.1685583f",
3
+ "version": "7.17.0-rc.34cd1021",
4
4
  "description": "Typography, spacing, and color primitives for Primer design system",
5
5
  "files": [
6
6
  "dist",
7
- "tokens-v2-private",
8
- "tokens-next-private",
9
- "build.js",
10
- "tokens/",
11
7
  "src/**/*",
12
8
  "!src/**/*.test.ts"
13
9
  ],
@@ -34,8 +30,6 @@
34
30
  "build:v8": "ts-node ./scripts/buildTokens.ts",
35
31
  "build:fallbacks": "ts-node ./scripts/buildFallbacks.ts",
36
32
  "build:figma": "ts-node scripts/buildFigma.ts",
37
- "build:tokens": "node -e \"require('./build')._init()\"",
38
- "build:new-tokens": "npm run build:tokens && npm run build:next && npm run build:figma",
39
33
  "tokenJson:check": "ts-node scripts/diffThemes.ts && ts-node scripts/diffTokenProps.ts",
40
34
  "contrast:check": "ts-node scripts/color-contrast.ts",
41
35
  "format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
@@ -45,14 +39,12 @@
45
39
  "lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config .eslintrc.js",
46
40
  "lint:tokens": "ts-node ./scripts/validateTokenJson.ts",
47
41
  "prebuild": "rm -rf dist",
48
- "prebuild:tokens": "rm -rf tokens-v2-private",
49
- "prebuild:next": "rm -rf tokens-next-private",
50
- "prepack": "npm run build && npm run build:tokens && npm run build:next",
42
+ "prebuild:next": "rm -rf dist",
43
+ "prepack": "npm run build && npm run build:next",
51
44
  "prepare": "husky",
52
45
  "release": "changeset publish",
53
- "start:storybook": "npm run build:next && cd docs/storybook && npm run storybook",
54
- "test": "jest --verbose --coverage",
55
- "watch": "ls data/**/*.scss scripts/**/*.ts | entr -s 'npm run build'"
46
+ "start:storybook": "npm run build && npm run build:next && cd docs/storybook && npm run storybook",
47
+ "test": "jest --verbose --coverage"
56
48
  },
57
49
  "prettier": "@github/prettier-config",
58
50
  "devDependencies": {
@@ -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,
@@ -22,6 +23,7 @@ import {
22
23
  shadowToCss,
23
24
  typographyToCss,
24
25
  dimensionToRemPxArray,
26
+ floatToPixel,
25
27
  } from './transformers'
26
28
  import {
27
29
  javascriptCommonJs,
@@ -131,6 +133,11 @@ StyleDictionary.registerTransform({
131
133
  ...colorToHex,
132
134
  })
133
135
 
136
+ StyleDictionary.registerTransform({
137
+ name: 'float/pixel',
138
+ ...floatToPixel,
139
+ })
140
+
134
141
  StyleDictionary.registerTransform({
135
142
  name: 'dimension/rem',
136
143
  ...dimensionToRem,
@@ -216,6 +223,11 @@ StyleDictionary.registerTransform({
216
223
  ...fontFamilyToCss,
217
224
  })
218
225
 
226
+ StyleDictionary.registerTransform({
227
+ name: 'fontFamily/figma',
228
+ ...fontFamilyToFigma,
229
+ })
230
+
219
231
  /**
220
232
  * @name {@link PrimerStyleDictionary}
221
233
  * @description Returns style dictionary object with primer preset that includes parsers, formats and transformers
@@ -7,6 +7,7 @@ export {isDeprecated} from './isDeprecated'
7
7
  export {isFromFile} from './isFromFile'
8
8
  export {isFontFamily} from './isFontFamily'
9
9
  export {isFontWeight} from './isFontWeight'
10
+ export {isNumber} from './isNumber'
10
11
  export {isShadow} from './isShadow'
11
12
  export {isSource} from './isSource'
12
13
  export {isTypography} from './isTypography'
@@ -0,0 +1,8 @@
1
+ import type StyleDictionary from 'style-dictionary'
2
+
3
+ /**
4
+ * @description Checks if token type is a number
5
+ * @param token [StyleDictionary.TransformedToken](https://github.com/amzn/style-dictionary/blob/main/types/TransformedToken.d.ts)
6
+ * @returns boolean
7
+ */
8
+ export const isNumber = (token: StyleDictionary.TransformedToken): boolean => token.$type === 'number'
@@ -27,6 +27,9 @@ const getFigmaType = (type: string): string => {
27
27
  const validTypes = {
28
28
  color: 'COLOR',
29
29
  dimension: 'FLOAT',
30
+ fontWeight: 'FLOAT',
31
+ number: 'FLOAT',
32
+ fontFamily: 'STRING',
30
33
  }
31
34
  if (type in validTypes) return validTypes[type as keyof typeof validTypes]
32
35
  throw new Error(`Invalid type: ${type}`)
@@ -3,9 +3,11 @@ import type {PlatformInitializer} from '../types/PlatformInitializer'
3
3
  import {isSource} from '../filters'
4
4
 
5
5
  const validFigmaToken = (token: StyleDictionary.TransformedToken) => {
6
- const validTypes = ['color', 'dimension', 'shadow']
6
+ const validTypes = ['color', 'dimension', 'shadow', 'fontWeight', 'fontFamily', 'number']
7
7
  // is a siource token, not an included one
8
8
  if (!isSource(token)) return false
9
+
10
+ if (`${token.value}`.substring(token.value.length - 2) === 'em') return false
9
11
  // has a collection attribute
10
12
  if (
11
13
  !('$extensions' in token) ||
@@ -25,6 +27,8 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
25
27
  'name/pathToFigma',
26
28
  // 'name/pathToSlashNotation',
27
29
  'figma/attributes',
30
+ 'fontFamily/figma',
31
+ 'float/pixel',
28
32
  'dimension/pixelUnitless',
29
33
  // 'border/figma',
30
34
  // 'typography/figma',
@@ -32,6 +36,11 @@ export const figma: PlatformInitializer = (outputFile, prefix, buildPath, option
32
36
  ],
33
37
  options: {
34
38
  basePxFontSize: 16,
39
+ fontFamilies: {
40
+ 'fontStack/system': 'SF Pro Text',
41
+ 'fontStack/sansSerif': 'SF Pro Text',
42
+ 'fontStack/monospace': 'SF Mono',
43
+ },
35
44
  ...options,
36
45
  },
37
46
  files: [
@@ -8,11 +8,13 @@ type Collections =
8
8
  | 'base/color/dark'
9
9
  | 'base/color/dark-dimmed'
10
10
  | 'base/color/dark-high-contrast'
11
+ | 'base/typography'
11
12
  | 'mode'
12
13
  | 'pattern/mode'
13
14
  | 'base/size'
14
15
  | 'functional/size'
15
16
  | 'pattern/size'
17
+ | 'typography'
16
18
 
17
19
  export const collection = (collections: Collections[]) => {
18
20
  return z.string().refine(
@@ -13,7 +13,7 @@ export const dimensionToken = baseToken
13
13
  $extensions: z
14
14
  .object({
15
15
  'org.primer.figma': z.object({
16
- collection: collection(['base/size', 'functional/size', 'pattern/size']),
16
+ collection: collection(['base/size', 'functional/size', 'pattern/size', 'typography']),
17
17
  scopes: scopes(['all', 'size', 'gap', 'radius', 'borderColor']),
18
18
  }),
19
19
  })
@@ -2,10 +2,20 @@ import {z} from 'zod'
2
2
  import {referenceValue} from './referenceValue'
3
3
  import {baseToken} from './baseToken'
4
4
  import {tokenType} from './tokenType'
5
+ import {collection} from './collections'
6
+ import {scopes} from './scopes'
5
7
 
6
8
  export const fontFamilyToken = baseToken
7
9
  .extend({
8
10
  $value: z.union([z.string(), referenceValue]),
9
11
  $type: tokenType('fontFamily'),
12
+ $extensions: z
13
+ .object({
14
+ 'org.primer.figma': z.object({
15
+ collection: collection(['base/typography', 'typography']).optional(),
16
+ scopes: scopes(['all']).optional(),
17
+ }),
18
+ })
19
+ .optional(),
10
20
  })
11
21
  .strict()
@@ -3,10 +3,20 @@ import {fontWeightValue} from './fontWeightValue'
3
3
  import {referenceValue} from './referenceValue'
4
4
  import {baseToken} from './baseToken'
5
5
  import {tokenType} from './tokenType'
6
+ import {collection} from './collections'
7
+ import {scopes} from './scopes'
6
8
 
7
9
  export const fontWeightToken = baseToken
8
10
  .extend({
9
11
  $type: tokenType('fontWeight'),
10
12
  $value: z.union([fontWeightValue, referenceValue]),
13
+ $extensions: z
14
+ .object({
15
+ 'org.primer.figma': z.object({
16
+ collection: collection(['base/typography', 'typography']).optional(),
17
+ scopes: scopes(['all']).optional(),
18
+ }),
19
+ })
20
+ .optional(),
11
21
  })
12
22
  .strict()
@@ -2,10 +2,27 @@ import {z} from 'zod'
2
2
  import {baseToken} from './baseToken'
3
3
  import {referenceValue} from './referenceValue'
4
4
  import {tokenType} from './tokenType'
5
+ import {scopes} from './scopes'
6
+ import {collection} from './collections'
5
7
 
6
8
  export const numberToken = baseToken
7
9
  .extend({
8
10
  $value: z.union([z.number(), referenceValue]),
9
11
  $type: tokenType('number'),
12
+ $extensions: z
13
+ .object({
14
+ 'org.primer.data': z
15
+ .object({
16
+ fontSize: z.number().optional(),
17
+ })
18
+ .optional(),
19
+ 'org.primer.figma': z
20
+ .object({
21
+ collection: collection(['typography']).optional(),
22
+ scopes: scopes(['all']).optional(),
23
+ })
24
+ .optional(),
25
+ })
26
+ .optional(),
10
27
  })
11
28
  .strict()
@@ -43,7 +43,7 @@
43
43
  },
44
44
  },
45
45
  },
46
- gray: {
46
+ neutral: {
47
47
  '0': {
48
48
  $value: '#cdd9e5',
49
49
  $type: 'color',
@@ -23,7 +23,7 @@
23
23
  },
24
24
  },
25
25
  },
26
- gray: {
26
+ neutral: {
27
27
  '0': {
28
28
  $value: '#ffffff',
29
29
  $type: 'color',
@@ -33,7 +33,7 @@
33
33
  },
34
34
  alpha: 0,
35
35
  },
36
- gray: {
36
+ neutral: {
37
37
  '0': {
38
38
  $value: '#f0f6fc',
39
39
  $type: 'color',
@@ -614,7 +614,7 @@
614
614
  },
615
615
  },
616
616
  '3': {
617
- $value: '#bc8cff',
617
+ $value: '#BE8FFF',
618
618
  $type: 'color',
619
619
  $extensions: {
620
620
  'org.primer.figma': {
@@ -623,7 +623,7 @@
623
623
  },
624
624
  },
625
625
  '4': {
626
- $value: '#a371f7',
626
+ $value: '#AB7DF8',
627
627
  $type: 'color',
628
628
  $extensions: {
629
629
  'org.primer.figma': {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  },
16
16
  },
17
- gray: {
17
+ neutral: {
18
18
  '0': {
19
19
  $value: '#ffffff',
20
20
  $type: 'color',
@@ -33,7 +33,7 @@
33
33
  },
34
34
  },
35
35
  },
36
- gray: {
36
+ neutral: {
37
37
  '0': {
38
38
  $value: '#f6f8fa',
39
39
  $type: 'color',
@@ -4,19 +4,43 @@
4
4
  "weight": {
5
5
  "light": {
6
6
  "$type": "fontWeight",
7
- "$value": 300
7
+ "$value": 300,
8
+ "$extensions": {
9
+ "org.primer.figma": {
10
+ "collection": "base/typography",
11
+ "scopes": ["all"]
12
+ }
13
+ }
8
14
  },
9
15
  "normal": {
10
16
  "$value": 400,
11
- "$type": "fontWeight"
17
+ "$type": "fontWeight",
18
+ "$extensions": {
19
+ "org.primer.figma": {
20
+ "collection": "base/typography",
21
+ "scopes": ["all"]
22
+ }
23
+ }
12
24
  },
13
25
  "medium": {
14
26
  "$value": 500,
15
- "$type": "fontWeight"
27
+ "$type": "fontWeight",
28
+ "$extensions": {
29
+ "org.primer.figma": {
30
+ "collection": "base/typography",
31
+ "scopes": ["all"]
32
+ }
33
+ }
16
34
  },
17
35
  "semibold": {
18
36
  "$value": 600,
19
- "$type": "fontWeight"
37
+ "$type": "fontWeight",
38
+ "$extensions": {
39
+ "org.primer.figma": {
40
+ "collection": "base/typography",
41
+ "scopes": ["all"]
42
+ }
43
+ }
20
44
  }
21
45
  }
22
46
  }
@@ -372,7 +372,7 @@
372
372
  syntax: {
373
373
  fgColor: {
374
374
  comment: {
375
- $value: '{base.color.gray.3}',
375
+ $value: '{base.color.neutral.3}',
376
376
  $type: 'color',
377
377
  $extensions: {
378
378
  'org.primer.figma': {
@@ -499,7 +499,7 @@
499
499
  },
500
500
  },
501
501
  bgColor: {
502
- $value: '{base.color.gray.9}',
502
+ $value: '{base.color.neutral.9}',
503
503
  $type: 'color',
504
504
  $extensions: {
505
505
  'org.primer.figma': {
@@ -512,7 +512,7 @@
512
512
  },
513
513
  borderColor: {
514
514
  divider: {
515
- $value: '{base.color.gray.3}',
515
+ $value: '{base.color.neutral.3}',
516
516
  $type: 'color',
517
517
  $extensions: {
518
518
  'org.primer.figma': {
@@ -527,7 +527,7 @@
527
527
  },
528
528
  headerSearch: {
529
529
  bgColor: {
530
- $value: '{base.color.gray.9}',
530
+ $value: '{base.color.neutral.9}',
531
531
  $type: 'color',
532
532
  $extensions: {
533
533
  'org.primer.figma': {
@@ -539,7 +539,7 @@
539
539
  },
540
540
  },
541
541
  borderColor: {
542
- $value: '{base.color.gray.6}',
542
+ $value: '{base.color.neutral.6}',
543
543
  $type: 'color',
544
544
  $extensions: {
545
545
  'org.primer.figma': {
@@ -1056,5 +1056,71 @@
1056
1056
  },
1057
1057
  },
1058
1058
  },
1059
+ pink: {
1060
+ bgColor: {
1061
+ muted: {
1062
+ $value: '{base.display.color.pink.0}',
1063
+ $type: 'color',
1064
+ $extensions: {
1065
+ 'org.primer.figma': {
1066
+ collection: 'mode',
1067
+ mode: 'light',
1068
+ group: 'component (internal)',
1069
+ scopes: ['bgColor'],
1070
+ },
1071
+ },
1072
+ },
1073
+ emphasis: {
1074
+ $value: '{base.display.color.pink.5}',
1075
+ $type: 'color',
1076
+ $extensions: {
1077
+ 'org.primer.figma': {
1078
+ collection: 'mode',
1079
+ mode: 'light',
1080
+ group: 'component (internal)',
1081
+ scopes: ['bgColor'],
1082
+ },
1083
+ },
1084
+ },
1085
+ },
1086
+ fgColor: {
1087
+ $value: '{base.display.color.pink.6}',
1088
+ $type: 'color',
1089
+ $extensions: {
1090
+ 'org.primer.figma': {
1091
+ collection: 'mode',
1092
+ mode: 'light',
1093
+ group: 'component (internal)',
1094
+ scopes: ['fgColor'],
1095
+ },
1096
+ },
1097
+ },
1098
+ borderColor: {
1099
+ muted: {
1100
+ $value: '{base.display.color.pink.1}',
1101
+ $type: 'color',
1102
+ $extensions: {
1103
+ 'org.primer.figma': {
1104
+ collection: 'mode',
1105
+ mode: 'light',
1106
+ group: 'component (internal)',
1107
+ scopes: ['borderColor'],
1108
+ },
1109
+ },
1110
+ },
1111
+ emphasis: {
1112
+ $value: '{base.display.color.pink.5}',
1113
+ $type: 'color',
1114
+ $extensions: {
1115
+ 'org.primer.figma': {
1116
+ collection: 'mode',
1117
+ mode: 'light',
1118
+ group: 'component (internal)',
1119
+ scopes: ['borderColor'],
1120
+ },
1121
+ },
1122
+ },
1123
+ },
1124
+ },
1059
1125
  },
1060
1126
  }
@@ -6,17 +6,17 @@
6
6
  {
7
7
  fgColor: {
8
8
  onEmphasis: {
9
- $value: '{base.color.gray.9}',
9
+ $value: '{base.color.neutral.9}',
10
10
  $type: 'color',
11
11
  },
12
12
  muted: {
13
- $value: '{base.color.gray.1}',
13
+ $value: '{base.color.neutral.1}',
14
14
  $type: 'color',
15
15
  mix: null,
16
16
  alpha: 1,
17
17
  },
18
18
  disabled: {
19
- $value: '{base.color.gray.4}',
19
+ $value: '{base.color.neutral.4}',
20
20
  $type: 'color',
21
21
  },
22
22
  },
@@ -27,29 +27,29 @@
27
27
  },
28
28
  neutral: {
29
29
  emphasis: {
30
- $value: '{base.color.gray.4}',
30
+ $value: '{base.color.neutral.4}',
31
31
  $type: 'color',
32
32
  },
33
33
  },
34
34
  },
35
35
  borderColor: {
36
36
  default: {
37
- $value: '{base.color.gray.5}',
37
+ $value: '{base.color.neutral.5}',
38
38
  $type: 'color',
39
39
  },
40
40
  muted: {
41
- $value: '{base.color.gray.5}',
41
+ $value: '{base.color.neutral.5}',
42
42
  $type: 'color',
43
43
  alpha: 1,
44
44
  },
45
45
  neutral: {
46
46
  muted: {
47
- $value: '{base.color.gray.4}',
47
+ $value: '{base.color.neutral.4}',
48
48
  $type: 'color',
49
49
  alpha: 1,
50
50
  },
51
51
  emphasis: {
52
- $value: '{base.color.gray.4}',
52
+ $value: '{base.color.neutral.4}',
53
53
  $type: 'color',
54
54
  },
55
55
  },
@@ -120,7 +120,7 @@
120
120
  control: {
121
121
  bgColor: {
122
122
  selected: {
123
- $value: '{base.color.gray.6}',
123
+ $value: '{base.color.neutral.6}',
124
124
  $type: 'color',
125
125
  },
126
126
  },
@@ -134,17 +134,17 @@
134
134
  transparent: {
135
135
  bgColor: {
136
136
  hover: {
137
- $value: '{base.color.gray.8}',
137
+ $value: '{base.color.neutral.8}',
138
138
  $type: 'color',
139
139
  alpha: 1,
140
140
  },
141
141
  active: {
142
- $value: '{base.color.gray.6}',
142
+ $value: '{base.color.neutral.6}',
143
143
  $type: 'color',
144
144
  alpha: 1,
145
145
  },
146
146
  selected: {
147
- $value: '{base.color.gray.6}',
147
+ $value: '{base.color.neutral.6}',
148
148
  $type: 'color',
149
149
  alpha: 1,
150
150
  },
@@ -155,7 +155,7 @@
155
155
  $type: 'color',
156
156
  },
157
157
  active: {
158
- $value: '{base.color.gray.4}',
158
+ $value: '{base.color.neutral.4}',
159
159
  $type: 'color',
160
160
  },
161
161
  },
@@ -249,13 +249,13 @@
249
249
  },
250
250
  bgColor: {
251
251
  hover: {
252
- $value: '{base.color.gray.1}',
252
+ $value: '{base.color.neutral.1}',
253
253
  $type: 'color',
254
254
  alpha: null,
255
255
  mix: null,
256
256
  },
257
257
  active: {
258
- $value: '{base.color.gray.2}',
258
+ $value: '{base.color.neutral.2}',
259
259
  $type: 'color',
260
260
  alpha: null,
261
261
  mix: null,
@@ -354,13 +354,13 @@
354
354
  underlineNav: {
355
355
  borderColor: {
356
356
  hover: {
357
- $value: '{base.color.gray.3}',
357
+ $value: '{base.color.neutral.3}',
358
358
  $type: 'color',
359
359
  },
360
360
  },
361
361
  iconColor: {
362
362
  rest: {
363
- $value: '{base.color.gray.1}',
363
+ $value: '{base.color.neutral.1}',
364
364
  $type: 'color',
365
365
  },
366
366
  },
@@ -25,7 +25,7 @@
25
25
  },
26
26
  closed: {
27
27
  '@': {
28
- $value: '{base.color.gray.3}',
28
+ $value: '{base.color.neutral.3}',
29
29
  $type: 'color',
30
30
  },
31
31
  },
@@ -66,12 +66,12 @@
66
66
  },
67
67
  closed: {
68
68
  muted: {
69
- $value: '{base.color.gray.4}',
69
+ $value: '{base.color.neutral.4}',
70
70
  $type: 'color',
71
71
  alpha: 0.4,
72
72
  },
73
73
  emphasis: {
74
- $value: '{base.color.gray.4}',
74
+ $value: '{base.color.neutral.4}',
75
75
  $type: 'color',
76
76
  },
77
77
  },
@@ -90,12 +90,12 @@
90
90
  },
91
91
  closed: {
92
92
  muted: {
93
- $value: '{base.color.gray.4}',
93
+ $value: '{base.color.neutral.4}',
94
94
  $type: 'color',
95
95
  alpha: 0.4,
96
96
  },
97
97
  emphasis: {
98
- $value: '{base.color.gray.4}',
98
+ $value: '{base.color.neutral.4}',
99
99
  $type: 'color',
100
100
  },
101
101
  },
@@ -25,7 +25,7 @@
25
25
  },
26
26
  closed: {
27
27
  '@': {
28
- $value: '{base.color.gray.4}',
28
+ $value: '{base.color.neutral.4}',
29
29
  $type: 'color',
30
30
  },
31
31
  },
@@ -63,11 +63,11 @@
63
63
  },
64
64
  closed: {
65
65
  muted: {
66
- $value: '{base.color.gray.4}',
66
+ $value: '{base.color.neutral.4}',
67
67
  $type: 'color',
68
68
  },
69
69
  emphasis: {
70
- $value: '{base.color.gray.5}',
70
+ $value: '{base.color.neutral.5}',
71
71
  $type: 'color',
72
72
  },
73
73
  },
@@ -108,12 +108,12 @@
108
108
  },
109
109
  closed: {
110
110
  muted: {
111
- $value: '{base.color.gray.4}',
111
+ $value: '{base.color.neutral.4}',
112
112
  $type: 'color',
113
113
  alpha: 0.4,
114
114
  },
115
115
  emphasis: {
116
- $value: '{base.color.gray.5}',
116
+ $value: '{base.color.neutral.5}',
117
117
  $type: 'color',
118
118
  },
119
119
  },