@team-monolith/cds 1.60.0 → 1.60.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.
@@ -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 };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import styled from "@emotion/styled";
3
- import { HOVER, Tooltip } from "../..";
3
+ import { HOVER, RESET_BUTTON, Tooltip } from "../..";
4
4
  import { css } from "@emotion/react";
5
5
  import { toggleButtonGroupClasses, } from "./ToggleButtonGroup";
6
6
  /** 하나의 ToggleButton을 그립니다. */
@@ -8,11 +8,12 @@ export function ToggleButton(props) {
8
8
  const { datum, placement, isActive, onClick } = props;
9
9
  const { label, onIcon, offIcon } = datum;
10
10
  if (isActive) {
11
- return (_jsxs(Active, Object.assign({ className: toggleButtonGroupClasses.toggleButton.active, onClick: onClick }, { children: [onIcon, label] })));
11
+ return (_jsxs(Active, Object.assign({ "aria-label": `${label} 선택 해제하기`, className: toggleButtonGroupClasses.toggleButton.active, onClick: onClick }, { children: [onIcon, label] })));
12
12
  }
13
- return (_jsx(Tooltip, Object.assign({ placement: placement, text: label }, { children: _jsx(Inactive, Object.assign({ className: toggleButtonGroupClasses.toggleButton.inactive, onClick: onClick }, { children: offIcon })) })));
13
+ return (_jsx(Tooltip, Object.assign({ placement: placement, text: label }, { children: _jsx(Inactive, Object.assign({ "aria-label": `${label} 선택하기`, className: toggleButtonGroupClasses.toggleButton.inactive, onClick: onClick }, { children: offIcon })) })));
14
14
  }
15
- const Active = styled.div(({ theme }) => css `
15
+ const Active = styled.button(({ theme }) => css `
16
+ ${RESET_BUTTON};
16
17
  cursor: pointer;
17
18
  display: flex;
18
19
  padding: 8px 12px;
@@ -35,7 +36,8 @@ const Active = styled.div(({ theme }) => css `
35
36
  height: 24px;
36
37
  }
37
38
  `);
38
- const Inactive = styled.div `
39
+ const Inactive = styled.button `
40
+ ${RESET_BUTTON};
39
41
  cursor: pointer;
40
42
  display: flex;
41
43
  padding: 8px 12px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.60.0",
3
+ "version": "1.60.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,