@team-monolith/cds 1.20.1 → 1.20.2

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.
@@ -15,10 +15,10 @@ export interface SwitchButtonOwnProps<RootComponentType extends React.ElementTyp
15
15
  onIcon: React.ReactNode;
16
16
  /** off 일때의 아이콘 */
17
17
  offIcon: React.ReactNode;
18
- /** 아이콘 오른쪽에 나타낼 숫자. 전달하지 않으면 나타나지 않습니다. */
19
- count?: number;
20
- /** on/off 변경시 호출되는 콜백 함수 */
21
- onChange: (isOn: boolean) => void;
18
+ /** 아이콘 오른쪽에 나타낼 부분. 전달하지 않으면 나타나지 않습니다. */
19
+ content?: React.ReactNode;
20
+ /** 버튼 클릭시 실행될 콜백 */
21
+ onClick: () => void;
22
22
  }
23
23
  export type SwitchButtonProps<RootComponentType extends React.ElementType = SwitchButtonTypeMap["defaultComponent"]> = PolymorphicProps<SwitchButtonTypeMap<RootComponentType>, RootComponentType>;
24
24
  export interface SwitchButtonTypeMap<RootComponentType extends React.ElementType = "button"> {
@@ -91,7 +91,7 @@ const SIZE_TO_SWITCH_BUTTON_STYLE = (size) => ({
91
91
  * [피그마](https://www.figma.com/file/CxpgZcJFoRPWEZyx5RC0tq/Framework-System?node-id=766%3A11274&mode=dev)
92
92
  */
93
93
  const SwitchButton = React.forwardRef(function SwitchButton(props, ref) {
94
- const { className, component: Component = "button", color, size, isOn, onIcon, offIcon, count, onChange } = props, other = __rest(props, ["className", "component", "color", "size", "isOn", "onIcon", "offIcon", "count", "onChange"]);
94
+ 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"]);
95
95
  const theme = useTheme();
96
96
  return (_jsxs(Component, Object.assign({ type: "button" }, other, { className: className, ref: ref, css: [
97
97
  css `
@@ -106,9 +106,9 @@ const SwitchButton = React.forwardRef(function SwitchButton(props, ref) {
106
106
  `,
107
107
  COLOR_TO_SWITCH_BUTTON_STYLE(theme, color, isOn),
108
108
  SIZE_TO_SWITCH_BUTTON_STYLE(size),
109
- ], onClick: () => onChange(!isOn) }, { children: [isOn ? onIcon : offIcon, count !== undefined && _jsx(Count, { children: count })] })));
109
+ ], onClick: onClick }, { children: [isOn ? onIcon : offIcon, content && _jsx(Content, { children: content })] })));
110
110
  });
111
- const Count = styled.span(({ theme }) => css `
111
+ const Content = styled.span(({ theme }) => css `
112
112
  color: ${theme.color.foreground.neutralBase};
113
113
  /* Default/Label/16px-Md */
114
114
  font-family: ${theme.fontFamily.ui};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,