@team-monolith/cds 1.88.1 → 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.
|
@@ -1,106 +1,74 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
13
|
/** @jsxImportSource @emotion/react */
|
|
3
14
|
import { css, useTheme } from "@emotion/react";
|
|
4
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
|
+
`;
|
|
5
44
|
const COLOR_TO_BACKGROUND_IMAGE = (theme, color) => ({
|
|
6
|
-
primary:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
${theme.color.background.primaryActive} 20px,
|
|
12
|
-
${theme.color.background.primaryActive} 30px,
|
|
13
|
-
${theme.color.background.primary} 30px,
|
|
14
|
-
${theme.color.background.primary} 40px,
|
|
15
|
-
${theme.color.background.primaryActive} 40px,
|
|
16
|
-
${theme.color.background.primaryActive} 80px,
|
|
17
|
-
${theme.color.background.primary} 80px,
|
|
18
|
-
${theme.color.background.primary} 300px
|
|
19
|
-
);
|
|
20
|
-
`,
|
|
21
|
-
grey: css `
|
|
22
|
-
background-image: repeating-linear-gradient(
|
|
23
|
-
-45deg,
|
|
24
|
-
${theme.color.background.neutralAlt} 0,
|
|
25
|
-
${theme.color.background.neutralAlt} 20px,
|
|
26
|
-
${theme.color.background.neutralAltActive} 20px,
|
|
27
|
-
${theme.color.background.neutralAltActive} 30px,
|
|
28
|
-
${theme.color.background.neutralAlt} 30px,
|
|
29
|
-
${theme.color.background.neutralAlt} 40px,
|
|
30
|
-
${theme.color.background.neutralAltActive} 40px,
|
|
31
|
-
${theme.color.background.neutralAltActive} 80px,
|
|
32
|
-
${theme.color.background.neutralAlt} 80px,
|
|
33
|
-
${theme.color.background.neutralAlt} 300px
|
|
34
|
-
);
|
|
35
|
-
`,
|
|
36
|
-
danger: css `
|
|
37
|
-
background-image: repeating-linear-gradient(
|
|
38
|
-
-45deg,
|
|
39
|
-
${theme.color.background.danger} 0,
|
|
40
|
-
${theme.color.background.danger} 20px,
|
|
41
|
-
${theme.color.background.dangerActive} 20px,
|
|
42
|
-
${theme.color.background.dangerActive} 30px,
|
|
43
|
-
${theme.color.background.danger} 30px,
|
|
44
|
-
${theme.color.background.danger} 40px,
|
|
45
|
-
${theme.color.background.dangerActive} 40px,
|
|
46
|
-
${theme.color.background.dangerActive} 80px,
|
|
47
|
-
${theme.color.background.danger} 80px,
|
|
48
|
-
${theme.color.background.danger} 300px
|
|
49
|
-
);
|
|
50
|
-
`,
|
|
51
|
-
textNeutral: {},
|
|
52
|
-
textDanger: {},
|
|
53
|
-
textPrimary: {},
|
|
54
|
-
black: css `
|
|
55
|
-
background-image: repeating-linear-gradient(
|
|
56
|
-
-45deg,
|
|
57
|
-
${theme.color.background.inverse} 0,
|
|
58
|
-
${theme.color.background.inverse} 20px,
|
|
59
|
-
${theme.color.background.inverseActive} 20px,
|
|
60
|
-
${theme.color.background.inverseActive} 30px,
|
|
61
|
-
${theme.color.background.inverse} 30px,
|
|
62
|
-
${theme.color.background.inverse} 40px,
|
|
63
|
-
${theme.color.background.inverseActive} 40px,
|
|
64
|
-
${theme.color.background.inverseActive} 80px,
|
|
65
|
-
${theme.color.background.inverse} 80px,
|
|
66
|
-
${theme.color.background.inverse} 300px
|
|
67
|
-
);
|
|
68
|
-
`,
|
|
69
|
-
white: css `
|
|
70
|
-
background-image: repeating-linear-gradient(
|
|
71
|
-
-45deg,
|
|
72
|
-
${theme.color.background.neutralBase} 0,
|
|
73
|
-
${theme.color.background.neutralBase} 20px,
|
|
74
|
-
${theme.color.background.neutralAltActive} 20px,
|
|
75
|
-
${theme.color.background.neutralAltActive} 30px,
|
|
76
|
-
${theme.color.background.neutralBase} 30px,
|
|
77
|
-
${theme.color.background.neutralBase} 40px,
|
|
78
|
-
${theme.color.background.neutralAltActive} 40px,
|
|
79
|
-
${theme.color.background.neutralAltActive} 80px,
|
|
80
|
-
${theme.color.background.neutralBase} 80px,
|
|
81
|
-
${theme.color.background.neutralBase} 300px
|
|
82
|
-
);
|
|
83
|
-
`,
|
|
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),
|
|
84
50
|
})[color];
|
|
85
51
|
/**
|
|
86
52
|
* 반짝이는 애니메이션 효과가 적용된 Button 컴포넌트
|
|
87
53
|
*/
|
|
88
54
|
export function AnimatedButton(props) {
|
|
55
|
+
const { color, loading, disabled } = props, _other = __rest(props, ["color", "loading", "disabled"]);
|
|
89
56
|
const theme = useTheme();
|
|
90
|
-
return (_jsx(Button, Object.assign({}, props, { css:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
+
] })));
|
|
105
74
|
}
|
|
106
|
-
;
|