@team-monolith/cds 1.51.1 → 1.52.0

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.
Files changed (63) hide show
  1. package/dist/icons/Custom.js +2 -2
  2. package/dist/icons/custom/worksheet-color.svg +5 -5
  3. package/dist/icons/custom/worksheet.svg +4 -4
  4. package/dist/patterns/LexicalEditor/LexicalEditor.d.ts +2 -0
  5. package/dist/patterns/LexicalEditor/LexicalEditor.js +6 -2
  6. package/dist/patterns/LexicalEditor/Plugins.d.ts +1 -0
  7. package/dist/patterns/LexicalEditor/Plugins.js +4 -2
  8. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/ProblemSelectNode.d.ts +1 -4
  9. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxComponent.d.ts +1 -1
  10. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxEdit.d.ts +1 -1
  11. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectBox/SelectBoxView.d.ts +1 -1
  12. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SettingForm/FormSelection.js +1 -1
  13. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.d.ts +7 -0
  14. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.js +79 -0
  15. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.d.ts +11 -0
  16. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SettingForm.js +93 -0
  17. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SheetInputNode.d.ts +33 -0
  18. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/SheetInputNode.js +77 -0
  19. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/index.d.ts +2 -0
  20. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/index.js +2 -0
  21. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxComponent.d.ts +18 -0
  22. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxComponent.js +80 -0
  23. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxEdit.d.ts +8 -0
  24. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxEdit.js +7 -0
  25. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxView.d.ts +9 -0
  26. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/SelectBoxView.js +22 -0
  27. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/index.d.ts +2 -0
  28. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectBox/index.js +2 -0
  29. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent.d.ts +9 -0
  30. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent.js +81 -0
  31. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormAllowMultipleAnswers.d.ts +6 -0
  32. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormAllowMultipleAnswers.js +10 -0
  33. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormSelection.d.ts +11 -0
  34. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/FormSelection.js +86 -0
  35. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/SettingForm.d.ts +13 -0
  36. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/SettingForm.js +148 -0
  37. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/index.d.ts +1 -0
  38. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SettingForm/index.js +1 -0
  39. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SheetSelectNode.d.ts +43 -0
  40. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SheetSelectNode.js +82 -0
  41. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/index.d.ts +2 -0
  42. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/index.js +2 -0
  43. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageDialog.d.ts +4 -1
  44. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageDialog.js +4 -4
  45. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUploadedDialogBody.d.ts +1 -1
  46. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUploadedDialogBody.js +5 -5
  47. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUriDialogBody.d.ts +1 -1
  48. package/dist/patterns/LexicalEditor/nodes/{ProblemSelectNode/SettingForm → insertImageDialog}/InsertImageUriDialogBody.js +4 -4
  49. package/dist/patterns/LexicalEditor/nodes/insertImageDialog/index.d.ts +1 -0
  50. package/dist/patterns/LexicalEditor/nodes/insertImageDialog/index.js +1 -0
  51. package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.d.ts +1 -0
  52. package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/ComponentAdderPlugin.js +6 -2
  53. package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.d.ts +1 -0
  54. package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.js +8 -2
  55. package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.d.ts +2 -0
  56. package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +56 -4
  57. package/dist/patterns/LexicalEditor/plugins/SheetInputPlugin/index.d.ts +5 -0
  58. package/dist/patterns/LexicalEditor/plugins/SheetInputPlugin/index.js +20 -0
  59. package/dist/patterns/LexicalEditor/plugins/SheetSelectPlugin/index.d.ts +5 -0
  60. package/dist/patterns/LexicalEditor/plugins/SheetSelectPlugin/index.js +20 -0
  61. package/dist/patterns/LexicalEditor/theme.d.ts +2 -0
  62. package/dist/patterns/LexicalEditor/theme.js +14 -0
  63. package/package.json +1 -1
@@ -271,7 +271,7 @@ function getColoredQuoteContextMenuOptions(editor, theme, node) {
271
271
  ];
272
272
  }
273
273
  export function useContextMenuOptions(props) {
274
- const { isQuizEnabled } = props;
274
+ const { isSheetEnabled, isQuizEnabled } = props;
275
275
  const theme = useTheme();
276
276
  return (editor, node, setImageOpen) => {
277
277
  if ($isProblemInputNode(node)) {
@@ -294,7 +294,13 @@ export function useContextMenuOptions(props) {
294
294
  }
295
295
  else {
296
296
  return [
297
- ...getBaseOptions({ editor, theme, setImageOpen, isQuizEnabled }),
297
+ ...getBaseOptions({
298
+ editor,
299
+ theme,
300
+ setImageOpen,
301
+ isSheetEnabled,
302
+ isQuizEnabled,
303
+ }),
298
304
  new ComponentPickerOption("블록 삭제", {
299
305
  icon: _jsx(CloseFillIcon, {}),
300
306
  keywords: [],
@@ -34,8 +34,10 @@ export declare function getBaseOptions(props: {
34
34
  editor: LexicalEditor;
35
35
  theme: Theme;
36
36
  setImageOpen: (open: boolean) => void;
37
+ isSheetEnabled: boolean;
37
38
  isQuizEnabled: boolean;
38
39
  }): (ComponentPickerOption | ComponentDrawerOption)[];
39
40
  export declare function ComponentPickerMenuPlugin(props: {
41
+ isSheetEnabled: boolean;
40
42
  isQuizEnabled: boolean;
41
43
  }): JSX.Element;
@@ -21,12 +21,14 @@ import * as ReactDOM from "react-dom";
21
21
  import { css as cssToClassName } from "@emotion/css";
22
22
  import { ComponentPickerMenuList } from "./ComponentPickerMenuList";
23
23
  import { InsertImageDialog } from "../ImagesPlugin/InsertImageDialog";
24
- import { TextIcon, H1Icon, H2Icon, H3Icon, ListUnorderedIcon, ListOrderedIcon, DoubleQuotesLIcon, CodeViewIcon, SeparatorIcon, ImageLineIcon, InputMethodLineIcon, ListRadioIcon, LayoutColumnLineIcon, } from "../../../../icons";
24
+ import { TextIcon, H1Icon, H2Icon, H3Icon, ListUnorderedIcon, ListOrderedIcon, DoubleQuotesLIcon, CodeViewIcon, SeparatorIcon, ImageLineIcon, InputMethodLineIcon, ListRadioIcon, LayoutColumnLineIcon, FileList2LineIcon, } from "../../../../icons";
25
25
  import { ZINDEX } from "../../../../utils/zIndex";
26
26
  import { css, useTheme } from "@emotion/react";
27
27
  import { INSERT_PROBLEM_INPUT_COMMAND } from "../ProblemInputPlugin";
28
28
  import { INSERT_PROBLEM_SELECT_COMMAND } from "../ProblemSelectPlugin";
29
29
  import { INSERT_LAYOUT_COMMAND } from "../LayoutPlugin";
30
+ import { INSERT_SHEET_SELECT_COMMAND } from "../SheetSelectPlugin";
31
+ import { INSERT_SHEET_INPUT_COMMAND } from "../SheetInputPlugin";
30
32
  // import useModal from "../../hooks/useModal";
31
33
  // import catTypingGif from "../../images/cat-typing.gif";
32
34
  // import { INSERT_IMAGE_COMMAND, InsertImageDialog } from "../ImagesPlugin";
@@ -67,6 +69,51 @@ function getDynamicOptions(editor, queryString) {
67
69
  }
68
70
  return options;
69
71
  }
72
+ function getSheetContextOptions(editor, theme) {
73
+ return [
74
+ new ComponentPickerOption("선택형 입력 칸", {
75
+ icon: _jsx(ListRadioIcon, { color: theme.color.foreground.primary }),
76
+ keywords: ["sheet select", "선택형 입력"],
77
+ onSelect: () => editor.dispatchCommand(INSERT_SHEET_SELECT_COMMAND, {
78
+ selections: [
79
+ {
80
+ show: {
81
+ image: null,
82
+ text: "",
83
+ },
84
+ value: "1",
85
+ },
86
+ ],
87
+ selected: [],
88
+ allowMultipleAnswers: false,
89
+ }),
90
+ }),
91
+ new ComponentPickerOption("단답형 입력 칸", {
92
+ icon: _jsx(InputMethodLineIcon, { color: theme.color.foreground.primary }),
93
+ keywords: ["sheet short input", "단답형 입력"],
94
+ onSelect: () => editor.dispatchCommand(INSERT_SHEET_INPUT_COMMAND, {
95
+ multiline: false,
96
+ value: "",
97
+ placeholder: "",
98
+ }),
99
+ }),
100
+ new ComponentPickerOption("서술형 입력 칸", {
101
+ icon: _jsx(FileList2LineIcon, { color: theme.color.foreground.primary }),
102
+ keywords: ["sheet long input", "서술형 입력"],
103
+ onSelect: () => editor.dispatchCommand(INSERT_SHEET_INPUT_COMMAND, {
104
+ multiline: true,
105
+ value: "",
106
+ placeholder: "",
107
+ }),
108
+ }),
109
+ new ComponentDrawerOption("활동지 메뉴구분선", (_jsx("div", { css: css `
110
+ width: 100%;
111
+ height: 1px;
112
+ background: ${theme.color.background.neutralAltActive};
113
+ margin: 4px 0;
114
+ ` }))),
115
+ ];
116
+ }
70
117
  function getQuizContextOptions(editor, theme) {
71
118
  return [
72
119
  new ComponentPickerOption("주관식 입력 칸", {
@@ -103,7 +150,7 @@ function getQuizContextOptions(editor, theme) {
103
150
  });
104
151
  },
105
152
  }),
106
- new ComponentDrawerOption("메뉴구분선", (_jsx("div", { css: css `
153
+ new ComponentDrawerOption("퀴즈 메뉴구분선", (_jsx("div", { css: css `
107
154
  width: 100%;
108
155
  height: 1px;
109
156
  background: ${theme.color.background.neutralAltActive};
@@ -112,7 +159,7 @@ function getQuizContextOptions(editor, theme) {
112
159
  ];
113
160
  }
114
161
  export function getBaseOptions(props) {
115
- const { editor, theme, setImageOpen, isQuizEnabled } = props;
162
+ const { editor, theme, setImageOpen, isSheetEnabled, isQuizEnabled } = props;
116
163
  const baseOptions = [
117
164
  new ComponentPickerOption("본문", {
118
165
  icon: _jsx(TextIcon, {}),
@@ -202,6 +249,10 @@ export function getBaseOptions(props) {
202
249
  if (isQuizEnabled || isDevMode) {
203
250
  baseOptions.unshift(...getQuizContextOptions(editor, theme));
204
251
  }
252
+ // isSheetEnabled이거나 devMode이면 활동지 컨텍스트 메뉴를 꼭대기에 추가합니다.
253
+ if (isSheetEnabled || isDevMode) {
254
+ baseOptions.unshift(...getSheetContextOptions(editor, theme));
255
+ }
205
256
  // devMode이면 칼럼 컨텍스트 메뉴를 추가합니다.
206
257
  if (isDevMode) {
207
258
  baseOptions.push(new ComponentPickerOption("칼럼", {
@@ -213,7 +264,7 @@ export function getBaseOptions(props) {
213
264
  return baseOptions;
214
265
  }
215
266
  export function ComponentPickerMenuPlugin(props) {
216
- const { isQuizEnabled } = props;
267
+ const { isSheetEnabled, isQuizEnabled } = props;
217
268
  const [editor] = useLexicalComposerContext();
218
269
  const theme = useTheme();
219
270
  const [queryString, setQueryString] = useState(null);
@@ -226,6 +277,7 @@ export function ComponentPickerMenuPlugin(props) {
226
277
  editor,
227
278
  theme,
228
279
  setImageOpen: setOpen,
280
+ isSheetEnabled,
229
281
  isQuizEnabled,
230
282
  });
231
283
  if (!queryString) {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { LexicalCommand } from "lexical";
3
+ import { SheetInputPayload } from "../../nodes/SheetInputNode";
4
+ export declare const INSERT_SHEET_INPUT_COMMAND: LexicalCommand<SheetInputPayload>;
5
+ export default function SheetInputPlugin(): JSX.Element | null;
@@ -0,0 +1,20 @@
1
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
2
+ import { $insertNodeToNearestRoot } from "@lexical/utils";
3
+ import { COMMAND_PRIORITY_EDITOR, createCommand, } from "lexical";
4
+ import { useEffect } from "react";
5
+ import { $createSheetInputNode, SheetInputNode, } from "../../nodes/SheetInputNode";
6
+ export const INSERT_SHEET_INPUT_COMMAND = createCommand("INSERT_SHEET_INPUT_COMMAND");
7
+ export default function SheetInputPlugin() {
8
+ const [editor] = useLexicalComposerContext();
9
+ useEffect(() => {
10
+ if (!editor.hasNodes([SheetInputNode])) {
11
+ throw new Error("SheetInputNode: SheetInputNode not registered on editor");
12
+ }
13
+ editor.registerCommand(INSERT_SHEET_INPUT_COMMAND, (payload) => {
14
+ const sheetInputNode = $createSheetInputNode(payload);
15
+ $insertNodeToNearestRoot(sheetInputNode);
16
+ return true;
17
+ }, COMMAND_PRIORITY_EDITOR);
18
+ }, [editor]);
19
+ return null;
20
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { LexicalCommand } from "lexical";
3
+ import { SheetSelectPayload } from "../../nodes/SheetSelectNode";
4
+ export declare const INSERT_SHEET_SELECT_COMMAND: LexicalCommand<SheetSelectPayload>;
5
+ export default function SheetSelectPlugin(): JSX.Element | null;
@@ -0,0 +1,20 @@
1
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
2
+ import { $insertNodeToNearestRoot } from "@lexical/utils";
3
+ import { COMMAND_PRIORITY_EDITOR, createCommand, } from "lexical";
4
+ import { useEffect } from "react";
5
+ import { $createSheetSelectNode, SheetSelectNode, } from "../../nodes/SheetSelectNode";
6
+ export const INSERT_SHEET_SELECT_COMMAND = createCommand("INSERT_SHEET_SELECT_COMMAND");
7
+ export default function SheetSelectPlugin() {
8
+ const [editor] = useLexicalComposerContext();
9
+ useEffect(() => {
10
+ if (!editor.hasNodes([SheetSelectNode])) {
11
+ throw new Error("SheetSelectNode: SheetSelectNode not registered on editor");
12
+ }
13
+ editor.registerCommand(INSERT_SHEET_SELECT_COMMAND, (payload) => {
14
+ const sheetSelectNode = $createSheetSelectNode(payload);
15
+ $insertNodeToNearestRoot(sheetSelectNode);
16
+ return true;
17
+ }, COMMAND_PRIORITY_EDITOR);
18
+ }, [editor]);
19
+ return null;
20
+ }
@@ -31,6 +31,8 @@ export declare function getTheme(theme: Theme, editable: boolean): {
31
31
  };
32
32
  problemInput: string;
33
33
  problemSelect: string;
34
+ sheetSelect: string;
35
+ sheetInput: string;
34
36
  layoutContainer: string;
35
37
  layoutItem: string | false;
36
38
  };
@@ -262,6 +262,20 @@ export function getTheme(theme, editable) {
262
262
  flex: 1;
263
263
  gap: 4px;
264
264
  margin-bottom: 8px;
265
+ `,
266
+ sheetSelect: css `
267
+ display: flex;
268
+ flex-direction: column;
269
+ flex: 1;
270
+ gap: 4px;
271
+ margin-bottom: 8px;
272
+ `,
273
+ sheetInput: css `
274
+ display: flex;
275
+ flex-direction: column;
276
+ flex: 1;
277
+ gap: 4px;
278
+ margin-bottom: 8px;
265
279
  `,
266
280
  layoutContainer: css `
267
281
  display: grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.51.1",
3
+ "version": "1.52.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,