@team-monolith/cds 1.59.1 → 1.60.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,5 +1,6 @@
1
1
  import React, { ButtonHTMLAttributes } from "react";
2
2
  import { PolymorphicProps } from "@mui/base";
3
+ import { ButtonProps } from "./Button";
3
4
  export type SquareButtonColor = "danger" | "primary" | "grey" | "icon" | "black" | "white";
4
5
  export type SquareButtonSize = "large" | "medium" | "small" | "xsmall";
5
6
  export interface SquareButtonOwnProps<RootComponentType extends React.ElementType> {
@@ -23,6 +24,8 @@ export interface SquareButtonOwnProps<RootComponentType extends React.ElementTyp
23
24
  loading?: boolean;
24
25
  /** 버튼 클릭 시 호출될 콜백 함수 */
25
26
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
27
+ /** 버튼에 전달될 Props */
28
+ buttonProps?: Omit<ButtonProps, "disabled" | "color" | "type" | "size" | "icon" | "label" | "loading" | "fullWidth" | "onClick">;
26
29
  }
27
30
  export type SquareButtonProps<RootComponentType extends React.ElementType = SquareButtonTypeMap["defaultComponent"]> = PolymorphicProps<SquareButtonTypeMap<RootComponentType>, RootComponentType>;
28
31
  export interface SquareButtonTypeMap<RootComponentType extends React.ElementType = "span"> {
@@ -168,7 +168,7 @@ const SIZE_TO_LABEL_STYLE = {
168
168
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=22-374&t=kTLv3t86qtGalHSS-0)
169
169
  */
170
170
  const SquareButton = React.forwardRef(function SquareButton(props, ref) {
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"]);
171
+ const { className, component: Component = "span", disabled, type = "button", color, size, icon, label, fullWidth, onClick, loading = false, buttonProps } = props, other = __rest(props, ["className", "component", "disabled", "type", "color", "size", "icon", "label", "fullWidth", "onClick", "loading", "buttonProps"]);
172
172
  return (_jsxs(Component, Object.assign({}, other, { ref: ref, className: className, css: css `
173
173
  display: flex;
174
174
  flex-direction: column;
@@ -176,7 +176,7 @@ const SquareButton = React.forwardRef(function SquareButton(props, ref) {
176
176
  gap: 8px;
177
177
 
178
178
  width: ${fullWidth ? "100%" : "fit-content"};
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 })))] })));
179
+ ` }, { children: [_jsx(Button, Object.assign({}, buttonProps, { 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 })))] })));
180
180
  });
181
181
  const Button = styled.button `
182
182
  cursor: pointer;
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource @emotion/react */
2
2
  import React from "react";
3
- import { ButtonColor, ButtonSize } from "../..";
3
+ import { ButtonColor, ButtonSize, ButtonProps } from "../..";
4
4
  import { DropdownMenuProps } from "./DropdownMenu";
5
5
  import { SerializedStyles } from "@emotion/react";
6
6
  export interface DropdownProps {
@@ -20,6 +20,8 @@ export interface DropdownProps {
20
20
  * 전달하지 않으면 기본으로 ArrowDropDownFillIcon이 표기됩니다.
21
21
  */
22
22
  endIcon?: React.ReactNode;
23
+ /** 버튼에 전달할 Props */
24
+ buttonProps?: Omit<ButtonProps, "disabled" | "color" | "size" | "startIcon" | "endIcon" | "label" | "onClick">;
23
25
  /** button에 적용되는 css 스타일 */
24
26
  buttonCss?: SerializedStyles;
25
27
  /** 버튼 컴포넌트 내 표기될 문자열 */
@@ -12,20 +12,20 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
13
  /** @jsxImportSource @emotion/react */
14
14
  import { forwardRef, useRef, useState } from "react";
15
- import { Button, ArrowDropDownFillIcon } from "../..";
15
+ import { Button, ArrowDropDownFillIcon, } from "../..";
16
16
  import { DropdownMenu } from "./DropdownMenu";
17
17
  /**
18
18
  * [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=203-95329&t=FwczLZ1IVvskUVbT-0)
19
19
  */
20
20
  const Dropdown = forwardRef((props, ref) => {
21
21
  const { className, component: Component = "div", disabled, color = "primary", size = "medium", bold, startIcon, endIcon = _jsx(ArrowDropDownFillIcon, {}), 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 buttonProps = {
23
- disabled,
22
+ const buttonProps = Object.assign(Object.assign({}, props.buttonProps), { disabled,
24
23
  color,
25
24
  size,
26
25
  startIcon,
27
26
  endIcon,
28
- };
27
+ label,
28
+ bold });
29
29
  const menuRef = useRef(null);
30
30
  const isControlled = menuProps.open !== undefined;
31
31
  const [open, setOpen] = useState(false);
@@ -52,6 +52,6 @@ const Dropdown = forwardRef((props, ref) => {
52
52
  });
53
53
  (_a = menuProps === null || menuProps === void 0 ? void 0 : menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps, e);
54
54
  };
55
- return (_jsxs(Component, Object.assign({ className: className }, other, { ref: ref }, { children: [_jsx(Button, Object.assign({ css: buttonCss, ref: menuRef }, buttonProps, { label: label, bold: bold, onClick: handleClick, fullWidth: true })), _jsx(DropdownMenu, Object.assign({}, menuProps, { open: isControlled ? menuProps.open : open, onClose: handleClose, anchorEl: menuRef.current, closeOnItemClick: closeOnItemClick, itemState: itemState, setItemState: setItemState }, { children: children }))] })));
55
+ return (_jsxs(Component, Object.assign({ className: className }, other, { ref: ref }, { children: [_jsx(Button, Object.assign({ css: buttonCss, ref: menuRef }, buttonProps, { onClick: handleClick, fullWidth: true })), _jsx(DropdownMenu, Object.assign({}, menuProps, { open: isControlled ? menuProps.open : open, onClose: handleClose, anchorEl: menuRef.current, closeOnItemClick: closeOnItemClick, itemState: itemState, setItemState: setItemState }, { children: children }))] })));
56
56
  });
57
57
  export { Dropdown };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.59.1",
3
+ "version": "1.60.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,