@team-monolith/cds 1.95.2 → 1.96.1

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.
@@ -3,7 +3,10 @@ export interface TooltipProps {
3
3
  className?: string;
4
4
  /** 툴팁에 표시될 제목 텍스트 */
5
5
  title?: string;
6
- /** 툴팁에 표시될 text 영역 값 */
6
+ /**
7
+ * 툴팁에 표시될 text 영역 값
8
+ * title이 없고 text가 null인 경우 툴팁을 표시하지 않음
9
+ */
7
10
  text: React.ReactNode;
8
11
  /** `true` 값일때 Tooltip을 오픈합니다. */
9
12
  open?: boolean;
@@ -20,7 +20,9 @@ import { Tooltip as MuiTooltip, } from "@mui/material";
20
20
  */
21
21
  export const Tooltip = React.forwardRef(function Tooltip(props, ref) {
22
22
  const { title, text, children } = props, restProps = __rest(props, ["title", "text", "children"]);
23
- return (_jsx(StyledTooltip, Object.assign({ ref: ref, title: _jsxs(_Fragment, { children: [title && _jsx(TitleDiv, { children: title }), text] }) }, restProps, { children: children })));
23
+ return (_jsx(StyledTooltip, Object.assign({ ref: ref, title:
24
+ // title이 없고 text가 null인 경우 툴팁을 표시하지 않음
25
+ !title && text === null ? null : (_jsxs(_Fragment, { children: [title && _jsx(TitleDiv, { children: title }), text] })) }, restProps, { children: children })));
24
26
  });
25
27
  // https://mui.com/material-ui/react-tooltip/#customization
26
28
  const StyledTooltip = styled((_a) => {
@@ -22,13 +22,22 @@ const TYPE_TO_INDEX_ICON = (type) => ({
22
22
  })[type];
23
23
  export function SelectBoxView(props) {
24
24
  const { index, isSelected, isAnswer, image, text, onClick } = props;
25
- const selectBoxType = isSelected
25
+ const selectedTypeAndDescription = isSelected
26
26
  ? isAnswer === undefined
27
- ? "primary"
27
+ ? {
28
+ type: "primary",
29
+ description: "선택됨",
30
+ }
28
31
  : isAnswer
29
- ? "success"
30
- : "danger"
31
- : undefined;
32
+ ? {
33
+ type: "success",
34
+ description: "선택됨, 정답",
35
+ }
36
+ : {
37
+ type: "danger",
38
+ description: "선택됨, 오답",
39
+ }
40
+ : null;
32
41
  const boxRef = useRef(null);
33
42
  const handleKeyDown = (e) => {
34
43
  // onClick이 없으면 아무것도 하지 않음.
@@ -50,7 +59,15 @@ export function SelectBoxView(props) {
50
59
  const ariaText = text || (image && image.altText) || index.toString() + "번 선택지";
51
60
  return (_jsx(SelectBoxComponent, { css: css `
52
61
  width: 100%;
53
- `, ref: boxRef, role: onClick ? "checkbox" : undefined, "aria-checked": isSelected, "aria-label": onClick ? ariaText + (isSelected ? " 선택됨" : " 선택하기") : ariaText, tabIndex: onClick ? 0 : -1, type: selectBoxType, index: selectBoxType ? TYPE_TO_INDEX_ICON(selectBoxType) : index, image: image, text: text, onClick: onClick,
62
+ `, ref: boxRef, role: onClick ? "checkbox" : undefined, "aria-checked": isSelected, "aria-label": onClick
63
+ ? ariaText +
64
+ " " +
65
+ (selectedTypeAndDescription
66
+ ? selectedTypeAndDescription.description
67
+ : "선택하기")
68
+ : ariaText, tabIndex: onClick ? 0 : -1, type: selectedTypeAndDescription === null || selectedTypeAndDescription === void 0 ? void 0 : selectedTypeAndDescription.type, index: selectedTypeAndDescription
69
+ ? TYPE_TO_INDEX_ICON(selectedTypeAndDescription.type)
70
+ : index, image: image, text: text, onClick: onClick,
54
71
  // 선택되지 않았으나 정답일 때 정답 태그를 표시
55
72
  endIcon: isAnswer &&
56
73
  !isSelected && (_jsx(Tag, { label: "\uC815\uB2F5", icon: _jsx(CheckboxCircleFillIcon, {}), color: "green", css: css `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.95.2",
3
+ "version": "1.96.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,