@madgex/design-system 9.3.0 → 10.0.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/README.md +52 -1
- package/dist/_tokens/css/{_tokens.css → variables.css} +3 -4
- package/dist/_tokens/js/_tokens-module.js +2599 -3884
- package/dist/_tokens/json/{_tokens-flat.json → variables-flat.json} +2 -28
- package/dist/_tokens/json/variables.json +331 -0
- package/dist/assets/icons.json +1 -1
- package/dist/css/index.css +1 -1
- package/dist/js/index.js +1 -1
- package/package.json +14 -17
- package/src/components/_preview.njk +1 -1
- package/src/components/inputs/combobox/combobox.scss +9 -3
- package/src/components/modal/modal.js +1 -1
- package/src/components/popover/popover.js +1 -1
- package/src/components/tabs/tabs.js +1 -1
- package/src/scss/constants/_sd-tokens.scss +1 -2
- package/src/tokens/_constants.json +35 -33
- package/src/tokens/color.json +64 -63
- package/src/tokens/custom.json +11 -7
- package/src/tokens/effects.json +4 -3
- package/src/tokens/email.json +30 -27
- package/src/tokens/size.json +16 -15
- package/src/tokens/typography.json +68 -62
- package/style-dictionary/color-transforms.js +143 -0
- package/style-dictionary/index.js +215 -0
- package/tasks/tokens.js +8 -26
- package/dist/_tokens/json/_tokens-nested.json +0 -4024
- package/src/tokens/_config.js +0 -181
- package/tasks/colorTransforms.js +0 -65
- package/tasks/registerTransforms.js +0 -17
package/src/tokens/_config.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const config = {
|
|
4
|
-
// This source path needs to be in posix because combineJSON util inside style dictionary only accepts that
|
|
5
|
-
source: [path.resolve(__dirname, '../tokens/*.json').split(path.sep).join(path.posix.sep)],
|
|
6
|
-
platforms: {
|
|
7
|
-
'css-variables': {
|
|
8
|
-
// transformGroup: 'css',
|
|
9
|
-
transforms: ['attribute/cti', 'name/cti/kebab', 'time/seconds', 'content/icon', 'color/css', 'css/rawData'],
|
|
10
|
-
buildPath: `${path.resolve(__dirname, '../../dist/_tokens/css/')}/`,
|
|
11
|
-
prefix: 'mds',
|
|
12
|
-
files: [
|
|
13
|
-
{
|
|
14
|
-
destination: '_tokens.css',
|
|
15
|
-
format: 'css/variables',
|
|
16
|
-
filter: 'removePrivate',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
'scss-variables': {
|
|
21
|
-
transforms: ['attribute/cti', 'name/cti/kebab'],
|
|
22
|
-
buildPath: `${path.resolve(__dirname, '../scss/constants/')}/`,
|
|
23
|
-
prefix: 'constant',
|
|
24
|
-
files: [
|
|
25
|
-
{
|
|
26
|
-
destination: '_sd-tokens.scss',
|
|
27
|
-
format: 'scss/map-deep',
|
|
28
|
-
options: {
|
|
29
|
-
themeable: false,
|
|
30
|
-
},
|
|
31
|
-
filter(token) {
|
|
32
|
-
// only keep "private" tokens aka constants
|
|
33
|
-
return !!(token && token.private);
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
// sketch: {
|
|
39
|
-
// transformGroup: 'web',
|
|
40
|
-
// buildPath: `${path.resolve(__dirname, '../../dist/_tokens/sketch/')}/`,
|
|
41
|
-
// prefix: 'mds',
|
|
42
|
-
// files: [
|
|
43
|
-
// {
|
|
44
|
-
// destination: '_tokens.sketchpalette',
|
|
45
|
-
// format: 'sketch/palette',
|
|
46
|
-
// },
|
|
47
|
-
// ],
|
|
48
|
-
// },
|
|
49
|
-
'json-flat': {
|
|
50
|
-
transformGroup: 'js',
|
|
51
|
-
transforms: ['attribute/cti', 'name/cti/kebab', 'color/css'],
|
|
52
|
-
buildPath: 'dist/_tokens/json/',
|
|
53
|
-
files: [
|
|
54
|
-
{
|
|
55
|
-
destination: '_tokens-flat.json',
|
|
56
|
-
format: 'json/flat',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
'json-nested': {
|
|
61
|
-
transformGroup: 'js',
|
|
62
|
-
transforms: ['attribute/cti', 'name/cti/kebab', 'color/css'],
|
|
63
|
-
buildPath: 'dist/_tokens/json/',
|
|
64
|
-
files: [
|
|
65
|
-
{
|
|
66
|
-
destination: '_tokens-nested.json',
|
|
67
|
-
format: 'json',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
// 'js-es6': {
|
|
72
|
-
// transformGroup: 'js',
|
|
73
|
-
// buildPath: 'dist/js/',
|
|
74
|
-
// prefix: 'mds',
|
|
75
|
-
// files: [
|
|
76
|
-
// {
|
|
77
|
-
// format: 'javascript/es6',
|
|
78
|
-
// destination: '_variables-es6.js',
|
|
79
|
-
// filter: {
|
|
80
|
-
// attributes: {
|
|
81
|
-
// category: 'color',
|
|
82
|
-
// },
|
|
83
|
-
// },
|
|
84
|
-
// },
|
|
85
|
-
// ],
|
|
86
|
-
// },
|
|
87
|
-
'js-module': {
|
|
88
|
-
transforms: ['attribute/cti', 'name/cti/pascal'],
|
|
89
|
-
buildPath: `${path.resolve(__dirname, '../../dist/_tokens/js/')}/`,
|
|
90
|
-
prefix: 'mds',
|
|
91
|
-
files: [
|
|
92
|
-
{
|
|
93
|
-
destination: '_tokens-module.js',
|
|
94
|
-
format: 'javascript/module',
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
// 'js-object': {
|
|
99
|
-
// transformGroup: 'js',
|
|
100
|
-
// buildPath: 'build/js/',
|
|
101
|
-
// files: [
|
|
102
|
-
// {
|
|
103
|
-
// destination: '_variables-object.js',
|
|
104
|
-
// format: 'javascript/object',
|
|
105
|
-
// },
|
|
106
|
-
// ],
|
|
107
|
-
// },
|
|
108
|
-
|
|
109
|
-
// android: {
|
|
110
|
-
// transformGroup: 'android',
|
|
111
|
-
// buildPath: 'build/android/',
|
|
112
|
-
// files: [
|
|
113
|
-
// {
|
|
114
|
-
// destination: 'font_dimens.xml',
|
|
115
|
-
// format: 'android/fontDimens',
|
|
116
|
-
// },
|
|
117
|
-
// {
|
|
118
|
-
// destination: 'colors.xml',
|
|
119
|
-
// format: 'android/colors',
|
|
120
|
-
// filter: {
|
|
121
|
-
// attributes: {
|
|
122
|
-
// category: 'color',
|
|
123
|
-
// },
|
|
124
|
-
// },
|
|
125
|
-
// },
|
|
126
|
-
// ],
|
|
127
|
-
// },
|
|
128
|
-
// ios: {
|
|
129
|
-
// transformGroup: 'ios',
|
|
130
|
-
// buildPath: 'build/ios/',
|
|
131
|
-
// files: [
|
|
132
|
-
// {
|
|
133
|
-
// destination: 'StyleDictionaryColor.h',
|
|
134
|
-
// format: 'ios/colors.h',
|
|
135
|
-
// className: 'StyleDictionaryColor',
|
|
136
|
-
// type: 'StyleDictionaryColorName',
|
|
137
|
-
// filter: {
|
|
138
|
-
// attributes: {
|
|
139
|
-
// category: 'color',
|
|
140
|
-
// },
|
|
141
|
-
// },
|
|
142
|
-
// },
|
|
143
|
-
// {
|
|
144
|
-
// destination: 'StyleDictionaryColor.m',
|
|
145
|
-
// format: 'ios/colors.m',
|
|
146
|
-
// className: 'StyleDictionaryColor',
|
|
147
|
-
// type: 'StyleDictionaryColorName',
|
|
148
|
-
// filter: {
|
|
149
|
-
// attributes: {
|
|
150
|
-
// category: 'color',
|
|
151
|
-
// },
|
|
152
|
-
// },
|
|
153
|
-
// },
|
|
154
|
-
// {
|
|
155
|
-
// destination: 'StyleDictionarySize.h',
|
|
156
|
-
// format: 'ios/static.h',
|
|
157
|
-
// className: 'StyleDictionarySize',
|
|
158
|
-
// type: 'float',
|
|
159
|
-
// filter: {
|
|
160
|
-
// attributes: {
|
|
161
|
-
// category: 'size',
|
|
162
|
-
// },
|
|
163
|
-
// },
|
|
164
|
-
// },
|
|
165
|
-
// {
|
|
166
|
-
// destination: 'StyleDictionarySize.m',
|
|
167
|
-
// format: 'ios/static.m',
|
|
168
|
-
// className: 'StyleDictionarySize',
|
|
169
|
-
// type: 'float',
|
|
170
|
-
// filter: {
|
|
171
|
-
// attributes: {
|
|
172
|
-
// category: 'size',
|
|
173
|
-
// },
|
|
174
|
-
// },
|
|
175
|
-
// },
|
|
176
|
-
// ],
|
|
177
|
-
// },
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
module.exports = config;
|
package/tasks/colorTransforms.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const { TinyColor } = require('@ctrl/tinycolor');
|
|
2
|
-
|
|
3
|
-
const TRANSFORM_AMOUNTS = {
|
|
4
|
-
LIGHT: 10,
|
|
5
|
-
LIGHTEST: 95,
|
|
6
|
-
DARK: 10,
|
|
7
|
-
DARKEST: 12,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// Replicates Sass lightness($color) function
|
|
11
|
-
function lightness(color) {
|
|
12
|
-
const { l } = color.toHsl();
|
|
13
|
-
|
|
14
|
-
return l * 100;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function createColorsFromBase({ value: baseColor }) {
|
|
18
|
-
const asTinyColor = new TinyColor(baseColor);
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
light: {
|
|
22
|
-
value: asTinyColor.lighten(TRANSFORM_AMOUNTS.LIGHT).toHexString(),
|
|
23
|
-
},
|
|
24
|
-
lightest: {
|
|
25
|
-
value: asTinyColor.lighten(TRANSFORM_AMOUNTS.LIGHTEST - lightness(asTinyColor)).toHexString(),
|
|
26
|
-
},
|
|
27
|
-
dark: {
|
|
28
|
-
value: asTinyColor.darken(TRANSFORM_AMOUNTS.DARK).toHexString(),
|
|
29
|
-
},
|
|
30
|
-
darkest: {
|
|
31
|
-
value: asTinyColor.darken(lightness(asTinyColor) - TRANSFORM_AMOUNTS.DARKEST).toHexString(),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function transformAllColors(colors) {
|
|
37
|
-
return colors.reduce((builtBrand, [name, color]) => {
|
|
38
|
-
if (!builtBrand[name]) {
|
|
39
|
-
// eslint-disable-next-line no-param-reassign
|
|
40
|
-
builtBrand[name] = { ...createColorsFromBase(color.base), ...color };
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return builtBrand;
|
|
44
|
-
}, {});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function generateBrandAndStatus({ brand, status }) {
|
|
48
|
-
if (status) {
|
|
49
|
-
return { brand: transformAllColors(Object.entries(brand)), status: transformAllColors(Object.entries(status)) };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return { brand: transformAllColors(Object.entries(brand)) };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function transformTokens(tokensObject) {
|
|
56
|
-
return {
|
|
57
|
-
...tokensObject,
|
|
58
|
-
color: {
|
|
59
|
-
...tokensObject.color,
|
|
60
|
-
...generateBrandAndStatus(tokensObject.color),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
module.exports = transformTokens;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function registerTransforms(StyleDictionary) {
|
|
2
|
-
return new Promise((resolve) => {
|
|
3
|
-
StyleDictionary.registerTransform({
|
|
4
|
-
name: 'css/rawData',
|
|
5
|
-
type: 'value',
|
|
6
|
-
matcher(prop) {
|
|
7
|
-
return prop.rawData;
|
|
8
|
-
},
|
|
9
|
-
transformer(prop) {
|
|
10
|
-
return prop.rawData;
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
resolve('Transform registered');
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.registerTransforms = registerTransforms;
|