@team-monolith/cds 1.99.9 → 1.99.11
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 +1 -1
- package/dist/components/OverflowTooltip.js +2 -4
- package/dist/components/SquareButton.js +5 -8
- package/dist/components/Switch.d.ts +3 -1
- package/dist/components/Switch.js +2 -2
- package/dist/components/Tooltip.d.ts +0 -6
- package/dist/components/Tooltip.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/FormSolution.js +2 -5
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SettingForm/SettingForm.js +4 -8
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/SettingForm.js +2 -3
- package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +2 -5
- package/dist/patterns/SegmentedControl/SegmentedControlButton.js +1 -4
- package/dist/patterns/ToggleButtonGroup/ToggleButton.js +1 -4
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { SerializedStyles } from "@emotion/react";
|
|
4
4
|
import { TooltipProps } from "./Tooltip";
|
|
5
|
-
interface OverflowTooltipProps extends Omit<TooltipProps, "open" | "onOpen" | "onClose" | "children"
|
|
5
|
+
interface OverflowTooltipProps extends Omit<TooltipProps, "open" | "onOpen" | "onClose" | "children"> {
|
|
6
6
|
className?: string;
|
|
7
7
|
childrenCss?: SerializedStyles;
|
|
8
8
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
|
-
import { useRef, useState
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
4
|
import { Tooltip } from "./Tooltip";
|
|
5
|
-
import { uid } from "uid";
|
|
6
5
|
/**
|
|
7
6
|
* 인자로 주어진 텍스트를 그립니다.
|
|
8
7
|
* 공간이 부족하면 ...으로 표시하고 툴팁으로 전체 내용을 노출합니다.
|
|
@@ -10,7 +9,6 @@ import { uid } from "uid";
|
|
|
10
9
|
export function OverflowTooltip(props) {
|
|
11
10
|
const tooltipRef = useRef(null);
|
|
12
11
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
13
|
-
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
14
12
|
const getIsOverflow = () => {
|
|
15
13
|
if (tooltipRef.current) {
|
|
16
14
|
return tooltipRef.current.scrollWidth > tooltipRef.current.offsetWidth;
|
|
@@ -25,7 +23,7 @@ export function OverflowTooltip(props) {
|
|
|
25
23
|
const handleClose = () => {
|
|
26
24
|
setIsTooltipOpen(false);
|
|
27
25
|
};
|
|
28
|
-
return (_jsx(Tooltip, Object.assign({
|
|
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 })) })));
|
|
29
27
|
}
|
|
30
28
|
const OverflowDiv = styled.div `
|
|
31
29
|
overflow: hidden;
|
|
@@ -176,9 +176,9 @@ const SIZE_TO_LABEL_STYLE = {
|
|
|
176
176
|
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=22-374&t=kTLv3t86qtGalHSS-0)
|
|
177
177
|
*/
|
|
178
178
|
export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
|
|
179
|
-
const { className, component: Component = "button", disabled, color, size, icon, label, fullWidth, loading = false, buttonProps } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "icon", "label", "fullWidth", "loading", "buttonProps"]);
|
|
179
|
+
const { className, component: Component = "button", disabled, color, size, icon, label, fullWidth, onClick, loading = false, buttonProps } = props, other = __rest(props, ["className", "component", "disabled", "color", "size", "icon", "label", "fullWidth", "onClick", "loading", "buttonProps"]);
|
|
180
180
|
const theme = useTheme();
|
|
181
|
-
return (_jsxs("span", Object.assign({ className: className, css: css `
|
|
181
|
+
return (_jsxs("span", Object.assign({}, other, { className: className, css: css `
|
|
182
182
|
display: flex;
|
|
183
183
|
flex-direction: column;
|
|
184
184
|
align-items: center;
|
|
@@ -186,15 +186,12 @@ export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
|
|
|
186
186
|
width: ${fullWidth ? "100%" : "fit-content"};
|
|
187
187
|
` }, { children: [_jsx(Component, Object.assign({ type: Component === "button" || Component === "input"
|
|
188
188
|
? "button"
|
|
189
|
-
: undefined },
|
|
189
|
+
: undefined }, buttonProps, { ref: ref, css: [
|
|
190
190
|
COLOR_TO_BUTTON_STYLE(theme, color, Boolean(disabled || loading)),
|
|
191
191
|
SIZE_TO_BUTTON_STYLE[size],
|
|
192
192
|
css `
|
|
193
|
-
display: inline-flex;
|
|
194
|
-
align-items: center;
|
|
195
|
-
justify-content: center;
|
|
196
193
|
border: none;
|
|
197
|
-
|
|
194
|
+
${fullWidth && `width: 100%;`}
|
|
198
195
|
${disabled || loading
|
|
199
196
|
? css `
|
|
200
197
|
cursor: default;
|
|
@@ -204,7 +201,7 @@ export const SquareButton = React.forwardRef(function SquareButton(props, ref) {
|
|
|
204
201
|
cursor: pointer;
|
|
205
202
|
`}
|
|
206
203
|
`,
|
|
207
|
-
], disabled: disabled || loading }, { children: loading ? _jsx(Spinner, {}) : icon })), label && (_jsx(Label, Object.assign({ disabled: disabled || loading, size: size }, { children: label })))] })));
|
|
204
|
+
], disabled: disabled || loading, onClick: onClick }, { children: loading ? _jsx(Spinner, {}) : icon })), label && (_jsx(Label, Object.assign({ disabled: disabled || loading, size: size }, { children: label })))] })));
|
|
208
205
|
});
|
|
209
206
|
const Label = styled.span `
|
|
210
207
|
font-weight: 400;
|
|
@@ -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: {
|
|
@@ -21,12 +21,6 @@ export interface TooltipProps {
|
|
|
21
21
|
placement?: "bottom-end" | "bottom-start" | "bottom" | "left-end" | "left-start" | "left" | "right-end" | "right-start" | "right" | "top-end" | "top-start" | "top";
|
|
22
22
|
/** 툴팁을 표시할 객체입니다. ref를 props로 받을 수 있어야합니다. */
|
|
23
23
|
children: React.ReactElement;
|
|
24
|
-
/**
|
|
25
|
-
* 툴팁의 고유 id입니다.
|
|
26
|
-
* 이 id는 툴팁을 띄우는 요소에 aria-labelledby 속성을 통해 연결되어,
|
|
27
|
-
* 스크린 리더 등의 보조 기술이 툴팁 내용을 올바르게 인식하도록 돕습니다.
|
|
28
|
-
*/
|
|
29
|
-
tooltipId: string;
|
|
30
24
|
}
|
|
31
25
|
/**
|
|
32
26
|
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=172-626&t=aFkKTFgWq2xFFGC5-0)
|
|
@@ -45,9 +45,9 @@ function addTabIndexIfNeeded(element) {
|
|
|
45
45
|
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=172-626&t=aFkKTFgWq2xFFGC5-0)
|
|
46
46
|
*/
|
|
47
47
|
export const Tooltip = React.forwardRef(function Tooltip(props, ref) {
|
|
48
|
-
const {
|
|
48
|
+
const { title, text, children } = props, restProps = __rest(props, ["title", "text", "children"]);
|
|
49
49
|
const focusableChildren = addTabIndexIfNeeded(children);
|
|
50
|
-
return (_jsx(StyledTooltip, Object.assign({
|
|
50
|
+
return (_jsx(StyledTooltip, Object.assign({ ref: ref, title:
|
|
51
51
|
// title이 없고 text가 null인 경우 툴팁을 표시하지 않음
|
|
52
52
|
!title && text === null ? null : (_jsxs(_Fragment, { children: [title && _jsx(TitleDiv, { children: title }), text] })), describeChild: true }, restProps, { children: focusableChildren })));
|
|
53
53
|
});
|
|
@@ -7,12 +7,9 @@ import { AlertFillIcon, DeleteBinLineIcon, ErrorWarningFillIcon, } from "../../.
|
|
|
7
7
|
import { SquareButton } from "../../../../../components/SquareButton";
|
|
8
8
|
import { Tooltip } from "../../../../../components/Tooltip";
|
|
9
9
|
import { TextTypeDropdown } from "./TextTypeDropdown";
|
|
10
|
-
import { uid } from "uid";
|
|
11
|
-
import { useMemo } from "react";
|
|
12
10
|
export function FormSolution(props) {
|
|
13
11
|
const { index, control, rules, onDelete } = props;
|
|
14
12
|
const theme = useTheme();
|
|
15
|
-
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
16
13
|
return (_jsx(Controller, { name: `solutions.${index}.value`, control: control, rules: rules, render: ({ field: { value, onChange }, fieldState: { invalid, error }, }) => {
|
|
17
14
|
const disabled = (error === null || error === void 0 ? void 0 : error.type) === "enabled";
|
|
18
15
|
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 +21,8 @@ export function FormSolution(props) {
|
|
|
24
21
|
gap: 4px;
|
|
25
22
|
` }, { children: [onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
26
23
|
"aria-label": "삭제",
|
|
27
|
-
} })), disabled && (_jsx(Tooltip, Object.assign({
|
|
24
|
+
} })), disabled && (_jsx(Tooltip, Object.assign({ 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
25
|
"aria-label": "정답 등록 불가",
|
|
29
|
-
}
|
|
26
|
+
} }) })))] })) }));
|
|
30
27
|
} }));
|
|
31
28
|
}
|
|
@@ -13,13 +13,9 @@ import { FormSegmentedControl } from "./FormSegmentedControl";
|
|
|
13
13
|
import { FormPlaceholder } from "./FormPlaceholder";
|
|
14
14
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
15
15
|
import { $getNodeByKey } from "lexical";
|
|
16
|
-
import { uid } from "uid";
|
|
17
|
-
import { useMemo } from "react";
|
|
18
16
|
export function SettingForm(props) {
|
|
19
17
|
const { solutions, showCharacterNumber, placeholder, nodeKey, onClose, caseSensitive, ignoreWhitespace, } = props;
|
|
20
18
|
const [editor] = useLexicalComposerContext();
|
|
21
|
-
const inputTooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
22
|
-
const placeholderTooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
23
19
|
const { control, handleSubmit, watch, trigger } = useForm({
|
|
24
20
|
mode: "all",
|
|
25
21
|
defaultValues: {
|
|
@@ -77,16 +73,16 @@ export function SettingForm(props) {
|
|
|
77
73
|
` }, { children: [_jsx(AlarmWarningFillIcon, { color: theme.color.foreground.neutralBaseDisabled, css: css `
|
|
78
74
|
width: 14px;
|
|
79
75
|
height: 14px;
|
|
80
|
-
` }), _jsx(Label, { children: "\uAC00\uB2A5\uD55C \uC815\uB2F5\uC744 \uBAA8\uB450 \uCD94\uAC00\uD574\uC57C \uC6D0\uD65C\uD558\uAC8C \uC790\uB3D9 \uCC44\uC810\uD560 \uC218 \uC788\uC5B4\uC694." })] }))] }), _jsxs(Right, { children: [_jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC785\uB825 \uCE78", _jsx(Tooltip, Object.assign({
|
|
76
|
+
` }), _jsx(Label, { children: "\uAC00\uB2A5\uD55C \uC815\uB2F5\uC744 \uBAA8\uB450 \uCD94\uAC00\uD574\uC57C \uC6D0\uD65C\uD558\uAC8C \uC790\uB3D9 \uCC44\uC810\uD560 \uC218 \uC788\uC5B4\uC694." })] }))] }), _jsxs(Right, { children: [_jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC785\uB825 \uCE78", _jsx(Tooltip, Object.assign({ text: _jsxs("span", { children: [`예를 들어 정답이 '글자 수'이고`, _jsx("br", {}), _jsx("b", { children: "\uAE00\uC790 \uC218\uB300\uB85C" }), " \uC635\uC158\uC744 \uC120\uD0DD\uD588\uB2E4\uBA74", _jsx("br", {}), `입력 칸이 '☐☐ ☐' 처럼 표시됩니다.`] }), placement: "top" }, { children: _jsx(QuestionFillIcon, { css: css `
|
|
81
77
|
width: 12px;
|
|
82
78
|
height: 12px;
|
|
83
|
-
|
|
79
|
+
` }) }))] }), _jsx(FormSegmentedControl, { control: control, trigger: trigger, name: "showCharacterNumber", items: [
|
|
84
80
|
{ value: false, label: "한 칸으로" },
|
|
85
81
|
{ value: true, label: "글자 수대로" },
|
|
86
|
-
] })] }), _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({
|
|
82
|
+
] })] }), _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({ 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 `
|
|
87
83
|
width: 12px;
|
|
88
84
|
height: 12px;
|
|
89
|
-
|
|
85
|
+
` }) }))] }), _jsx(FormPlaceholder, { control: control })] }), _jsxs(FormArea, { children: [_jsx(Label, { children: "\uB744\uC5B4\uC4F0\uAE30" }), _jsx(FormSegmentedControl, { control: control, trigger: trigger, name: "ignoreWhitespace", items: [
|
|
90
86
|
{ value: true, label: "무시하기" },
|
|
91
87
|
{ value: false, label: "포함하기" },
|
|
92
88
|
] })] }), _jsxs(FormArea, { children: [_jsx(Label, { children: "\uB300\uC18C\uBB38\uC790" }), _jsx(FormSegmentedControl, { control: control, trigger: trigger, name: "caseSensitive", items: [
|
|
@@ -11,13 +11,12 @@ import { AddFillIcon, AlarmWarningFillIcon, ListRadioIcon, } from "../../../../.
|
|
|
11
11
|
import { Button } from "../../../../../components/Button";
|
|
12
12
|
import { FormSelection } from "./FormSelection";
|
|
13
13
|
import { Tooltip } from "../../../../../components/Tooltip";
|
|
14
|
-
import { useState
|
|
14
|
+
import { useState } from "react";
|
|
15
15
|
import { uid } from "uid";
|
|
16
16
|
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 tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
21
20
|
const { control, handleSubmit, watch } = useForm({
|
|
22
21
|
mode: "all",
|
|
23
22
|
defaultValues: {
|
|
@@ -90,7 +89,7 @@ export function SettingForm(props) {
|
|
|
90
89
|
}, disabled: fields.length >= 9 }), hasMultipleAnswers && (_jsxs(Alert, { children: [_jsx(AlarmWarningFillIcon, { css: css `
|
|
91
90
|
width: 14px;
|
|
92
91
|
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({
|
|
92
|
+
` }), "\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({ 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", { children: _jsx(Button, { color: "primary", size: "xsmall", label: "\uC774\uB300\uB85C \uB123\uAE30", type: "submit", disabled: !hasAnswer }) }) }))] })] })));
|
|
94
93
|
}
|
|
95
94
|
const Form = styled.form(({ theme }) => css `
|
|
96
95
|
display: flex;
|
|
@@ -8,13 +8,10 @@ import { css } from "@emotion/react";
|
|
|
8
8
|
import { InputMethodLineIcon, QuestionFillIcon } from "../../../../icons";
|
|
9
9
|
import { Button, Input, shadows, Tooltip } from "../../../..";
|
|
10
10
|
import { $isSheetInputNode } from "./SheetInputNode";
|
|
11
|
-
import { uid } from "uid";
|
|
12
|
-
import { useMemo } from "react";
|
|
13
11
|
/** 활동지 활동의 입력칸 설정 컴포넌트입니다. */
|
|
14
12
|
export function SettingForm(props) {
|
|
15
13
|
const { multiline, placeholder, nodeKey, onClose } = props;
|
|
16
14
|
const [editor] = useLexicalComposerContext();
|
|
17
|
-
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
18
15
|
const { control, handleSubmit } = useForm({
|
|
19
16
|
mode: "all",
|
|
20
17
|
defaultValues: {
|
|
@@ -34,10 +31,10 @@ export function SettingForm(props) {
|
|
|
34
31
|
return (_jsxs(Form, Object.assign({ onSubmit: handleSubmit(onSettingSubmit) }, { children: [_jsxs(Title, { children: [_jsx(InputMethodLineIcon, { css: css `
|
|
35
32
|
width: 12px;
|
|
36
33
|
height: 12px;
|
|
37
|
-
` }), multiline ? "서술형 입력 칸" : "단답형 입력 칸"] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({
|
|
34
|
+
` }), multiline ? "서술형 입력 칸" : "단답형 입력 칸"] }), _jsx(Content, { children: _jsxs(FormArea, { children: [_jsxs(Label, { children: ["\uC790\uB9AC \uD45C\uC2DC\uC790", _jsx(Tooltip, Object.assign({ 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
35
|
width: 12px;
|
|
39
36
|
height: 12px;
|
|
40
|
-
|
|
37
|
+
` }) }))] }), _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
38
|
}
|
|
42
39
|
const Form = styled.form(({ theme }) => css `
|
|
43
40
|
display: flex;
|
|
@@ -30,10 +30,7 @@ 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
|
-
|
|
34
|
-
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, title: isActive
|
|
35
|
-
? (typeof label === "string" ? `${label} 선택됨` : "선택됨")
|
|
36
|
-
: undefined })));
|
|
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 })));
|
|
37
34
|
});
|
|
38
35
|
const StyledButton = styled(Button, {
|
|
39
36
|
shouldForwardProp: (prop) => prop !== "isActive",
|
|
@@ -3,17 +3,14 @@ import styled from "@emotion/styled";
|
|
|
3
3
|
import { HOVER, RESET_BUTTON, Tooltip } from "../..";
|
|
4
4
|
import { css } from "@emotion/react";
|
|
5
5
|
import { toggleButtonGroupClasses, } from "./ToggleButtonGroup";
|
|
6
|
-
import { uid } from "uid";
|
|
7
|
-
import { useMemo } from "react";
|
|
8
6
|
/** 하나의 ToggleButton을 그립니다. */
|
|
9
7
|
export function ToggleButton(props) {
|
|
10
8
|
const { datum, placement, isActive, onClick } = props;
|
|
11
9
|
const { label, onIcon, offIcon } = datum;
|
|
12
|
-
const tooltipId = useMemo(() => `tooltip-${uid()}`, []);
|
|
13
10
|
if (isActive) {
|
|
14
11
|
return (_jsxs(Active, Object.assign({ "aria-label": `${label} 선택 해제하기`, className: toggleButtonGroupClasses.toggleButton.active, onClick: onClick }, { children: [onIcon, label] })));
|
|
15
12
|
}
|
|
16
|
-
return (_jsx(Tooltip, Object.assign({
|
|
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 })) })));
|
|
17
14
|
}
|
|
18
15
|
const Active = styled.button(({ theme }) => css `
|
|
19
16
|
${RESET_BUTTON};
|