@team-monolith/cds 1.110.0 → 1.111.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.
@@ -5,7 +5,7 @@ export declare const tagClasses: {
5
5
  readonly closeButton: "Tag-closeButton";
6
6
  };
7
7
  export type TagColor = "default" | "red" | "teal" | "orange" | "blue" | "green" | "yellow" | "black" | "white" | "ai";
8
- export interface TagProps {
8
+ type TagCommonProps = {
9
9
  className?: string;
10
10
  component?: React.ElementType;
11
11
  /** 컴포넌트 내 표기될 메인으로 노출될 내용 */
@@ -16,12 +16,20 @@ export interface TagProps {
16
16
  color?: TagColor;
17
17
  /** 라벨 텍스트의 굵기 여부 */
18
18
  bold?: boolean;
19
- /** 컴포넌트 우측에 표기될 닫기 버튼 유무 */
20
- close?: boolean;
21
- /** 닫기 버튼 클릭 시 호출될 콜백 함수 */
19
+ /** 태그 컴포넌트 영역을 클릭 호출될 콜백 함수 */
22
20
  onClick?: () => void;
23
- }
21
+ };
22
+ type ClosableTagProps = TagCommonProps & {
23
+ close: true;
24
+ /** 닫기 버튼 클릭 시 호출될 콜백 함수. 등록하지 않으면 onClick으로 fallback. */
25
+ onClose?: () => void;
26
+ };
27
+ type NonClosableTagProps = TagCommonProps & {
28
+ close?: false;
29
+ };
30
+ export type TagProps = ClosableTagProps | NonClosableTagProps;
24
31
  /**
25
32
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=42-869&t=HZXCHP0r0tbvMA6v-0)
26
33
  */
27
34
  export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<unknown>>;
35
+ export {};
@@ -81,7 +81,7 @@ const COLOR_TO_STYLE = (theme, color) => ({
81
81
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=42-869&t=HZXCHP0r0tbvMA6v-0)
82
82
  */
83
83
  export const Tag = React.forwardRef(function Tag(props, ref) {
84
- const { className, component: Component = "span", label, icon, color = "default", bold, close, onClick } = props, other = __rest(props, ["className", "component", "label", "icon", "color", "bold", "close", "onClick"]);
84
+ const { className, component: Component = "span", label, icon, color = "default", bold, onClick, close } = props, other = __rest(props, ["className", "component", "label", "icon", "color", "bold", "onClick", "close"]);
85
85
  const theme = useTheme();
86
86
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: [tagClasses.root, className].filter(Boolean).join(" "), css: [
87
87
  css `
@@ -101,7 +101,7 @@ export const Tag = React.forwardRef(function Tag(props, ref) {
101
101
  }
102
102
  `,
103
103
  COLOR_TO_STYLE(theme, color),
104
- close
104
+ onClick
105
105
  ? css `
106
106
  cursor: pointer;
107
107
  `
@@ -110,7 +110,15 @@ export const Tag = React.forwardRef(function Tag(props, ref) {
110
110
  font-weight: ${bold ? 700 : 400};
111
111
  font-size: 12px;
112
112
  line-height: 20px;
113
- `, children: label }), close && _jsx(StyledCloseFillIcon, { className: tagClasses.closeButton })] })));
113
+ `, children: label }), close && (_jsx("span", { css: css `
114
+ display: flex;
115
+ cursor: pointer;
116
+ align-items: center;
117
+ `, onClick: (e) => {
118
+ var _a, _b;
119
+ (_b = ((_a = props.onClose) !== null && _a !== void 0 ? _a : onClick)) === null || _b === void 0 ? void 0 : _b();
120
+ e.stopPropagation();
121
+ }, children: _jsx(StyledCloseFillIcon, { className: tagClasses.closeButton }) }))] })));
114
122
  });
115
123
  const StyledCloseFillIcon = styled(CloseFillIcon) `
116
124
  width: 10px;
package/dist/index.d.ts CHANGED
@@ -36,3 +36,4 @@ export * from "./patterns/SegmentedControl";
36
36
  export * from "./patterns/LexicalEditor";
37
37
  export * from "./patterns/Accordion";
38
38
  export * from "./patterns/ToggleButtonGroup";
39
+ export * from "./patterns/Tabs";
package/dist/index.js CHANGED
@@ -36,3 +36,4 @@ export * from "./patterns/SegmentedControl";
36
36
  export * from "./patterns/LexicalEditor";
37
37
  export * from "./patterns/Accordion";
38
38
  export * from "./patterns/ToggleButtonGroup";
39
+ export * from "./patterns/Tabs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.110.0",
3
+ "version": "1.111.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,