@team-monolith/cds 1.88.2 → 1.88.3
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.
|
@@ -13,85 +13,40 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
13
13
|
/** @jsxImportSource @emotion/react */
|
|
14
14
|
import { css, useTheme } from "@emotion/react";
|
|
15
15
|
import { Button } from "..";
|
|
16
|
+
const DARK_BLACK_COLOR = "#202020";
|
|
17
|
+
// ButtonColor가 BackgroundButtonColor인지 체크하는 type guard 함수
|
|
18
|
+
function isBackgroundButtonColor(color) {
|
|
19
|
+
return !['textNeutral', 'textDanger', 'textPrimary'].includes(color);
|
|
20
|
+
}
|
|
21
|
+
const getGradient = (baseColor, activeColor) => css `
|
|
22
|
+
background-image: repeating-linear-gradient(
|
|
23
|
+
-45deg,
|
|
24
|
+
${baseColor} 0%,
|
|
25
|
+
${baseColor} 20%,
|
|
26
|
+
${activeColor} 20%,
|
|
27
|
+
${activeColor} 25%,
|
|
28
|
+
${baseColor} 25%,
|
|
29
|
+
${baseColor} 30%,
|
|
30
|
+
${activeColor} 30%,
|
|
31
|
+
${activeColor} 40%,
|
|
32
|
+
${baseColor} 40%,
|
|
33
|
+
${baseColor} 60%,
|
|
34
|
+
${activeColor} 60%,
|
|
35
|
+
${activeColor} 70%,
|
|
36
|
+
${baseColor} 70%,
|
|
37
|
+
${baseColor} 75%,
|
|
38
|
+
${activeColor} 75%,
|
|
39
|
+
${activeColor} 80%,
|
|
40
|
+
${baseColor} 80%,
|
|
41
|
+
${baseColor} 100%
|
|
42
|
+
);
|
|
43
|
+
`;
|
|
16
44
|
const COLOR_TO_BACKGROUND_IMAGE = (theme, color) => ({
|
|
17
|
-
primary:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
${theme.color.background.primaryActive} 20px,
|
|
23
|
-
${theme.color.background.primaryActive} 30px,
|
|
24
|
-
${theme.color.background.primary} 30px,
|
|
25
|
-
${theme.color.background.primary} 40px,
|
|
26
|
-
${theme.color.background.primaryActive} 40px,
|
|
27
|
-
${theme.color.background.primaryActive} 80px,
|
|
28
|
-
${theme.color.background.primary} 80px,
|
|
29
|
-
${theme.color.background.primary} 300px
|
|
30
|
-
);
|
|
31
|
-
`,
|
|
32
|
-
grey: css `
|
|
33
|
-
background-image: repeating-linear-gradient(
|
|
34
|
-
-45deg,
|
|
35
|
-
${theme.color.background.neutralAlt} 0,
|
|
36
|
-
${theme.color.background.neutralAlt} 20px,
|
|
37
|
-
${theme.color.background.neutralAltActive} 20px,
|
|
38
|
-
${theme.color.background.neutralAltActive} 30px,
|
|
39
|
-
${theme.color.background.neutralAlt} 30px,
|
|
40
|
-
${theme.color.background.neutralAlt} 40px,
|
|
41
|
-
${theme.color.background.neutralAltActive} 40px,
|
|
42
|
-
${theme.color.background.neutralAltActive} 80px,
|
|
43
|
-
${theme.color.background.neutralAlt} 80px,
|
|
44
|
-
${theme.color.background.neutralAlt} 300px
|
|
45
|
-
);
|
|
46
|
-
`,
|
|
47
|
-
danger: css `
|
|
48
|
-
background-image: repeating-linear-gradient(
|
|
49
|
-
-45deg,
|
|
50
|
-
${theme.color.background.danger} 0,
|
|
51
|
-
${theme.color.background.danger} 20px,
|
|
52
|
-
${theme.color.background.dangerActive} 20px,
|
|
53
|
-
${theme.color.background.dangerActive} 30px,
|
|
54
|
-
${theme.color.background.danger} 30px,
|
|
55
|
-
${theme.color.background.danger} 40px,
|
|
56
|
-
${theme.color.background.dangerActive} 40px,
|
|
57
|
-
${theme.color.background.dangerActive} 80px,
|
|
58
|
-
${theme.color.background.danger} 80px,
|
|
59
|
-
${theme.color.background.danger} 300px
|
|
60
|
-
);
|
|
61
|
-
`,
|
|
62
|
-
textNeutral: {},
|
|
63
|
-
textDanger: {},
|
|
64
|
-
textPrimary: {},
|
|
65
|
-
black: css `
|
|
66
|
-
background-image: repeating-linear-gradient(
|
|
67
|
-
-45deg,
|
|
68
|
-
${theme.color.background.inverse} 0,
|
|
69
|
-
${theme.color.background.inverse} 20px,
|
|
70
|
-
${theme.color.background.inverseActive} 20px,
|
|
71
|
-
${theme.color.background.inverseActive} 30px,
|
|
72
|
-
${theme.color.background.inverse} 30px,
|
|
73
|
-
${theme.color.background.inverse} 40px,
|
|
74
|
-
${theme.color.background.inverseActive} 40px,
|
|
75
|
-
${theme.color.background.inverseActive} 80px,
|
|
76
|
-
${theme.color.background.inverse} 80px,
|
|
77
|
-
${theme.color.background.inverse} 300px
|
|
78
|
-
);
|
|
79
|
-
`,
|
|
80
|
-
white: css `
|
|
81
|
-
background-image: repeating-linear-gradient(
|
|
82
|
-
-45deg,
|
|
83
|
-
${theme.color.background.neutralBase} 0,
|
|
84
|
-
${theme.color.background.neutralBase} 20px,
|
|
85
|
-
${theme.color.background.neutralAltActive} 20px,
|
|
86
|
-
${theme.color.background.neutralAltActive} 30px,
|
|
87
|
-
${theme.color.background.neutralBase} 30px,
|
|
88
|
-
${theme.color.background.neutralBase} 40px,
|
|
89
|
-
${theme.color.background.neutralAltActive} 40px,
|
|
90
|
-
${theme.color.background.neutralAltActive} 80px,
|
|
91
|
-
${theme.color.background.neutralBase} 80px,
|
|
92
|
-
${theme.color.background.neutralBase} 300px
|
|
93
|
-
);
|
|
94
|
-
`,
|
|
45
|
+
primary: getGradient(theme.color.background.primary, theme.color.background.primaryActive),
|
|
46
|
+
grey: getGradient(theme.color.background.neutralAlt, theme.color.background.neutralAltActive),
|
|
47
|
+
danger: getGradient(theme.color.background.danger, theme.color.background.dangerActive),
|
|
48
|
+
black: getGradient(theme.color.background.inverse, DARK_BLACK_COLOR),
|
|
49
|
+
white: getGradient(theme.color.background.neutralBase, theme.color.background.neutralAltActive),
|
|
95
50
|
})[color];
|
|
96
51
|
/**
|
|
97
52
|
* 반짝이는 애니메이션 효과가 적용된 Button 컴포넌트
|
|
@@ -99,20 +54,21 @@ const COLOR_TO_BACKGROUND_IMAGE = (theme, color) => ({
|
|
|
99
54
|
export function AnimatedButton(props) {
|
|
100
55
|
const { color, loading, disabled } = props, _other = __rest(props, ["color", "loading", "disabled"]);
|
|
101
56
|
const theme = useTheme();
|
|
102
|
-
return (_jsx(Button, Object.assign({}, props, { css: disabled || loading
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
57
|
+
return (_jsx(Button, Object.assign({}, props, { css: disabled || loading || !isBackgroundButtonColor(color)
|
|
58
|
+
? []
|
|
59
|
+
: [
|
|
60
|
+
css `
|
|
61
|
+
background-size: 400% 100%;
|
|
62
|
+
animation: AnimateBG 8s linear infinite;
|
|
63
|
+
@keyframes AnimateBG {
|
|
64
|
+
0% {
|
|
65
|
+
background-position: 400% 50%;
|
|
66
|
+
}
|
|
67
|
+
100% {
|
|
68
|
+
background-position: 0% 50%;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
COLOR_TO_BACKGROUND_IMAGE(theme, color),
|
|
73
|
+
] })));
|
|
117
74
|
}
|
|
118
|
-
;
|