@team-monolith/cds 1.74.6 → 1.75.0

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,14 @@
1
1
  import React from "react";
2
2
  import { ButtonProps } from "./Button";
3
3
  export type BannerColor = "red" | "blue" | "green" | "yellow" | "white";
4
+ export declare const bannerClasses: {
5
+ readonly icon: "Banner-icon";
6
+ readonly textContainer: "Banner-textContainer";
7
+ readonly headline: "Banner-textContainer-headline";
8
+ readonly content: "Banner-textContainer-content";
9
+ readonly button: "Banner-button";
10
+ readonly closeSquareButton: "Banner-closeSquareButton";
11
+ };
4
12
  export interface BannerProps {
5
13
  className?: string;
6
14
  component?: React.ElementType;
@@ -16,8 +24,6 @@ export interface BannerProps {
16
24
  buttonLabel?: string;
17
25
  /** 컴포넌트 우측 버튼 클릭 시 호출될 콜백 함수 */
18
26
  onButtonClick?: () => void;
19
- /** 버튼 컴포넌트에 삽입될 ClassName */
20
- buttonClassName?: string;
21
27
  /** Button에 전달될 Props */
22
28
  buttonProps?: Omit<ButtonProps, "className" | "label" | "onClick">;
23
29
  /** 컴포넌트 우측에 표기될 닫기 버튼 유무 */
@@ -17,6 +17,14 @@ import React from "react";
17
17
  import { CloseFillIcon } from "../icons";
18
18
  import SquareButton from "./SquareButton";
19
19
  import Button from "./Button";
20
+ export const bannerClasses = {
21
+ icon: "Banner-icon",
22
+ textContainer: "Banner-textContainer",
23
+ headline: "Banner-textContainer-headline",
24
+ content: "Banner-textContainer-content",
25
+ button: "Banner-button",
26
+ closeSquareButton: "Banner-closeSquareButton",
27
+ };
20
28
  const COLOR_PALETTE = (theme, color) => ({
21
29
  red: {
22
30
  background: theme.color.container.redContainer,
@@ -49,7 +57,7 @@ const COLOR_PALETTE = (theme, color) => ({
49
57
  */
50
58
  // eslint-disable-next-line react/display-name, @typescript-eslint/no-explicit-any
51
59
  const Banner = React.forwardRef((props, ref) => {
52
- const { className, component: Component = "div", headline, content, icon, color, buttonLabel, buttonClassName, onButtonClick, buttonProps, close, onClose, fullWidth } = props, other = __rest(props, ["className", "component", "headline", "content", "icon", "color", "buttonLabel", "buttonClassName", "onButtonClick", "buttonProps", "close", "onClose", "fullWidth"]);
60
+ const { className, component: Component = "div", headline, content, icon, color, buttonLabel, onButtonClick, buttonProps, close, onClose, fullWidth } = props, other = __rest(props, ["className", "component", "headline", "content", "icon", "color", "buttonLabel", "onButtonClick", "buttonProps", "close", "onClose", "fullWidth"]);
53
61
  const theme = useTheme();
54
62
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: [
55
63
  css `
@@ -67,17 +75,17 @@ const Banner = React.forwardRef((props, ref) => {
67
75
  border-radius: 12px;
68
76
  width: fit-content;
69
77
  `,
70
- ] }, { children: [icon && (_jsx(IconDiv, Object.assign({ css: css `
78
+ ] }, { children: [icon && (_jsx(Icon, Object.assign({ className: bannerClasses.icon, css: css `
71
79
  align-self: ${headline && content ? "flex-start" : "center"};
72
80
  color: ${COLOR_PALETTE(theme, color).headline};
73
- ` }, { children: icon }))), _jsxs(TextContainer, { children: [headline && (_jsx(HeadlineDiv, Object.assign({ css: css `
81
+ ` }, { children: icon }))), _jsxs(TextContainer, Object.assign({ className: bannerClasses.textContainer }, { children: [headline && (_jsx(Headline, Object.assign({ className: bannerClasses.headline, css: css `
74
82
  color: ${COLOR_PALETTE(theme, color).headline};
75
- ` }, { children: headline }))), content && (_jsx(ContentDiv, Object.assign({ css: css `
83
+ ` }, { children: headline }))), content && (_jsx(Content, Object.assign({ className: bannerClasses.content, css: css `
76
84
  color: ${COLOR_PALETTE(theme, color).content};
77
- ` }, { children: content })))] }), buttonLabel && (_jsx(Button, Object.assign({ className: buttonClassName, css: !buttonProps &&
85
+ ` }, { children: content })))] })), buttonLabel && (_jsx(Button, Object.assign({ className: bannerClasses.button, css: !buttonProps &&
78
86
  css `
79
87
  color: ${COLOR_PALETTE(theme, color).content};
80
- `, color: "textNeutral", size: "small", label: buttonLabel, onClick: onButtonClick }, buttonProps))), close && (_jsx(SquareButton, { css: css `
88
+ `, color: "textNeutral", size: "small", label: buttonLabel, onClick: onButtonClick }, buttonProps))), close && (_jsx(SquareButton, { className: bannerClasses.closeSquareButton, css: css `
81
89
  > button {
82
90
  color: ${COLOR_PALETTE(theme, color).content};
83
91
  }
@@ -85,7 +93,7 @@ const Banner = React.forwardRef((props, ref) => {
85
93
  "aria-label": "닫기",
86
94
  } }))] })));
87
95
  });
88
- const IconDiv = styled.div `
96
+ const Icon = styled.div `
89
97
  display: flex;
90
98
  align-items: flex-start;
91
99
  padding: 12px 0px;
@@ -95,14 +103,14 @@ const IconDiv = styled.div `
95
103
  height: 20px;
96
104
  }
97
105
  `;
98
- const HeadlineDiv = styled.div(({ theme }) => css `
106
+ const Headline = styled.div(({ theme }) => css `
99
107
  font-family: ${theme.fontFamily.ui};
100
108
  font-size: 16px;
101
109
  font-style: normal;
102
110
  font-weight: 700;
103
111
  line-height: 20px; /* 125% */
104
112
  `);
105
- const ContentDiv = styled.div(({ theme }) => css `
113
+ const Content = styled.div(({ theme }) => css `
106
114
  font-family: ${theme.fontFamily.ui};
107
115
  font-size: 16px;
108
116
  font-style: normal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.74.6",
3
+ "version": "1.75.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,