@kiva/kv-tokens 0.11.1 → 0.13.0
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/CHANGELOG.md +39 -0
- package/README.md +52 -0
- package/configs/kivaColors.js +16 -14
- package/configs/tailwind.config.js +3 -6
- package/package.json +2 -8
- package/primitives.json +17 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.13.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@0.12.0...@kiva/kv-tokens@0.13.0) (2021-10-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **KvTokens:** Add lg (40px) border radius ([9aa3c89](https://github.com/kiva/kv-ui-elements/commit/9aa3c89de329ad434b7022a2288aaa38af91056b))
|
|
12
|
+
* **KvTokens:** Improve border-tertiary visibility in mint theme ([b216817](https://github.com/kiva/kv-ui-elements/commit/b216817e6132c8d3cbc8246feb3d61da724ff319))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [0.12.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@0.11.3...@kiva/kv-tokens@0.12.0) (2021-09-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **KvThemeProvider:** Add darkGreen theme ([8eaf80c](https://github.com/kiva/kv-ui-elements/commit/8eaf80cd9063d6f4468b131464ca1b7f5d127360))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [0.11.3](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@0.11.2...@kiva/kv-tokens@0.11.3) (2021-09-14)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package @kiva/kv-tokens
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.11.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@0.11.1...@kiva/kv-tokens@0.11.2) (2021-09-08)
|
|
38
|
+
|
|
39
|
+
**Note:** Version bump only for package @kiva/kv-tokens
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
6
45
|
## [0.11.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-tokens@0.11.0...@kiva/kv-tokens@0.11.1) (2021-09-01)
|
|
7
46
|
|
|
8
47
|
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# kv-tokens
|
|
2
|
+
|
|
3
|
+
The package contains
|
|
4
|
+
|
|
5
|
+
- A JSON file specifying the design definitions of Kiva's style guide.
|
|
6
|
+
- A custom Tailwind configuration set to Kiva's style guide that can be used as a preset for your Tailwind project.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
`npm i --save-dev @kiva/kv-tokens`
|
|
11
|
+
|
|
12
|
+
## Using the Design Definitions
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
const designTokens = require("@kiva/kv-tokens/primitives.json");
|
|
16
|
+
|
|
17
|
+
const primaryTextColor = designTokens.colors.theme.DEFAULT.text.primary;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Using the Tailwind Preset
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// tailwind.config.js
|
|
24
|
+
module.exports = {
|
|
25
|
+
presets: [require("@kiva/kv-tokens/configs/tailwind.config")],
|
|
26
|
+
// Project-specific customizations
|
|
27
|
+
theme: {
|
|
28
|
+
//...
|
|
29
|
+
},
|
|
30
|
+
purge: [
|
|
31
|
+
//...
|
|
32
|
+
],
|
|
33
|
+
// ...
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
See the [Tailwind documentation](https://tailwindcss.com/docs/configuration#presets) for more information on using a preset.
|
|
38
|
+
|
|
39
|
+
### Notable Config Differences
|
|
40
|
+
|
|
41
|
+
Our Tailwind config has some differences to the standard install. Notably
|
|
42
|
+
|
|
43
|
+
- All Tailwind classes are prefixed with "tw-". E.g., `tw-mb-1` instead of `mb-1`.
|
|
44
|
+
- Themable color names instead of the default Tailwind colors. E.g., `tw-bg-primary` instead of `tw-bg-gray-500`.
|
|
45
|
+
See our [Storybook](https://main--608b4cf87f686c00213841b1.chromatic.com/?path=/docs/base-styling-primitives--primitives) for possible names.
|
|
46
|
+
- Our spacing scale is based on 8px rather Tailwind's default 4px.
|
|
47
|
+
|
|
48
|
+
## Contribution Guidelines
|
|
49
|
+
|
|
50
|
+
The Kiva UI project is bound by a [Code of Conduct](https://github.com/kiva/ui/blob/master/code_of_conduct.md).
|
|
51
|
+
|
|
52
|
+
Kiva welcomes outside contributions to our UI repository. If you have any ideas for a feature or improvement, create an issue and we can discuss whether it makes sense to create a pull request. Thanks for the help!
|
package/configs/kivaColors.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
const { hexToRGB } = require('./util');
|
|
2
2
|
const designtokens = require('../primitives.json');
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const {
|
|
5
|
+
DEFAULT: defaultThemeTokens,
|
|
6
|
+
dark: darkThemeTokens,
|
|
7
|
+
'dark-green': darkGreenThemeTokens,
|
|
8
|
+
mint: mintThemeTokens,
|
|
9
|
+
} = designtokens.colors.theme;
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Loops through a theme object and builds a set of CSS custom properties
|
|
10
13
|
* They will be referenced by Tailwind classes.
|
|
11
14
|
*/
|
|
12
|
-
const
|
|
15
|
+
const buildCSSVarsFromTokens = (theme) => {
|
|
13
16
|
const customProperties = {};
|
|
14
17
|
const themeCategories = Object.keys(theme);
|
|
15
18
|
|
|
@@ -27,14 +30,10 @@ const buildCSSCustomPropertiesFromTheme = (theme) => {
|
|
|
27
30
|
return customProperties;
|
|
28
31
|
};
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
default: buildCSSCustomPropertiesFromTheme(defaultTheme),
|
|
35
|
-
dark: buildCSSCustomPropertiesFromTheme(darkTheme),
|
|
36
|
-
mint: buildCSSCustomPropertiesFromTheme(mintTheme),
|
|
37
|
-
};
|
|
33
|
+
const defaultTheme = buildCSSVarsFromTokens(defaultThemeTokens);
|
|
34
|
+
const darkTheme = buildCSSVarsFromTokens(darkThemeTokens);
|
|
35
|
+
const mintTheme = buildCSSVarsFromTokens(mintThemeTokens);
|
|
36
|
+
const darkGreenTheme = buildCSSVarsFromTokens(darkGreenThemeTokens);
|
|
38
37
|
|
|
39
38
|
// function to allow background opacity and text opacity with tailwind colors
|
|
40
39
|
// https://www.youtube.com/watch?v=MAtaT8BZEAo
|
|
@@ -73,7 +72,7 @@ const buildColorChoices = (themeProperty) => {
|
|
|
73
72
|
const property = {};
|
|
74
73
|
// themable properties
|
|
75
74
|
// Read from the default theme since it will have all of the keys
|
|
76
|
-
Object.keys(
|
|
75
|
+
Object.keys(defaultThemeTokens[themeProperty]).forEach((key) => {
|
|
77
76
|
property[key] = withOpacity(`--${twPrefix}-${key}`);
|
|
78
77
|
});
|
|
79
78
|
return property;
|
|
@@ -81,5 +80,8 @@ const buildColorChoices = (themeProperty) => {
|
|
|
81
80
|
|
|
82
81
|
module.exports = {
|
|
83
82
|
buildColorChoices,
|
|
84
|
-
|
|
83
|
+
defaultTheme,
|
|
84
|
+
darkTheme,
|
|
85
|
+
darkGreenTheme,
|
|
86
|
+
mintTheme,
|
|
85
87
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const plugin = require('tailwindcss/plugin');
|
|
2
2
|
const typographyPlugin = require('@tailwindcss/typography');
|
|
3
3
|
const kivaTypography = require('./kivaTypography');
|
|
4
|
-
const {
|
|
4
|
+
const { defaultTheme, buildColorChoices } = require('./kivaColors');
|
|
5
5
|
const designtokens = require('../primitives.json');
|
|
6
6
|
const { rem } = require('./util');
|
|
7
7
|
|
|
@@ -87,7 +87,7 @@ module.exports = {
|
|
|
87
87
|
sm: rem(radii.sm),
|
|
88
88
|
DEFAULT: rem(radii.default),
|
|
89
89
|
// md: '0.375rem',
|
|
90
|
-
|
|
90
|
+
lg: rem(radii.lg),
|
|
91
91
|
// xl: '0.75rem',
|
|
92
92
|
// '2xl': '1rem',
|
|
93
93
|
// '3xl': '1.5rem',
|
|
@@ -194,10 +194,7 @@ module.exports = {
|
|
|
194
194
|
addBase({
|
|
195
195
|
// add our default theme CSS color properties to the root
|
|
196
196
|
// so they'll available for Tailwind classes
|
|
197
|
-
':root':
|
|
198
|
-
...kivaThemes.static, // static colors
|
|
199
|
-
...kivaThemes.default, // themable colors
|
|
200
|
-
},
|
|
197
|
+
':root': defaultTheme, // themable colors
|
|
201
198
|
});
|
|
202
199
|
addUtilities({
|
|
203
200
|
'.text-base': textStyles.textBase,
|
package/package.json
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-tokens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"main": "index.js",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"tailwind-config-viewer": "tailwind-config-viewer -o -c ./configs/tailwind.config.js"
|
|
10
|
-
},
|
|
11
8
|
"dependencies": {
|
|
12
9
|
"@tailwindcss/typography": "^0.4.0",
|
|
13
10
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.1.0"
|
|
14
11
|
},
|
|
15
|
-
"
|
|
16
|
-
"tailwind-config-viewer": "^1.5.1"
|
|
17
|
-
},
|
|
18
|
-
"gitHead": "6a299a0c658379827cae3e681848ed9f39db8288"
|
|
12
|
+
"gitHead": "539035ff1ab0c4a0ef4ca2598e5506677ea8d9c9"
|
|
19
13
|
}
|
package/primitives.json
CHANGED
|
@@ -103,6 +103,21 @@
|
|
|
103
103
|
},
|
|
104
104
|
"background": {
|
|
105
105
|
"primary": "#95D4B3"
|
|
106
|
+
},
|
|
107
|
+
"border": {
|
|
108
|
+
"tertiary": "#4AB67E"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"dark-green": {
|
|
112
|
+
"text": {
|
|
113
|
+
"primary": "#F5F5F5",
|
|
114
|
+
"primary-inverse": "#212121",
|
|
115
|
+
"secondary": "#9E9E9E"
|
|
116
|
+
},
|
|
117
|
+
"background": {
|
|
118
|
+
"primary": "#2AA967",
|
|
119
|
+
"primary-inverse": "#F5F5F5",
|
|
120
|
+
"secondary": "#228752"
|
|
106
121
|
}
|
|
107
122
|
}
|
|
108
123
|
}
|
|
@@ -222,7 +237,8 @@
|
|
|
222
237
|
"shadows": {},
|
|
223
238
|
"radii": {
|
|
224
239
|
"sm": 4,
|
|
225
|
-
"default": 14
|
|
240
|
+
"default": 14,
|
|
241
|
+
"lg": 40
|
|
226
242
|
},
|
|
227
243
|
"opacity": {
|
|
228
244
|
"default": 1,
|