@team-monolith/cds 1.99.8 → 1.99.9
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/Button.js +1 -1
- package/dist/components/OverflowTooltip.js +2 -2
- package/dist/components/SquareButton.js +3 -1
- package/dist/patterns/Dropdown/Dropdown.js +2 -2
- package/dist/patterns/Dropdown/DropdownItem/DropdownItem.js +3 -3
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/FormSolution.js +3 -3
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/SettingForm.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +3 -3
- package/dist/patterns/ToggleButtonGroup/ToggleButton.js +2 -2
- package/package.json +1 -1
|
@@ -212,7 +212,7 @@ const SIZE_TO_LABEL_STYLE = {
|
|
|
212
212
|
export const Button = React.forwardRef(function Button(props, ref) {
|
|
213
213
|
const { className, component: Component = "button", disabled, color, size, startIcon, endIcon, label, fullWidth, bold = false, loading = false } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "startIcon", "endIcon", "label", "fullWidth", "bold", "loading"]);
|
|
214
214
|
const theme = useTheme();
|
|
215
|
-
return (_jsxs(Component, Object.assign({ type: Component === "
|
|
215
|
+
return (_jsxs(Component, Object.assign({ type: Component === "button" || Component === "input" ? "button" : undefined }, other, { className: className, ref: ref, css: [
|
|
216
216
|
css `
|
|
217
217
|
display: inline-flex;
|
|
218
218
|
align-items: center;
|
|
@@ -10,7 +10,7 @@ import { uid } from "uid";
|
|
|
10
10
|
export function OverflowTooltip(props) {
|
|
11
11
|
const tooltipRef = useRef(null);
|
|
12
12
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
13
|
-
const
|
|
13
|
+
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
14
14
|
const getIsOverflow = () => {
|
|
15
15
|
if (tooltipRef.current) {
|
|
16
16
|
return tooltipRef.current.scrollWidth > tooltipRef.current.offsetWidth;
|
|
@@ -25,7 +25,7 @@ export function OverflowTooltip(props) {
|
|
|
25
25
|
const handleClose = () => {
|
|
26
26
|
setIsTooltipOpen(false);
|
|
27
27
|
};
|
|
28
|
-
return (_jsx(Tooltip, Object.assign({ tooltipId:
|
|
28
|
+
return (_jsx(Tooltip, Object.assign({ tooltipId: tooltipId, open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose }, props, { children: _jsx(OverflowDiv, Object.assign({ css: props.childrenCss, ref: tooltipRef, onMouseOver: handleOpen, "aria-labelledby": tooltipId }, { children: props.text })) })));
|
|
29
29
|
}
|
|
30
30
|
const OverflowDiv = styled.div `
|
|
31
31
|
overflow: hidden;
|
|
@@ -184,7 +184,9 @@ export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
|
|
|
184
184
|
align-items: center;
|
|
185
185
|
gap: 8px;
|
|
186
186
|
width: ${fullWidth ? "100%" : "fit-content"};
|
|
187
|
-
` }, { children: [_jsx(Component, Object.assign({ type: Component === "
|
|
187
|
+
` }, { children: [_jsx(Component, Object.assign({ type: Component === "button" || Component === "input"
|
|
188
|
+
? "button"
|
|
189
|
+
: undefined }, other, buttonProps, { ref: ref, css: [
|
|
188
190
|
COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled || loading)),
|
|
189
191
|
SIZE_TO_BUTTON_STYLE[size],
|
|
190
192
|
css `
|
|
@@ -32,7 +32,7 @@ const Dropdown = forwardRef(function Dropdown(props, ref) {
|
|
|
32
32
|
const isControlled = menuProps.open !== undefined;
|
|
33
33
|
const [open, setOpen] = useState(false);
|
|
34
34
|
const [itemState, setItemState] = useState(new Map());
|
|
35
|
-
const
|
|
35
|
+
const dropdownMenuId = useMemo(() => `dropdown-menu-${uid()}`, []);
|
|
36
36
|
const handleClick = (e) => {
|
|
37
37
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
38
38
|
if (!isControlled)
|
|
@@ -55,6 +55,6 @@ const Dropdown = forwardRef(function Dropdown(props, ref) {
|
|
|
55
55
|
});
|
|
56
56
|
(_a = menuProps.onClose) === null || _a === void 0 ? void 0 : _a.call(menuProps, e);
|
|
57
57
|
};
|
|
58
|
-
return (_jsxs(Component, Object.assign({ className: className }, other, { ref: ref }, { children: [_jsx(Button, Object.assign({ css: buttonCss, ref: menuRef }, buttonProps, { onClick: handleClick, fullWidth: true, "aria-expanded": (_a = menuProps.open) !== null && _a !== void 0 ? _a : open, "aria-controls":
|
|
58
|
+
return (_jsxs(Component, Object.assign({ className: className }, other, { ref: ref }, { children: [_jsx(Button, Object.assign({ css: buttonCss, ref: menuRef }, buttonProps, { onClick: handleClick, fullWidth: true, "aria-expanded": (_a = menuProps.open) !== null && _a !== void 0 ? _a : open, "aria-controls": dropdownMenuId })), _jsx(DropdownMenu, Object.assign({ dropdownMenuId: dropdownMenuId }, menuProps, { open: isControlled ? menuProps.open : open, onClose: handleClose, anchorEl: menuRef.current, closeOnItemClick: closeOnItemClick, itemState: itemState, setItemState: setItemState }, { children: children }))] })));
|
|
59
59
|
});
|
|
60
60
|
export { Dropdown };
|
|
@@ -31,7 +31,7 @@ const DropdownItem = React.forwardRef(function DropdownItem(props, ref) {
|
|
|
31
31
|
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
32
|
const itemRef = useRef(null);
|
|
33
33
|
const { open, onCloseOnItemClick, nestedIndex, itemState, setItemState } = useContext(DropdownContext);
|
|
34
|
-
const
|
|
34
|
+
const dropdownMenuId = useMemo(() => `dropdown-menu-${uid()}`, []);
|
|
35
35
|
const absItemIndex = nestedIndex ? `${nestedIndex}-${index}` : `${index}`;
|
|
36
36
|
// 서브메뉴가 존재하는지 여부
|
|
37
37
|
const isSubMenuExist = Boolean(children);
|
|
@@ -51,7 +51,7 @@ const DropdownItem = React.forwardRef(function DropdownItem(props, ref) {
|
|
|
51
51
|
setSelected(setItemState, absItemIndex);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
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 ?
|
|
54
|
+
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 }, { 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) => {
|
|
55
55
|
e.stopPropagation();
|
|
56
56
|
} }))), 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: {
|
|
57
57
|
open,
|
|
@@ -59,7 +59,7 @@ const DropdownItem = React.forwardRef(function DropdownItem(props, ref) {
|
|
|
59
59
|
nestedIndex: absItemIndex,
|
|
60
60
|
itemState,
|
|
61
61
|
setItemState,
|
|
62
|
-
} }, { children: _jsx(DropdownMenu, Object.assign({ dropdownMenuId:
|
|
62
|
+
} }, { children: _jsx(DropdownMenu, Object.assign({ dropdownMenuId: dropdownMenuId }, subMenuProps, { open: isSubMenuShowed, anchorEl: itemRef.current, isNestedMenu: true, anchorOrigin: {
|
|
63
63
|
vertical: "top",
|
|
64
64
|
horizontal: "right",
|
|
65
65
|
}, itemState: itemState, setItemState: setItemState }, { children: children })) })))] }));
|
|
@@ -12,7 +12,7 @@ import { useMemo } from "react";
|
|
|
12
12
|
export function FormSolution(props) {
|
|
13
13
|
const { index, control, rules, onDelete } = props;
|
|
14
14
|
const theme = useTheme();
|
|
15
|
-
const
|
|
15
|
+
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
16
16
|
return (_jsx(Controller, { name: `solutions.${index}.value`, control: control, rules: rules, render: ({ field: { value, onChange }, fieldState: { invalid, error }, }) => {
|
|
17
17
|
const disabled = (error === null || error === void 0 ? void 0 : error.type) === "enabled";
|
|
18
18
|
return (_jsx(Input, { size: "small", color: invalid ? "activeDanger" : "default", onChange: onChange, disabled: disabled, value: value, hintIcon: !disabled && invalid ? _jsx(ErrorWarningFillIcon, {}) : undefined, hintText: !disabled ? error === null || error === void 0 ? void 0 : error.message : undefined, placeholder: "\uC548\uB155\uD558\uC138\uC694", fullWidth: true, css: css `
|
|
@@ -24,8 +24,8 @@ export function FormSolution(props) {
|
|
|
24
24
|
gap: 4px;
|
|
25
25
|
` }, { children: [onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
26
26
|
"aria-label": "삭제",
|
|
27
|
-
} })), disabled && (_jsx(Tooltip, Object.assign({ tooltipId:
|
|
27
|
+
} })), disabled && (_jsx(Tooltip, Object.assign({ tooltipId: tooltipId, text: _jsxs("span", { children: ["\uC785\uB825 \uCE78 \uC124\uC815\uC774 '\uAE00\uC790 \uC218\uB300\uB85C'\uC778 \uACBD\uC6B0", _jsx("br", {}), "\uC815\uB2F5\uC744 \uD558\uB098\uB9CC \uB4F1\uB85D\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."] }) }, { children: _jsx(SquareButton, { color: "danger", size: "xsmall", icon: _jsx(AlertFillIcon, { color: theme.color.foreground.neutralAlt }), disabled: true, buttonProps: {
|
|
28
28
|
"aria-label": "정답 등록 불가",
|
|
29
|
-
}, "aria-labelledby":
|
|
29
|
+
}, "aria-labelledby": tooltipId }) })))] })) }));
|
|
30
30
|
} }));
|
|
31
31
|
}
|
|
@@ -18,8 +18,8 @@ import { useMemo } from "react";
|
|
|
18
18
|
export function SettingForm(props) {
|
|
19
19
|
const { solutions, showCharacterNumber, placeholder, nodeKey, onClose, caseSensitive, ignoreWhitespace, } = props;
|
|
20
20
|
const [editor] = useLexicalComposerContext();
|
|
21
|
-
const inputTooltipId = useMemo(uid
|
|
22
|
-
const placeholderTooltipId = useMemo(uid
|
|
21
|
+
const inputTooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
22
|
+
const placeholderTooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
23
23
|
const { control, handleSubmit, watch, trigger } = useForm({
|
|
24
24
|
mode: "all",
|
|
25
25
|
defaultValues: {
|
|
@@ -17,7 +17,7 @@ export function SettingForm(props) {
|
|
|
17
17
|
const { selections, nodeKey, onClose } = props;
|
|
18
18
|
const [editor] = useLexicalComposerContext();
|
|
19
19
|
const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
20
|
-
const
|
|
20
|
+
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
21
21
|
const { control, handleSubmit, watch } = useForm({
|
|
22
22
|
mode: "all",
|
|
23
23
|
defaultValues: {
|
|
@@ -90,7 +90,7 @@ export function SettingForm(props) {
|
|
|
90
90
|
}, disabled: fields.length >= 9 }), hasMultipleAnswers && (_jsxs(Alert, { children: [_jsx(AlarmWarningFillIcon, { css: css `
|
|
91
91
|
width: 14px;
|
|
92
92
|
height: 14px;
|
|
93
|
-
` }), "\uC815\uB2F5\uC774 \uC5EC\uB7EC \uAC1C\uC778 \uBB38\uC81C\uC5D0\uB294 \uC815\uB2F5\uC744 \uBAA8\uB450 \uC120\uD0DD\uD574\uC57C \uD55C\uB2E4\uB294 \uC548\uB0B4\uAC00 \uC81C\uACF5\uB429\uB2C8\uB2E4."] }))] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: "\uB2EB\uAE30", onClick: onClose }), _jsx(Tooltip, Object.assign({ tooltipId:
|
|
93
|
+
` }), "\uC815\uB2F5\uC774 \uC5EC\uB7EC \uAC1C\uC778 \uBB38\uC81C\uC5D0\uB294 \uC815\uB2F5\uC744 \uBAA8\uB450 \uC120\uD0DD\uD574\uC57C \uD55C\uB2E4\uB294 \uC548\uB0B4\uAC00 \uC81C\uACF5\uB429\uB2C8\uB2E4."] }))] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: "\uB2EB\uAE30", onClick: onClose }), _jsx(Tooltip, Object.assign({ tooltipId: tooltipId, open: !hasAnswer && tooltipOpen, text: "\uC120\uD0DD\uC9C0 \uC911 \uC815\uB2F5\uC744 \uD45C\uC2DC\uD574\uC8FC\uC138\uC694.", onOpen: () => setTooltipOpen(true), onClose: () => setTooltipOpen(false), placement: "top-end" }, { children: _jsx("span", Object.assign({ "aria-labelledby": tooltipId }, { children: _jsx(Button, { color: "primary", size: "xsmall", label: "\uC774\uB300\uB85C \uB123\uAE30", type: "submit", disabled: !hasAnswer }) })) }))] })] })));
|
|
94
94
|
}
|
|
95
95
|
const Form = styled.form(({ theme }) => css `
|
|
96
96
|
display: flex;
|
|
@@ -14,7 +14,7 @@ import { useMemo } from "react";
|
|
|
14
14
|
export function SettingForm(props) {
|
|
15
15
|
const { multiline, placeholder, nodeKey, onClose } = props;
|
|
16
16
|
const [editor] = useLexicalComposerContext();
|
|
17
|
-
const
|
|
17
|
+
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
18
18
|
const { control, handleSubmit } = useForm({
|
|
19
19
|
mode: "all",
|
|
20
20
|
defaultValues: {
|
|
@@ -34,10 +34,10 @@ export function SettingForm(props) {
|
|
|
34
34
|
return (_jsxs(Form, Object.assign({ onSubmit: handleSubmit(onSettingSubmit) }, { children: [_jsxs(Title, { children: [_jsx(InputMethodLineIcon, { css: css `
|
|
35
35
|
width: 12px;
|
|
36
36
|
height: 12px;
|
|
37
|
-
` }), multiline ? "서술형 입력 칸" : "단답형 입력 칸"] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({ tooltipId:
|
|
37
|
+
` }), multiline ? "서술형 입력 칸" : "단답형 입력 칸"] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({ tooltipId: tooltipId, text: _jsx("span", { children: "\uC785\uB825 \uCE78\uC5D0 \uAE30\uBCF8\uC73C\uB85C \uB178\uCD9C\uB418\uB294 \uD14D\uC2A4\uD2B8\uC785\uB2C8\uB2E4." }), placement: "top" }, { children: _jsx(QuestionFillIcon, { css: css `
|
|
38
38
|
width: 12px;
|
|
39
39
|
height: 12px;
|
|
40
|
-
`, "aria-labelledby":
|
|
40
|
+
`, "aria-labelledby": tooltipId }) }))] }), _jsx(Controller, { name: "placeholder", control: control, render: ({ field: { value, onChange } }) => (_jsx(Input, { size: "small", color: "default", value: value, onChange: onChange, placeholder: "\uC608) \uC5EC\uAE30\uC5D0 \uC785\uB825\uD558\uC138\uC694." })) })] }) }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: "\uB2EB\uAE30", onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: "\uC774\uB300\uB85C \uB123\uAE30", bold: true, type: "submit" })] })] })));
|
|
41
41
|
}
|
|
42
42
|
const Form = styled.form(({ theme }) => css `
|
|
43
43
|
display: flex;
|
|
@@ -9,11 +9,11 @@ import { useMemo } from "react";
|
|
|
9
9
|
export function ToggleButton(props) {
|
|
10
10
|
const { datum, placement, isActive, onClick } = props;
|
|
11
11
|
const { label, onIcon, offIcon } = datum;
|
|
12
|
-
const
|
|
12
|
+
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
13
13
|
if (isActive) {
|
|
14
14
|
return (_jsxs(Active, Object.assign({ "aria-label": `${label} 선택 해제하기`, className: toggleButtonGroupClasses.toggleButton.active, onClick: onClick }, { children: [onIcon, label] })));
|
|
15
15
|
}
|
|
16
|
-
return (_jsx(Tooltip, Object.assign({ tooltipId:
|
|
16
|
+
return (_jsx(Tooltip, Object.assign({ tooltipId: tooltipId, placement: placement, text: label }, { children: _jsx(Inactive, Object.assign({ "aria-label": `${label} 선택하기`, className: toggleButtonGroupClasses.toggleButton.inactive, onClick: onClick, "aria-labelledby": tooltipId }, { children: offIcon })) })));
|
|
17
17
|
}
|
|
18
18
|
const Active = styled.button(({ theme }) => css `
|
|
19
19
|
${RESET_BUTTON};
|