@team-monolith/cds 1.100.3 → 1.100.5
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/Book/Book.js +2 -1
- package/dist/components/OverflowTooltip.d.ts +0 -2
- package/dist/components/OverflowTooltip.js +1 -13
- package/dist/components/Switch.d.ts +4 -5
- package/dist/components/Switch.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/patterns/Accordion.d.ts +0 -1
- package/dist/patterns/Accordion.js +2 -2
- package/dist/patterns/Dropdown/DropdownItem/DropdownItem.js +1 -2
- package/dist/patterns/LexicalEditor/nodes/ImageNode/ImageComponent.js +17 -15
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +4 -4
- package/dist/patterns/LexicalEditor/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +1 -0
- package/dist/patterns/LexicalEditor/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +4 -2
- package/dist/utils/visuallyHidden.d.ts +1 -0
- package/dist/utils/visuallyHidden.js +12 -0
- package/package.json +1 -1
|
@@ -193,7 +193,8 @@ const CoverTitle = styled("h1", {
|
|
|
193
193
|
const BookGradient = styled.div `
|
|
194
194
|
width: 200px;
|
|
195
195
|
height: ${BOOK_HEIGHT}px;
|
|
196
|
-
background:
|
|
196
|
+
background:
|
|
197
|
+
linear-gradient(
|
|
197
198
|
180deg,
|
|
198
199
|
rgba(255, 255, 255, 0) 0%,
|
|
199
200
|
rgba(0, 0, 0, 0.75) 100%
|
|
@@ -5,8 +5,6 @@ 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>;
|
|
10
8
|
}
|
|
11
9
|
/**
|
|
12
10
|
* 인자로 주어진 텍스트를 그립니다.
|
|
@@ -1,14 +1,3 @@
|
|
|
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
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
13
2
|
import styled from "@emotion/styled";
|
|
14
3
|
import { useRef, useState } from "react";
|
|
@@ -18,7 +7,6 @@ import { Tooltip } from "./Tooltip";
|
|
|
18
7
|
* 공간이 부족하면 ...으로 표시하고 툴팁으로 전체 내용을 노출합니다.
|
|
19
8
|
*/
|
|
20
9
|
export function OverflowTooltip(props) {
|
|
21
|
-
const { divProps } = props, tooltipProps = __rest(props, ["divProps"]);
|
|
22
10
|
const tooltipRef = useRef(null);
|
|
23
11
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
24
12
|
const getIsOverflow = () => {
|
|
@@ -35,7 +23,7 @@ export function OverflowTooltip(props) {
|
|
|
35
23
|
const handleClose = () => {
|
|
36
24
|
setIsTooltipOpen(false);
|
|
37
25
|
};
|
|
38
|
-
return (_jsx(Tooltip, Object.assign({ open: isTooltipOpen, onOpen: handleOpen, onClose: handleClose },
|
|
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 })) })));
|
|
39
27
|
}
|
|
40
28
|
const OverflowDiv = styled.div `
|
|
41
29
|
overflow: hidden;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SwitchProps as MuiSwitchProps } from "@mui/material";
|
|
2
3
|
export type SwitchSize = "small" | "large";
|
|
3
|
-
export interface SwitchProps {
|
|
4
|
+
export interface SwitchProps extends Omit<MuiSwitchProps, "size"> {
|
|
4
5
|
className?: string;
|
|
5
6
|
/** 스위치 체크 상태 여부 */
|
|
6
7
|
checked: boolean;
|
|
@@ -11,10 +12,8 @@ export interface SwitchProps {
|
|
|
11
12
|
size: SwitchSize;
|
|
12
13
|
/** 스위치 상태 변경 시 호출될 콜백 함수 */
|
|
13
14
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
14
|
-
/** HTML input 태그에 전달될 props */
|
|
15
|
-
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* [피그마](https://www.figma.com/file/yhrRFizzmhPoHdw9FbYow2/Codle-PD-Kit---Components?type=design&node-id=36-1577&t=9sDLb4XIOdmF2VMc-0)
|
|
19
18
|
*/
|
|
20
|
-
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
19
|
+
export declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -13,14 +13,14 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
13
13
|
/** @jsxImportSource @emotion/react */
|
|
14
14
|
import styled from "@emotion/styled";
|
|
15
15
|
import React from "react";
|
|
16
|
-
import { Switch as MuiSwitch } from "@mui/material";
|
|
16
|
+
import { Switch as MuiSwitch, } from "@mui/material";
|
|
17
17
|
import { css } from "@emotion/react";
|
|
18
18
|
/**
|
|
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
|
|
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 } = 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 })));
|
|
24
24
|
});
|
|
25
25
|
const SIZE_TO_SWTICH_SIZE = {
|
|
26
26
|
large: {
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./icons/custom/colored";
|
|
|
30
30
|
export * from "./utils/hover";
|
|
31
31
|
export * from "./utils/reset";
|
|
32
32
|
export * from "./utils/zIndex";
|
|
33
|
+
export * from "./utils/visuallyHidden";
|
|
33
34
|
export * from "./patterns/Dropdown";
|
|
34
35
|
export * from "./patterns/SegmentedControl";
|
|
35
36
|
export * from "./patterns/LexicalEditor";
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./icons/custom/colored";
|
|
|
30
30
|
export * from "./utils/hover";
|
|
31
31
|
export * from "./utils/reset";
|
|
32
32
|
export * from "./utils/zIndex";
|
|
33
|
+
export * from "./utils/visuallyHidden";
|
|
33
34
|
export * from "./patterns/Dropdown";
|
|
34
35
|
export * from "./patterns/SegmentedControl";
|
|
35
36
|
export * from "./patterns/LexicalEditor";
|
|
@@ -7,7 +7,6 @@ export interface AccordionProps {
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
open?: boolean;
|
|
9
9
|
onClick?: () => void;
|
|
10
|
-
buttonLabel?: string;
|
|
11
10
|
}
|
|
12
11
|
/** 배너같이 생겼으나 누를 때마다 하단내용이 접힘(보이지않음)/펼침(보임) 상태가 바뀌는 컴포넌트입니다. */
|
|
13
12
|
export declare function Accordion(props: AccordionProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -6,12 +6,12 @@ import { ArrowDownSLineIcon, ArrowUpSLineIcon } from "../icons";
|
|
|
6
6
|
import { RESET_BUTTON } from "../utils/reset";
|
|
7
7
|
/** 배너같이 생겼으나 누를 때마다 하단내용이 접힘(보이지않음)/펼침(보임) 상태가 바뀌는 컴포넌트입니다. */
|
|
8
8
|
export function Accordion(props) {
|
|
9
|
-
const { className, icon, title, children, open = false, onClick, wrapperClassName,
|
|
9
|
+
const { className, icon, title, children, open = false, onClick, wrapperClassName, } = props;
|
|
10
10
|
return (_jsxs("div", Object.assign({ css: css `
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: 2px;
|
|
14
|
-
`, className: wrapperClassName }, { children: [_jsxs(Container, Object.assign({ type: "button", className: className, onClick: onClick, "aria-expanded": open
|
|
14
|
+
`, className: wrapperClassName }, { children: [_jsxs(Container, Object.assign({ type: "button", className: className, onClick: onClick, "aria-expanded": open }, { 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,10 +50,9 @@ 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 }, (Component === "button"
|
|
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, disabled: disabled }, (Component === "button"
|
|
54
54
|
? {
|
|
55
55
|
type: "button",
|
|
56
|
-
disabled: disabled,
|
|
57
56
|
css: RESET_BUTTON,
|
|
58
57
|
}
|
|
59
58
|
: {}), { 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) => {
|
|
@@ -3,7 +3,7 @@ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
|
3
3
|
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
4
4
|
import { mergeRegister } from "@lexical/utils";
|
|
5
5
|
import { $getNodeByKey, $getSelection, $isNodeSelection, $isRangeSelection, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, createCommand, DRAGSTART_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from "lexical";
|
|
6
|
-
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { Suspense, useCallback, useEffect, useRef, useState, } from "react";
|
|
7
7
|
import { $isImageNode } from "./ImageNode";
|
|
8
8
|
import { SquareButton } from "../../../../components/SquareButton";
|
|
9
9
|
import { Settings3FillIcon } from "../../../../icons";
|
|
@@ -13,6 +13,7 @@ import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
|
|
|
13
13
|
import { ImageNotAvailable } from "./ImageNotAvailable";
|
|
14
14
|
import { ImageResizer } from "./ImageResizer";
|
|
15
15
|
import { css } from "@emotion/react";
|
|
16
|
+
import { RESET_BUTTON } from "../../../../utils/reset";
|
|
16
17
|
const imageCache = new Set();
|
|
17
18
|
export const RIGHT_CLICK_IMAGE_COMMAND = createCommand("RIGHT_CLICK_IMAGE_COMMAND");
|
|
18
19
|
function useSuspenseImage(src) {
|
|
@@ -30,9 +31,13 @@ function useSuspenseImage(src) {
|
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
/**
|
|
35
|
+
* 접근성과 관련한 이슈로 onClick이 가능할 땐 button 으로 그립니다.
|
|
36
|
+
*/
|
|
37
|
+
function LazyImage(props) {
|
|
38
|
+
const { altText, className, imageRef, src, width, height, maxWidth: _maxWidth, onError, title, buttonProps, } = props;
|
|
34
39
|
useSuspenseImage(src);
|
|
35
|
-
|
|
40
|
+
const img = (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
36
41
|
height,
|
|
37
42
|
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
38
43
|
// maxWidth: `min(${maxWidth}px, 100%)`,
|
|
@@ -40,17 +45,11 @@ function LazyImage({ altText, className, imageRef, src, width, height, maxWidth:
|
|
|
40
45
|
// fixme: maxWidth를 수정할 수 있게 되면 원복합니다.
|
|
41
46
|
maxWidth: "100%",
|
|
42
47
|
width,
|
|
43
|
-
}, title: title,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
49
|
-
onClick();
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
}
|
|
53
|
-
: {}))));
|
|
48
|
+
}, title: title, onError: onError, draggable: "false" }));
|
|
49
|
+
if (buttonProps) {
|
|
50
|
+
return (_jsx("button", Object.assign({ type: "button", css: RESET_BUTTON }, buttonProps, { children: img })));
|
|
51
|
+
}
|
|
52
|
+
return img;
|
|
54
53
|
}
|
|
55
54
|
export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth, resizable, }) {
|
|
56
55
|
const imageRef = useRef(null);
|
|
@@ -194,7 +193,10 @@ export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth,
|
|
|
194
193
|
? `focused ${$isNodeSelection(selection) ? "draggable" : ""}`
|
|
195
194
|
: null, css: css `
|
|
196
195
|
cursor: pointer;
|
|
197
|
-
`, src: src, altText: altText, imageRef: imageRef, width: width, height: height, maxWidth: maxWidth, onError: () => setIsLoadError(true),
|
|
196
|
+
`, src: src, altText: altText, imageRef: imageRef, width: width, height: height, maxWidth: maxWidth, onError: () => setIsLoadError(true), buttonProps: {
|
|
197
|
+
onClick: () => window.open(src, "_blank"),
|
|
198
|
+
"aria-label": "이미지 보기 (새 창)",
|
|
199
|
+
}, title: "\uD074\uB9AD\uD574\uC11C \uC6D0\uBCF8 \uC774\uBBF8\uC9C0 \uBCF4\uAE30." })) })) })));
|
|
198
200
|
}
|
|
199
201
|
return (_jsxs(_Fragment, { children: [_jsxs(EditContainer, { children: [_jsx(Suspense, Object.assign({ fallback: null }, { children: _jsx("div", Object.assign({ draggable: draggable, css: css `
|
|
200
202
|
// ImageResizer를 위한 relative 설정입니다.
|
|
@@ -58,9 +58,9 @@ export function FormSelection(props) {
|
|
|
58
58
|
"aria-label": value.show.image
|
|
59
59
|
? "이미지 바꾸기"
|
|
60
60
|
: "이미지 삽입하기",
|
|
61
|
-
} }), _jsxs(Answer,
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
} }), _jsxs(Answer, { children: ["\uC815\uB2F5", _jsx(Switch, { checked: Boolean(value.isAnswer), size: "small", onChange: () => {
|
|
62
|
+
onChange(Object.assign(Object.assign({}, value), { isAnswer: !value.isAnswer }));
|
|
63
|
+
} })] }), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
64
64
|
"aria-label": "삭제",
|
|
65
65
|
} }))] }))] }));
|
|
66
66
|
}
|
|
@@ -89,7 +89,7 @@ const Index = styled.div(({ theme }) => css `
|
|
|
89
89
|
font-weight: 800;
|
|
90
90
|
line-height: 16px;
|
|
91
91
|
`);
|
|
92
|
-
const Answer = styled.
|
|
92
|
+
const Answer = styled.label(({ theme }) => css `
|
|
93
93
|
display: flex;
|
|
94
94
|
align-items: center;
|
|
95
95
|
padding-right: 4px;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
2
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
4
|
import { sanitizeUrl } from "../../utils/url";
|
|
4
5
|
import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from "lexical";
|
|
@@ -9,6 +10,7 @@ import { $findMatchingParent, mergeRegister } from "@lexical/utils";
|
|
|
9
10
|
import styled from "@emotion/styled";
|
|
10
11
|
import { CloseFillIcon, CheckLineIcon, EditLineIcon, DeleteBinLineIcon, } from "../../../../icons";
|
|
11
12
|
import { Input } from "../../../../components/Input";
|
|
13
|
+
import { VISUALLY_HIDDEN } from "../../../../utils/visuallyHidden";
|
|
12
14
|
export function FloatingLinkEditor(props) {
|
|
13
15
|
const { editor, isLink, setIsLink, anchorElem, isLinkEditMode, setIsLinkEditMode, } = props;
|
|
14
16
|
const editorRef = useRef(null);
|
|
@@ -151,7 +153,7 @@ export function FloatingLinkEditor(props) {
|
|
|
151
153
|
} }, { children: _jsx(CloseFillIcon, {}) })), _jsx(Button, Object.assign({ tabIndex: 0, onClick: (event) => {
|
|
152
154
|
event.preventDefault();
|
|
153
155
|
handleLinkSubmission();
|
|
154
|
-
} }, { children: _jsx(CheckLineIcon, {}) }))] })] })) : (_jsxs(_Fragment, { children: [
|
|
156
|
+
} }, { children: _jsx(CheckLineIcon, {}) }))] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Link, Object.assign({ href: sanitizeUrl(linkUrl), target: "_blank", rel: "noopener noreferrer" }, { children: [linkUrl, _jsx("div", Object.assign({ css: VISUALLY_HIDDEN }, { children: "(\uC0C8 \uCC3D)" }))] })), _jsxs(Buttons, { children: [_jsx(Button, Object.assign({ tabIndex: 0, onClick: (event) => {
|
|
155
157
|
event.preventDefault();
|
|
156
158
|
setEditedLinkUrl(linkUrl);
|
|
157
159
|
setIsLinkEditMode(true);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VISUALLY_HIDDEN: import("@emotion/utils").SerializedStyles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
2
|
+
export const VISUALLY_HIDDEN = css `
|
|
3
|
+
position: absolute;
|
|
4
|
+
width: 1px;
|
|
5
|
+
height: 1px;
|
|
6
|
+
margin: -1px;
|
|
7
|
+
padding: 0;
|
|
8
|
+
border: 0;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
clip: rect(0, 0, 0, 0);
|
|
11
|
+
white-space: nowrap; /* 텍스트가 줄 바뀜 없이 한 줄로 유지되도록 */
|
|
12
|
+
`;
|