@primer/primitives 8.2.4-rc.e3ccaf09 → 8.2.4-rc.f820602a
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 +17 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Data is served from the `dist/` folder:
|
|
|
27
27
|
|
|
28
28
|
All available imports:
|
|
29
29
|
|
|
30
|
-
```
|
|
30
|
+
```css
|
|
31
31
|
/* size/typography */
|
|
32
32
|
@import '@primer/primitives/dist/css/base/size/size.css';
|
|
33
33
|
@import '@primer/primitives/dist/css/base/typography/typography.css';
|
|
@@ -70,13 +70,13 @@ In the individual files, e.g. `light.high-contrast.json5` you can now add tokens
|
|
|
70
70
|
You can create color tokens that inherit a color but have a different alpha value by adding the `alpha` property.
|
|
71
71
|
**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`.
|
|
72
72
|
|
|
73
|
-
```
|
|
73
|
+
```json5
|
|
74
74
|
{
|
|
75
75
|
muted: {
|
|
76
76
|
$value: '{base.color.blue.3}',
|
|
77
77
|
alpha: 0.4, // the opacity value of the color === 40% opaque
|
|
78
78
|
$type: 'color',
|
|
79
|
-
}
|
|
79
|
+
},
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -88,17 +88,17 @@ The `mix` proeprty mixes the color it gets into the main color from the `$value`
|
|
|
88
88
|
|
|
89
89
|
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`.
|
|
90
90
|
|
|
91
|
-
```
|
|
91
|
+
```json5
|
|
92
92
|
{
|
|
93
93
|
control: {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
$value: '{base.color.gray.4}', // main color
|
|
95
|
+
$type: 'color',
|
|
96
|
+
mix: {
|
|
97
|
+
color: '{base.color.gray.5}', // color to mix into the main color
|
|
98
|
+
weight: 0.2, // amount of the mix color that is added === 20% of gray.5 is mix into gray.4
|
|
99
|
+
},
|
|
99
100
|
},
|
|
100
101
|
}
|
|
101
|
-
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
#### Extensions property
|
|
@@ -113,7 +113,7 @@ For our Figma export we use the following meta data:
|
|
|
113
113
|
|
|
114
114
|
Code example
|
|
115
115
|
|
|
116
|
-
```
|
|
116
|
+
```json5
|
|
117
117
|
bgColor: {
|
|
118
118
|
$value: '{borderColor.accent.muted}',
|
|
119
119
|
$type: 'color',
|
|
@@ -133,18 +133,18 @@ Token names have to be in camelCase or kebab-case and may only include letters,
|
|
|
133
133
|
The only acception is the `@`-hack. This is used when you want to have a default value and sub-values, e.g. `bgColor.accent` and `bgColor.accent.muted`.
|
|
134
134
|
In this case you can create the follwing structure. The `@` will be removed from the name and act as the default value.
|
|
135
135
|
|
|
136
|
-
```
|
|
136
|
+
```json5
|
|
137
137
|
{
|
|
138
138
|
bgColor: {
|
|
139
139
|
accent: {
|
|
140
|
-
|
|
140
|
+
'@': {
|
|
141
141
|
// values for accent (default)
|
|
142
142
|
},
|
|
143
|
-
|
|
143
|
+
muted: {
|
|
144
144
|
// values for accent-muted
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
148
|
}
|
|
149
149
|
```
|
|
150
150
|
|
|
@@ -155,4 +155,3 @@ In this case you can create the follwing structure. The `@` will be removed from
|
|
|
155
155
|
[primer]: https://github.com/primer/primer
|
|
156
156
|
[npm]: https://www.npmjs.com/
|
|
157
157
|
[install-npm]: https://docs.npmjs.com/getting-started/installing-node
|
|
158
|
-
[scss]: https://sass-lang.com/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/primitives",
|
|
3
|
-
"version": "8.2.4-rc.
|
|
3
|
+
"version": "8.2.4-rc.f820602a",
|
|
4
4
|
"description": "Typography, spacing, and color primitives for Primer design system",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"format": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
|
|
34
34
|
"format:check": "prettier --check '**/*.{js,jsx,ts,tsx,md,mdx,css}'",
|
|
35
35
|
"install:storybook": "cd docs/storybook && npm ci --legacy-peer-deps --no-audit --no-fund",
|
|
36
|
-
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint '**/*.{js,ts,tsx,md,mdx}' --
|
|
36
|
+
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint '**/*.{js,ts,tsx,md,mdx}' --config .eslintrc.cjs && npm run lint:tokens",
|
|
37
37
|
"lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config .eslintrc.cjs",
|
|
38
38
|
"lint:tokens": "ts-node ./scripts/validateTokenJson.ts",
|
|
39
39
|
"prebuild": "rm -rf dist",
|