@team-monolith/cds 1.125.1 → 1.127.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.
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ export declare const badgeClasses: {
3
+ readonly root: "Badge";
4
+ readonly icon: "Badge-icon";
5
+ readonly label: "Badge-label";
6
+ };
7
+ export interface BadgeProps {
8
+ className?: string;
9
+ component?: React.ElementType;
10
+ /** 컴포넌트 내 표기될 문자열 */
11
+ label: React.ReactNode;
12
+ /** 컴포넌트 좌측에 표기될 아이콘 */
13
+ icon?: React.ReactNode;
14
+ }
15
+ /**
16
+ * Badge 컴포넌트
17
+ * [피그마](https://www.figma.com/design/UD08wln8CwDoCMGFBIGTiZ/CDS?node-id=6586-3001)
18
+ */
19
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,55 @@
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 styled from "@emotion/styled";
16
+ import React from "react";
17
+ export const badgeClasses = {
18
+ root: "Badge",
19
+ icon: "Badge-icon",
20
+ label: "Badge-label",
21
+ };
22
+ /**
23
+ * Badge 컴포넌트
24
+ * [피그마](https://www.figma.com/design/UD08wln8CwDoCMGFBIGTiZ/CDS?node-id=6586-3001)
25
+ */
26
+ export const Badge = React.forwardRef(function Badge(props, ref) {
27
+ const { className, component: Component = "span", label, icon } = props, other = __rest(props, ["className", "component", "label", "icon"]);
28
+ const theme = useTheme();
29
+ return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: [badgeClasses.root, className].filter(Boolean).join(" "), css: css `
30
+ width: fit-content;
31
+ display: inline-flex;
32
+ align-items: center;
33
+ gap: 2px;
34
+ padding: 2px 8px 2px 6px;
35
+ border-radius: 22px;
36
+ font-family: ${theme.fontFamily.ui};
37
+ `, children: [icon && _jsx(IconWrapper, { className: badgeClasses.icon, children: icon }), _jsx(Label, { className: badgeClasses.label, children: label })] })));
38
+ });
39
+ const IconWrapper = styled.span `
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ width: 14px;
44
+ height: 14px;
45
+
46
+ svg {
47
+ width: 14px;
48
+ height: 14px;
49
+ }
50
+ `;
51
+ const Label = styled.span `
52
+ font-size: 12px;
53
+ font-weight: 600;
54
+ line-height: 18px;
55
+ `;
@@ -21,8 +21,6 @@ export interface ButtonOwnProps<RootComponentType extends React.ElementType> {
21
21
  endIcon?: React.ReactNode;
22
22
  /** 컴포넌트 내 표기될 문자열 */
23
23
  label: React.ReactNode;
24
- /** 버튼 텍스트 굵음 여부 */
25
- bold?: boolean;
26
24
  /** 로딩 여부 */
27
25
  loading?: boolean;
28
26
  /** 전체 너비 유무 */
@@ -214,7 +214,7 @@ const SIZE_TO_LABEL_STYLE = {
214
214
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=20-173&t=cXcCv3QijbX7MkoC-0)
215
215
  */
216
216
  export const Button = React.forwardRef(function Button(props, ref) {
217
- 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"]);
217
+ const { className, component: Component = "button", disabled, color, size, startIcon, endIcon, label, fullWidth, loading = false } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "label", "fullWidth", "loading"]);
218
218
  const theme = useTheme();
219
219
  return (_jsxs(Component, Object.assign({ type: Component === "button" || Component === "input" ? "button" : undefined }, other, { className: [buttonClasses.root, className].filter(Boolean).join(" "), ref: ref, css: [
220
220
  css `
@@ -247,10 +247,10 @@ export const Button = React.forwardRef(function Button(props, ref) {
247
247
  `,
248
248
  COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled || loading)),
249
249
  SIZE_TO_BUTTON_STYLE[size],
250
- ], disabled: disabled || loading, children: [loading ? _jsx(Spinner, {}) : startIcon, label && (_jsx(Label, { className: buttonClasses.label, size: size, bold: bold, children: label })), endIcon] })));
250
+ ], disabled: disabled || loading, children: [loading ? _jsx(Spinner, {}) : startIcon, label && (_jsx(Label, { className: buttonClasses.label, size: size, children: label })), endIcon] })));
251
251
  });
252
252
  const Label = styled.span `
253
- font-weight: ${({ bold }) => (bold ? 700 : 400)};
253
+ font-weight: 700;
254
254
  white-space: nowrap;
255
255
  ${({ size }) => SIZE_TO_LABEL_STYLE[size]}
256
256
  `;
@@ -21,8 +21,8 @@ export function FileTypeAlertDialog(props) {
21
21
  color: ${theme.color.background.danger};
22
22
  ` }), children: [_jsx(AlertDialogTitle, { className: fileTypeAlertDialogClasses.title, css: css `
23
23
  font-weight: 700;
24
- `, onClose: onClose, children: t("파일 형식을 확인해주세요.") }), _jsx(AlertDialogContent, { className: fileTypeAlertDialogClasses.content, children: content }), _jsxs(AlertDialogActions, { className: fileTypeAlertDialogClasses.actions, children: [_jsx(Button, { color: "grey", label: t("닫기", { context: "다이얼로그" }), size: "medium", onClick: onClose, bold: true }), _jsx(Button, { color: "primary", label: t("다시 업로드"), size: "medium", onClick: () => {
24
+ `, onClose: onClose, children: t("파일 형식을 확인해주세요.") }), _jsx(AlertDialogContent, { className: fileTypeAlertDialogClasses.content, children: content }), _jsxs(AlertDialogActions, { className: fileTypeAlertDialogClasses.actions, children: [_jsx(Button, { color: "grey", label: t("닫기", { context: "다이얼로그" }), size: "medium", onClick: onClose }), _jsx(Button, { color: "primary", label: t("다시 업로드"), size: "medium", onClick: () => {
25
25
  onClose();
26
26
  openFileBrowser();
27
- }, bold: true })] })] }));
27
+ } })] })] }));
28
28
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../@types/emotion.d.ts" preserve="true" />
2
2
  export * from "./components/AlertDialog";
3
+ export * from "./components/Badge";
3
4
  export * from "./components/DecoratedNumber";
4
5
  export * from "./components/Banner";
5
6
  export * from "./components/Book";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="../../@types/emotion.d.ts" preserve="true"/>
2
2
  export * from "./components/AlertDialog";
3
+ export * from "./components/Badge";
3
4
  export * from "./components/DecoratedNumber";
4
5
  export * from "./components/Banner";
5
6
  export * from "./components/Book";
@@ -12,8 +12,6 @@ export interface DropdownProps {
12
12
  color?: ButtonColor;
13
13
  /** 버튼 컴포넌트 크기 */
14
14
  size?: ButtonSize;
15
- /** 버튼 컴포넌트 텍스트 굵음 여부 */
16
- bold?: boolean;
17
15
  /** 버튼 컴포넌트 내 좌측에 표기될 아이콘 */
18
16
  startIcon?: React.ReactNode;
19
17
  /** 버튼 컴포넌트 내 우측에 표기될 아이콘.
@@ -19,14 +19,13 @@ import { DropdownMenu } from "./DropdownMenu";
19
19
  */
20
20
  const Dropdown = forwardRef(function Dropdown(props, ref) {
21
21
  var _a;
22
- const { className, component: Component = "div", disabled, color = "primary", size = "medium", bold, startIcon, endIcon = _jsx(ArrowDownSFillIcon, {}), buttonCss, label, onClick, menuProps = {}, children, closeOnItemClick } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "bold", "startIcon", "endIcon", "buttonCss", "label", "onClick", "menuProps", "children", "closeOnItemClick"]);
22
+ const { className, component: Component = "div", disabled, color = "primary", size = "medium", startIcon, endIcon = _jsx(ArrowDownSFillIcon, {}), buttonCss, label, onClick, menuProps = {}, children, closeOnItemClick } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "buttonCss", "label", "onClick", "menuProps", "children", "closeOnItemClick"]);
23
23
  const buttonProps = Object.assign(Object.assign({}, props.buttonProps), { disabled,
24
24
  color,
25
25
  size,
26
26
  startIcon,
27
27
  endIcon,
28
- label,
29
- bold });
28
+ label });
30
29
  const menuRef = useRef(null);
31
30
  const isControlled = menuProps.open !== undefined;
32
31
  const [open, setOpen] = useState(false);
@@ -10,7 +10,6 @@ interface FileSelectInputProps {
10
10
  size: number;
11
11
  uploadDate: string;
12
12
  }) => void;
13
- bold?: boolean;
14
13
  }
15
14
  /**
16
15
  * 파일 탐색기를 열어 특정 파일을 업로드 한 후, 그 경로를 onChange로 전달합니다.
@@ -38,7 +38,7 @@ const MAX_FILE_SIZE = 1 * 1024 * 1024 * 1024; // 1GB
38
38
  * @returns
39
39
  */
40
40
  export function FileSelectInput(props) {
41
- const { onChange, fileType, onFileSubmit, bold = false } = props;
41
+ const { onChange, fileType, onFileSubmit } = props;
42
42
  const [errorMessage, setErrorMessage] = useState(null);
43
43
  const inputRef = useRef(null);
44
44
  const { t } = useTranslation();
@@ -82,7 +82,7 @@ export function FileSelectInput(props) {
82
82
  return (_jsxs(_Fragment, { children: [_jsxs(Container, { children: [_jsx(Button, { fullWidth: true, color: "grey", size: "medium", label: t("파일 선택하기"), onClick: () => {
83
83
  var _a;
84
84
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
85
- }, startIcon: _jsx(UploadLineIcon, {}), bold: bold }), _jsx(IconAndErrorMessage, { children: errorMessage && (_jsxs(_Fragment, { children: [_jsx(FileWarningLineIcon, { css: css `
85
+ }, startIcon: _jsx(UploadLineIcon, {}) }), _jsx(IconAndErrorMessage, { children: errorMessage && (_jsxs(_Fragment, { children: [_jsx(FileWarningLineIcon, { css: css `
86
86
  padding: 0 4px;
87
87
  width: 24px;
88
88
  height: 24px;
@@ -14,7 +14,7 @@ export function FormIconAndLabel(props) {
14
14
  const { t } = useTranslation();
15
15
  return (_jsx(Controller, { control: control, name: "iconType", render: ({ field: { value, onChange } }) => {
16
16
  const { startIcon, title, icons } = getIconData(value, theme, t);
17
- return (_jsxs(_Fragment, { children: [_jsx(Dropdown, { label: t("아이콘: {{title}}", { title }), size: "small", color: "grey", closeOnItemClick: true, bold: true, startIcon: startIcon, endIcon: _jsx(ArrowDownSFillIcon, {}), menuProps: {
17
+ return (_jsxs(_Fragment, { children: [_jsx(Dropdown, { label: t("아이콘: {{title}}", { title }), size: "small", color: "grey", closeOnItemClick: true, startIcon: startIcon, endIcon: _jsx(ArrowDownSFillIcon, {}), menuProps: {
18
18
  menuCss: css `
19
19
  width: 216px;
20
20
  `,
@@ -53,7 +53,7 @@ export function SettingForm(props) {
53
53
  question: { text: getTexts(t, "placeholderEvaluationItem") },
54
54
  selectedLabelIndex: null,
55
55
  });
56
- } })] }), _jsxs(Right, { children: [_jsx(Label, { children: t("아이콘, 레이블") }), _jsx(FormIconAndLabel, { control: control, labelsLength: labels.length })] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), bold: true, type: "submit" })] })] }));
56
+ } })] }), _jsxs(Right, { children: [_jsx(Label, { children: t("아이콘, 레이블") }), _jsx(FormIconAndLabel, { control: control, labelsLength: labels.length })] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), type: "submit" })] })] }));
57
57
  }
58
58
  const Form = styled.form(({ theme }) => css `
59
59
  display: flex;
@@ -39,7 +39,7 @@ export function SettingForm(props) {
39
39
  : t("단답형 입력 칸", { context: "렉시컬 단답형/서술형 도구" })] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: [t("자리 표시자", { context: "렉시컬 단답형/서술형 도구" }), _jsx(Tooltip, { text: getTexts(t, "descriptionDefaultInputText"), placement: "top", children: _jsx(QuestionFillIcon, { css: css `
40
40
  width: 12px;
41
41
  height: 12px;
42
- ` }) })] }), _jsx(Controller, { name: "placeholder", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { size: "small", color: "default", value: value, onChange: onChange, placeholder: getTexts(t, "exampleEnterHere") })) })] }) }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), bold: true, type: "submit" })] })] }));
42
+ ` }) })] }), _jsx(Controller, { name: "placeholder", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { size: "small", color: "default", value: value, onChange: onChange, placeholder: getTexts(t, "exampleEnterHere") })) })] }) }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), type: "submit" })] })] }));
43
43
  }
44
44
  const Form = styled.form(({ theme }) => css `
45
45
  display: flex;
@@ -86,7 +86,7 @@ export function SettingForm(props) {
86
86
  min-width: 14px;
87
87
  width: 14px;
88
88
  height: 14px;
89
- ` }), t("다중 선택을 허용한 문제에는 여러 선택지를 고를 수 있다는 안내가 제공됩니다.")] }))] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), bold: true, type: "submit" })] })] }));
89
+ ` }), t("다중 선택을 허용한 문제에는 여러 선택지를 고를 수 있다는 안내가 제공됩니다.")] }))] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: t("닫기", { context: "렉시컬 도구 설정창" }), onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: t("이대로 넣기", { context: "렉시컬 도구 설정창" }), type: "submit" })] })] }));
90
90
  }
91
91
  const Form = styled.form(({ theme }) => css `
92
92
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.125.1",
3
+ "version": "1.127.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,