@team-monolith/cds 1.99.11 → 1.99.13
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.
- package/dist/components/OverflowTooltip.d.ts +2 -0
- package/dist/components/OverflowTooltip.js +1 -1
- package/dist/patterns/Accordion.d.ts +1 -0
- package/dist/patterns/Accordion.js +5 -3
- package/dist/patterns/Dropdown/Dropdown.js +2 -3
- package/dist/patterns/Dropdown/DropdownItem/DropdownItem.js +2 -3
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -7,6 +7,7 @@ export interface AccordionProps {
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
open?: boolean;
|
|
9
9
|
onClick?: () => void;
|
|
10
|
+
buttonLabel?: string;
|
|
10
11
|
}
|
|
11
12
|
/** 배너같이 생겼으나 누를 때마다 하단내용이 접힘(보이지않음)/펼침(보임) 상태가 바뀌는 컴포넌트입니다. */
|
|
12
13
|
export declare function Accordion(props: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,15 @@ import { jsxs as _jsxs, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from "@emotion/react";
|
|
4
4
|
import styled from "@emotion/styled";
|
|
5
5
|
import { ArrowDownSLineIcon, ArrowUpSLineIcon } from "../icons";
|
|
6
|
+
import { RESET_BUTTON } from "../utils/reset";
|
|
6
7
|
/** 배너같이 생겼으나 누를 때마다 하단내용이 접힘(보이지않음)/펼침(보임) 상태가 바뀌는 컴포넌트입니다. */
|
|
7
8
|
export function Accordion(props) {
|
|
8
|
-
const { className, icon, title, children, open = false, onClick, wrapperClassName, } = props;
|
|
9
|
+
const { className, icon, title, children, open = false, onClick, wrapperClassName, buttonLabel, } = props;
|
|
9
10
|
return (_jsxs("div", Object.assign({ css: css `
|
|
10
11
|
display: flex;
|
|
11
12
|
flex-direction: column;
|
|
12
13
|
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
|
+
`, className: wrapperClassName }, { children: [_jsxs(Container, Object.assign({ className: className, onClick: onClick, "aria-expanded": open, "aria-label": buttonLabel }, { children: [_jsxs(Title, { children: [icon, title] }), open ? _jsx(ArrowUpSLineIcon, {}) : _jsx(ArrowDownSLineIcon, {})] })), open && children] })));
|
|
14
15
|
}
|
|
15
16
|
const Title = styled.div(({ theme }) => css `
|
|
16
17
|
display: flex;
|
|
@@ -21,7 +22,8 @@ const Title = styled.div(({ theme }) => css `
|
|
|
21
22
|
font-weight: 700;
|
|
22
23
|
line-height: 16px; /* 133.333% */
|
|
23
24
|
`);
|
|
24
|
-
const Container = styled.
|
|
25
|
+
const Container = styled.button `
|
|
26
|
+
${RESET_BUTTON}
|
|
25
27
|
display: flex;
|
|
26
28
|
padding: 8px 16px;
|
|
27
29
|
align-items: center;
|
|
@@ -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,
|
|
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 =
|
|
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,
|
|
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 =
|
|
33
|
+
const dropdownMenuId = `dropdown-menu-${useId()}`;
|
|
35
34
|
const absItemIndex = nestedIndex ? `${nestedIndex}-${index}` : `${index}`;
|
|
36
35
|
// 서브메뉴가 존재하는지 여부
|
|
37
36
|
const isSubMenuExist = Boolean(children);
|