@tidbcloud/uikit 2.0.0-beta.18 → 2.0.0-beta.19
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 +6 -0
- package/dist/theme/colors.cjs +2 -2
- package/dist/theme/colors.js +2 -2
- package/dist/theme/theme.cjs +38 -34
- package/dist/theme/theme.js +38 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/theme/colors.cjs
CHANGED
package/dist/theme/colors.js
CHANGED
package/dist/theme/theme.cjs
CHANGED
|
@@ -6,25 +6,29 @@ const font = require("./font.cjs");
|
|
|
6
6
|
const react = require("@emotion/react");
|
|
7
7
|
const Colors = Object.keys(colors);
|
|
8
8
|
const getButtonStyles = (theme2, params) => {
|
|
9
|
+
var _a;
|
|
10
|
+
let color = ((_a = params.color) == null ? void 0 : _a.includes(".")) ? params.color.split(".")[0] : params.color;
|
|
9
11
|
const getFilledStyles = () => {
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
color = color || theme2.primaryColor;
|
|
13
|
+
const bgColorShade = color.includes("carbon") ? 9 : theme2.fn.primaryShade();
|
|
14
|
+
const hoverBgColorShade = color.includes("carbon") ? bgColorShade - 1 : bgColorShade + 1;
|
|
15
|
+
const bgColor = theme2.fn.themeColor(color, bgColorShade);
|
|
16
|
+
const bgHoverColor = theme2.fn.themeColor(color, hoverBgColorShade);
|
|
14
17
|
return {
|
|
15
18
|
color: theme2.white,
|
|
16
|
-
backgroundColor: bgColor
|
|
19
|
+
backgroundColor: bgColor,
|
|
17
20
|
...theme2.fn.hover({
|
|
18
|
-
backgroundColor:
|
|
21
|
+
backgroundColor: bgHoverColor
|
|
19
22
|
}),
|
|
20
23
|
"&:disabled": {
|
|
21
24
|
color: theme2.white,
|
|
22
|
-
backgroundColor:
|
|
25
|
+
backgroundColor: theme2.fn.themeColor(color, 5)
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
28
|
};
|
|
26
29
|
const getLightStyles = () => {
|
|
27
|
-
|
|
30
|
+
color = color || "peacock";
|
|
31
|
+
const mainColor = theme2.colors[color];
|
|
28
32
|
const fontColorShade = 7;
|
|
29
33
|
const bgColorShade = 1;
|
|
30
34
|
const borderColorShade = 4;
|
|
@@ -47,10 +51,10 @@ const getButtonStyles = (theme2, params) => {
|
|
|
47
51
|
};
|
|
48
52
|
};
|
|
49
53
|
const getDefaultStyles = () => {
|
|
50
|
-
|
|
54
|
+
color = color || theme2.primaryColor;
|
|
51
55
|
const mainColor = theme2.colors[color];
|
|
52
56
|
const fontColorShade = color === "carbon" ? 8 : 7;
|
|
53
|
-
const bgColorShade =
|
|
57
|
+
const bgColorShade = 2;
|
|
54
58
|
const borderColorShade = color === "carbon" ? 5 : 4;
|
|
55
59
|
return {
|
|
56
60
|
color: mainColor[fontColorShade],
|
|
@@ -69,13 +73,13 @@ const getButtonStyles = (theme2, params) => {
|
|
|
69
73
|
};
|
|
70
74
|
};
|
|
71
75
|
const getSubtleStyles = () => {
|
|
72
|
-
|
|
76
|
+
color = color || "peacock";
|
|
73
77
|
const mainColor = theme2.colors[color];
|
|
74
78
|
const fontColorShade = 7;
|
|
75
79
|
const bgColorShade = 1;
|
|
76
80
|
return {
|
|
77
81
|
color: mainColor[fontColorShade],
|
|
78
|
-
backgroundColor:
|
|
82
|
+
backgroundColor: "transparent",
|
|
79
83
|
...theme2.fn.hover({
|
|
80
84
|
color: mainColor[fontColorShade + 1],
|
|
81
85
|
backgroundColor: mainColor[bgColorShade + 1]
|
|
@@ -298,11 +302,11 @@ const theme = {
|
|
|
298
302
|
item: {
|
|
299
303
|
transition: "background 150ms ease-in-out",
|
|
300
304
|
color: theme2.colors.carbon[8],
|
|
301
|
-
"&:hover": {
|
|
305
|
+
"&:hover, &[data-hovered]": {
|
|
302
306
|
backgroundColor: theme2.colors.carbon[2],
|
|
303
307
|
textDecoration: "none"
|
|
304
308
|
},
|
|
305
|
-
"&:disabled": {
|
|
309
|
+
"&:disabled, &[data-disabled]": {
|
|
306
310
|
color: theme2.colors.carbon[5],
|
|
307
311
|
userSelect: "none",
|
|
308
312
|
cursor: "not-allowed",
|
|
@@ -321,26 +325,26 @@ const theme = {
|
|
|
321
325
|
fw: 500
|
|
322
326
|
},
|
|
323
327
|
styles: (theme2, params) => {
|
|
324
|
-
const
|
|
328
|
+
const withThemeColor = (shade) => theme2.fn.themeColor(params.color ?? theme2.primaryColor, shade);
|
|
325
329
|
const rootStyles = {
|
|
326
330
|
light: {
|
|
327
|
-
color:
|
|
331
|
+
color: withThemeColor(8),
|
|
328
332
|
"&:hover": {
|
|
329
|
-
color:
|
|
330
|
-
backgroundColor:
|
|
333
|
+
color: withThemeColor(8),
|
|
334
|
+
backgroundColor: withThemeColor(2)
|
|
331
335
|
},
|
|
332
336
|
"&:active": {
|
|
333
|
-
color:
|
|
334
|
-
backgroundColor:
|
|
337
|
+
color: withThemeColor(8),
|
|
338
|
+
backgroundColor: withThemeColor(4)
|
|
335
339
|
},
|
|
336
340
|
"&[data-active]": {
|
|
337
|
-
color:
|
|
338
|
-
backgroundColor:
|
|
341
|
+
color: withThemeColor(9),
|
|
342
|
+
backgroundColor: withThemeColor(4),
|
|
339
343
|
"&:hover": {
|
|
340
|
-
backgroundColor:
|
|
344
|
+
backgroundColor: withThemeColor(4)
|
|
341
345
|
},
|
|
342
346
|
"&:active": {
|
|
343
|
-
backgroundColor:
|
|
347
|
+
backgroundColor: withThemeColor(4)
|
|
344
348
|
}
|
|
345
349
|
}
|
|
346
350
|
}
|
|
@@ -508,7 +512,6 @@ const theme = {
|
|
|
508
512
|
},
|
|
509
513
|
Badge: {
|
|
510
514
|
styles(theme2, params) {
|
|
511
|
-
const color = params.color ?? theme2.primaryColor;
|
|
512
515
|
const styles = {
|
|
513
516
|
dot: {
|
|
514
517
|
border: "none",
|
|
@@ -516,8 +519,8 @@ const theme = {
|
|
|
516
519
|
fontWeight: 500
|
|
517
520
|
},
|
|
518
521
|
outline: {
|
|
519
|
-
color: theme2.
|
|
520
|
-
borderColor: theme2.
|
|
522
|
+
color: theme2.fn.themeColor(params.color ?? theme2.primaryColor, 8),
|
|
523
|
+
borderColor: theme2.fn.themeColor(params.color ?? theme2.primaryColor, 4)
|
|
521
524
|
}
|
|
522
525
|
};
|
|
523
526
|
return {
|
|
@@ -529,14 +532,14 @@ const theme = {
|
|
|
529
532
|
},
|
|
530
533
|
Checkbox: {
|
|
531
534
|
styles(theme2, params) {
|
|
532
|
-
const
|
|
535
|
+
const withThemeColor = (shade) => theme2.fn.themeColor(params.color ?? theme2.primaryColor, shade);
|
|
533
536
|
return {
|
|
534
537
|
input: {
|
|
535
538
|
borderRadius: 4,
|
|
536
|
-
borderColor:
|
|
539
|
+
borderColor: withThemeColor(6),
|
|
537
540
|
"&:checked:not(:disabled)": {
|
|
538
|
-
backgroundColor:
|
|
539
|
-
borderColor:
|
|
541
|
+
backgroundColor: withThemeColor(9),
|
|
542
|
+
borderColor: withThemeColor(9)
|
|
540
543
|
},
|
|
541
544
|
"&:disabled:checked": {
|
|
542
545
|
backgroundColor: theme2.colors.carbon[6],
|
|
@@ -544,7 +547,7 @@ const theme = {
|
|
|
544
547
|
}
|
|
545
548
|
},
|
|
546
549
|
label: {
|
|
547
|
-
color:
|
|
550
|
+
color: withThemeColor(8),
|
|
548
551
|
"&[data-disabled]": {
|
|
549
552
|
color: theme2.colors.carbon[6]
|
|
550
553
|
}
|
|
@@ -670,8 +673,9 @@ const theme = {
|
|
|
670
673
|
},
|
|
671
674
|
Radio: {
|
|
672
675
|
styles(theme2, params) {
|
|
673
|
-
|
|
674
|
-
const
|
|
676
|
+
var _a;
|
|
677
|
+
const color = ((_a = params.color) == null ? void 0 : _a.includes(".")) ? params.color.split(".")[0] : params.color ?? "carbon";
|
|
678
|
+
const shade = color.includes("carbon") ? 9 : 7;
|
|
675
679
|
const size = params.size ?? "sm";
|
|
676
680
|
const sizes = {
|
|
677
681
|
xs: 14,
|
package/dist/theme/theme.js
CHANGED
|
@@ -4,25 +4,29 @@ import { FONT_FAMILY } from "./font.js";
|
|
|
4
4
|
import { keyframes } from "@emotion/react";
|
|
5
5
|
const Colors = Object.keys(colors);
|
|
6
6
|
const getButtonStyles = (theme2, params) => {
|
|
7
|
+
var _a;
|
|
8
|
+
let color = ((_a = params.color) == null ? void 0 : _a.includes(".")) ? params.color.split(".")[0] : params.color;
|
|
7
9
|
const getFilledStyles = () => {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
color = color || theme2.primaryColor;
|
|
11
|
+
const bgColorShade = color.includes("carbon") ? 9 : theme2.fn.primaryShade();
|
|
12
|
+
const hoverBgColorShade = color.includes("carbon") ? bgColorShade - 1 : bgColorShade + 1;
|
|
13
|
+
const bgColor = theme2.fn.themeColor(color, bgColorShade);
|
|
14
|
+
const bgHoverColor = theme2.fn.themeColor(color, hoverBgColorShade);
|
|
12
15
|
return {
|
|
13
16
|
color: theme2.white,
|
|
14
|
-
backgroundColor: bgColor
|
|
17
|
+
backgroundColor: bgColor,
|
|
15
18
|
...theme2.fn.hover({
|
|
16
|
-
backgroundColor:
|
|
19
|
+
backgroundColor: bgHoverColor
|
|
17
20
|
}),
|
|
18
21
|
"&:disabled": {
|
|
19
22
|
color: theme2.white,
|
|
20
|
-
backgroundColor:
|
|
23
|
+
backgroundColor: theme2.fn.themeColor(color, 5)
|
|
21
24
|
}
|
|
22
25
|
};
|
|
23
26
|
};
|
|
24
27
|
const getLightStyles = () => {
|
|
25
|
-
|
|
28
|
+
color = color || "peacock";
|
|
29
|
+
const mainColor = theme2.colors[color];
|
|
26
30
|
const fontColorShade = 7;
|
|
27
31
|
const bgColorShade = 1;
|
|
28
32
|
const borderColorShade = 4;
|
|
@@ -45,10 +49,10 @@ const getButtonStyles = (theme2, params) => {
|
|
|
45
49
|
};
|
|
46
50
|
};
|
|
47
51
|
const getDefaultStyles = () => {
|
|
48
|
-
|
|
52
|
+
color = color || theme2.primaryColor;
|
|
49
53
|
const mainColor = theme2.colors[color];
|
|
50
54
|
const fontColorShade = color === "carbon" ? 8 : 7;
|
|
51
|
-
const bgColorShade =
|
|
55
|
+
const bgColorShade = 2;
|
|
52
56
|
const borderColorShade = color === "carbon" ? 5 : 4;
|
|
53
57
|
return {
|
|
54
58
|
color: mainColor[fontColorShade],
|
|
@@ -67,13 +71,13 @@ const getButtonStyles = (theme2, params) => {
|
|
|
67
71
|
};
|
|
68
72
|
};
|
|
69
73
|
const getSubtleStyles = () => {
|
|
70
|
-
|
|
74
|
+
color = color || "peacock";
|
|
71
75
|
const mainColor = theme2.colors[color];
|
|
72
76
|
const fontColorShade = 7;
|
|
73
77
|
const bgColorShade = 1;
|
|
74
78
|
return {
|
|
75
79
|
color: mainColor[fontColorShade],
|
|
76
|
-
backgroundColor:
|
|
80
|
+
backgroundColor: "transparent",
|
|
77
81
|
...theme2.fn.hover({
|
|
78
82
|
color: mainColor[fontColorShade + 1],
|
|
79
83
|
backgroundColor: mainColor[bgColorShade + 1]
|
|
@@ -296,11 +300,11 @@ const theme = {
|
|
|
296
300
|
item: {
|
|
297
301
|
transition: "background 150ms ease-in-out",
|
|
298
302
|
color: theme2.colors.carbon[8],
|
|
299
|
-
"&:hover": {
|
|
303
|
+
"&:hover, &[data-hovered]": {
|
|
300
304
|
backgroundColor: theme2.colors.carbon[2],
|
|
301
305
|
textDecoration: "none"
|
|
302
306
|
},
|
|
303
|
-
"&:disabled": {
|
|
307
|
+
"&:disabled, &[data-disabled]": {
|
|
304
308
|
color: theme2.colors.carbon[5],
|
|
305
309
|
userSelect: "none",
|
|
306
310
|
cursor: "not-allowed",
|
|
@@ -319,26 +323,26 @@ const theme = {
|
|
|
319
323
|
fw: 500
|
|
320
324
|
},
|
|
321
325
|
styles: (theme2, params) => {
|
|
322
|
-
const
|
|
326
|
+
const withThemeColor = (shade) => theme2.fn.themeColor(params.color ?? theme2.primaryColor, shade);
|
|
323
327
|
const rootStyles = {
|
|
324
328
|
light: {
|
|
325
|
-
color:
|
|
329
|
+
color: withThemeColor(8),
|
|
326
330
|
"&:hover": {
|
|
327
|
-
color:
|
|
328
|
-
backgroundColor:
|
|
331
|
+
color: withThemeColor(8),
|
|
332
|
+
backgroundColor: withThemeColor(2)
|
|
329
333
|
},
|
|
330
334
|
"&:active": {
|
|
331
|
-
color:
|
|
332
|
-
backgroundColor:
|
|
335
|
+
color: withThemeColor(8),
|
|
336
|
+
backgroundColor: withThemeColor(4)
|
|
333
337
|
},
|
|
334
338
|
"&[data-active]": {
|
|
335
|
-
color:
|
|
336
|
-
backgroundColor:
|
|
339
|
+
color: withThemeColor(9),
|
|
340
|
+
backgroundColor: withThemeColor(4),
|
|
337
341
|
"&:hover": {
|
|
338
|
-
backgroundColor:
|
|
342
|
+
backgroundColor: withThemeColor(4)
|
|
339
343
|
},
|
|
340
344
|
"&:active": {
|
|
341
|
-
backgroundColor:
|
|
345
|
+
backgroundColor: withThemeColor(4)
|
|
342
346
|
}
|
|
343
347
|
}
|
|
344
348
|
}
|
|
@@ -506,7 +510,6 @@ const theme = {
|
|
|
506
510
|
},
|
|
507
511
|
Badge: {
|
|
508
512
|
styles(theme2, params) {
|
|
509
|
-
const color = params.color ?? theme2.primaryColor;
|
|
510
513
|
const styles = {
|
|
511
514
|
dot: {
|
|
512
515
|
border: "none",
|
|
@@ -514,8 +517,8 @@ const theme = {
|
|
|
514
517
|
fontWeight: 500
|
|
515
518
|
},
|
|
516
519
|
outline: {
|
|
517
|
-
color: theme2.
|
|
518
|
-
borderColor: theme2.
|
|
520
|
+
color: theme2.fn.themeColor(params.color ?? theme2.primaryColor, 8),
|
|
521
|
+
borderColor: theme2.fn.themeColor(params.color ?? theme2.primaryColor, 4)
|
|
519
522
|
}
|
|
520
523
|
};
|
|
521
524
|
return {
|
|
@@ -527,14 +530,14 @@ const theme = {
|
|
|
527
530
|
},
|
|
528
531
|
Checkbox: {
|
|
529
532
|
styles(theme2, params) {
|
|
530
|
-
const
|
|
533
|
+
const withThemeColor = (shade) => theme2.fn.themeColor(params.color ?? theme2.primaryColor, shade);
|
|
531
534
|
return {
|
|
532
535
|
input: {
|
|
533
536
|
borderRadius: 4,
|
|
534
|
-
borderColor:
|
|
537
|
+
borderColor: withThemeColor(6),
|
|
535
538
|
"&:checked:not(:disabled)": {
|
|
536
|
-
backgroundColor:
|
|
537
|
-
borderColor:
|
|
539
|
+
backgroundColor: withThemeColor(9),
|
|
540
|
+
borderColor: withThemeColor(9)
|
|
538
541
|
},
|
|
539
542
|
"&:disabled:checked": {
|
|
540
543
|
backgroundColor: theme2.colors.carbon[6],
|
|
@@ -542,7 +545,7 @@ const theme = {
|
|
|
542
545
|
}
|
|
543
546
|
},
|
|
544
547
|
label: {
|
|
545
|
-
color:
|
|
548
|
+
color: withThemeColor(8),
|
|
546
549
|
"&[data-disabled]": {
|
|
547
550
|
color: theme2.colors.carbon[6]
|
|
548
551
|
}
|
|
@@ -668,8 +671,9 @@ const theme = {
|
|
|
668
671
|
},
|
|
669
672
|
Radio: {
|
|
670
673
|
styles(theme2, params) {
|
|
671
|
-
|
|
672
|
-
const
|
|
674
|
+
var _a;
|
|
675
|
+
const color = ((_a = params.color) == null ? void 0 : _a.includes(".")) ? params.color.split(".")[0] : params.color ?? "carbon";
|
|
676
|
+
const shade = color.includes("carbon") ? 9 : 7;
|
|
673
677
|
const size = params.size ?? "sm";
|
|
674
678
|
const sizes = {
|
|
675
679
|
xs: 14,
|