@team-monolith/cds 1.88.2 → 1.88.4

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,6 +1,10 @@
1
1
  import React from "react";
2
- import { ButtonProps } from "..";
2
+ import { ButtonColor, ButtonProps } from "..";
3
+ type BackgroundButtonColor = Exclude<ButtonColor, "textNeutral" | "textDanger" | "textPrimary">;
3
4
  /**
4
5
  * 반짝이는 애니메이션 효과가 적용된 Button 컴포넌트
5
6
  */
6
- export declare function AnimatedButton<RootComponentType extends React.ElementType = "button">(props: ButtonProps<RootComponentType>): React.ReactElement;
7
+ export declare function AnimatedButton<RootComponentType extends React.ElementType = "button">(props: ButtonProps<RootComponentType> & {
8
+ color: BackgroundButtonColor;
9
+ }): React.ReactElement;
10
+ export {};
@@ -11,108 +11,60 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
13
13
  /** @jsxImportSource @emotion/react */
14
- import { css, useTheme } from "@emotion/react";
14
+ import { css, keyframes, useTheme } from "@emotion/react";
15
15
  import { Button } from "..";
16
+ const DARK_BLACK_COLOR = "#202020";
17
+ const getGradient = (baseColor, activeColor) => css `
18
+ background-image: repeating-linear-gradient(
19
+ -45deg,
20
+ ${baseColor} 0%,
21
+ ${baseColor} 20%,
22
+ ${activeColor} 20%,
23
+ ${activeColor} 25%,
24
+ ${baseColor} 25%,
25
+ ${baseColor} 30%,
26
+ ${activeColor} 30%,
27
+ ${activeColor} 40%,
28
+ ${baseColor} 40%,
29
+ ${baseColor} 60%,
30
+ ${activeColor} 60%,
31
+ ${activeColor} 70%,
32
+ ${baseColor} 70%,
33
+ ${baseColor} 75%,
34
+ ${activeColor} 75%,
35
+ ${activeColor} 80%,
36
+ ${baseColor} 80%,
37
+ ${baseColor} 100%
38
+ );
39
+ `;
16
40
  const COLOR_TO_BACKGROUND_IMAGE = (theme, color) => ({
17
- primary: css `
18
- background-image: repeating-linear-gradient(
19
- -45deg,
20
- ${theme.color.background.primary} 0,
21
- ${theme.color.background.primary} 20px,
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
- `,
41
+ primary: getGradient(theme.color.background.primary, theme.color.background.primaryActive),
42
+ grey: getGradient(theme.color.background.neutralAlt, theme.color.background.neutralAltActive),
43
+ danger: getGradient(theme.color.background.danger, theme.color.background.dangerActive),
44
+ black: getGradient(theme.color.background.inverse, DARK_BLACK_COLOR),
45
+ white: getGradient(theme.color.background.neutralBase, theme.color.background.neutralAltActive),
95
46
  })[color];
47
+ const backgroundSlideAnimation = keyframes `
48
+ 0% {
49
+ background-position: 400% 50%;
50
+ }
51
+ 100% {
52
+ background-position: 0% 50%;
53
+ }
54
+ `;
96
55
  /**
97
56
  * 반짝이는 애니메이션 효과가 적용된 Button 컴포넌트
98
57
  */
99
58
  export function AnimatedButton(props) {
100
59
  const { color, loading, disabled } = props, _other = __rest(props, ["color", "loading", "disabled"]);
101
60
  const theme = useTheme();
102
- return (_jsx(Button, Object.assign({}, props, { css: disabled || loading ? [] : [
103
- css `
104
- background-size: 400% 100%;
105
- animation: AnimateBG 2s linear infinite;
106
- @keyframes AnimateBG {
107
- 0% {
108
- background-position: 100% 50%;
109
- }
110
- 100% {
111
- background-position: 0% 50%;
112
- }
113
- }
114
- `,
115
- COLOR_TO_BACKGROUND_IMAGE(theme, color)
116
- ] })));
61
+ return (_jsx(Button, Object.assign({}, props, { css: disabled || loading
62
+ ? []
63
+ : [
64
+ css `
65
+ background-size: 400% 100%;
66
+ animation: ${backgroundSlideAnimation} 8s linear infinite;
67
+ `,
68
+ COLOR_TO_BACKGROUND_IMAGE(theme, color),
69
+ ] })));
117
70
  }
118
- ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.88.2",
3
+ "version": "1.88.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,