@team-monolith/cds 1.88.3 → 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,13 +11,9 @@ 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
16
  const DARK_BLACK_COLOR = "#202020";
17
- // ButtonColor가 BackgroundButtonColor인지 체크하는 type guard 함수
18
- function isBackgroundButtonColor(color) {
19
- return !['textNeutral', 'textDanger', 'textPrimary'].includes(color);
20
- }
21
17
  const getGradient = (baseColor, activeColor) => css `
22
18
  background-image: repeating-linear-gradient(
23
19
  -45deg,
@@ -48,26 +44,26 @@ const COLOR_TO_BACKGROUND_IMAGE = (theme, color) => ({
48
44
  black: getGradient(theme.color.background.inverse, DARK_BLACK_COLOR),
49
45
  white: getGradient(theme.color.background.neutralBase, theme.color.background.neutralAltActive),
50
46
  })[color];
47
+ const backgroundSlideAnimation = keyframes `
48
+ 0% {
49
+ background-position: 400% 50%;
50
+ }
51
+ 100% {
52
+ background-position: 0% 50%;
53
+ }
54
+ `;
51
55
  /**
52
56
  * 반짝이는 애니메이션 효과가 적용된 Button 컴포넌트
53
57
  */
54
58
  export function AnimatedButton(props) {
55
59
  const { color, loading, disabled } = props, _other = __rest(props, ["color", "loading", "disabled"]);
56
60
  const theme = useTheme();
57
- return (_jsx(Button, Object.assign({}, props, { css: disabled || loading || !isBackgroundButtonColor(color)
61
+ return (_jsx(Button, Object.assign({}, props, { css: disabled || loading
58
62
  ? []
59
63
  : [
60
64
  css `
61
65
  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
- }
66
+ animation: ${backgroundSlideAnimation} 8s linear infinite;
71
67
  `,
72
68
  COLOR_TO_BACKGROUND_IMAGE(theme, color),
73
69
  ] })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.88.3",
3
+ "version": "1.88.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,