@team-monolith/cds 1.20.0 → 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
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
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,
|
|
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:
|
|
109
|
+
], onClick: onClick }, { children: [isOn ? onIcon : offIcon, content && _jsx(Content, { children: content })] })));
|
|
110
110
|
});
|
|
111
|
-
const
|
|
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};
|
|
@@ -5,12 +5,12 @@ import styled from "@emotion/styled";
|
|
|
5
5
|
import { ArrowDownSLineIcon, ArrowUpSLineIcon } from "../icons";
|
|
6
6
|
/** 배너같이 생겼으나 누를 때마다 하단내용이 접힘(보이지않음)/펼침(보임) 상태가 바뀌는 컴포넌트입니다. */
|
|
7
7
|
export function Accordion(props) {
|
|
8
|
-
const { className, icon, title, children, open = false, onClick,
|
|
8
|
+
const { className, icon, title, children, open = false, onClick, wrapperClassName, } = props;
|
|
9
9
|
return (_jsxs("div", Object.assign({ css: css `
|
|
10
10
|
display: flex;
|
|
11
11
|
flex-direction: column;
|
|
12
|
-
gap:
|
|
13
|
-
|
|
12
|
+
gap: 2px;
|
|
13
|
+
`, className: wrapperClassName }, { children: [_jsxs(Container, Object.assign({ className: className, onClick: onClick }, { children: [_jsxs(Title, { children: [icon, title] }), open ? _jsx(ArrowUpSLineIcon, {}) : _jsx(ArrowDownSLineIcon, {})] })), open && children] })));
|
|
14
14
|
}
|
|
15
15
|
const Title = styled.div(({ theme }) => css `
|
|
16
16
|
display: flex;
|