@team-monolith/cds 1.42.1 → 1.43.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,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { Theme } from "@emotion/react";
2
3
  export declare const light: {
3
4
  fontFamily: {
4
5
  ui: string;
@@ -110,7 +111,119 @@ export declare const light: {
110
111
  };
111
112
  };
112
113
  };
114
+ export declare const dark: {
115
+ fontFamily: {
116
+ ui: string;
117
+ title: string;
118
+ };
119
+ color: {
120
+ background: {
121
+ neutralBase: string;
122
+ neutralBaseActive: string;
123
+ neutralBaseDisabled: string;
124
+ neutralAlt: string;
125
+ neutralAltActive: string;
126
+ neutralAltDisabled: string;
127
+ primary: string;
128
+ primaryActive: string;
129
+ primaryDisabled: string;
130
+ secondary: string;
131
+ secondaryActive: string;
132
+ secondaryDisabled: string;
133
+ danger: string;
134
+ dangerActive: string;
135
+ dangerDisabled: string;
136
+ success: string;
137
+ successActive: string;
138
+ successDisabled: string;
139
+ info: string;
140
+ infoActive: string;
141
+ infoDisabled: string;
142
+ warning: string;
143
+ warningActive: string;
144
+ warningDisabled: string;
145
+ inverse: string;
146
+ inverseActive: string;
147
+ inverseDisabled: string;
148
+ };
149
+ foreground: {
150
+ neutralBase: string;
151
+ neutralBaseActive: string;
152
+ neutralBaseDisabled: string;
153
+ neutralAlt: string;
154
+ neutralAltActive: string;
155
+ neutralAltDisabled: string;
156
+ primary: string;
157
+ primaryActive: string;
158
+ primaryDisabled: string;
159
+ secondary: string;
160
+ secondaryActive: string;
161
+ secondaryDisabled: string;
162
+ danger: string;
163
+ dangerActive: string;
164
+ dangerDisabled: string;
165
+ success: string;
166
+ successActive: string;
167
+ successDisabled: string;
168
+ info: string;
169
+ infoActive: string;
170
+ infoDisabled: string;
171
+ warning: string;
172
+ warningActive: string;
173
+ warningDisabled: string;
174
+ };
175
+ container: {
176
+ blueContainer: string;
177
+ blueOnContainer: string;
178
+ orangeContainer: string;
179
+ orangeOnContainer: string;
180
+ redContainer: string;
181
+ redOnContainer: string;
182
+ greenContainer: string;
183
+ greenOnContainer: string;
184
+ tealContainer: string;
185
+ tealOnContainer: string;
186
+ yellowContainer: string;
187
+ yellowOnContainer: string;
188
+ obsidianContainer: string;
189
+ obsidianOnContainer: string;
190
+ marbleContainer: string;
191
+ marbleOnContainer: string;
192
+ };
193
+ brand: {
194
+ brandOriginal: string;
195
+ brandAlt: string;
196
+ brandAccent: string;
197
+ brandFaded: string;
198
+ pdf: string;
199
+ pdfAlt: string;
200
+ quiz: string;
201
+ quizAlt: string;
202
+ python: string;
203
+ pythonAlt: string;
204
+ embedded: string;
205
+ embeddedAlt: string;
206
+ board: string;
207
+ boardAlt: string;
208
+ scratch: string;
209
+ scratchAlt: string;
210
+ entry: string;
211
+ entryAlt: string;
212
+ video: string;
213
+ videoAlt: string;
214
+ };
215
+ blanket: {
216
+ neutral: string;
217
+ neutralLight: string;
218
+ neutralHeavy: string;
219
+ inverse: string;
220
+ inverseLight: string;
221
+ inverseHeavy: string;
222
+ };
223
+ };
224
+ };
113
225
  interface CodleDesignSystemContext {
226
+ theme?: Theme;
114
227
  lexical?: {
115
228
  uploadByFile: (file: File) => Promise<string>;
116
229
  };
@@ -116,6 +116,117 @@ export const light = {
116
116
  },
117
117
  },
118
118
  };
119
+ export const dark = {
120
+ fontFamily: {
121
+ ui: FONT.pretendard,
122
+ title: FONT.naumSquareNeo,
123
+ },
124
+ color: {
125
+ background: {
126
+ neutralBase: COLOR.black,
127
+ neutralBaseActive: COLOR.grey08,
128
+ neutralBaseDisabled: COLOR.grey09,
129
+ neutralAlt: COLOR.grey08,
130
+ neutralAltActive: COLOR.grey07,
131
+ neutralAltDisabled: COLOR.grey09,
132
+ primary: COLOR.blue04,
133
+ primaryActive: COLOR.blue03,
134
+ primaryDisabled: COLOR.blue07,
135
+ secondary: COLOR.orange04,
136
+ secondaryActive: COLOR.orange03,
137
+ secondaryDisabled: COLOR.orange08,
138
+ danger: COLOR.red03,
139
+ dangerActive: COLOR.red02,
140
+ dangerDisabled: COLOR.red09,
141
+ success: COLOR.green04,
142
+ successActive: COLOR.green03,
143
+ successDisabled: COLOR.green08,
144
+ info: COLOR.teal03,
145
+ infoActive: COLOR.teal02,
146
+ infoDisabled: COLOR.teal09,
147
+ warning: COLOR.yellow03,
148
+ warningActive: COLOR.yellow02,
149
+ warningDisabled: COLOR.yellow09,
150
+ inverse: COLOR.white,
151
+ inverseActive: COLOR.grey03,
152
+ inverseDisabled: COLOR.grey07,
153
+ },
154
+ foreground: {
155
+ neutralBase: COLOR.white,
156
+ neutralBaseActive: COLOR.grey02,
157
+ neutralBaseDisabled: COLOR.grey04,
158
+ neutralAlt: COLOR.black,
159
+ neutralAltActive: COLOR.grey08,
160
+ neutralAltDisabled: COLOR.grey02,
161
+ primary: COLOR.blue04,
162
+ primaryActive: COLOR.blue03,
163
+ primaryDisabled: COLOR.blue07,
164
+ secondary: COLOR.orange04,
165
+ secondaryActive: COLOR.orange03,
166
+ secondaryDisabled: COLOR.orange07,
167
+ danger: COLOR.red03,
168
+ dangerActive: COLOR.red02,
169
+ dangerDisabled: COLOR.red07,
170
+ success: COLOR.green04,
171
+ successActive: COLOR.green03,
172
+ successDisabled: COLOR.green07,
173
+ info: COLOR.teal03,
174
+ infoActive: COLOR.teal02,
175
+ infoDisabled: COLOR.teal07,
176
+ warning: COLOR.yellow03,
177
+ warningActive: COLOR.yellow02,
178
+ warningDisabled: COLOR.yellow07,
179
+ },
180
+ container: {
181
+ blueContainer: COLOR.blue09,
182
+ blueOnContainer: COLOR.blue02,
183
+ orangeContainer: COLOR.orange09,
184
+ orangeOnContainer: COLOR.orange02,
185
+ redContainer: COLOR.red09,
186
+ redOnContainer: COLOR.red02,
187
+ greenContainer: COLOR.green09,
188
+ greenOnContainer: COLOR.green02,
189
+ tealContainer: COLOR.teal09,
190
+ tealOnContainer: COLOR.teal02,
191
+ yellowContainer: COLOR.yellow08,
192
+ yellowOnContainer: COLOR.yellow02,
193
+ obsidianContainer: COLOR.grey07,
194
+ obsidianOnContainer: COLOR.grey03,
195
+ marbleContainer: COLOR.grey03,
196
+ marbleOnContainer: COLOR.grey07,
197
+ },
198
+ brand: {
199
+ brandOriginal: COLOR.blue06,
200
+ brandAlt: COLOR.blue04,
201
+ brandAccent: COLOR.blue03,
202
+ brandFaded: COLOR.blue07,
203
+ pdf: "#FF5850",
204
+ pdfAlt: "#800700",
205
+ quiz: "#F889AA",
206
+ quizAlt: "#760A27",
207
+ python: "#3E88FF",
208
+ pythonAlt: "#002666",
209
+ embedded: "#7C8597",
210
+ embeddedAlt: "#434956",
211
+ board: "#42DB88",
212
+ boardAlt: "#11552D",
213
+ scratch: "#FF9D3E",
214
+ scratchAlt: "#663000",
215
+ entry: "#32D27D",
216
+ entryAlt: "#135330",
217
+ video: "#5F32DE",
218
+ videoAlt: "#2D2640",
219
+ },
220
+ blanket: {
221
+ neutral: COLOR.alphaf20,
222
+ neutralLight: COLOR.alphaf10,
223
+ neutralHeavy: COLOR.alphaf50,
224
+ inverse: COLOR.alpha030,
225
+ inverseLight: COLOR.alpha015,
226
+ inverseHeavy: COLOR.alpha065,
227
+ },
228
+ },
229
+ };
119
230
  export const CodleDesignSystemContext = createContext({});
120
231
  // eslint-disable-next-line import/no-anonymous-default-export
121
232
  export default function (props) {
@@ -131,9 +242,10 @@ export default function (props) {
131
242
  },
132
243
  },
133
244
  });
245
+ const { theme = light } = props;
134
246
  return (_jsxs(_Fragment, { children: [_jsx(Global, { styles: css `
135
247
  body {
136
248
  font-family: ${FONT.pretendard};
137
249
  }
138
- ` }), _jsx(MuiThemeProvider, Object.assign({ theme: muiTheme }, { children: _jsx(ThemeProvider, Object.assign({ theme: light }, { children: _jsx(CodleDesignSystemContext.Provider, Object.assign({ value: props }, { children: props.children })) })) }))] }));
250
+ ` }), _jsx(MuiThemeProvider, Object.assign({ theme: muiTheme }, { children: _jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsx(CodleDesignSystemContext.Provider, Object.assign({ value: props }, { children: props.children })) })) }))] }));
139
251
  }
@@ -52,9 +52,9 @@ const Banner = React.forwardRef((props, ref) => {
52
52
  const theme = useTheme();
53
53
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: [
54
54
  css `
55
- box-sizing: border-box;
56
55
  display: flex;
57
56
  align-items: center;
57
+ padding: 0px 12px;
58
58
  line-height: 125%;
59
59
  background: ${COLOR_PALETTE(theme, color).background};
60
60
  `,
@@ -67,6 +67,7 @@ const Banner = React.forwardRef((props, ref) => {
67
67
  width: fit-content;
68
68
  `,
69
69
  ] }, { children: [icon && (_jsx(IconDiv, Object.assign({ css: css `
70
+ align-self: ${headline && content ? "flex-start" : "center"};
70
71
  color: ${COLOR_PALETTE(theme, color).headline};
71
72
  ` }, { children: icon }))), _jsxs(TextContainer, { children: [headline && (_jsx(HeadlineDiv, Object.assign({ css: css `
72
73
  color: ${COLOR_PALETTE(theme, color).headline};
@@ -78,12 +79,17 @@ const Banner = React.forwardRef((props, ref) => {
78
79
  > button {
79
80
  color: ${COLOR_PALETTE(theme, color).content};
80
81
  }
81
- `, color: "icon", size: "medium", icon: _jsx(CloseFillIcon, {}), onClick: onClose }))] })));
82
+ `, color: "icon", size: "small", icon: _jsx(CloseFillIcon, {}), onClick: onClose }))] })));
82
83
  });
83
84
  const IconDiv = styled.div `
84
85
  display: flex;
85
- align-items: center;
86
- padding: 16px 0px 16px 16px;
86
+ align-items: flex-start;
87
+ padding: 12px 0px;
88
+
89
+ svg {
90
+ width: 20px;
91
+ height: 20px;
92
+ }
87
93
  `;
88
94
  const HeadlineDiv = styled.div(({ theme }) => css `
89
95
  font-family: ${theme.fontFamily.ui};
@@ -105,7 +111,7 @@ const TextContainer = styled.div `
105
111
  display: flex;
106
112
  flex-direction: column;
107
113
  align-items: flex-start;
108
- padding: 16px;
114
+ padding: 12px;
109
115
  gap: 4px;
110
116
  `;
111
117
  export default Banner;
@@ -19,6 +19,8 @@ export interface ButtonOwnProps<RootComponentType extends React.ElementType> {
19
19
  label: React.ReactNode;
20
20
  /** 버튼 텍스트 굵음 여부 */
21
21
  bold?: boolean;
22
+ /** 로딩 여부 */
23
+ loading?: boolean;
22
24
  /** 전체 너비 유무 */
23
25
  fullWidth?: boolean;
24
26
  }
@@ -15,18 +15,19 @@ import { css, useTheme } from "@emotion/react";
15
15
  import styled from "@emotion/styled";
16
16
  import React from "react";
17
17
  import { HOVER } from "../utils/hover";
18
+ import { Spinner } from "..";
18
19
  const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
19
20
  primary: css `
20
21
  ${disabled
21
22
  ? css `
22
- color: ${theme.color.foreground.neutralAlt};
23
+ color: ${theme.color.foreground.neutralAltDisabled};
23
24
  background: ${theme.color.background.primaryDisabled};
24
25
  `
25
26
  : css `
26
27
  color: ${theme.color.foreground.neutralAlt};
27
28
  background: ${theme.color.background.primary};
28
29
  ${HOVER(css `
29
- color: ${theme.color.foreground.neutralAlt};
30
+ color: ${theme.color.foreground.neutralAltActive};
30
31
  background: ${theme.color.background.primaryActive};
31
32
  `)}
32
33
  `}
@@ -34,7 +35,7 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
34
35
  grey: css `
35
36
  ${disabled
36
37
  ? css `
37
- background: ${theme.color.background.neutralAlt};
38
+ background: ${theme.color.background.neutralAltDisabled};
38
39
  color: ${theme.color.foreground.neutralBaseDisabled};
39
40
  `
40
41
  : css `
@@ -42,21 +43,21 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
42
43
  color: ${theme.color.foreground.neutralBase};
43
44
  ${HOVER(css `
44
45
  background: ${theme.color.background.neutralAltActive};
45
- color: ${theme.color.foreground.neutralBase};
46
+ color: ${theme.color.foreground.neutralBaseActive};
46
47
  `)}
47
48
  `}
48
49
  `,
49
50
  danger: css `
50
51
  ${disabled
51
52
  ? css `
52
- color: ${theme.color.foreground.neutralAlt};
53
+ color: ${theme.color.foreground.neutralAltDisabled};
53
54
  background: ${theme.color.background.dangerDisabled};
54
55
  `
55
56
  : css `
56
57
  color: ${theme.color.foreground.neutralAlt};
57
58
  background: ${theme.color.background.danger};
58
59
  ${HOVER(css `
59
- color: ${theme.color.foreground.neutralAlt};
60
+ color: ${theme.color.foreground.neutralAltActive};
60
61
  background: ${theme.color.background.dangerActive};
61
62
  `)}
62
63
  `}
@@ -71,8 +72,8 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
71
72
  background: none;
72
73
  color: ${theme.color.foreground.neutralBase};
73
74
  ${HOVER(css `
74
- background: ${theme.color.background.neutralAltActive};
75
- color: ${theme.color.foreground.neutralBase};
75
+ background: ${theme.color.blanket.neutralLight};
76
+ color: ${theme.color.foreground.neutralBaseActive};
76
77
  `)}
77
78
  `}
78
79
  `,
@@ -86,8 +87,8 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
86
87
  background: none;
87
88
  color: ${theme.color.foreground.danger};
88
89
  ${HOVER(css `
89
- background: ${theme.color.background.neutralAltActive};
90
- color: ${theme.color.foreground.danger};
90
+ background: ${theme.color.blanket.neutralLight};
91
+ color: ${theme.color.foreground.dangerActive};
91
92
  `)}
92
93
  `}
93
94
  `,
@@ -101,8 +102,8 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
101
102
  background: none;
102
103
  color: ${theme.color.foreground.primary};
103
104
  ${HOVER(css `
104
- background: ${theme.color.background.neutralAltActive};
105
- color: ${theme.color.foreground.primary};
105
+ background: ${theme.color.blanket.neutralLight};
106
+ color: ${theme.color.foreground.primaryActive};
106
107
  `)}
107
108
  `}
108
109
  `,
@@ -117,7 +118,7 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
117
118
  color: ${theme.color.foreground.neutralAlt};
118
119
  ${HOVER(css `
119
120
  background: ${theme.color.background.inverseActive};
120
- color: ${theme.color.foreground.neutralAlt};
121
+ color: ${theme.color.foreground.neutralAltActive};
121
122
  `)}
122
123
  `}
123
124
  `,
@@ -132,7 +133,7 @@ const COLOR_TO_BUTTON_STYLE = (theme, color, disabled) => ({
132
133
  color: ${theme.color.foreground.neutralBase};
133
134
  ${HOVER(css `
134
135
  background: ${theme.color.background.neutralAltActive};
135
- color: ${theme.color.foreground.neutralBase};
136
+ color: ${theme.color.foreground.neutralBaseActive};
136
137
  `)}
137
138
  `}
138
139
  `,
@@ -143,6 +144,7 @@ const SIZE_TO_BUTTON_STYLE = {
143
144
  height: 56px;
144
145
  padding: 0 20px;
145
146
  gap: 10px;
147
+ border-radius: 12px;
146
148
 
147
149
  svg {
148
150
  width: 24px;
@@ -154,6 +156,7 @@ const SIZE_TO_BUTTON_STYLE = {
154
156
  height: 48px;
155
157
  padding: 0 16px;
156
158
  gap: 8px;
159
+ border-radius: 10px;
157
160
 
158
161
  svg {
159
162
  width: 20px;
@@ -165,6 +168,7 @@ const SIZE_TO_BUTTON_STYLE = {
165
168
  height: 36px;
166
169
  padding: 0 12px;
167
170
  gap: 8px;
171
+ border-radius: 8px;
168
172
 
169
173
  svg {
170
174
  width: 16px;
@@ -176,6 +180,7 @@ const SIZE_TO_BUTTON_STYLE = {
176
180
  height: 28px;
177
181
  padding: 0 8px;
178
182
  gap: 4px;
183
+ border-radius: 6px;
179
184
 
180
185
  svg {
181
186
  width: 12px;
@@ -205,7 +210,7 @@ const SIZE_TO_LABEL_STYLE = {
205
210
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=20-173&t=cXcCv3QijbX7MkoC-0)
206
211
  */
207
212
  const Button = React.forwardRef(function Button(props, ref) {
208
- const { className, component: Component = "button", disabled, color, size, startIcon, endIcon, label, fullWidth, bold = false } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "label", "fullWidth", "bold"]);
213
+ const { className, component: Component = "button", disabled, color, size, startIcon, endIcon, label, fullWidth, bold = false, loading = false } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "label", "fullWidth", "bold", "loading"]);
209
214
  const theme = useTheme();
210
215
  return (_jsxs(Component, Object.assign({ type: "button" }, other, { className: className, ref: ref, css: [
211
216
  css `
@@ -215,9 +220,8 @@ const Button = React.forwardRef(function Button(props, ref) {
215
220
  gap: 8px;
216
221
 
217
222
  border: none;
218
- border-radius: 8px;
219
223
 
220
- ${disabled
224
+ ${disabled || loading
221
225
  ? css `
222
226
  cursor: default;
223
227
  pointer-events: none;
@@ -237,9 +241,9 @@ const Button = React.forwardRef(function Button(props, ref) {
237
241
  flex-shrink: 0;
238
242
  `};
239
243
  `,
240
- COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled)),
244
+ COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled || loading)),
241
245
  SIZE_TO_BUTTON_STYLE[size],
242
- ], disabled: disabled }, { children: [startIcon, label && (_jsx(Label, Object.assign({ size: size, bold: bold }, { children: label }))), endIcon] })));
246
+ ], disabled: disabled || loading }, { children: [loading ? _jsx(Spinner, {}) : startIcon, label && (_jsx(Label, Object.assign({ size: size, bold: bold }, { children: label }))), endIcon] })));
243
247
  });
244
248
  const Label = styled.span `
245
249
  font-weight: ${({ bold }) => (bold ? 700 : 400)};
@@ -25,8 +25,8 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => {
25
25
  ${disabled
26
26
  ? css `
27
27
  rect {
28
- fill: ${theme.color.background.neutralAlt};
29
- stroke: ${theme.color.background.neutralAltActive};
28
+ fill: ${theme.color.background.neutralBaseDisabled};
29
+ stroke: ${theme.color.foreground.neutralBaseDisabled};
30
30
  }
31
31
  `
32
32
  : css `
@@ -48,7 +48,7 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => {
48
48
  ${disabled
49
49
  ? css `
50
50
  rect {
51
- fill: ${theme.color.background.neutralAlt};
51
+ fill: ${theme.color.background.neutralBaseDisabled};
52
52
  stroke: ${theme.color.background.primaryDisabled};
53
53
  }
54
54
  path {
@@ -76,7 +76,7 @@ const CHECKBOX_ICON_STYLE = (theme, type, disabled) => {
76
76
  ${disabled
77
77
  ? css `
78
78
  rect {
79
- fill: ${theme.color.background.neutralAlt};
79
+ fill: ${theme.color.background.neutralBaseDisabled};
80
80
  stroke: ${theme.color.background.primaryDisabled};
81
81
  }
82
82
  rect + rect {
@@ -114,7 +114,7 @@ const CheckboxInput = React.forwardRef((props, ref) => {
114
114
  onChange,
115
115
  inputProps,
116
116
  };
117
- return (_jsxs(Label, Object.assign({ className: className, ref: ref }, other, { children: [_jsx(Checkbox, Object.assign({}, checkboxProps)), _jsx("span", Object.assign({ css: css `
117
+ return (_jsxs(Label, Object.assign({ className: className, ref: ref, disabled: disabled !== null && disabled !== void 0 ? disabled : false }, other, { children: [_jsx(Checkbox, Object.assign({}, checkboxProps)), _jsx("span", Object.assign({ css: css `
118
118
  margin-left: 8px;
119
119
  ` }, { children: label }))] })));
120
120
  });
@@ -155,7 +155,9 @@ const Label = styled.label `
155
155
  font-size: 14px;
156
156
  font-weight: 500;
157
157
  line-height: 16px;
158
- color: ${({ theme }) => theme.color.foreground.neutralBase};
158
+ color: ${({ theme, disabled }) => disabled
159
+ ? theme.color.foreground.neutralBaseDisabled
160
+ : theme.color.foreground.neutralBase};
159
161
  align-self: center;
160
162
  `;
161
163
  const CheckboxIcon = (props) => {
@@ -24,10 +24,9 @@ const TYPE_TO_ICON_STYLE = (theme, type, disabled) => {
24
24
  }
25
25
  ${disabled
26
26
  ? css `
27
- cursor: default;
28
27
  path {
29
- stroke: ${theme.color.background.primaryDisabled};
30
- fill: ${theme.color.background.neutralAlt};
28
+ stroke: ${theme.color.foreground.neutralBaseDisabled};
29
+ fill: ${theme.color.background.neutralBaseDisabled};
31
30
  }
32
31
  `
33
32
  : css `
@@ -48,10 +47,9 @@ const TYPE_TO_ICON_STYLE = (theme, type, disabled) => {
48
47
  }
49
48
  ${disabled
50
49
  ? css `
51
- cursor: default;
52
50
  path {
53
51
  stroke: ${theme.color.background.primaryDisabled};
54
- fill: ${theme.color.background.neutralAlt};
52
+ fill: ${theme.color.background.neutralBaseDisabled};
55
53
  }
56
54
  rect {
57
55
  fill: ${theme.color.background.primaryDisabled};
@@ -85,14 +83,14 @@ const RadioInput = React.forwardRef((props, ref) => {
85
83
  onChange,
86
84
  inputProps,
87
85
  };
88
- return (_jsxs(Label, Object.assign({ className: className, ref: ref }, other, { children: [_jsx(RadioButton, Object.assign({}, radioProps)), _jsx("span", Object.assign({ css: css `
86
+ return (_jsxs(Label, Object.assign({ className: className, ref: ref, disabled: disabled !== null && disabled !== void 0 ? disabled : false }, other, { children: [_jsx(RadioButton, Object.assign({}, radioProps)), _jsx("span", Object.assign({ css: css `
89
87
  margin-left: 8px;
90
88
  ` }, { children: label }))] })));
91
89
  });
92
90
  const RadioButton = React.forwardRef((props, ref) => {
93
91
  const { className, checked, label, spacer = false, disabled = false, onChange, inputProps } = props, other = __rest(props, ["className", "checked", "label", "spacer", "disabled", "onChange", "inputProps"]);
94
92
  const type = props.checked ? "selected" : "default";
95
- return (_jsxs(RadioButtonContainer, Object.assign({ className: className, spacer: spacer, ref: ref }, other, { children: [_jsx(StyledInput, Object.assign({ type: "radio" }, inputProps, { checked: checked, disabled: disabled, onChange: onChange })), _jsx(RadioButtonIcon, { type: type, disabled: disabled })] })));
93
+ return (_jsxs(RadioButtonContainer, Object.assign({ className: className, spacer: spacer, disabled: disabled, ref: ref }, other, { children: [_jsx(StyledInput, Object.assign({ type: "radio" }, inputProps, { checked: checked, disabled: disabled, onChange: onChange })), _jsx(RadioButtonIcon, { type: type, disabled: disabled })] })));
96
94
  });
97
95
  const Label = styled.label `
98
96
  display: flex;
@@ -101,15 +99,17 @@ const Label = styled.label `
101
99
  font-size: 14px;
102
100
  font-weight: 500;
103
101
  line-height: 16px;
104
- color: ${({ theme }) => theme.color.foreground.neutralBase};
102
+ color: ${({ theme, disabled }) => disabled
103
+ ? theme.color.foreground.neutralBaseDisabled
104
+ : theme.color.foreground.neutralBase};
105
105
  align-self: center;
106
106
  `;
107
- const RadioButtonContainer = styled.span(({ spacer }) => css `
107
+ const RadioButtonContainer = styled.span(({ spacer, disabled }) => css `
108
108
  display: inline-flex;
109
109
  position: relative;
110
110
  width: 16px;
111
111
  height: 16px;
112
- cursor: pointer;
112
+ cursor: ${disabled ? "default" : "pointer"};
113
113
  margin-bottom: ${spacer ? "8px" : "0"};
114
114
  `);
115
115
  const StyledInput = styled.input `
@@ -0,0 +1,2 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ export declare function Spinner(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ export function Spinner() {
4
+ return (_jsxs("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, { children: [_jsx("path", { d: "M15.6025 10.4904C16.095 8.98682 16.1307 7.37089 15.7048 5.84702C15.279 4.32314 14.4109 2.95976 13.2102 1.92928C12.0095 0.898795 10.5303 0.247495 8.95942 0.0577392C7.38859 -0.132017 5.79677 0.148294 4.38525 0.863224C2.97373 1.57815 1.80591 2.69559 1.02946 4.07424C0.253021 5.45288 -0.0971706 7.0308 0.0231732 8.60847C0.143517 10.1861 0.728991 11.6927 1.70556 12.9376C2.68213 14.1825 4.00592 15.1099 5.50955 15.6025L6.50573 12.5615C5.60355 12.2659 4.80928 11.7095 4.22333 10.9626C3.63739 10.2156 3.28611 9.31168 3.2139 8.36508C3.1417 7.41848 3.35181 6.47173 3.81768 5.64454C4.28354 4.81736 4.98424 4.14689 5.83115 3.71793C6.67806 3.28898 7.63316 3.12079 8.57565 3.23464C9.51815 3.3485 10.4057 3.73928 11.1261 4.35757C11.8465 4.97586 12.3674 5.79389 12.6229 6.70821C12.8784 7.62254 12.857 8.59209 12.5615 9.49427L15.6025 10.4904Z", fill: "currentColor" }), _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", dur: "1s", from: "0 0 0", to: "360 0 0", repeatCount: "indefinite" })] })));
5
+ }
@@ -19,6 +19,8 @@ export interface SquareButtonOwnProps<RootComponentType extends React.ElementTyp
19
19
  label?: string;
20
20
  /** 전체 너비 유무 */
21
21
  fullWidth?: boolean;
22
+ /** 로딩 여부 */
23
+ loading?: boolean;
22
24
  /** 버튼 클릭 시 호출될 콜백 함수 */
23
25
  onClick?: () => void;
24
26
  }
@@ -15,6 +15,7 @@ import { css } from "@emotion/react";
15
15
  import styled from "@emotion/styled";
16
16
  import React from "react";
17
17
  import { HOVER } from "../utils/hover";
18
+ import { Spinner } from "./Spinner";
18
19
  const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
19
20
  danger: css `
20
21
  border: none;
@@ -23,9 +24,11 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
23
24
 
24
25
  ${HOVER(css `
25
26
  background: ${theme.color.background.dangerActive};
27
+ color: ${theme.color.foreground.neutralAltActive};
26
28
  `)}
27
29
  &:disabled {
28
30
  background: ${theme.color.background.dangerDisabled};
31
+ color: ${theme.color.foreground.neutralAltDisabled};
29
32
  }
30
33
  `,
31
34
  grey: css `
@@ -35,10 +38,10 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
35
38
 
36
39
  ${HOVER(css `
37
40
  background: ${theme.color.background.neutralAltActive};
38
- color: ${theme.color.foreground.neutralBase};
41
+ color: ${theme.color.foreground.neutralBaseActive};
39
42
  `)}
40
43
  &:disabled {
41
- background: ${theme.color.background.neutralAlt};
44
+ background: ${theme.color.background.neutralAltDisabled};
42
45
  color: ${theme.color.foreground.neutralBaseDisabled};
43
46
  }
44
47
  `,
@@ -49,9 +52,11 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
49
52
 
50
53
  ${HOVER(css `
51
54
  background: ${theme.color.background.primaryActive};
55
+ color: ${theme.color.foreground.neutralAltActive};
52
56
  `)}
53
57
  &:disabled {
54
58
  background: ${theme.color.background.primaryDisabled};
59
+ color: ${theme.color.foreground.neutralAltDisabled};
55
60
  }
56
61
  `,
57
62
  icon: css `
@@ -60,8 +65,8 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
60
65
  color: ${theme.color.foreground.neutralBase};
61
66
 
62
67
  ${HOVER(css `
63
- background: ${theme.color.background.neutralAltActive};
64
- color: ${theme.color.foreground.neutralBase};
68
+ background: ${theme.color.blanket.neutralLight};
69
+ color: ${theme.color.foreground.neutralBaseActive};
65
70
  `)}
66
71
  &:disabled {
67
72
  background: none;
@@ -74,7 +79,7 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
74
79
  color: ${theme.color.foreground.neutralAlt};
75
80
  ${HOVER(css `
76
81
  background: ${theme.color.background.inverseActive};
77
- color: ${theme.color.foreground.neutralAlt};
82
+ color: ${theme.color.foreground.neutralAltActive};
78
83
  `)}
79
84
  &:disabled {
80
85
  background: ${theme.color.background.inverseDisabled};
@@ -87,7 +92,7 @@ const COLOR_TO_BUTTON_STYLE = (theme, color) => ({
87
92
  color: ${theme.color.foreground.neutralBase};
88
93
  ${HOVER(css `
89
94
  background: ${theme.color.background.neutralAltActive};
90
- color: ${theme.color.foreground.neutralBase};
95
+ color: ${theme.color.foreground.neutralBaseActive};
91
96
  `)}
92
97
  &:disabled {
93
98
  background: ${theme.color.background.neutralAltDisabled};
@@ -99,41 +104,45 @@ const SIZE_TO_BUTTON_STYLE = {
99
104
  large: css `
100
105
  width: 56px;
101
106
  height: 56px;
102
- padding: 16px;
107
+ padding: 12px;
108
+ border-radius: 8px;
103
109
 
104
110
  svg {
105
- width: 24px;
106
- height: 24px;
111
+ width: 32px;
112
+ height: 32px;
107
113
  }
108
114
  `,
109
115
  medium: css `
110
116
  width: 48px;
111
117
  height: 48px;
112
- padding: 14px;
118
+ padding: 10px;
119
+ border-radius: 8px;
113
120
 
114
121
  svg {
115
- width: 20px;
116
- height: 20px;
122
+ width: 28px;
123
+ height: 28px;
117
124
  }
118
125
  `,
119
126
  small: css `
120
127
  width: 36px;
121
128
  height: 36px;
122
- padding: 10px;
129
+ padding: 8px;
130
+ border-radius: 8px;
123
131
 
124
132
  svg {
125
- width: 16px;
126
- height: 16px;
133
+ width: 20px;
134
+ height: 20px;
127
135
  }
128
136
  `,
129
137
  xsmall: css `
130
138
  width: 28px;
131
139
  height: 28px;
132
- padding: 8px;
140
+ padding: 6px;
141
+ border-radius: 4px;
133
142
 
134
143
  svg {
135
- width: 12px;
136
- height: 12px;
144
+ width: 16px;
145
+ height: 16px;
137
146
  }
138
147
  `,
139
148
  };
@@ -159,7 +168,7 @@ const SIZE_TO_LABEL_STYLE = {
159
168
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=22-374&t=kTLv3t86qtGalHSS-0)
160
169
  */
161
170
  const SquareButton = React.forwardRef(function SquareButton(props, ref) {
162
- const { className, component: Component = "span", disabled, type = "button", color, size, icon, label, fullWidth, onClick } = props, other = __rest(props, ["className", "component", "disabled", "type", "color", "size", "icon", "label", "fullWidth", "onClick"]);
171
+ const { className, component: Component = "span", disabled, type = "button", color, size, icon, label, fullWidth, onClick, loading = false } = props, other = __rest(props, ["className", "component", "disabled", "type", "color", "size", "icon", "label", "fullWidth", "onClick", "loading"]);
163
172
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: css `
164
173
  display: flex;
165
174
  flex-direction: column;
@@ -167,10 +176,9 @@ const SquareButton = React.forwardRef(function SquareButton(props, ref) {
167
176
  gap: 8px;
168
177
 
169
178
  width: ${fullWidth ? "100%" : "fit-content"};
170
- ` }, { children: [_jsx(Button, Object.assign({ type: type, color: color, size: size, disabled: disabled, fullWidth: fullWidth, onClick: onClick }, { children: icon })), label && (_jsx(Label, Object.assign({ disabled: disabled, size: size }, { children: label })))] })));
179
+ ` }, { children: [_jsx(Button, Object.assign({ type: type, color: color, size: size, disabled: disabled || loading, fullWidth: fullWidth, onClick: onClick }, { children: loading ? _jsx(Spinner, {}) : icon })), label && (_jsx(Label, Object.assign({ disabled: disabled || loading, size: size }, { children: label })))] })));
171
180
  });
172
181
  const Button = styled.button `
173
- border-radius: 8px;
174
182
  cursor: pointer;
175
183
  &:disabled {
176
184
  cursor: default;
@@ -39,50 +39,73 @@ const SIZE_TO_SWTICH_SIZE = {
39
39
  const StyledSwitch = styled(MuiSwitch, {
40
40
  shouldForwardProp: (prop) => prop !== "switchSize",
41
41
  })(({ theme, switchSize }) => css `
42
- width: ${SIZE_TO_SWTICH_SIZE[switchSize].width};
43
- height: ${SIZE_TO_SWTICH_SIZE[switchSize].height};
44
- padding: 0; // 기존 Mui padding 속성 override
45
- & .MuiSwitch-switchBase {
46
- padding: 2px;
47
- &.Mui-checked {
48
- transform: translateX(${SIZE_TO_SWTICH_SIZE[switchSize].translateX});
49
- color: ${theme.color.foreground.neutralAlt};
42
+ // Specificity를 높이기 위해 최상위에 &.MuiSwitch-root를 추가
43
+ &.MuiSwitch-root {
44
+ width: ${SIZE_TO_SWTICH_SIZE[switchSize].width};
45
+ height: ${SIZE_TO_SWTICH_SIZE[switchSize].height};
46
+ padding: 0; // 기존 Mui padding 속성 override
47
+ .MuiSwitch-switchBase {
48
+ padding: 2px;
49
+ &.Mui-checked {
50
+ transform: translateX(${SIZE_TO_SWTICH_SIZE[switchSize].translateX});
51
+ }
52
+ }
53
+
54
+ .MuiSwitch-thumb {
55
+ box-shadow: none;
56
+ filter: drop-shadow(0px 2px 4px rgba(0, 35, 11, 0.2));
57
+ width: ${SIZE_TO_SWTICH_SIZE[switchSize].thumbSize};
58
+ height: ${SIZE_TO_SWTICH_SIZE[switchSize].thumbSize};
59
+ border-radius: 77px;
60
+ transition: color 0.3s ease;
61
+
62
+ color: ${theme.color.foreground.primary};
63
+ }
64
+
65
+ .MuiSwitch-track {
66
+ border-radius: 16px;
67
+ opacity: 1;
68
+ box-sizing: border-box;
69
+
70
+ background: none;
71
+ border: 1px solid ${theme.color.background.primary};
72
+ }
73
+
74
+ .Mui-disabled {
50
75
  & + .MuiSwitch-track {
51
76
  opacity: 1;
77
+ border-color: ${theme.color.background.primaryDisabled};
78
+ }
79
+
80
+ .MuiSwitch-thumb {
81
+ filter: none;
82
+ color: ${theme.color.foreground.primaryDisabled};
83
+ }
84
+ }
85
+
86
+ .Mui-checked {
87
+ & + .MuiSwitch-track {
88
+ opacity: 1;
89
+ border-color: ${theme.color.background.primary};
52
90
  background-color: ${theme.color.background.primary};
53
91
  }
54
- &.Mui-disabled + .MuiSwitch-track {
92
+
93
+ .MuiSwitch-thumb {
94
+ color: ${theme.color.background.neutralBase};
95
+ }
96
+ }
97
+
98
+ .Mui-checked.Mui-disabled {
99
+ & + .MuiSwitch-track {
55
100
  opacity: 1;
101
+ border-color: ${theme.color.background.primaryDisabled};
56
102
  background-color: ${theme.color.background.primaryDisabled};
57
103
  }
58
- }
59
- &.Mui-disabled + .MuiSwitch-track {
60
- opacity: 1;
61
- background-color: ${theme.color.background.neutralAltDisabled};
62
- }
63
- &:hover {
64
- background-color: inherit; // 기존 Mui hover 속성 override
65
- }
66
- }
67
- .Mui-disabled .MuiSwitch-thumb {
68
- filter: none;
69
- box-shadow: none;
70
- background-color: ${theme.color.foreground.neutralAltDisabled};
71
- }
72
104
 
73
- .MuiSwitch-thumb {
74
- box-shadow: none;
75
- filter: drop-shadow(0px 2px 4px rgba(0, 35, 11, 0.2));
76
- width: ${SIZE_TO_SWTICH_SIZE[switchSize].thumbSize};
77
- height: ${SIZE_TO_SWTICH_SIZE[switchSize].thumbSize};
78
- border-radius: 77px;
79
- transition: width 300ms;
80
- }
81
- .MuiSwitch-track {
82
- border-radius: 16px;
83
- opacity: 1;
84
- background-color: ${theme.color.background.neutralAltActive};
85
- box-sizing: border-box;
105
+ .MuiSwitch-thumb {
106
+ color: ${theme.color.background.neutralBaseDisabled};
107
+ }
108
+ }
86
109
  }
87
110
  `);
88
111
  export default Switch;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export { default as Popover } from "./components/Popover";
17
17
  export * from "./components/Popover";
18
18
  export { default as RadioInput } from "./components/RadioInput";
19
19
  export * from "./components/RadioInput";
20
+ export * from "./components/Spinner";
20
21
  export { default as SquareButton } from "./components/SquareButton";
21
22
  export * from "./components/SquareButton";
22
23
  export { default as Switch } from "./components/Switch";
@@ -31,7 +32,7 @@ export { default as color } from "./foundation/color";
31
32
  export { default as shadows } from "./foundation/shadows";
32
33
  export * from "./foundation/breakpoints";
33
34
  export { default as CodleDesignSystemProvider } from "./CodleDesignSystemProvider";
34
- export { light } from "./CodleDesignSystemProvider";
35
+ export * from "./CodleDesignSystemProvider";
35
36
  export * from "./icons";
36
37
  export * from "./icons/Custom";
37
38
  export * from "./utils/hover";
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as Popover } from "./components/Popover";
17
17
  export * from "./components/Popover";
18
18
  export { default as RadioInput } from "./components/RadioInput";
19
19
  export * from "./components/RadioInput";
20
+ export * from "./components/Spinner";
20
21
  export { default as SquareButton } from "./components/SquareButton";
21
22
  export * from "./components/SquareButton";
22
23
  export { default as Switch } from "./components/Switch";
@@ -31,7 +32,7 @@ export { default as color } from "./foundation/color";
31
32
  export { default as shadows } from "./foundation/shadows";
32
33
  export * from "./foundation/breakpoints";
33
34
  export { default as CodleDesignSystemProvider } from "./CodleDesignSystemProvider";
34
- export { light } from "./CodleDesignSystemProvider";
35
+ export * from "./CodleDesignSystemProvider";
35
36
  export * from "./icons";
36
37
  export * from "./icons/Custom";
37
38
  export * from "./utils/hover";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.42.1",
3
+ "version": "1.43.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,