@team-monolith/cds 1.99.14 → 1.99.16
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.js +13 -1
- package/dist/components/Switch.d.ts +1 -1
- package/dist/patterns/Accordion.js +1 -1
- package/dist/patterns/Dropdown/DropdownItem/DropdownItem.js +7 -1
- package/dist/patterns/LexicalEditor/nodes/ImageNode/ImageComponent.js +10 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +1 -1
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +15 -1
- package/dist/patterns/SegmentedControl/SegmentedControlGroup.js +1 -1
- package/dist/patterns/SegmentedControl/SegmentedControlSquareButton.js +18 -2
- package/package.json +1 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
13
|
import styled from "@emotion/styled";
|
|
3
14
|
import { useRef, useState } from "react";
|
|
@@ -7,6 +18,7 @@ import { Tooltip } from "./Tooltip";
|
|
|
7
18
|
* 공간이 부족하면 ...으로 표시하고 툴팁으로 전체 내용을 노출합니다.
|
|
8
19
|
*/
|
|
9
20
|
export function OverflowTooltip(props) {
|
|
21
|
+
const { divProps } = props, tooltipProps = __rest(props, ["divProps"]);
|
|
10
22
|
const tooltipRef = useRef(null);
|
|
11
23
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
12
24
|
const getIsOverflow = () => {
|
|
@@ -23,7 +35,7 @@ export function OverflowTooltip(props) {
|
|
|
23
35
|
const handleClose = () => {
|
|
24
36
|
setIsTooltipOpen(false);
|
|
25
37
|
};
|
|
26
|
-
return (_jsx(Tooltip, Object.assign({ open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose },
|
|
38
|
+
return (_jsx(Tooltip, Object.assign({ open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose }, tooltipProps, { children: _jsx(OverflowDiv, Object.assign({}, divProps, { css: props.childrenCss, ref: tooltipRef, onMouseOver: handleOpen }, { children: props.text })) })));
|
|
27
39
|
}
|
|
28
40
|
const OverflowDiv = styled.div `
|
|
29
41
|
overflow: hidden;
|
|
@@ -12,7 +12,7 @@ export interface SwitchProps {
|
|
|
12
12
|
/** 스위치 상태 변경 시 호출될 콜백 함수 */
|
|
13
13
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
14
14
|
/** HTML input 태그에 전달될 props */
|
|
15
|
-
inputProps
|
|
15
|
+
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-1577&t=9sDLb4XIOdmF2VMc-0)
|
|
@@ -11,7 +11,7 @@ export function Accordion(props) {
|
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: 2px;
|
|
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
|
+
`, className: wrapperClassName }, { children: [_jsxs(Container, Object.assign({ type: "button", className: className, onClick: onClick, "aria-expanded": open, "aria-label": buttonLabel }, { children: [_jsxs(Title, { children: [icon, title] }), open ? _jsx(ArrowUpSLineIcon, {}) : _jsx(ArrowDownSLineIcon, {})] })), open && children] })));
|
|
15
15
|
}
|
|
16
16
|
const Title = styled.div(({ theme }) => css `
|
|
17
17
|
display: flex;
|
|
@@ -50,7 +50,13 @@ const DropdownItem = React.forwardRef(function DropdownItem(props, ref) {
|
|
|
50
50
|
setSelected(setItemState, absItemIndex);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
return (_jsxs(_Fragment, { children: [_jsx(Component, Object.assign({ className: className, ref: ref, tabIndex: disabled ? -1 : 0, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: handleClick, "aria-disabled": disabled }, other, { "aria-expanded": isSubMenuExist ? isSubMenuShowed : undefined, "aria-controls": isSubMenuExist ? dropdownMenuId : undefined,
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsx(Component, Object.assign({ className: className, ref: ref, tabIndex: disabled ? -1 : 0, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: handleClick, "aria-disabled": disabled }, other, { "aria-expanded": isSubMenuExist ? isSubMenuShowed : undefined, "aria-controls": isSubMenuExist ? dropdownMenuId : undefined }, (Component === "button"
|
|
54
|
+
? {
|
|
55
|
+
type: "button",
|
|
56
|
+
disabled: disabled,
|
|
57
|
+
css: RESET_BUTTON,
|
|
58
|
+
}
|
|
59
|
+
: {}), { children: _jsxs(Item, Object.assign({ ref: itemRef, disabled: disabled, selected: isSubMenuShowed || Boolean(active) }, { children: [_jsxs(LeftWrapper, { children: [checkbox && (_jsx(StyledCheckboxInput, Object.assign({}, checkboxProps, { disabled: disabled, onClick: (e) => {
|
|
54
60
|
e.stopPropagation();
|
|
55
61
|
} }))), startIcon && (_jsx(IconDiv, Object.assign({ type: type, preserveIconColor: preserveIconColor }, { children: startIcon }))), _jsx(LabelDiv, Object.assign({ css: labelCss, type: type }, { children: label }))] }), endIcon && (_jsx(IconDiv, Object.assign({ type: type, preserveIconColor: preserveIconColor }, { children: endIcon }))), !endIcon && isSubMenuExist && (_jsx(IconDiv, Object.assign({ type: type, preserveIconColor: preserveIconColor }, { children: _jsx(ArrowRightSLineIcon, {}) })))] })) })), isSubMenuExist && (_jsx(DropdownContext.Provider, Object.assign({ value: {
|
|
56
62
|
open,
|
|
@@ -32,7 +32,7 @@ function useSuspenseImage(src) {
|
|
|
32
32
|
}
|
|
33
33
|
function LazyImage({ altText, className, imageRef, src, width, height, maxWidth: _maxWidth, onError, title, onClick, }) {
|
|
34
34
|
useSuspenseImage(src);
|
|
35
|
-
return (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
35
|
+
return (_jsx("img", Object.assign({ className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
36
36
|
height,
|
|
37
37
|
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
38
38
|
// maxWidth: `min(${maxWidth}px, 100%)`,
|
|
@@ -40,7 +40,15 @@ function LazyImage({ altText, className, imageRef, src, width, height, maxWidth:
|
|
|
40
40
|
// fixme: maxWidth를 수정할 수 있게 되면 원복합니다.
|
|
41
41
|
maxWidth: "100%",
|
|
42
42
|
width,
|
|
43
|
-
}, "aria-label": title, onClick: onClick, onError: onError, draggable: "false",
|
|
43
|
+
}, title: title, "aria-label": title, onClick: onClick, onError: onError, draggable: "false" }, (onClick ? {
|
|
44
|
+
role: "button",
|
|
45
|
+
tabIndex: 0,
|
|
46
|
+
onKeyDown: (event) => {
|
|
47
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
48
|
+
onClick();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} : {}))));
|
|
44
52
|
}
|
|
45
53
|
export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth, resizable, }) {
|
|
46
54
|
const imageRef = useRef(null);
|
|
@@ -60,7 +60,7 @@ export function FormSelection(props) {
|
|
|
60
60
|
: "이미지 삽입하기",
|
|
61
61
|
} }), _jsxs(Answer, Object.assign({ onClick: () => {
|
|
62
62
|
onChange(Object.assign(Object.assign({}, value), { isAnswer: !value.isAnswer }));
|
|
63
|
-
} }, { children: ["\uC815\uB2F5", _jsx(Switch, { checked: Boolean(value.isAnswer), size: "small" })] })), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
63
|
+
} }, { children: ["\uC815\uB2F5", _jsx(Switch, { checked: Boolean(value.isAnswer), size: "small", inputProps: { "aria-label": "정답" } })] })), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
64
64
|
"aria-label": "삭제",
|
|
65
65
|
} }))] }))] }));
|
|
66
66
|
}
|
|
@@ -30,7 +30,21 @@ 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
|
-
|
|
33
|
+
// 화살표 키(좌, 우)로 인접 버튼으로 포커스 이동하는 로직
|
|
34
|
+
const handleKeyDown = (e) => {
|
|
35
|
+
let sibling = null;
|
|
36
|
+
if (e.key === "ArrowRight") {
|
|
37
|
+
sibling = e.currentTarget.nextElementSibling;
|
|
38
|
+
}
|
|
39
|
+
else if (e.key === "ArrowLeft") {
|
|
40
|
+
sibling = e.currentTarget.previousElementSibling;
|
|
41
|
+
}
|
|
42
|
+
if (sibling instanceof HTMLButtonElement) {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
sibling.focus();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
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, onKeyDown: handleKeyDown, disabled: context.disabled || props.disabled, "aria-selected": isActive, role: "tab", tabIndex: isActive ? 0 : -1 })));
|
|
34
48
|
});
|
|
35
49
|
const StyledButton = styled(Button, {
|
|
36
50
|
shouldForwardProp: (prop) => prop !== "isActive",
|
|
@@ -29,7 +29,7 @@ export const SegmentedControlGroup = React.forwardRef(function SegmentedControlG
|
|
|
29
29
|
background-color: ${theme.color.background.neutralAlt};
|
|
30
30
|
border-radius: 8px;
|
|
31
31
|
border: 1px solid ${theme.color.background.neutralAltActive};
|
|
32
|
-
`, role: "tablist" }, { children: _jsx(Context.Provider, Object.assign({ value: Object.assign(Object.assign({}, props), { onClick: (newValue) => {
|
|
32
|
+
`, role: "tablist", "aria-orientation": "horizontal" }, { children: _jsx(Context.Provider, Object.assign({ value: Object.assign(Object.assign({}, props), { onClick: (newValue) => {
|
|
33
33
|
var _a, _b, _c;
|
|
34
34
|
if (multiSelect) {
|
|
35
35
|
if (props.value.includes(newValue)) {
|
|
@@ -20,7 +20,7 @@ import { SegmentedControlGroupPropsContext, } from "./SegmentedControlGroupProps
|
|
|
20
20
|
* [피그마](https://www.figma.com/file/PnQp3tPxiCjgsPZfLUaUL1/Codle-PD-Kit---Patterns?node-id=181%3A89883)
|
|
21
21
|
*/
|
|
22
22
|
export const SegmentedControlSquareButton = React.forwardRef(function SegmentedControlSquareButton(props, ref) {
|
|
23
|
-
const { onClick, icon } = props, other = __rest(props, ["onClick", "icon"]);
|
|
23
|
+
const { onClick, icon, buttonProps } = props, other = __rest(props, ["onClick", "icon", "buttonProps"]);
|
|
24
24
|
const context = useContext(SegmentedControlGroupPropsContext);
|
|
25
25
|
const handleClick = (e) => {
|
|
26
26
|
var _a;
|
|
@@ -30,7 +30,23 @@ export const SegmentedControlSquareButton = React.forwardRef(function SegmentedC
|
|
|
30
30
|
const isActive = context.multiSelect
|
|
31
31
|
? context.value.includes(props.value)
|
|
32
32
|
: context.value === props.value;
|
|
33
|
-
|
|
33
|
+
// 화살표 키(좌, 우)로 인접 버튼으로 포커스 이동하는 로직
|
|
34
|
+
const handleKeyDown = (e) => {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
let siblingButton = null;
|
|
37
|
+
if (e.key === "ArrowRight") {
|
|
38
|
+
// sibling 요소의 첫 번째 자식인 버튼에 포커스 이동 처리
|
|
39
|
+
siblingButton = (_b = (_a = e.currentTarget.nextElementSibling) === null || _a === void 0 ? void 0 : _a.firstElementChild) !== null && _b !== void 0 ? _b : null;
|
|
40
|
+
}
|
|
41
|
+
else if (e.key === "ArrowLeft") {
|
|
42
|
+
siblingButton = (_d = (_c = e.currentTarget.previousElementSibling) === null || _c === void 0 ? void 0 : _c.firstElementChild) !== null && _d !== void 0 ? _d : null;
|
|
43
|
+
}
|
|
44
|
+
if (siblingButton instanceof HTMLButtonElement) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
siblingButton.focus();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return (_jsx(StyledSquareButton, Object.assign({}, other, { ref: ref, isActive: isActive, icon: typeof icon === "function" ? icon(isActive) : icon, color: isActive ? "white" : "icon", size: context.size, fullWidth: context.fullWidth, onClick: handleClick, onKeyDown: handleKeyDown, disabled: context.disabled || props.disabled, buttonProps: Object.assign(Object.assign({}, buttonProps), { "aria-selected": isActive, role: "tab", tabIndex: isActive ? 0 : -1 }) })));
|
|
34
50
|
});
|
|
35
51
|
const StyledSquareButton = styled(SquareButton, {
|
|
36
52
|
shouldForwardProp: (prop) => prop !== "isActive",
|