@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.
- package/README.md +53 -1
- package/dist/color-contrast-check.json +1 -1
- package/dist/js/colors/dark.js +40 -40
- package/dist/js/colors/dark_colorblind.js +40 -40
- package/dist/js/colors/dark_dimmed.js +40 -40
- package/dist/js/colors/dark_high_contrast.js +24 -24
- package/dist/js/colors/dark_tritanopia.js +40 -40
- package/dist/js/colors/light.js +44 -44
- package/dist/js/colors/light_colorblind.js +16 -16
- package/dist/js/colors/light_high_contrast.js +9 -9
- package/dist/js/colors/light_tritanopia.js +16 -16
- package/dist/json/colors/dark.json +40 -40
- package/dist/json/colors/dark_colorblind.json +40 -40
- package/dist/json/colors/dark_dimmed.json +40 -40
- package/dist/json/colors/dark_high_contrast.json +24 -24
- package/dist/json/colors/dark_tritanopia.json +40 -40
- package/dist/json/colors/light.json +44 -44
- package/dist/json/colors/light_colorblind.json +16 -16
- package/dist/json/colors/light_high_contrast.json +9 -9
- package/dist/json/colors/light_tritanopia.json +16 -16
- package/dist/scss/colors/_dark.scss +40 -40
- package/dist/scss/colors/_dark_colorblind.scss +40 -40
- package/dist/scss/colors/_dark_dimmed.scss +40 -40
- package/dist/scss/colors/_dark_high_contrast.scss +24 -24
- package/dist/scss/colors/_dark_tritanopia.scss +40 -40
- package/dist/scss/colors/_light.scss +44 -44
- package/dist/scss/colors/_light_colorblind.scss +16 -16
- package/dist/scss/colors/_light_high_contrast.scss +9 -9
- package/dist/scss/colors/_light_tritanopia.scss +16 -16
- package/dist/ts/colors/dark.ts +40 -40
- package/dist/ts/colors/dark_colorblind.ts +40 -40
- package/dist/ts/colors/dark_dimmed.ts +40 -40
- package/dist/ts/colors/dark_high_contrast.ts +24 -24
- package/dist/ts/colors/dark_tritanopia.ts +40 -40
- package/dist/ts/colors/light.ts +44 -44
- package/dist/ts/colors/light_colorblind.ts +16 -16
- package/dist/ts/colors/light_high_contrast.ts +9 -9
- package/dist/ts/colors/light_tritanopia.ts +16 -16
- package/package.json +15 -14
- package/tokens-next-private/css/base/color/dark-colorblind.css +198 -0
- package/tokens-next-private/css/base/color/dark-dimmed.css +198 -0
- package/tokens-next-private/css/base/color/dark-high-contrast.css +198 -0
- package/tokens-next-private/css/base/color/dark-tritanopia.css +198 -0
- package/tokens-next-private/css/base/color/dark.css +198 -0
- package/tokens-next-private/css/base/color/light-colorblind.css +198 -0
- package/tokens-next-private/css/base/color/light-high-contrast.css +198 -0
- package/tokens-next-private/css/base/color/light-tritanopia.css +198 -0
- package/tokens-next-private/css/base/color/light.css +198 -0
- package/tokens-next-private/css/base/size/size.css +24 -0
- package/tokens-next-private/css/base/typography/typography.css +11 -0
- package/tokens-next-private/css/functional/size/border.css +18 -0
- package/tokens-next-private/css/functional/size/breakpoints.css +13 -0
- package/tokens-next-private/css/functional/size/size-coarse.css +10 -0
- package/tokens-next-private/css/functional/size/size-fine.css +10 -0
- package/tokens-next-private/css/functional/size/size.css +54 -0
- package/tokens-next-private/css/functional/size/viewport.css +13 -0
- package/tokens-next-private/css/functional/themes/dark-colorblind.css +604 -0
- package/tokens-next-private/css/functional/themes/dark-dimmed.css +604 -0
- package/tokens-next-private/css/functional/themes/dark-high-contrast.css +604 -0
- package/tokens-next-private/css/functional/themes/dark-tritanopia.css +604 -0
- package/tokens-next-private/css/functional/themes/dark.css +604 -0
- package/tokens-next-private/css/functional/themes/light-colorblind.css +554 -0
- package/tokens-next-private/css/functional/themes/light-high-contrast.css +554 -0
- package/tokens-next-private/css/functional/themes/light-tritanopia.css +554 -0
- package/tokens-next-private/css/functional/themes/light.css +554 -0
- package/tokens-next-private/css/functional/typography/typography.css +47 -0
- package/tokens-next-private/docs/base/color/dark-colorblind.json +1419 -0
- package/tokens-next-private/docs/base/color/dark-dimmed.json +1419 -0
- package/tokens-next-private/docs/base/color/dark-high-contrast.json +1419 -0
- package/tokens-next-private/docs/base/color/dark-tritanopia.json +1419 -0
- package/tokens-next-private/docs/base/color/dark.json +1419 -0
- package/tokens-next-private/docs/base/color/light-colorblind.json +1419 -0
- package/tokens-next-private/docs/base/color/light-high-contrast.json +1419 -0
- package/tokens-next-private/docs/base/color/light-tritanopia.json +1419 -0
- package/tokens-next-private/docs/base/color/light.json +1419 -0
- package/tokens-next-private/docs/base/size/size.json +227 -0
- package/tokens-next-private/docs/base/typography/typography.json +60 -0
- package/tokens-next-private/docs/functional/size/border.json +135 -0
- package/tokens-next-private/docs/functional/size/breakpoints.json +82 -0
- package/tokens-next-private/docs/functional/size/size-coarse.json +55 -0
- package/tokens-next-private/docs/functional/size/size-fine.json +55 -0
- package/tokens-next-private/docs/functional/size/size.json +647 -0
- package/tokens-next-private/docs/functional/size/viewport.json +70 -0
- package/tokens-next-private/docs/functional/themes/dark-colorblind.json +4535 -0
- package/tokens-next-private/docs/functional/themes/dark-dimmed.json +4539 -0
- package/tokens-next-private/docs/functional/themes/dark-high-contrast.json +4543 -0
- package/tokens-next-private/docs/functional/themes/dark-tritanopia.json +4539 -0
- package/tokens-next-private/docs/functional/themes/dark.json +4539 -0
- package/tokens-next-private/docs/functional/themes/light-colorblind.json +4241 -0
- package/tokens-next-private/docs/functional/themes/light-high-contrast.json +4231 -0
- package/tokens-next-private/docs/functional/themes/light-tritanopia.json +4231 -0
- package/tokens-next-private/docs/functional/themes/light.json +4231 -0
- package/tokens-next-private/docs/functional/typography/typography.json +581 -0
- package/tokens-next-private/js/base/color/dark-colorblind.js +122 -0
- package/tokens-next-private/js/base/color/dark-dimmed.js +122 -0
- package/tokens-next-private/js/base/color/dark-high-contrast.js +122 -0
- package/tokens-next-private/js/base/color/dark-tritanopia.js +122 -0
- package/tokens-next-private/js/base/color/dark.js +122 -0
- package/tokens-next-private/js/base/color/light-colorblind.js +122 -0
- package/tokens-next-private/js/base/color/light-high-contrast.js +122 -0
- package/tokens-next-private/js/base/color/light-tritanopia.js +122 -0
- package/tokens-next-private/js/base/color/light.js +122 -0
- package/tokens-next-private/js/base/size/size.js +28 -0
- package/tokens-next-private/js/base/typography/typography.js +17 -0
- package/tokens-next-private/js/functional/size/border.js +28 -0
- package/tokens-next-private/js/functional/size/breakpoints.js +15 -0
- package/tokens-next-private/js/functional/size/size-coarse.js +24 -0
- package/tokens-next-private/js/functional/size/size-fine.js +24 -0
- package/tokens-next-private/js/functional/size/size.js +98 -0
- package/tokens-next-private/js/functional/size/viewport.js +15 -0
- package/tokens-next-private/js/functional/themes/dark-colorblind.js +593 -0
- package/tokens-next-private/js/functional/themes/dark-dimmed.js +593 -0
- package/tokens-next-private/js/functional/themes/dark-high-contrast.js +593 -0
- package/tokens-next-private/js/functional/themes/dark-tritanopia.js +593 -0
- package/tokens-next-private/js/functional/themes/dark.js +593 -0
- package/tokens-next-private/js/functional/themes/light-colorblind.js +618 -0
- package/tokens-next-private/js/functional/themes/light-high-contrast.js +618 -0
- package/tokens-next-private/js/functional/themes/light-tritanopia.js +618 -0
- package/tokens-next-private/js/functional/themes/light.js +618 -0
- package/tokens-next-private/js/functional/typography/typography.js +77 -0
- package/tokens-next-private/json/base/color/dark-colorblind.json +117 -0
- package/tokens-next-private/json/base/color/dark-dimmed.json +117 -0
- package/tokens-next-private/json/base/color/dark-high-contrast.json +117 -0
- package/tokens-next-private/json/base/color/dark-tritanopia.json +117 -0
- package/tokens-next-private/json/base/color/dark.json +117 -0
- package/tokens-next-private/json/base/color/light-colorblind.json +117 -0
- package/tokens-next-private/json/base/color/light-high-contrast.json +117 -0
- package/tokens-next-private/json/base/color/light-tritanopia.json +117 -0
- package/tokens-next-private/json/base/color/light.json +117 -0
- package/tokens-next-private/json/base/size/size.json +23 -0
- package/tokens-next-private/json/base/typography/typography.json +12 -0
- package/tokens-next-private/json/functional/size/border.json +23 -0
- package/tokens-next-private/json/functional/size/breakpoints.json +10 -0
- package/tokens-next-private/json/functional/size/size-coarse.json +19 -0
- package/tokens-next-private/json/functional/size/size-fine.json +19 -0
- package/tokens-next-private/json/functional/size/size.json +93 -0
- package/tokens-next-private/json/functional/size/viewport.json +10 -0
- package/tokens-next-private/json/functional/themes/dark-colorblind.json +588 -0
- package/tokens-next-private/json/functional/themes/dark-dimmed.json +588 -0
- package/tokens-next-private/json/functional/themes/dark-high-contrast.json +588 -0
- package/tokens-next-private/json/functional/themes/dark-tritanopia.json +588 -0
- package/tokens-next-private/json/functional/themes/dark.json +588 -0
- package/tokens-next-private/json/functional/themes/light-colorblind.json +613 -0
- package/tokens-next-private/json/functional/themes/light-high-contrast.json +613 -0
- package/tokens-next-private/json/functional/themes/light-tritanopia.json +613 -0
- package/tokens-next-private/json/functional/themes/light.json +613 -0
- package/tokens-next-private/json/functional/typography/typography.json +72 -0
- package/tokens-next-private/removed/color.json +421 -0
- package/tokens-next-private/scss/base/color/dark-colorblind.scss +102 -0
- package/tokens-next-private/scss/base/color/dark-dimmed.scss +102 -0
- package/tokens-next-private/scss/base/color/dark-high-contrast.scss +102 -0
- package/tokens-next-private/scss/base/color/dark-tritanopia.scss +102 -0
- package/tokens-next-private/scss/base/color/dark.scss +102 -0
- package/tokens-next-private/scss/base/color/light-colorblind.scss +102 -0
- package/tokens-next-private/scss/base/color/light-high-contrast.scss +102 -0
- package/tokens-next-private/scss/base/color/light-tritanopia.scss +102 -0
- package/tokens-next-private/scss/base/color/light.scss +102 -0
- package/tokens-next-private/scss/base/size/size.scss +26 -0
- package/tokens-next-private/scss/base/typography/typography.scss +13 -0
- package/tokens-next-private/scss/functional/size/border.scss +20 -0
- package/tokens-next-private/scss/functional/size/breakpoints.scss +15 -0
- package/tokens-next-private/scss/functional/size/size-coarse.scss +12 -0
- package/tokens-next-private/scss/functional/size/size-fine.scss +12 -0
- package/tokens-next-private/scss/functional/size/size.scss +56 -0
- package/tokens-next-private/scss/functional/size/viewport.scss +24 -0
- package/tokens-next-private/scss/functional/themes/dark-colorblind.scss +305 -0
- package/tokens-next-private/scss/functional/themes/dark-dimmed.scss +305 -0
- package/tokens-next-private/scss/functional/themes/dark-high-contrast.scss +305 -0
- package/tokens-next-private/scss/functional/themes/dark-tritanopia.scss +305 -0
- package/tokens-next-private/scss/functional/themes/dark.scss +305 -0
- package/tokens-next-private/scss/functional/themes/light-colorblind.scss +280 -0
- package/tokens-next-private/scss/functional/themes/light-high-contrast.scss +280 -0
- package/tokens-next-private/scss/functional/themes/light-tritanopia.scss +280 -0
- package/tokens-next-private/scss/functional/themes/light.scss +280 -0
- package/tokens-next-private/scss/functional/typography/typography.scss +49 -0
- package/tokens-next-private/ts/base/color/dark-colorblind.ts +122 -0
- package/tokens-next-private/ts/base/color/dark-dimmed.ts +122 -0
- package/tokens-next-private/ts/base/color/dark-high-contrast.ts +122 -0
- package/tokens-next-private/ts/base/color/dark-tritanopia.ts +122 -0
- package/tokens-next-private/ts/base/color/dark.ts +122 -0
- package/tokens-next-private/ts/base/color/light-colorblind.ts +122 -0
- package/tokens-next-private/ts/base/color/light-high-contrast.ts +122 -0
- package/tokens-next-private/ts/base/color/light-tritanopia.ts +122 -0
- package/tokens-next-private/ts/base/color/light.ts +122 -0
- package/tokens-next-private/ts/base/size/size.ts +28 -0
- package/tokens-next-private/ts/base/typography/typography.ts +17 -0
- package/tokens-next-private/ts/functional/size/border.ts +28 -0
- package/tokens-next-private/ts/functional/size/breakpoints.ts +15 -0
- package/tokens-next-private/ts/functional/size/size-coarse.ts +24 -0
- package/tokens-next-private/ts/functional/size/size-fine.ts +24 -0
- package/tokens-next-private/ts/functional/size/size.ts +98 -0
- package/tokens-next-private/ts/functional/size/viewport.ts +15 -0
- package/tokens-next-private/ts/functional/themes/dark-colorblind.ts +593 -0
- package/tokens-next-private/ts/functional/themes/dark-dimmed.ts +593 -0
- package/tokens-next-private/ts/functional/themes/dark-high-contrast.ts +593 -0
- package/tokens-next-private/ts/functional/themes/dark-tritanopia.ts +593 -0
- package/tokens-next-private/ts/functional/themes/dark.ts +593 -0
- package/tokens-next-private/ts/functional/themes/light-colorblind.ts +618 -0
- package/tokens-next-private/ts/functional/themes/light-high-contrast.ts +618 -0
- package/tokens-next-private/ts/functional/themes/light-tritanopia.ts +618 -0
- package/tokens-next-private/ts/functional/themes/light.ts +618 -0
- package/tokens-next-private/ts/functional/typography/typography.ts +77 -0
- package/tokens-next-private/ts/types/BaseColorDesignTokens.d.ts +125 -0
- package/tokens-next-private/ts/types/SizeDesignTokens.d.ts +143 -0
- package/tokens-next-private/ts/types/ThemeDesignTokens.d.ts +635 -0
- package/tokens-next-private/ts/types/TypographyDesignTokens.d.ts +87 -0
- package/tokens-v2-private/css/tokens/base/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/base/typography/typography.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/border.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/breakpoints.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-coarse.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size-fine.css +1 -1
- package/tokens-v2-private/css/tokens/functional/size/size.css +1 -1
- package/tokens-v2-private/css/tokens/functional/typography/typography.css +1 -1
- package/tokens-v2-private/js/module/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/module/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/js/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/js/tokens/functional/typography/typography.js +1 -1
- package/tokens-v2-private/scss/tokens/base/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/base/typography/typography.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/border.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/breakpoints.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-coarse.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size-fine.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/size.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/size/viewport.scss +1 -1
- package/tokens-v2-private/scss/tokens/functional/typography/typography.scss +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/base/typography/typography.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/border.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/breakpoints.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-coarse.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size-fine.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/size.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/tokens-v2-private/ts/tokens/functional/size/viewport.js +1 -1
- package/tokens-v2-private/ts/tokens/functional/typography/typography.d.ts +1 -1
- 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
|
-
|
|
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/)
|