@team-monolith/cds 1.100.3 → 1.100.4
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 +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 +15 -13
- package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +4 -2
- package/dist/patterns/LexicalEditor/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.d.ts +1 -0
- package/dist/patterns/LexicalEditor/plugins/FloatingLinkEditorPlugin/FloatingLinkEditor.js +6 -3
- package/dist/utils/visuallyHidden.d.ts +1 -0
- package/dist/utils/visuallyHidden.js +12 -0
- package/package.json +1 -1
|
@@ -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) => {
|
|
@@ -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) {
|
|
@@ -32,7 +33,18 @@ function useSuspenseImage(src) {
|
|
|
32
33
|
}
|
|
33
34
|
function LazyImage({ altText, className, imageRef, src, width, height, maxWidth: _maxWidth, onError, title, onClick, }) {
|
|
34
35
|
useSuspenseImage(src);
|
|
35
|
-
|
|
36
|
+
if (onClick) {
|
|
37
|
+
return (_jsx("button", Object.assign({ type: "button", css: RESET_BUTTON, onClick: onClick, "aria-label": "\uC774\uBBF8\uC9C0 (\uC0C8 \uD0ED)" }, { children: _jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
38
|
+
height,
|
|
39
|
+
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
40
|
+
// maxWidth: `min(${maxWidth}px, 100%)`,
|
|
41
|
+
// 이미지가 maxWidth보다 클 경우 이미지를 줄이지 않기 위해 100%로 변경
|
|
42
|
+
// fixme: maxWidth를 수정할 수 있게 되면 원복합니다.
|
|
43
|
+
maxWidth: "100%",
|
|
44
|
+
width,
|
|
45
|
+
}, title: title, onError: onError, draggable: "false" }) })));
|
|
46
|
+
}
|
|
47
|
+
return (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
|
|
36
48
|
height,
|
|
37
49
|
// 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
|
|
38
50
|
// maxWidth: `min(${maxWidth}px, 100%)`,
|
|
@@ -40,17 +52,7 @@ function LazyImage({ altText, className, imageRef, src, width, height, maxWidth:
|
|
|
40
52
|
// fixme: maxWidth를 수정할 수 있게 되면 원복합니다.
|
|
41
53
|
maxWidth: "100%",
|
|
42
54
|
width,
|
|
43
|
-
}, title: title,
|
|
44
|
-
? {
|
|
45
|
-
role: "button",
|
|
46
|
-
tabIndex: 0,
|
|
47
|
-
onKeyDown: (event) => {
|
|
48
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
49
|
-
onClick();
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
}
|
|
53
|
-
: {}))));
|
|
55
|
+
}, title: title, onError: onError, draggable: "false" }));
|
|
54
56
|
}
|
|
55
57
|
export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth, resizable, }) {
|
|
56
58
|
const imageRef = useRef(null);
|
|
@@ -194,7 +196,7 @@ export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth,
|
|
|
194
196
|
? `focused ${$isNodeSelection(selection) ? "draggable" : ""}`
|
|
195
197
|
: null, css: css `
|
|
196
198
|
cursor: pointer;
|
|
197
|
-
`, src: src, altText: altText, imageRef: imageRef, width: width, height: height, maxWidth: maxWidth, onError: () => setIsLoadError(true), onClick: () => window.open(src, "_blank"), title: "\uD074\uB9AD\uD574\uC11C \uC6D0\uBCF8 \uC774\uBBF8\uC9C0 \uBCF4\uAE30.
|
|
199
|
+
`, src: src, altText: altText, imageRef: imageRef, width: width, height: height, maxWidth: maxWidth, onError: () => setIsLoadError(true), onClick: () => window.open(src, "_blank"), 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 설정입니다.
|
|
@@ -9,6 +9,7 @@ import { SquareButton } from "../../../../../components/SquareButton";
|
|
|
9
9
|
import { Switch } from "../../../../../components/Switch";
|
|
10
10
|
import { useState } from "react";
|
|
11
11
|
import { InsertImageDialog } from "../../../components/InsertImageDialog";
|
|
12
|
+
import { RESET_BUTTON } from "../../../../../utils/reset";
|
|
12
13
|
export function FormSelection(props) {
|
|
13
14
|
var _a;
|
|
14
15
|
const { index, control, rules, onDelete } = props;
|
|
@@ -60,7 +61,7 @@ export function FormSelection(props) {
|
|
|
60
61
|
: "이미지 삽입하기",
|
|
61
62
|
} }), _jsxs(Answer, Object.assign({ onClick: () => {
|
|
62
63
|
onChange(Object.assign(Object.assign({}, value), { isAnswer: !value.isAnswer }));
|
|
63
|
-
} }, { children: ["\uC815\uB2F5", _jsx(Switch, { checked: Boolean(value.isAnswer), size: "small", inputProps: {
|
|
64
|
+
} }, { children: ["\uC815\uB2F5", _jsx(Switch, { checked: Boolean(value.isAnswer), size: "small", inputProps: { tabIndex: -1 } })] })), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete, buttonProps: {
|
|
64
65
|
"aria-label": "삭제",
|
|
65
66
|
} }))] }))] }));
|
|
66
67
|
}
|
|
@@ -89,7 +90,8 @@ const Index = styled.div(({ theme }) => css `
|
|
|
89
90
|
font-weight: 800;
|
|
90
91
|
line-height: 16px;
|
|
91
92
|
`);
|
|
92
|
-
const Answer = styled.
|
|
93
|
+
const Answer = styled.button(({ theme }) => css `
|
|
94
|
+
${RESET_BUTTON}
|
|
93
95
|
display: flex;
|
|
94
96
|
align-items: center;
|
|
95
97
|
padding-right: 4px;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { useCallback, useEffect, useId, 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";
|
|
5
6
|
import { getSelectedNode } from "../../utils/getSelectedNode";
|
|
@@ -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);
|
|
@@ -16,6 +18,7 @@ export function FloatingLinkEditor(props) {
|
|
|
16
18
|
const [linkUrl, setLinkUrl] = useState("");
|
|
17
19
|
const [editedLinkUrl, setEditedLinkUrl] = useState("https://");
|
|
18
20
|
const [lastSelection, setLastSelection] = useState(null);
|
|
21
|
+
const newWindowInfoId = `new-window-info-${useId()}`;
|
|
19
22
|
const $updateLinkEditor = useCallback(() => {
|
|
20
23
|
var _a, _b;
|
|
21
24
|
const selection = $getSelection();
|
|
@@ -151,7 +154,7 @@ export function FloatingLinkEditor(props) {
|
|
|
151
154
|
} }, { children: _jsx(CloseFillIcon, {}) })), _jsx(Button, Object.assign({ tabIndex: 0, onClick: (event) => {
|
|
152
155
|
event.preventDefault();
|
|
153
156
|
handleLinkSubmission();
|
|
154
|
-
} }, { children: _jsx(CheckLineIcon, {}) }))] })] })) : (_jsxs(_Fragment, { children: [_jsx(Link, Object.assign({ href: sanitizeUrl(linkUrl), target: "_blank", rel: "noopener noreferrer",
|
|
157
|
+
} }, { children: _jsx(CheckLineIcon, {}) }))] })] })) : (_jsxs(_Fragment, { children: [_jsx(Link, Object.assign({ href: sanitizeUrl(linkUrl), target: "_blank", rel: "noopener noreferrer", "aria-labelledby": newWindowInfoId }, { children: linkUrl })), _jsx("div", Object.assign({ id: newWindowInfoId, css: VISUALLY_HIDDEN }, { children: "\uC0C8 \uCC3D\uC5D0\uC11C \uC5F4\uB9BC" })), _jsxs(Buttons, { children: [_jsx(Button, Object.assign({ tabIndex: 0, onClick: (event) => {
|
|
155
158
|
event.preventDefault();
|
|
156
159
|
setEditedLinkUrl(linkUrl);
|
|
157
160
|
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
|
+
`;
|