@primer/primitives 7.11.2-rc.fd60637 → 7.11.2

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 (259) hide show
  1. package/README.md +53 -1
  2. package/dist/color-contrast-check.json +1 -1
  3. package/dist/js/colors/dark.js +40 -40
  4. package/dist/js/colors/dark_colorblind.js +40 -40
  5. package/dist/js/colors/dark_dimmed.js +40 -40
  6. package/dist/js/colors/dark_high_contrast.js +24 -24
  7. package/dist/js/colors/dark_tritanopia.js +40 -40
  8. package/dist/js/colors/light.js +44 -44
  9. package/dist/js/colors/light_colorblind.js +16 -16
  10. package/dist/js/colors/light_high_contrast.js +9 -9
  11. package/dist/js/colors/light_tritanopia.js +16 -16
  12. package/dist/json/colors/dark.json +40 -40
  13. package/dist/json/colors/dark_colorblind.json +40 -40
  14. package/dist/json/colors/dark_dimmed.json +40 -40
  15. package/dist/json/colors/dark_high_contrast.json +24 -24
  16. package/dist/json/colors/dark_tritanopia.json +40 -40
  17. package/dist/json/colors/light.json +44 -44
  18. package/dist/json/colors/light_colorblind.json +16 -16
  19. package/dist/json/colors/light_high_contrast.json +9 -9
  20. package/dist/json/colors/light_tritanopia.json +16 -16
  21. package/dist/scss/colors/_dark.scss +40 -40
  22. package/dist/scss/colors/_dark_colorblind.scss +40 -40
  23. package/dist/scss/colors/_dark_dimmed.scss +40 -40
  24. package/dist/scss/colors/_dark_high_contrast.scss +24 -24
  25. package/dist/scss/colors/_dark_tritanopia.scss +40 -40
  26. package/dist/scss/colors/_light.scss +44 -44
  27. package/dist/scss/colors/_light_colorblind.scss +16 -16
  28. package/dist/scss/colors/_light_high_contrast.scss +9 -9
  29. package/dist/scss/colors/_light_tritanopia.scss +16 -16
  30. package/dist/ts/colors/dark.ts +40 -40
  31. package/dist/ts/colors/dark_colorblind.ts +40 -40
  32. package/dist/ts/colors/dark_dimmed.ts +40 -40
  33. package/dist/ts/colors/dark_high_contrast.ts +24 -24
  34. package/dist/ts/colors/dark_tritanopia.ts +40 -40
  35. package/dist/ts/colors/light.ts +44 -44
  36. package/dist/ts/colors/light_colorblind.ts +16 -16
  37. package/dist/ts/colors/light_high_contrast.ts +9 -9
  38. package/dist/ts/colors/light_tritanopia.ts +16 -16
  39. package/package.json +15 -14
  40. package/tokens-next-private/css/base/color/dark-colorblind.css +198 -0
  41. package/tokens-next-private/css/base/color/dark-dimmed.css +198 -0
  42. package/tokens-next-private/css/base/color/dark-high-contrast.css +198 -0
  43. package/tokens-next-private/css/base/color/dark-tritanopia.css +198 -0
  44. package/tokens-next-private/css/base/color/dark.css +198 -0
  45. package/tokens-next-private/css/base/color/light-colorblind.css +198 -0
  46. package/tokens-next-private/css/base/color/light-high-contrast.css +198 -0
  47. package/tokens-next-private/css/base/color/light-tritanopia.css +198 -0
  48. package/tokens-next-private/css/base/color/light.css +198 -0
  49. package/tokens-next-private/css/base/size/size.css +24 -0
  50. package/tokens-next-private/css/base/typography/typography.css +11 -0
  51. package/tokens-next-private/css/functional/size/border.css +18 -0
  52. package/tokens-next-private/css/functional/size/breakpoints.css +13 -0
  53. package/tokens-next-private/css/functional/size/size-coarse.css +10 -0
  54. package/tokens-next-private/css/functional/size/size-fine.css +10 -0
  55. package/tokens-next-private/css/functional/size/size.css +54 -0
  56. package/tokens-next-private/css/functional/size/viewport.css +13 -0
  57. package/tokens-next-private/css/functional/themes/dark-colorblind.css +604 -0
  58. package/tokens-next-private/css/functional/themes/dark-dimmed.css +604 -0
  59. package/tokens-next-private/css/functional/themes/dark-high-contrast.css +604 -0
  60. package/tokens-next-private/css/functional/themes/dark-tritanopia.css +604 -0
  61. package/tokens-next-private/css/functional/themes/dark.css +604 -0
  62. package/tokens-next-private/css/functional/themes/light-colorblind.css +554 -0
  63. package/tokens-next-private/css/functional/themes/light-high-contrast.css +554 -0
  64. package/tokens-next-private/css/functional/themes/light-tritanopia.css +554 -0
  65. package/tokens-next-private/css/functional/themes/light.css +554 -0
  66. package/tokens-next-private/css/functional/typography/typography.css +47 -0
  67. package/tokens-next-private/docs/base/color/dark-colorblind.json +1419 -0
  68. package/tokens-next-private/docs/base/color/dark-dimmed.json +1419 -0
  69. package/tokens-next-private/docs/base/color/dark-high-contrast.json +1419 -0
  70. package/tokens-next-private/docs/base/color/dark-tritanopia.json +1419 -0
  71. package/tokens-next-private/docs/base/color/dark.json +1419 -0
  72. package/tokens-next-private/docs/base/color/light-colorblind.json +1419 -0
  73. package/tokens-next-private/docs/base/color/light-high-contrast.json +1419 -0
  74. package/tokens-next-private/docs/base/color/light-tritanopia.json +1419 -0
  75. package/tokens-next-private/docs/base/color/light.json +1419 -0
  76. package/tokens-next-private/docs/base/size/size.json +227 -0
  77. package/tokens-next-private/docs/base/typography/typography.json +60 -0
  78. package/tokens-next-private/docs/functional/size/border.json +135 -0
  79. package/tokens-next-private/docs/functional/size/breakpoints.json +82 -0
  80. package/tokens-next-private/docs/functional/size/size-coarse.json +55 -0
  81. package/tokens-next-private/docs/functional/size/size-fine.json +55 -0
  82. package/tokens-next-private/docs/functional/size/size.json +647 -0
  83. package/tokens-next-private/docs/functional/size/viewport.json +70 -0
  84. package/tokens-next-private/docs/functional/themes/dark-colorblind.json +4535 -0
  85. package/tokens-next-private/docs/functional/themes/dark-dimmed.json +4539 -0
  86. package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +4543 -0
  87. package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +4539 -0
  88. package/tokens-next-private/docs/functional/themes/dark.json +4539 -0
  89. package/tokens-next-private/docs/functional/themes/light-colorblind.json +4241 -0
  90. package/tokens-next-private/docs/functional/themes/light-high-contrast.json +4231 -0
  91. package/tokens-next-private/docs/functional/themes/light-tritanopia.json +4231 -0
  92. package/tokens-next-private/docs/functional/themes/light.json +4231 -0
  93. package/tokens-next-private/docs/functional/typography/typography.json +581 -0
  94. package/tokens-next-private/js/base/color/dark-colorblind.js +122 -0
  95. package/tokens-next-private/js/base/color/dark-dimmed.js +122 -0
  96. package/tokens-next-private/js/base/color/dark-high-contrast.js +122 -0
  97. package/tokens-next-private/js/base/color/dark-tritanopia.js +122 -0
  98. package/tokens-next-private/js/base/color/dark.js +122 -0
  99. package/tokens-next-private/js/base/color/light-colorblind.js +122 -0
  100. package/tokens-next-private/js/base/color/light-high-contrast.js +122 -0
  101. package/tokens-next-private/js/base/color/light-tritanopia.js +122 -0
  102. package/tokens-next-private/js/base/color/light.js +122 -0
  103. package/tokens-next-private/js/base/size/size.js +28 -0
  104. package/tokens-next-private/js/base/typography/typography.js +17 -0
  105. package/tokens-next-private/js/functional/size/border.js +28 -0
  106. package/tokens-next-private/js/functional/size/breakpoints.js +15 -0
  107. package/tokens-next-private/js/functional/size/size-coarse.js +24 -0
  108. package/tokens-next-private/js/functional/size/size-fine.js +24 -0
  109. package/tokens-next-private/js/functional/size/size.js +98 -0
  110. package/tokens-next-private/js/functional/size/viewport.js +15 -0
  111. package/tokens-next-private/js/functional/themes/dark-colorblind.js +593 -0
  112. package/tokens-next-private/js/functional/themes/dark-dimmed.js +593 -0
  113. package/tokens-next-private/js/functional/themes/dark-high-contrast.js +593 -0
  114. package/tokens-next-private/js/functional/themes/dark-tritanopia.js +593 -0
  115. package/tokens-next-private/js/functional/themes/dark.js +593 -0
  116. package/tokens-next-private/js/functional/themes/light-colorblind.js +618 -0
  117. package/tokens-next-private/js/functional/themes/light-high-contrast.js +618 -0
  118. package/tokens-next-private/js/functional/themes/light-tritanopia.js +618 -0
  119. package/tokens-next-private/js/functional/themes/light.js +618 -0
  120. package/tokens-next-private/js/functional/typography/typography.js +77 -0
  121. package/tokens-next-private/json/base/color/dark-colorblind.json +117 -0
  122. package/tokens-next-private/json/base/color/dark-dimmed.json +117 -0
  123. package/tokens-next-private/json/base/color/dark-high-contrast.json +117 -0
  124. package/tokens-next-private/json/base/color/dark-tritanopia.json +117 -0
  125. package/tokens-next-private/json/base/color/dark.json +117 -0
  126. package/tokens-next-private/json/base/color/light-colorblind.json +117 -0
  127. package/tokens-next-private/json/base/color/light-high-contrast.json +117 -0
  128. package/tokens-next-private/json/base/color/light-tritanopia.json +117 -0
  129. package/tokens-next-private/json/base/color/light.json +117 -0
  130. package/tokens-next-private/json/base/size/size.json +23 -0
  131. package/tokens-next-private/json/base/typography/typography.json +12 -0
  132. package/tokens-next-private/json/functional/size/border.json +23 -0
  133. package/tokens-next-private/json/functional/size/breakpoints.json +10 -0
  134. package/tokens-next-private/json/functional/size/size-coarse.json +19 -0
  135. package/tokens-next-private/json/functional/size/size-fine.json +19 -0
  136. package/tokens-next-private/json/functional/size/size.json +93 -0
  137. package/tokens-next-private/json/functional/size/viewport.json +10 -0
  138. package/tokens-next-private/json/functional/themes/dark-colorblind.json +588 -0
  139. package/tokens-next-private/json/functional/themes/dark-dimmed.json +588 -0
  140. package/tokens-next-private/json/functional/themes/dark-high-contrast.json +588 -0
  141. package/tokens-next-private/json/functional/themes/dark-tritanopia.json +588 -0
  142. package/tokens-next-private/json/functional/themes/dark.json +588 -0
  143. package/tokens-next-private/json/functional/themes/light-colorblind.json +613 -0
  144. package/tokens-next-private/json/functional/themes/light-high-contrast.json +613 -0
  145. package/tokens-next-private/json/functional/themes/light-tritanopia.json +613 -0
  146. package/tokens-next-private/json/functional/themes/light.json +613 -0
  147. package/tokens-next-private/json/functional/typography/typography.json +72 -0
  148. package/tokens-next-private/removed/color.json +421 -0
  149. package/tokens-next-private/scss/base/color/dark-colorblind.scss +102 -0
  150. package/tokens-next-private/scss/base/color/dark-dimmed.scss +102 -0
  151. package/tokens-next-private/scss/base/color/dark-high-contrast.scss +102 -0
  152. package/tokens-next-private/scss/base/color/dark-tritanopia.scss +102 -0
  153. package/tokens-next-private/scss/base/color/dark.scss +102 -0
  154. package/tokens-next-private/scss/base/color/light-colorblind.scss +102 -0
  155. package/tokens-next-private/scss/base/color/light-high-contrast.scss +102 -0
  156. package/tokens-next-private/scss/base/color/light-tritanopia.scss +102 -0
  157. package/tokens-next-private/scss/base/color/light.scss +102 -0
  158. package/tokens-next-private/scss/base/size/size.scss +26 -0
  159. package/tokens-next-private/scss/base/typography/typography.scss +13 -0
  160. package/tokens-next-private/scss/functional/size/border.scss +20 -0
  161. package/tokens-next-private/scss/functional/size/breakpoints.scss +15 -0
  162. package/tokens-next-private/scss/functional/size/size-coarse.scss +12 -0
  163. package/tokens-next-private/scss/functional/size/size-fine.scss +12 -0
  164. package/tokens-next-private/scss/functional/size/size.scss +56 -0
  165. package/tokens-next-private/scss/functional/size/viewport.scss +24 -0
  166. package/tokens-next-private/scss/functional/themes/dark-colorblind.scss +305 -0
  167. package/tokens-next-private/scss/functional/themes/dark-dimmed.scss +305 -0
  168. package/tokens-next-private/scss/functional/themes/dark-high-contrast.scss +305 -0
  169. package/tokens-next-private/scss/functional/themes/dark-tritanopia.scss +305 -0
  170. package/tokens-next-private/scss/functional/themes/dark.scss +305 -0
  171. package/tokens-next-private/scss/functional/themes/light-colorblind.scss +280 -0
  172. package/tokens-next-private/scss/functional/themes/light-high-contrast.scss +280 -0
  173. package/tokens-next-private/scss/functional/themes/light-tritanopia.scss +280 -0
  174. package/tokens-next-private/scss/functional/themes/light.scss +280 -0
  175. package/tokens-next-private/scss/functional/typography/typography.scss +49 -0
  176. package/tokens-next-private/ts/base/color/dark-colorblind.ts +122 -0
  177. package/tokens-next-private/ts/base/color/dark-dimmed.ts +122 -0
  178. package/tokens-next-private/ts/base/color/dark-high-contrast.ts +122 -0
  179. package/tokens-next-private/ts/base/color/dark-tritanopia.ts +122 -0
  180. package/tokens-next-private/ts/base/color/dark.ts +122 -0
  181. package/tokens-next-private/ts/base/color/light-colorblind.ts +122 -0
  182. package/tokens-next-private/ts/base/color/light-high-contrast.ts +122 -0
  183. package/tokens-next-private/ts/base/color/light-tritanopia.ts +122 -0
  184. package/tokens-next-private/ts/base/color/light.ts +122 -0
  185. package/tokens-next-private/ts/base/size/size.ts +28 -0
  186. package/tokens-next-private/ts/base/typography/typography.ts +17 -0
  187. package/tokens-next-private/ts/functional/size/border.ts +28 -0
  188. package/tokens-next-private/ts/functional/size/breakpoints.ts +15 -0
  189. package/tokens-next-private/ts/functional/size/size-coarse.ts +24 -0
  190. package/tokens-next-private/ts/functional/size/size-fine.ts +24 -0
  191. package/tokens-next-private/ts/functional/size/size.ts +98 -0
  192. package/tokens-next-private/ts/functional/size/viewport.ts +15 -0
  193. package/tokens-next-private/ts/functional/themes/dark-colorblind.ts +593 -0
  194. package/tokens-next-private/ts/functional/themes/dark-dimmed.ts +593 -0
  195. package/tokens-next-private/ts/functional/themes/dark-high-contrast.ts +593 -0
  196. package/tokens-next-private/ts/functional/themes/dark-tritanopia.ts +593 -0
  197. package/tokens-next-private/ts/functional/themes/dark.ts +593 -0
  198. package/tokens-next-private/ts/functional/themes/light-colorblind.ts +618 -0
  199. package/tokens-next-private/ts/functional/themes/light-high-contrast.ts +618 -0
  200. package/tokens-next-private/ts/functional/themes/light-tritanopia.ts +618 -0
  201. package/tokens-next-private/ts/functional/themes/light.ts +618 -0
  202. package/tokens-next-private/ts/functional/typography/typography.ts +77 -0
  203. package/tokens-next-private/ts/types/BaseColorDesignTokens.d.ts +125 -0
  204. package/tokens-next-private/ts/types/SizeDesignTokens.d.ts +143 -0
  205. package/tokens-next-private/ts/types/ThemeDesignTokens.d.ts +635 -0
  206. package/tokens-next-private/ts/types/TypographyDesignTokens.d.ts +87 -0
  207. package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
  208. package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
  209. package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
  210. package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
  211. package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
  212. package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
  213. package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
  214. package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
  215. package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
  216. package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
  217. package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
  218. package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
  219. package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
  220. package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
  221. package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
  222. package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
  223. package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
  224. package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
  225. package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
  226. package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
  227. package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
  228. package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
  229. package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
  230. package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
  231. package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
  232. package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
  233. package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
  234. package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
  235. package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
  236. package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
  237. package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
  238. package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
  239. package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
  240. package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
  241. package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
  242. package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
  243. package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
  244. package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
  245. package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
  246. package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
  247. package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
  248. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  249. package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
  250. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  251. package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
  252. package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
  253. package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
  254. package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
  255. package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
  256. package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
  257. package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
  258. package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
  259. package/tokens-v2-private/ts/tokens/functional/typography/typography.js +1 -1
package/README.md CHANGED
@@ -11,7 +11,7 @@ This repo contains values for color, spacing, and typography primitives for use
11
11
  This repository is distributed on [npm][npm]. After [installing npm][install-npm], you can install `@primer/primitives` with this command.
12
12
 
13
13
  ```sh
14
- $ npm install --save @primer/primitives
14
+ npm install --save @primer/primitives
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -114,6 +114,58 @@ During the build process, the `removed.json` files will be added to a `dist/remo
114
114
  + colors.json
115
115
  ```
116
116
 
117
+ ## V8 Tokens
118
+
119
+ With `/primitives` version 8, design tokens have been moved to json files in the [src/tokens](./src/tokens/) directory. Those tokens are compiled with [style dictionary](https://amzn.github.io/style-dictionary/#/) in [scripts/buildTokens.ts](./scripts/buildTokens.ts).
120
+
121
+ To make working with tokens easier, we added some additional functionality on top of what style dictionary comes with:
122
+
123
+ ### Extending and Overwriting
124
+
125
+ We have two main color modes: `light` and `dark`. Additionally we have specific accessibility modes based on those, such as `light high contrast`.
126
+
127
+ We added a way to create a mode by only including the changes from the main mode. We call this `overrides`.
128
+ `Overrides` are cerated in `src/tokens/functional/color/[light|dark]/overrides/` and have to be added to [themes.config.ts](./scripts/themes.config.ts) to work.
129
+ In the individual files, e.g. `light.high-contrast.json5` you can now add tokens in the same structure as in any main file, e.g. `primitives-light.json5` to replace them.
130
+
131
+ ### Transforming Colors with Alpha and Mix
132
+
133
+ #### Alpha
134
+
135
+ You can create color tokens that inherit a color but have a different alpha value by adding the `alpha` property.
136
+ **Note:** The original alpha value will be replaced by your value. If you add `alpha: 0.4` to a color, it doesn't matter if the color you reference has no `alpha` or `alpha: 0.7`, the new token will always have newly the defined value of `alpha: 0.4`.
137
+
138
+ ```js
139
+ {
140
+ muted: {
141
+ $value: '{base.color.blue.3}',
142
+ alpha: 0.4, // the opacity value of the color === 40% opaque
143
+ $type: 'color',
144
+ }
145
+ }
146
+ ```
147
+
148
+ #### Mix
149
+
150
+ In rare cases, you may need to create a color between two steps in the color scale, e.g. between `gray.4` and `gray.5`. A common example are interactive states, like `hover` where a full step on the color scale would be to much. For those cases you can use the `mix` property.
151
+
152
+ The `mix` proeprty mixes the color it gets into the main color from the `$value` attribute. The amount added is controlled by the `weight`. A weight of `0.1` adds 10% of the color, and a weight of `0.75` adds 75%.
153
+
154
+ A `mix` proprty must always have a `color` and a `weight` child. `color` can be a `hex` value or a reference to a valid color. The `weight` property must receive a value between `0.0` and `1`.
155
+
156
+ ```js
157
+ {
158
+ control: {
159
+ $value: '{base.color.gray.4}', // main color
160
+ $type: 'color',
161
+ mix: {
162
+ color: '{base.color.gray.5}', // color to mix into the main color
163
+ weight: 0.2, // amount of the mix color that is added === 20% of gray.5 is mix into gray.4
164
+ },
165
+ }
166
+ }
167
+ ```
168
+
117
169
  ## License
118
170
 
119
171
  [MIT](./LICENSE) © [GitHub](https://github.com/)