@team-monolith/cds 1.99.10 → 1.99.12

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,6 +5,8 @@ import { TooltipProps } from "./Tooltip";
5
5
  interface OverflowTooltipProps extends Omit<TooltipProps, "open" | "onOpen" | "onClose" | "children"> {
6
6
  className?: string;
7
7
  childrenCss?: SerializedStyles;
8
+ /** 접근성을 위한 aria 속성을 전달하기 위한 prop */
9
+ divProps?: React.HTMLAttributes<HTMLDivElement>;
8
10
  }
9
11
  /**
10
12
  * 인자로 주어진 텍스트를 그립니다.
@@ -23,7 +23,7 @@ export function OverflowTooltip(props) {
23
23
  const handleClose = () => {
24
24
  setIsTooltipOpen(false);
25
25
  };
26
- return (_jsx(Tooltip, Object.assign({ open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose }, props, { children: _jsx(OverflowDiv, Object.assign({ css: props.childrenCss, ref: tooltipRef, onMouseOver: handleOpen }, { children: props.text })) })));
26
+ return (_jsx(Tooltip, Object.assign({ open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose }, props, { children: _jsx(OverflowDiv, Object.assign({ css: props.childrenCss, ref: tooltipRef, onMouseOver: handleOpen }, props.divProps, { children: props.text })) })));
27
27
  }
28
28
  const OverflowDiv = styled.div `
29
29
  overflow: hidden;
@@ -191,7 +191,7 @@ export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
191
191
  SIZE_TO_BUTTON_STYLE[size],
192
192
  css `
193
193
  border: none;
194
- width: ${fullWidth ? "100%" : "fit-content"};
194
+ ${fullWidth && `width: 100%;`}
195
195
  ${disabled || loading
196
196
  ? css `
197
197
  cursor: default;
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { InputHTMLAttributes } from "react";
2
2
  export type SwitchSize = "small" | "large";
3
3
  export interface SwitchProps {
4
4
  className?: string;
@@ -11,6 +11,8 @@ export interface SwitchProps {
11
11
  size: SwitchSize;
12
12
  /** 스위치 상태 변경 시 호출될 콜백 함수 */
13
13
  onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
14
+ /** HTML input 태그에 전달될 props */
15
+ inputProps?: InputHTMLAttributes<HTMLInputElement>;
14
16
  }
15
17
  /**
16
18
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-1577&t=9sDLb4XIOdmF2VMc-0)
@@ -19,8 +19,8 @@ import { css } from "@emotion/react";
19
19
  * [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-1577&t=9sDLb4XIOdmF2VMc-0)
20
20
  */
21
21
  export const Switch = React.forwardRef(function Switch(props, ref) {
22
- const { className, checked, disabled = false, size, onChange } = props, other = __rest(props, ["className", "checked", "disabled", "size", "onChange"]);
23
- return (_jsx(StyledSwitch, Object.assign({}, other, { ref: ref, className: className, checked: checked, disabled: disabled, onChange: onChange, switchSize: size })));
22
+ const { className, checked, disabled = false, size, onChange, inputProps } = props, other = __rest(props, ["className", "checked", "disabled", "size", "onChange", "inputProps"]);
23
+ return (_jsx(StyledSwitch, Object.assign({}, other, { ref: ref, className: className, checked: checked, disabled: disabled, onChange: onChange, switchSize: size, inputProps: inputProps })));
24
24
  });
25
25
  const SIZE_TO_SWTICH_SIZE = {
26
26
  large: {
@@ -11,10 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
13
  /** @jsxImportSource @emotion/react */
14
- import { forwardRef, useMemo, useRef, useState } from "react";
14
+ import { forwardRef, useId, useRef, useState } from "react";
15
15
  import { Button, ArrowDownSFillIcon, } from "../..";
16
16
  import { DropdownMenu } from "./DropdownMenu";
17
- import { uid } from "uid";
18
17
  /**
19
18
  * [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?type=design&node-id=203-95329&t=FwczLZ1IVvskUVbT-0)
20
19
  */
@@ -32,7 +31,7 @@ const Dropdown = forwardRef(function Dropdown(props, ref) {
32
31
  const isControlled = menuProps.open !== undefined;
33
32
  const [open, setOpen] = useState(false);
34
33
  const [itemState, setItemState] = useState(new Map());
35
- const dropdownMenuId = useMemo(() => `dropdown-menu-${uid()}`, []);
34
+ const dropdownMenuId = `dropdown-menu-${useId()}`;
36
35
  const handleClick = (e) => {
37
36
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
38
37
  if (!isControlled)
@@ -15,11 +15,10 @@ import { css } from "@emotion/react";
15
15
  import * as React from "react";
16
16
  import styled from "@emotion/styled";
17
17
  import { CheckboxInput, ArrowRightSLineIcon, HOVER, } from "../../..";
18
- import { useContext, useMemo, useRef } from "react";
18
+ import { useContext, useId, useRef } from "react";
19
19
  import { DropdownMenu } from "../DropdownMenu";
20
20
  import { DropdownContext } from "../DropdownContext";
21
21
  import { getSelected, setSelected } from "./selected";
22
- import { uid } from "uid";
23
22
  const TYPE_TO_COLOR = (theme, type) => ({
24
23
  default: theme.color.foreground.neutralBase,
25
24
  danger: theme.color.foreground.danger,
@@ -31,7 +30,7 @@ const DropdownItem = React.forwardRef(function DropdownItem(props, ref) {
31
30
  const { className, index, labelCss, component: Component = "div", type = "default", checkbox, checkboxProps = { checked: false }, startIcon, label, endIcon, preserveIconColor = false, disabled, active, onMouseEnter, onMouseLeave, onClick, subMenuProps, children } = props, other = __rest(props, ["className", "index", "labelCss", "component", "type", "checkbox", "checkboxProps", "startIcon", "label", "endIcon", "preserveIconColor", "disabled", "active", "onMouseEnter", "onMouseLeave", "onClick", "subMenuProps", "children"]);
32
31
  const itemRef = useRef(null);
33
32
  const { open, onCloseOnItemClick, nestedIndex, itemState, setItemState } = useContext(DropdownContext);
34
- const dropdownMenuId = useMemo(() => `dropdown-menu-${uid()}`, []);
33
+ const dropdownMenuId = `dropdown-menu-${useId()}`;
35
34
  const absItemIndex = nestedIndex ? `${nestedIndex}-${index}` : `${index}`;
36
35
  // 서브메뉴가 존재하는지 여부
37
36
  const isSubMenuExist = Boolean(children);
@@ -30,7 +30,6 @@ export const SegmentedControlButton = React.forwardRef(function SegmentedControl
30
30
  const isActive = context.multiSelect
31
31
  ? context.value.includes(props.value)
32
32
  : context.value === props.value;
33
- const { label } = other;
34
33
  return (_jsx(StyledButton, Object.assign({}, other, { ref: ref, startIcon: typeof startIcon === "function" ? startIcon(isActive) : startIcon, endIcon: typeof endIcon === "function" ? endIcon(isActive) : endIcon, isActive: isActive, color: isActive ? "white" : "textNeutral", size: context.size, onClick: handleClick, disabled: context.disabled || props.disabled, "aria-selected": isActive ? "true" : undefined })));
35
34
  });
36
35
  const StyledButton = styled(Button, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.99.10",
3
+ "version": "1.99.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,