@team-monolith/cds 1.24.0 → 1.24.1

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,5 +1,5 @@
1
1
  import React from "react";
2
- export type BannerColor = "red" | "blue" | "green" | "yellow";
2
+ export type BannerColor = "red" | "blue" | "green" | "yellow" | "white";
3
3
  export interface BannerProps {
4
4
  className?: string;
5
5
  component?: React.ElementType;
@@ -15,6 +15,8 @@ export interface BannerProps {
15
15
  buttonLabel?: string;
16
16
  /** 컴포넌트 우측 버튼 클릭 시 호출될 콜백 함수 */
17
17
  onButtonClick?: () => void;
18
+ /** 버튼 컴포넌트에 삽입될 ClassName */
19
+ buttonClassName?: string;
18
20
  /** 컴포넌트 우측에 표기될 닫기 버튼 유무 */
19
21
  close?: boolean;
20
22
  /** 닫기 버튼 클릭 시 호출될 콜백 함수 */
@@ -14,43 +14,50 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
14
14
  import { css, useTheme } from "@emotion/react";
15
15
  import styled from "@emotion/styled";
16
16
  import React from "react";
17
- import COLOR from "../foundation/color";
18
17
  import { CloseFillIcon } from "../icons";
19
- import { RESET_BUTTON } from "../utils/reset";
20
18
  import SquareButton from "./SquareButton";
21
- const COLOR_TO_STYLE = (theme, color) => ({
22
- red: css `
23
- background: ${theme.color.container.dangerContainer};
24
- color: ${theme.color.container.dangerOnContainer};
25
- `,
26
- blue: css `
27
- background: ${theme.color.container.primaryContainer};
28
- color: ${theme.color.container.primaryOnContainer};
29
- `,
30
- green: css `
31
- background: ${theme.color.container.successContainer};
32
- color: ${theme.color.container.successOnContainer};
33
- `,
34
- yellow: css `
35
- background: ${theme.color.container.warningContainer};
36
- color: ${theme.color.container.warningOnContainer};
37
- `,
19
+ import Button from "./Button";
20
+ const COLOR_PALETTE = (theme, color) => ({
21
+ red: {
22
+ background: theme.color.container.dangerContainer,
23
+ headline: theme.color.container.dangerOnContainer,
24
+ content: theme.color.container.dangerOnContainer,
25
+ },
26
+ blue: {
27
+ background: theme.color.container.primaryContainer,
28
+ headline: theme.color.container.primaryOnContainer,
29
+ content: theme.color.container.primaryOnContainer,
30
+ },
31
+ green: {
32
+ background: theme.color.container.successContainer,
33
+ headline: theme.color.container.successOnContainer,
34
+ content: theme.color.container.successOnContainer,
35
+ },
36
+ yellow: {
37
+ background: theme.color.container.warningContainer,
38
+ headline: theme.color.container.warningOnContainer,
39
+ content: theme.color.container.warningOnContainer,
40
+ },
41
+ white: {
42
+ background: theme.color.background.neutralBase,
43
+ headline: theme.color.foreground.neutralBaseDisabled,
44
+ content: theme.color.foreground.neutralBase,
45
+ },
38
46
  })[color];
39
47
  /**
40
48
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=44-2847&t=bhnL1ombbddld3RQ-0)
41
49
  */
42
50
  const Banner = React.forwardRef((props, ref) => {
43
- const { className, component: Component = "div", headline, content, icon, color, buttonLabel, onButtonClick, close, onClose, fullWidth } = props, other = __rest(props, ["className", "component", "headline", "content", "icon", "color", "buttonLabel", "onButtonClick", "close", "onClose", "fullWidth"]);
51
+ const { className, component: Component = "div", headline, content, icon, color, buttonLabel, buttonClassName, onButtonClick, close, onClose, fullWidth } = props, other = __rest(props, ["className", "component", "headline", "content", "icon", "color", "buttonLabel", "buttonClassName", "onButtonClick", "close", "onClose", "fullWidth"]);
44
52
  const theme = useTheme();
45
53
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: [
46
54
  css `
47
55
  box-sizing: border-box;
48
56
  display: flex;
49
57
  align-items: center;
50
- color: ${COLOR.white};
51
58
  line-height: 125%;
59
+ background: ${COLOR_PALETTE(theme, color).background};
52
60
  `,
53
- COLOR_TO_STYLE(theme, color),
54
61
  fullWidth
55
62
  ? css `
56
63
  width: 100%;
@@ -59,10 +66,17 @@ const Banner = React.forwardRef((props, ref) => {
59
66
  border-radius: 12px;
60
67
  width: fit-content;
61
68
  `,
62
- ] }, { children: [icon && _jsx(IconDiv, { children: icon }), _jsxs(TextContainer, { children: [headline && _jsx(HeadlineDiv, { children: headline }), content && _jsx(ContentDiv, { children: content })] }), buttonLabel && (_jsx(BannerButton, Object.assign({ type: "button", onClick: onButtonClick }, { children: buttonLabel }))), close && (_jsx(SquareButton, { css: css `
63
- > button,
64
- > button:hover {
65
- color: currentColor;
69
+ ] }, { children: [icon && (_jsx(IconDiv, Object.assign({ css: css `
70
+ color: ${COLOR_PALETTE(theme, color).headline};
71
+ ` }, { children: icon }))), _jsxs(TextContainer, { children: [headline && (_jsx(HeadlineDiv, Object.assign({ css: css `
72
+ color: ${COLOR_PALETTE(theme, color).headline};
73
+ ` }, { children: headline }))), content && (_jsx(ContentDiv, Object.assign({ css: css `
74
+ color: ${COLOR_PALETTE(theme, color).content};
75
+ ` }, { children: content })))] }), buttonLabel && (_jsx(Button, { className: buttonClassName, css: css `
76
+ color: ${COLOR_PALETTE(theme, color).content};
77
+ `, color: "textNeutral", size: "small", label: buttonLabel, onClick: onButtonClick })), close && (_jsx(SquareButton, { css: css `
78
+ > button {
79
+ color: ${COLOR_PALETTE(theme, color).content};
66
80
  }
67
81
  `, color: "icon", size: "medium", icon: _jsx(CloseFillIcon, {}), onClick: onClose }))] })));
68
82
  });
@@ -94,13 +108,4 @@ const TextContainer = styled.div `
94
108
  padding: 16px;
95
109
  gap: 4px;
96
110
  `;
97
- const BannerButton = styled.button `
98
- ${RESET_BUTTON}
99
- display: flex;
100
- justify-content: center;
101
- align-items: center;
102
- padding: 10px 12px;
103
- cursor: pointer;
104
- color: currentColor;
105
- `;
106
111
  export default Banner;
@@ -0,0 +1,33 @@
1
+ import { PolymorphicProps } from "@mui/base";
2
+ import React from "react";
3
+ export type SwitchButtonColor = "grey" | "white" | "none";
4
+ export type SwitchButtonSize = "medium" | "xsmall";
5
+ export interface SwitchButtonOwnProps<RootComponentType extends React.ElementType> {
6
+ className?: string;
7
+ component?: RootComponentType;
8
+ /** 스위치 버튼 색상 */
9
+ color: SwitchButtonColor;
10
+ /** 스위치 버튼 크기 */
11
+ size: SwitchButtonSize;
12
+ /** on/off status를 나타냅니다. */
13
+ isOn: boolean;
14
+ /** on 일때의 아이콘 */
15
+ onIcon: React.ReactNode;
16
+ /** off 일때의 아이콘 */
17
+ offIcon: React.ReactNode;
18
+ /** 아이콘 오른쪽에 나타낼 부분. 전달하지 않으면 나타나지 않습니다. */
19
+ content?: React.ReactNode;
20
+ /** 버튼 클릭시 실행될 콜백 */
21
+ onClick: () => void;
22
+ }
23
+ export type SwitchButtonProps<RootComponentType extends React.ElementType = SwitchButtonTypeMap["defaultComponent"]> = PolymorphicProps<SwitchButtonTypeMap<RootComponentType>, RootComponentType>;
24
+ export interface SwitchButtonTypeMap<RootComponentType extends React.ElementType = "button"> {
25
+ props: SwitchButtonOwnProps<RootComponentType>;
26
+ defaultComponent: RootComponentType;
27
+ }
28
+ type SwitchButtonComponent = <RootComponentType extends React.ElementType = "button">(props: SwitchButtonProps<RootComponentType>) => React.ReactElement | null;
29
+ /**
30
+ * [피그마](https://www.figma.com/file/CxpgZcJFoRPWEZyx5RC0tq/Framework-System?node-id=766%3A11274&mode=dev)
31
+ */
32
+ declare const SwitchButton: SwitchButtonComponent;
33
+ export default SwitchButton;
@@ -0,0 +1,153 @@
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
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
+ /** @jsxImportSource @emotion/react */
14
+ import { css, useTheme } from "@emotion/react";
15
+ import { HOVER } from "../utils/hover";
16
+ import React from "react";
17
+ import styled from "@emotion/styled";
18
+ const COLOR_TO_SWITCH_BUTTON_STYLE = (theme, color, isOn) => ({
19
+ grey: css `
20
+ ${isOn
21
+ ? css `
22
+ background: ${theme.color.background.neutralAltActive};
23
+ span {
24
+ opacity: 1;
25
+ font-weight: 700;
26
+ }
27
+ svg {
28
+ opacity: 1;
29
+ }
30
+ `
31
+ : css `
32
+ background: ${theme.color.background.neutralAlt};
33
+ span,
34
+ svg {
35
+ opacity: 0.6;
36
+ }
37
+ ${HOVER(css `
38
+ span,
39
+ svg {
40
+ opacity: 1;
41
+ }
42
+ `)}
43
+ `}
44
+ `,
45
+ white: css `
46
+ ${isOn
47
+ ? css `
48
+ background: ${theme.color.background.neutralAlt};
49
+ span {
50
+ opacity: 1;
51
+ font-weight: 700;
52
+ }
53
+ svg {
54
+ opacity: 1;
55
+ }
56
+ `
57
+ : css `
58
+ background: ${theme.color.background.neutralBase};
59
+ span,
60
+ svg {
61
+ opacity: 0.6;
62
+ }
63
+ ${HOVER(css `
64
+ span,
65
+ svg {
66
+ opacity: 1;
67
+ }
68
+ `)}
69
+ `}
70
+ `,
71
+ none: css `
72
+ ${isOn
73
+ ? css `
74
+ background: ${theme.color.background.neutralAlt};
75
+ span {
76
+ opacity: 1;
77
+ font-weight: 700;
78
+ }
79
+ svg {
80
+ opacity: 1;
81
+ }
82
+ `
83
+ : css `
84
+ background: none;
85
+ span,
86
+ svg {
87
+ opacity: 0.6;
88
+ }
89
+ ${HOVER(css `
90
+ span,
91
+ svg {
92
+ opacity: 1;
93
+ }
94
+ `)}
95
+ `}
96
+ `,
97
+ })[color];
98
+ const SIZE_TO_SWITCH_BUTTON_STYLE = (size) => ({
99
+ medium: css `
100
+ padding: 8px 12px;
101
+ gap: 8px;
102
+ height: 40px;
103
+ svg {
104
+ width: 24px;
105
+ height: 24px;
106
+ }
107
+ span {
108
+ font-size: 16px;
109
+ line-height: 20px;
110
+ }
111
+ `,
112
+ xsmall: css `
113
+ padding: 4px 6px;
114
+ gap: 4px;
115
+ height: 24px;
116
+ svg {
117
+ width: 16px;
118
+ height: 16px;
119
+ }
120
+ span {
121
+ font-size: 12px;
122
+ line-height: 16px;
123
+ }
124
+ `,
125
+ })[size];
126
+ /**
127
+ * [피그마](https://www.figma.com/file/CxpgZcJFoRPWEZyx5RC0tq/Framework-System?node-id=766%3A11274&mode=dev)
128
+ */
129
+ const SwitchButton = React.forwardRef(function SwitchButton(props, ref) {
130
+ const { className, component: Component = "button", color, size, isOn, onIcon, offIcon, content, onClick } = props, other = __rest(props, ["className", "component", "color", "size", "isOn", "onIcon", "offIcon", "content", "onClick"]);
131
+ const theme = useTheme();
132
+ return (_jsxs(Component, Object.assign({ type: "button" }, other, { className: className, ref: ref, css: [
133
+ css `
134
+ display: flex;
135
+ justify-content: center;
136
+ align-items: center;
137
+ width: fit-content;
138
+ cursor: pointer;
139
+ border: none;
140
+ border-radius: 99px;
141
+ text-decoration: none;
142
+ `,
143
+ COLOR_TO_SWITCH_BUTTON_STYLE(theme, color, isOn),
144
+ SIZE_TO_SWITCH_BUTTON_STYLE(size),
145
+ ], onClick: onClick }, { children: [isOn ? onIcon : offIcon, content && _jsx(Content, { children: content })] })));
146
+ });
147
+ const Content = styled.span(({ theme }) => css `
148
+ color: ${theme.color.foreground.neutralBase};
149
+ /* Default/Label/16px-Md */
150
+ font-family: ${theme.fontFamily.ui};
151
+ font-weight: 500;
152
+ `);
153
+ export default SwitchButton;
@@ -19,12 +19,10 @@ export declare const CustomSymbolIcon: React.ForwardRefExoticComponent<{
19
19
  export declare const customGoogleSvg: string;
20
20
  export declare const CustomGoogleIcon: React.ForwardRefExoticComponent<{
21
21
  className?: string | undefined;
22
- color?: string | undefined;
23
22
  } & React.RefAttributes<any>>;
24
23
  export declare const customWhaleSvg: string;
25
24
  export declare const CustomWhaleIcon: React.ForwardRefExoticComponent<{
26
25
  className?: string | undefined;
27
- color?: string | undefined;
28
26
  } & React.RefAttributes<any>>;
29
27
  export declare const customJudgeColorSvg: string;
30
28
  export declare const CustomJudgeColorIcon: React.ForwardRefExoticComponent<{
@@ -82,6 +80,20 @@ export declare const customProSvg: string;
82
80
  export declare const CustomProIcon: React.ForwardRefExoticComponent<{
83
81
  className?: string | undefined;
84
82
  } & React.RefAttributes<any>>;
83
+ export declare const customMasterSvg: string;
84
+ export declare const CustomMasterIcon: React.ForwardRefExoticComponent<{
85
+ className?: string | undefined;
86
+ } & React.RefAttributes<any>>;
87
+ export declare const customGrantSvg: string;
88
+ export declare const CustomGrantIcon: React.ForwardRefExoticComponent<{
89
+ className?: string | undefined;
90
+ color?: string | undefined;
91
+ } & React.RefAttributes<any>>;
92
+ export declare const customGrantAltSvg: string;
93
+ export declare const CustomGrantAltIcon: React.ForwardRefExoticComponent<{
94
+ className?: string | undefined;
95
+ color?: string | undefined;
96
+ } & React.RefAttributes<any>>;
85
97
  export declare const customQuizSvg: string;
86
98
  export declare const CustomQuizIcon: React.ForwardRefExoticComponent<{
87
99
  className?: string | undefined;
@@ -154,3 +166,57 @@ export declare const customEmbeddedColorSvg: string;
154
166
  export declare const CustomEmbeddedColorIcon: React.ForwardRefExoticComponent<{
155
167
  className?: string | undefined;
156
168
  } & React.RefAttributes<any>>;
169
+ export declare const customEmoHeartSvg: string;
170
+ export declare const CustomEmoHeartIcon: React.ForwardRefExoticComponent<{
171
+ className?: string | undefined;
172
+ color?: string | undefined;
173
+ } & React.RefAttributes<any>>;
174
+ export declare const customEmoHeartColorSvg: string;
175
+ export declare const CustomEmoHeartColorIcon: React.ForwardRefExoticComponent<{
176
+ className?: string | undefined;
177
+ } & React.RefAttributes<any>>;
178
+ export declare const customEmoHundredSvg: string;
179
+ export declare const CustomEmoHundredIcon: React.ForwardRefExoticComponent<{
180
+ className?: string | undefined;
181
+ color?: string | undefined;
182
+ } & React.RefAttributes<any>>;
183
+ export declare const customEmoHundredColorSvg: string;
184
+ export declare const CustomEmoHundredColorIcon: React.ForwardRefExoticComponent<{
185
+ className?: string | undefined;
186
+ } & React.RefAttributes<any>>;
187
+ export declare const customEmoStarsSvg: string;
188
+ export declare const CustomEmoStarsIcon: React.ForwardRefExoticComponent<{
189
+ className?: string | undefined;
190
+ color?: string | undefined;
191
+ } & React.RefAttributes<any>>;
192
+ export declare const customEmoStarsColorSvg: string;
193
+ export declare const CustomEmoStarsColorIcon: React.ForwardRefExoticComponent<{
194
+ className?: string | undefined;
195
+ } & React.RefAttributes<any>>;
196
+ export declare const customEmoThumbupSvg: string;
197
+ export declare const CustomEmoThumbupIcon: React.ForwardRefExoticComponent<{
198
+ className?: string | undefined;
199
+ color?: string | undefined;
200
+ } & React.RefAttributes<any>>;
201
+ export declare const customEmoThumbupColorSvg: string;
202
+ export declare const CustomEmoThumbupColorIcon: React.ForwardRefExoticComponent<{
203
+ className?: string | undefined;
204
+ } & React.RefAttributes<any>>;
205
+ export declare const customEmoClapSvg: string;
206
+ export declare const CustomEmoClapIcon: React.ForwardRefExoticComponent<{
207
+ className?: string | undefined;
208
+ color?: string | undefined;
209
+ } & React.RefAttributes<any>>;
210
+ export declare const customEmoClapColorSvg: string;
211
+ export declare const CustomEmoClapColorIcon: React.ForwardRefExoticComponent<{
212
+ className?: string | undefined;
213
+ } & React.RefAttributes<any>>;
214
+ export declare const customBoardSvg: string;
215
+ export declare const CustomBoardIcon: React.ForwardRefExoticComponent<{
216
+ className?: string | undefined;
217
+ color?: string | undefined;
218
+ } & React.RefAttributes<any>>;
219
+ export declare const customBoardColorSvg: string;
220
+ export declare const CustomBoardColorIcon: React.ForwardRefExoticComponent<{
221
+ className?: string | undefined;
222
+ } & React.RefAttributes<any>>;