@navikt/ds-tokens 0.6.2 → 0.8.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/dist/tokens-cjs.js +178 -6672
- package/dist/tokens.css +65 -186
- package/dist/tokens.js +68 -189
- package/dist/tokens.less +68 -189
- package/dist/tokens.scss +68 -189
- package/package.json +3 -3
- package/src/colors.json +49 -26
- package/src/index.js +8 -180
package/src/colors.json
CHANGED
|
@@ -74,16 +74,25 @@
|
|
|
74
74
|
"value": "rgba(241, 241, 241, 1)"
|
|
75
75
|
},
|
|
76
76
|
"200": {
|
|
77
|
-
"value": "rgba(
|
|
77
|
+
"value": "rgba(229, 229, 229, 1)"
|
|
78
|
+
},
|
|
79
|
+
"300": {
|
|
80
|
+
"value": "rgba(207, 207, 207, 1)"
|
|
78
81
|
},
|
|
79
82
|
"400": {
|
|
80
|
-
"value": "rgba(
|
|
83
|
+
"value": "rgba(176, 176, 176, 1)"
|
|
84
|
+
},
|
|
85
|
+
"500": {
|
|
86
|
+
"value": "rgba(143, 143, 143, 1)"
|
|
81
87
|
},
|
|
82
88
|
"600": {
|
|
83
|
-
"value": "rgba(
|
|
89
|
+
"value": "rgba(112, 112, 112, 1)"
|
|
90
|
+
},
|
|
91
|
+
"700": {
|
|
92
|
+
"value": "rgba(89, 89, 89, 1)"
|
|
84
93
|
},
|
|
85
94
|
"800": {
|
|
86
|
-
"value": "rgba(
|
|
95
|
+
"value": "rgba(64, 64, 64, 1)"
|
|
87
96
|
},
|
|
88
97
|
"900": {
|
|
89
98
|
"value": "rgba(38, 38, 38, 1)"
|
|
@@ -297,23 +306,26 @@
|
|
|
297
306
|
"semantic": {
|
|
298
307
|
"color": {
|
|
299
308
|
"border": {
|
|
300
|
-
"
|
|
301
|
-
"value": "{navds.global.color.gray.
|
|
309
|
+
"inverted": {
|
|
310
|
+
"value": "{navds.global.color.gray.200.value}"
|
|
302
311
|
},
|
|
303
312
|
"muted": {
|
|
304
313
|
"value": "{navds.global.color.gray.400.value}"
|
|
314
|
+
},
|
|
315
|
+
"@": {
|
|
316
|
+
"value": "{navds.global.color.gray.600.value}"
|
|
305
317
|
}
|
|
306
318
|
},
|
|
307
319
|
"canvas": {
|
|
308
320
|
"background": {
|
|
309
|
-
"default": {
|
|
310
|
-
"value": "{navds.global.color.gray.100.value}"
|
|
311
|
-
},
|
|
312
321
|
"inverted": {
|
|
313
322
|
"value": "{navds.global.color.gray.900.value}"
|
|
314
323
|
},
|
|
315
324
|
"light": {
|
|
316
325
|
"value": "{navds.global.color.white.value}"
|
|
326
|
+
},
|
|
327
|
+
"@": {
|
|
328
|
+
"value": "{navds.global.color.gray.100.value}"
|
|
317
329
|
}
|
|
318
330
|
}
|
|
319
331
|
},
|
|
@@ -383,50 +395,61 @@
|
|
|
383
395
|
}
|
|
384
396
|
},
|
|
385
397
|
"focus": {
|
|
386
|
-
"value": "{navds.global.color.blue.800.value}",
|
|
387
398
|
"inverted": {
|
|
388
399
|
"value": "{navds.global.color.blue.200.value}"
|
|
400
|
+
},
|
|
401
|
+
"@": {
|
|
402
|
+
"value": "{navds.global.color.blue.800.value}"
|
|
389
403
|
}
|
|
390
404
|
},
|
|
391
405
|
"interaction": {
|
|
392
406
|
"danger": {
|
|
393
|
-
"default": {
|
|
394
|
-
"value": "{navds.global.color.red.500.value}"
|
|
395
|
-
},
|
|
396
407
|
"hover": {
|
|
397
408
|
"value": "{navds.global.color.red.600.value}"
|
|
398
409
|
},
|
|
399
410
|
"selected": {
|
|
400
411
|
"value": "{navds.global.color.red.700.value}"
|
|
412
|
+
},
|
|
413
|
+
"@": {
|
|
414
|
+
"value": "{navds.global.color.red.500.value}"
|
|
401
415
|
}
|
|
402
416
|
},
|
|
403
417
|
"primary": {
|
|
404
|
-
"default": {
|
|
405
|
-
"value": "{navds.global.color.blue.500.value}"
|
|
406
|
-
},
|
|
407
418
|
"hover": {
|
|
408
|
-
"
|
|
419
|
+
"subtle": {
|
|
420
|
+
"value": "{navds.global.color.blue.50.value}"
|
|
421
|
+
},
|
|
422
|
+
"@": {
|
|
423
|
+
"value": "{navds.global.color.blue.600.value}"
|
|
424
|
+
}
|
|
409
425
|
},
|
|
410
426
|
"selected": {
|
|
411
427
|
"value": "{navds.global.color.deepblue.500.value}"
|
|
428
|
+
},
|
|
429
|
+
"@": {
|
|
430
|
+
"@": {
|
|
431
|
+
"value": "{navds.global.color.blue.500.value}"
|
|
432
|
+
}
|
|
412
433
|
}
|
|
413
434
|
}
|
|
414
435
|
},
|
|
415
|
-
"
|
|
416
|
-
"
|
|
417
|
-
"value": "{navds.global.color.
|
|
436
|
+
"link": {
|
|
437
|
+
"visited": {
|
|
438
|
+
"value": "{navds.global.color.purple.500.value}"
|
|
418
439
|
},
|
|
440
|
+
"@": {
|
|
441
|
+
"value": "{navds.global.color.blue.500.value}"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
"text": {
|
|
419
445
|
"inverted": {
|
|
420
446
|
"value": "{navds.global.color.white.value}"
|
|
421
447
|
},
|
|
422
|
-
"link": {
|
|
423
|
-
"value": "{navds.global.color.blue.500.value}",
|
|
424
|
-
"visited": {
|
|
425
|
-
"value": "{navds.global.color.purple.500.value}"
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
448
|
"muted": {
|
|
429
449
|
"value": "{navds.global.color.gray.600.value}"
|
|
450
|
+
},
|
|
451
|
+
"@": {
|
|
452
|
+
"value": "{navds.global.color.gray.900.value}"
|
|
430
453
|
}
|
|
431
454
|
}
|
|
432
455
|
}
|
package/src/index.js
CHANGED
|
@@ -1,144 +1,8 @@
|
|
|
1
|
-
const Color = require("color");
|
|
2
|
-
const newColors = require("./colors.json");
|
|
3
|
-
const newSpacing = require("./spacing.json");
|
|
4
|
-
|
|
5
1
|
const baseFontSize = 16;
|
|
6
|
-
|
|
7
2
|
const getFontSize = (size) => `${size / baseFontSize}rem`;
|
|
8
|
-
// https://github.com/hihayk/scale/blob/69b766bba2db046d3e8cb4026ae32a32c897f9ff/src/utils.js#L44
|
|
9
|
-
const mixColors = (color, step, amount, mixColor) => {
|
|
10
|
-
const saturation = Math.round(Color(color).hsl().color[1]);
|
|
11
|
-
// Setting directly to hex returns different result...
|
|
12
|
-
return Color(
|
|
13
|
-
Color(color)
|
|
14
|
-
.saturate(((step + 1) / 5) * (saturation / 100))
|
|
15
|
-
.mix(Color(mixColor), ((amount / 100) * (step + 1)) / 5)
|
|
16
|
-
.string()
|
|
17
|
-
).hex();
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const lightColor = (color, step) => mixColors(color, step, 100, "white");
|
|
21
|
-
const darkColor = (color, step) => mixColors(color, step, 85, "black");
|
|
22
|
-
|
|
23
|
-
const baseColors = {
|
|
24
|
-
blue: "#0067c5",
|
|
25
|
-
deepblue: "#005B82",
|
|
26
|
-
lightblue: "#66CBEC",
|
|
27
|
-
orange: "#FF9100",
|
|
28
|
-
green: "#06893A",
|
|
29
|
-
red: "#BA3A26",
|
|
30
|
-
purple: "#634689",
|
|
31
|
-
limegreen: "#a2ad00",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const white = "#ffffff";
|
|
35
|
-
const darkgray = "#262626";
|
|
36
|
-
const lightgray = "#F1F1F1";
|
|
37
|
-
|
|
38
|
-
const gray = (n) => Color(lightgray).mix(Color(darkgray), n).hex();
|
|
39
3
|
|
|
40
4
|
module.exports = {
|
|
41
5
|
navds: {
|
|
42
|
-
...(newSpacing?.navds ?? {}),
|
|
43
|
-
...(newColors?.navds ?? {}),
|
|
44
|
-
color: {
|
|
45
|
-
white: { value: white },
|
|
46
|
-
darkgray: { value: darkgray },
|
|
47
|
-
gray: {
|
|
48
|
-
90: { value: gray(1) },
|
|
49
|
-
80: { value: gray(0.8) },
|
|
50
|
-
60: { value: gray(0.6667) },
|
|
51
|
-
40: { value: gray(0.4) },
|
|
52
|
-
20: { value: gray(0.196) },
|
|
53
|
-
10: { value: gray(0) },
|
|
54
|
-
},
|
|
55
|
-
...Object.entries(baseColors).reduce(
|
|
56
|
-
(colors, [name, color]) => ({
|
|
57
|
-
...colors,
|
|
58
|
-
[name]: {
|
|
59
|
-
90: { value: darkColor(color, 3) },
|
|
60
|
-
80: { value: darkColor(color, 2) },
|
|
61
|
-
70: { value: darkColor(color, 1) },
|
|
62
|
-
60: { value: darkColor(color, 0) },
|
|
63
|
-
50: { value: color },
|
|
64
|
-
40: { value: lightColor(color, 0) },
|
|
65
|
-
30: { value: lightColor(color, 1) },
|
|
66
|
-
20: { value: lightColor(color, 2) },
|
|
67
|
-
10: { value: lightColor(color, 3) },
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
{}
|
|
71
|
-
),
|
|
72
|
-
disabled: { value: "{navds.color.gray.40.value}" },
|
|
73
|
-
action: {
|
|
74
|
-
default: { value: "{navds.color.blue.50.value}" },
|
|
75
|
-
hover: { value: "{navds.color.blue.60.value}" },
|
|
76
|
-
active: { value: "{navds.color.deepblue.50.value}" },
|
|
77
|
-
},
|
|
78
|
-
danger: {
|
|
79
|
-
default: { value: "{navds.color.red.50.value}" },
|
|
80
|
-
hover: { value: "{navds.color.red.60.value}" },
|
|
81
|
-
active: { value: "{navds.color.red.70.value}" },
|
|
82
|
-
},
|
|
83
|
-
error: {
|
|
84
|
-
border: { value: "{navds.color.red.50.value}" },
|
|
85
|
-
background: { value: "{navds.color.red.10.value}" },
|
|
86
|
-
},
|
|
87
|
-
warning: {
|
|
88
|
-
border: { value: "{navds.color.orange.60.value}" },
|
|
89
|
-
background: { value: "{navds.color.orange.10.value}" },
|
|
90
|
-
},
|
|
91
|
-
info: {
|
|
92
|
-
border: { value: "{navds.color.lightblue.70.value}" },
|
|
93
|
-
background: { value: "{navds.color.lightblue.10.value}" },
|
|
94
|
-
},
|
|
95
|
-
success: {
|
|
96
|
-
border: { value: "{navds.color.green.50.value}" },
|
|
97
|
-
background: { value: "{navds.color.green.10.value}" },
|
|
98
|
-
},
|
|
99
|
-
border: { value: "{navds.color.gray.40.value}" },
|
|
100
|
-
background: { value: "{navds.color.white.value}" },
|
|
101
|
-
text: {
|
|
102
|
-
primary: { value: "{navds.color.gray.90.value}" },
|
|
103
|
-
inverse: { value: "{navds.color.white.value}" },
|
|
104
|
-
disabled: { value: "{navds.color.gray.60.value}" },
|
|
105
|
-
link: { value: "{navds.color.blue.50.value}" },
|
|
106
|
-
error: { value: "{navds.color.red.50.value}" },
|
|
107
|
-
},
|
|
108
|
-
hover: { value: "{navds.color.gray.40.value}" },
|
|
109
|
-
tag: {
|
|
110
|
-
error: {
|
|
111
|
-
border: { value: "{navds.color.red.50.value}" },
|
|
112
|
-
background: { value: "{navds.color.red.10.value}" },
|
|
113
|
-
},
|
|
114
|
-
warning: {
|
|
115
|
-
border: { value: "{navds.color.orange.60.value}" },
|
|
116
|
-
background: { value: "{navds.color.orange.10.value}" },
|
|
117
|
-
},
|
|
118
|
-
info: {
|
|
119
|
-
border: { value: "{navds.color.lightblue.70.value}" },
|
|
120
|
-
background: { value: "{navds.color.lightblue.10.value}" },
|
|
121
|
-
},
|
|
122
|
-
success: {
|
|
123
|
-
border: { value: "{navds.color.green.50.value}" },
|
|
124
|
-
background: { value: "{navds.color.green.10.value}" },
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
modal: {
|
|
128
|
-
overlay: {
|
|
129
|
-
value: "rgba(38, 38, 38, 0.7)",
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
border: {
|
|
134
|
-
default: {
|
|
135
|
-
value: "1px solid {navds.color.border.value}",
|
|
136
|
-
},
|
|
137
|
-
radius: { value: "4px" },
|
|
138
|
-
},
|
|
139
|
-
panel: {
|
|
140
|
-
hover: { value: "1px solid {navds.color.blue.50.value}" },
|
|
141
|
-
},
|
|
142
6
|
font: {
|
|
143
7
|
family: { value: '"Source Sans Pro", Arial, sans-serif' },
|
|
144
8
|
line: {
|
|
@@ -176,35 +40,16 @@ module.exports = {
|
|
|
176
40
|
},
|
|
177
41
|
},
|
|
178
42
|
shadow: {
|
|
179
|
-
focus: { value: "0 0 0 3px {navds.color.
|
|
180
|
-
"focus-
|
|
181
|
-
|
|
182
|
-
},
|
|
183
|
-
text: {
|
|
184
|
-
focus: { value: "{navds.color.blue.80.value}" },
|
|
185
|
-
shadow: { value: "0 0 0 2px {navds.color.blue.80.value}" },
|
|
186
|
-
},
|
|
187
|
-
contentContainer: {
|
|
188
|
-
maxWidth: { value: "79.5rem" },
|
|
189
|
-
padding: {
|
|
190
|
-
small: { value: "{navds.spacing.4.value}" },
|
|
191
|
-
mediumAndLarger: { value: "{navds.spacing.6.value}" },
|
|
43
|
+
focus: { value: "0 0 0 3px {navds.semantic.color.focus.@.value}" },
|
|
44
|
+
"focus-inverted": {
|
|
45
|
+
value: "0 0 0 3px {navds.semantic.color.focus.inverted.value}",
|
|
192
46
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
gutter: {
|
|
196
|
-
small: { value: "{navds.spacing.4.value}" },
|
|
197
|
-
mediumAndLarger: { value: "{navds.spacing.6.value}" },
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
layout: {
|
|
201
|
-
background: {
|
|
202
|
-
white: { value: white },
|
|
203
|
-
gray: { value: "{navds.color.gray.10.value}" },
|
|
47
|
+
popover: {
|
|
48
|
+
value: "0 2px 4px 0 {navds.global.color.gray.200.value}",
|
|
204
49
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
50
|
+
card: {
|
|
51
|
+
value:
|
|
52
|
+
"0 1px 3px 0 rgba(38,38,38,0.2),0 2px 1px 0 rgba(38,38,38,0.12),0 1px 1px 0 rgba(38,38,38,0.14)",
|
|
208
53
|
},
|
|
209
54
|
},
|
|
210
55
|
"z-index": {
|
|
@@ -212,22 +57,5 @@ module.exports = {
|
|
|
212
57
|
popover: { value: 1000 },
|
|
213
58
|
focus: { value: 10 },
|
|
214
59
|
},
|
|
215
|
-
sidebar: {
|
|
216
|
-
sticky: {
|
|
217
|
-
offset: { value: "0" },
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
checkmark: {
|
|
221
|
-
image: {
|
|
222
|
-
white: {
|
|
223
|
-
value:
|
|
224
|
-
"url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMyAxMCI+ICAgIDxnPiAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNNCwxMGMtMC40LDAtMC44LTAuMS0xLjEtMC40TDAuNCw3LjFDMC4xLDYuOCwwLDYuNCwwLDZzMC4yLTAuOCwwLjUtMS4xQzEsNC40LDIsNC40LDIuNSw0LjlMNCw2LjRsNi40LTYgICAgQzEwLjgsMC4xLDExLjEsMCwxMS41LDBjMC40LDAsMC44LDAuMiwxLDAuNWMwLjYsMC42LDAuNSwxLjYtMC4xLDIuMXYwTDUsOS42QzQuNyw5LjksNC40LDEwLDQsMTB6IE0xMS44LDEuOUwxMS44LDEuOSAgICBDMTEuOCwxLjksMTEuOCwxLjksMTEuOCwxLjl6IE0xMS4yLDEuMUMxMS4yLDEuMSwxMS4yLDEuMSwxMS4yLDEuMUwxMS4yLDEuMXoiLz4gICAgPC9nPjwvc3ZnPg==)",
|
|
225
|
-
},
|
|
226
|
-
blue: {
|
|
227
|
-
value:
|
|
228
|
-
"url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMyAxMCI+ICAgIDxnPiAgICA8cGF0aCBmaWxsPSIjMDA2N0M1IiBkPSJNNCwxMGMtMC40LDAtMC44LTAuMS0xLjEtMC40TDAuNCw3LjFDMC4xLDYuOCwwLDYuNCwwLDZzMC4yLTAuOCwwLjUtMS4xQzEsNC40LDIsNC40LDIuNSw0LjlMNCw2LjRsNi40LTYgICAgQzEwLjgsMC4xLDExLjEsMCwxMS41LDBjMC40LDAsMC44LDAuMiwxLDAuNWMwLjYsMC42LDAuNSwxLjYtMC4xLDIuMXYwTDUsOS42QzQuNyw5LjksNC40LDEwLDQsMTB6IE0xMS44LDEuOUwxMS44LDEuOSAgICBDMTEuOCwxLjksMTEuOCwxLjksMTEuOCwxLjl6IE0xMS4yLDEuMUMxMS4yLDEuMSwxMS4yLDEuMSwxMS4yLDEuMUwxMS4yLDEuMXoiLz4gICAgPC9nPjwvc3ZnPg==)",
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
60
|
},
|
|
233
61
|
};
|