@team-monolith/cds 1.100.4 → 1.100.6

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.
@@ -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: linear-gradient(
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%
@@ -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";
@@ -31,20 +31,13 @@ function useSuspenseImage(src) {
31
31
  });
32
32
  }
33
33
  }
34
- function LazyImage({ altText, className, imageRef, src, width, height, maxWidth: _maxWidth, onError, title, onClick, }) {
34
+ /**
35
+ * 접근성과 관련한 이슈로 onClick이 가능할 땐 button 으로 그립니다.
36
+ */
37
+ function LazyImage(props) {
38
+ const { altText, className, imageRef, src, width, height, maxWidth: _maxWidth, onError, title, buttonProps, } = props;
35
39
  useSuspenseImage(src);
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: {
40
+ const img = (_jsx("img", { className: className || undefined, src: src, alt: altText, ref: imageRef, style: {
48
41
  height,
49
42
  // 이미지로 인해 좌우로 스크롤이 생기는 것을 방지
50
43
  // maxWidth: `min(${maxWidth}px, 100%)`,
@@ -53,6 +46,10 @@ function LazyImage({ altText, className, imageRef, src, width, height, maxWidth:
53
46
  maxWidth: "100%",
54
47
  width,
55
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;
56
53
  }
57
54
  export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth, resizable, }) {
58
55
  const imageRef = useRef(null);
@@ -196,7 +193,10 @@ export function ImageComponent({ src, altText, nodeKey, width, height, maxWidth,
196
193
  ? `focused ${$isNodeSelection(selection) ? "draggable" : ""}`
197
194
  : null, css: css `
198
195
  cursor: pointer;
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." })) })) })));
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." })) })) })));
200
200
  }
201
201
  return (_jsxs(_Fragment, { children: [_jsxs(EditContainer, { children: [_jsx(Suspense, Object.assign({ fallback: null }, { children: _jsx("div", Object.assign({ draggable: draggable, css: css `
202
202
  // ImageResizer를 위한 relative 설정입니다.
@@ -9,7 +9,6 @@ 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";
13
12
  export function FormSelection(props) {
14
13
  var _a;
15
14
  const { index, control, rules, onDelete } = props;
@@ -59,9 +58,9 @@ export function FormSelection(props) {
59
58
  "aria-label": value.show.image
60
59
  ? "이미지 바꾸기"
61
60
  : "이미지 삽입하기",
62
- } }), _jsxs(Answer, Object.assign({ onClick: () => {
63
- onChange(Object.assign(Object.assign({}, value), { isAnswer: !value.isAnswer }));
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: {
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: {
65
64
  "aria-label": "삭제",
66
65
  } }))] }))] }));
67
66
  }
@@ -90,8 +89,7 @@ const Index = styled.div(({ theme }) => css `
90
89
  font-weight: 800;
91
90
  line-height: 16px;
92
91
  `);
93
- const Answer = styled.button(({ theme }) => css `
94
- ${RESET_BUTTON}
92
+ const Answer = styled.label(({ theme }) => css `
95
93
  display: flex;
96
94
  align-items: center;
97
95
  padding-right: 4px;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
- import { useCallback, useEffect, useId, useRef, useState, } from "react";
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { sanitizeUrl } from "../../utils/url";
5
5
  import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND, } from "lexical";
6
6
  import { getSelectedNode } from "../../utils/getSelectedNode";
@@ -18,7 +18,6 @@ export function FloatingLinkEditor(props) {
18
18
  const [linkUrl, setLinkUrl] = useState("");
19
19
  const [editedLinkUrl, setEditedLinkUrl] = useState("https://");
20
20
  const [lastSelection, setLastSelection] = useState(null);
21
- const newWindowInfoId = `new-window-info-${useId()}`;
22
21
  const $updateLinkEditor = useCallback(() => {
23
22
  var _a, _b;
24
23
  const selection = $getSelection();
@@ -154,7 +153,7 @@ export function FloatingLinkEditor(props) {
154
153
  } }, { children: _jsx(CloseFillIcon, {}) })), _jsx(Button, Object.assign({ tabIndex: 0, onClick: (event) => {
155
154
  event.preventDefault();
156
155
  handleLinkSubmission();
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) => {
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) => {
158
157
  event.preventDefault();
159
158
  setEditedLinkUrl(linkUrl);
160
159
  setIsLinkEditMode(true);
@@ -1,2 +1,3 @@
1
+ export declare const RESET_COMMON_BOX: import("@emotion/utils").SerializedStyles;
1
2
  export declare const RESET_BUTTON: import("@emotion/utils").SerializedStyles;
2
3
  export declare const RESET_TABLE: import("@emotion/utils").SerializedStyles;
@@ -1,4 +1,9 @@
1
1
  import { css } from "@emotion/react";
2
+ export const RESET_COMMON_BOX = css `
3
+ margin: 0;
4
+ padding: 0;
5
+ border: 0;
6
+ `;
2
7
  export const RESET_BUTTON = css `
3
8
  display: inline-block;
4
9
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.100.4",
3
+ "version": "1.100.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,