@team-monolith/cds 1.56.1 → 1.57.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 (47) hide show
  1. package/@types/emotion.d.ts +2 -0
  2. package/dist/CodleDesignSystemProvider.js +4 -0
  3. package/dist/icons/Custom.d.ts +9 -0
  4. package/dist/icons/Custom.js +10 -0
  5. package/dist/icons/custom/makecode-color.svg +4 -0
  6. package/dist/icons/custom/makecode.svg +5 -0
  7. package/dist/patterns/LexicalEditor/LexicalEditor.js +2 -0
  8. package/dist/patterns/LexicalEditor/Plugins.js +2 -1
  9. package/dist/patterns/LexicalEditor/nodes/Form/FormInput.d.ts +11 -0
  10. package/dist/patterns/LexicalEditor/nodes/Form/FormInput.js +51 -0
  11. package/dist/patterns/LexicalEditor/nodes/Form/index.d.ts +1 -0
  12. package/dist/patterns/LexicalEditor/nodes/Form/index.js +1 -0
  13. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/Evaluation.d.ts +16 -0
  14. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/Evaluation.js +103 -0
  15. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormIconAndLabel.d.ts +7 -0
  16. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormIconAndLabel.js +52 -0
  17. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.d.ts +7 -0
  18. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/FormLabel.js +30 -0
  19. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/index.d.ts +1 -0
  20. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormIconAndLabel/index.js +1 -0
  21. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.d.ts +9 -0
  22. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/FormQuestion.js +42 -0
  23. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/SettingForm.d.ts +17 -0
  24. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/SettingForm.js +110 -0
  25. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/index.d.ts +1 -0
  26. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/SettingForm/index.js +1 -0
  27. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/index.d.ts +2 -0
  28. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/Evaluation/index.js +2 -0
  29. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/EvaluationComponent.d.ts +10 -0
  30. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/EvaluationComponent.js +57 -0
  31. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/index.d.ts +1 -0
  32. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/EvaluationComponent/index.js +1 -0
  33. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/SelfEvaluationNode.d.ts +45 -0
  34. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/SelfEvaluationNode.js +81 -0
  35. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/iconData.d.ts +14 -0
  36. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/iconData.js +61 -0
  37. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/index.d.ts +1 -0
  38. package/dist/patterns/LexicalEditor/nodes/SelfEvaluationNode/index.js +1 -0
  39. package/dist/patterns/LexicalEditor/plugins/ComponentAdderPlugin/useContextMenuOptions.js +15 -0
  40. package/dist/patterns/LexicalEditor/plugins/ComponentPickerMenuPlugin/ComponentPickerMenuPlugin.js +18 -1
  41. package/dist/patterns/LexicalEditor/plugins/SelfEvaluationPlugin/index.d.ts +5 -0
  42. package/dist/patterns/LexicalEditor/plugins/SelfEvaluationPlugin/index.js +20 -0
  43. package/dist/patterns/LexicalEditor/theme.d.ts +1 -0
  44. package/dist/patterns/LexicalEditor/theme.js +7 -0
  45. package/dist/patterns/ToggleButtonGroup/ToggleButtonGroup.d.ts +3 -3
  46. package/dist/patterns/ToggleButtonGroup/ToggleButtonGroup.js +8 -3
  47. package/package.json +1 -1
@@ -104,6 +104,8 @@ interface CodleColors {
104
104
  worksheetAlt: string;
105
105
  ebook: string;
106
106
  ebookAlt: string;
107
+ makecode: string;
108
+ makecodeAlt: string;
107
109
  };
108
110
  blanket: {
109
111
  neutral: string;
@@ -109,6 +109,8 @@ export const light = {
109
109
  worksheetAlt: "#EEE5FF",
110
110
  ebook: "#0094FF",
111
111
  ebookAlt: "#E0F2FF",
112
+ makecode: "#AA278F",
113
+ makecodeAlt: "#FFE0F9",
112
114
  },
113
115
  blanket: {
114
116
  neutral: COLOR.alpha030,
@@ -224,6 +226,8 @@ export const dark = {
224
226
  worksheetAlt: "#5F5C66",
225
227
  ebook: "#0094FF",
226
228
  ebookAlt: "#475966",
229
+ makecode: "#AA278F",
230
+ makecodeAlt: "#664760",
227
231
  },
228
232
  blanket: {
229
233
  neutral: COLOR.alphaf20,
@@ -307,3 +307,12 @@ export declare const customEmoNeutralColorSvg: string;
307
307
  export declare const CustomEmoNeutralColorIcon: React.ForwardRefExoticComponent<{
308
308
  className?: string | undefined;
309
309
  } & React.RefAttributes<any>>;
310
+ export declare const customMakecodeSvg: string;
311
+ export declare const CustomMakecodeIcon: React.ForwardRefExoticComponent<{
312
+ className?: string | undefined;
313
+ color?: string | undefined;
314
+ } & React.RefAttributes<any>>;
315
+ export declare const customMakecodeColorSvg: string;
316
+ export declare const CustomMakecodeColorIcon: React.ForwardRefExoticComponent<{
317
+ className?: string | undefined;
318
+ } & React.RefAttributes<any>>;
@@ -346,3 +346,13 @@ export const CustomEmoNeutralColorIcon = forwardRef((props, ref) => {
346
346
  const uniqueId = useMemo(uid, []);
347
347
  return (_jsxs("svg", Object.assign({}, props, { ref: ref, xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, { children: [_jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint0_radial_${uniqueId})` }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint1_radial_${uniqueId})` }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint2_radial_${uniqueId})`, fillOpacity: "0.6" }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint3_radial_${uniqueId})` }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint4_radial_${uniqueId})` }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint5_radial_${uniqueId})` }), _jsx("path", { d: "M11.9992 22.4983C19 22.4983 22.4983 17.7977 22.4983 11.9992C22.4983 6.20064 19 1.5 11.9992 1.5C4.99833 1.5 1.5 6.20064 1.5 11.9992C1.5 17.7977 4.99833 22.4983 11.9992 22.4983Z", fill: `url(#paint6_radial_${uniqueId})` }), _jsx("circle", { cx: "6.75", cy: "11.25", r: "3.75", fill: `url(#paint7_radial_${uniqueId})` }), _jsx("circle", { cx: "14.625", cy: "11.625", r: "3.375", fill: `url(#paint8_radial_${uniqueId})` }), _jsx("path", { d: "M7.875 13.5C9.73896 13.5 11.25 11.989 11.25 10.125C11.25 8.26104 9.73896 6.75 7.875 6.75C6.01104 6.75 4.5 8.26104 4.5 10.125C4.5 11.989 6.01104 13.5 7.875 13.5Z", fill: "white" }), _jsx("path", { d: "M16.125 13.5C17.989 13.5 19.5 11.989 19.5 10.125C19.5 8.26104 17.989 6.75 16.125 6.75C14.261 6.75 12.75 8.26104 12.75 10.125C12.75 11.989 14.261 13.5 16.125 13.5Z", fill: "white" }), _jsx("path", { d: "M8.25 12.75C9.49264 12.75 10.5 11.7426 10.5 10.5C10.5 9.25736 9.49264 8.25 8.25 8.25C7.00736 8.25 6 9.25736 6 10.5C6 11.7426 7.00736 12.75 8.25 12.75Z", fill: `url(#paint9_linear_${uniqueId})` }), _jsx("path", { d: "M15.75 12.75C16.9926 12.75 18 11.7426 18 10.5C18 9.25736 16.9926 8.25 15.75 8.25C14.5074 8.25 13.5 9.25736 13.5 10.5C13.5 11.7426 14.5074 12.75 15.75 12.75Z", fill: `url(#paint10_linear_${uniqueId})` }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 15.75C9 15.3358 9.33579 15 9.75 15H14.25C14.6642 15 15 15.3358 15 15.75C15 16.1642 14.6642 16.5 14.25 16.5H9.75C9.33579 16.5 9 16.1642 9 15.75Z", fill: `url(#paint11_linear_${uniqueId})` }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.0721 5.84912C15.0708 5.85163 15.0695 5.85412 15.0682 5.8566C15.0679 5.85723 15.0677 5.85757 15.0677 5.85761L15.0677 5.85754L15.0691 5.85499L15.0705 5.85229L15.0713 5.85058L15.0718 5.84962L15.0721 5.84912ZM17.182 5.8566C17.1815 5.85571 17.1806 5.85425 17.1794 5.85226C17.1747 5.84444 17.1647 5.8288 17.1489 5.80781C17.1173 5.76562 17.0639 5.70382 16.9846 5.64043C16.8325 5.51875 16.5662 5.375 16.1251 5.375C15.6841 5.375 15.4177 5.51875 15.2656 5.64043C15.1864 5.70382 15.1329 5.76562 15.1013 5.80781C15.0855 5.8288 15.0756 5.84444 15.0708 5.85226C15.0696 5.85425 15.0687 5.85572 15.0682 5.8566C14.9423 6.09774 14.6458 6.19437 14.4015 6.07221C14.1545 5.94872 14.0544 5.64838 14.1779 5.40139L14.6251 5.625C14.1779 5.40139 14.178 5.40113 14.1782 5.40086L14.1784 5.40031L14.179 5.39915L14.1803 5.39662L14.1834 5.39071L14.1915 5.37562C14.1978 5.36415 14.2059 5.3499 14.216 5.33328C14.2362 5.30009 14.2643 5.25714 14.3013 5.20781C14.3751 5.10938 14.4857 4.98368 14.6409 4.85957C14.9575 4.60625 15.4412 4.375 16.1251 4.375C16.8091 4.375 17.2927 4.60625 17.6093 4.85957C17.7645 4.98368 17.8751 5.10938 17.9489 5.20781C17.9859 5.25714 18.014 5.30009 18.0342 5.33328C18.0443 5.3499 18.0524 5.36415 18.0587 5.37562L18.0668 5.39071L18.0699 5.39662L18.0712 5.39915L18.0718 5.40031L18.0721 5.40086C18.0722 5.40113 18.0723 5.40139 17.6251 5.625L18.0723 5.40139C18.1958 5.64838 18.0957 5.94872 17.8487 6.07221C17.6044 6.19437 17.3079 6.09774 17.182 5.8566Z", fill: `url(#paint12_linear_${uniqueId})` }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M6.82206 6.15088C6.82081 6.14837 6.81953 6.14588 6.81824 6.1434C6.81788 6.14277 6.81769 6.14243 6.81766 6.14239L6.8177 6.14246L6.81907 6.14501L6.82046 6.14771L6.82133 6.14942L6.82181 6.15038L6.82206 6.15088ZM8.93198 6.1434C8.93147 6.14429 8.93061 6.14575 8.92941 6.14774C8.92466 6.15556 8.91468 6.1712 8.89894 6.19219C8.86729 6.23438 8.81386 6.29618 8.73464 6.35957C8.58253 6.48125 8.31615 6.625 7.87511 6.625C7.43407 6.625 7.16769 6.48125 7.01558 6.35957C6.93636 6.29618 6.88292 6.23438 6.85128 6.19219C6.83554 6.1712 6.82556 6.15556 6.82081 6.14774C6.8196 6.14575 6.81875 6.14428 6.81824 6.1434C6.69231 5.90226 6.39581 5.80563 6.1515 5.92779C5.90451 6.05128 5.8044 6.35162 5.9279 6.59861L6.37511 6.375C5.9279 6.59861 5.92803 6.59887 5.92816 6.59914L5.92844 6.59969L5.92902 6.60085L5.93031 6.60338L5.93337 6.60929L5.94149 6.62438C5.94779 6.63585 5.95594 6.6501 5.96603 6.66672C5.98618 6.69991 6.01429 6.74286 6.05128 6.79219C6.12511 6.89062 6.23574 7.01632 6.39089 7.14043C6.70753 7.39375 7.19115 7.625 7.87511 7.625C8.55907 7.625 9.04269 7.39375 9.35933 7.14043C9.51448 7.01632 9.62511 6.89062 9.69894 6.79219C9.73593 6.74286 9.76404 6.69991 9.78419 6.66672C9.79428 6.6501 9.80243 6.63585 9.80873 6.62438L9.81685 6.60929L9.81991 6.60338L9.8212 6.60085L9.82178 6.59969L9.82206 6.59914C9.82219 6.59887 9.82232 6.59861 9.37511 6.375L9.82232 6.59861C9.94582 6.35162 9.84571 6.05128 9.59872 5.92779C9.35441 5.80563 9.05791 5.90226 8.93198 6.1434Z", fill: `url(#paint13_linear_${uniqueId})` }), _jsxs("defs", { children: [_jsxs("radialGradient", Object.assign({ id: `paint0_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(19.125 6.75) rotate(131.878) scale(29.2115)" }, { children: [_jsx("stop", { stopColor: "#FFF478" }), _jsx("stop", { offset: "0.474827", stopColor: "#FFB02E" }), _jsx("stop", { offset: "1", stopColor: "#F70A8D" })] })), _jsxs("radialGradient", Object.assign({ id: `paint1_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(12 9.375) rotate(101.31) scale(13.3849 17.1435)" }, { children: [_jsx("stop", { offset: "0.787821", stopColor: "#F59639", stopOpacity: "0" }), _jsx("stop", { offset: "0.972509", stopColor: "#FF7DCE" })] })), _jsxs("radialGradient", Object.assign({ id: `paint2_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(13.5 10.5) rotate(135) scale(30.7591)" }, { children: [_jsx("stop", { offset: "0.314853", stopOpacity: "0" }), _jsx("stop", { offset: "1" })] })), _jsxs("radialGradient", Object.assign({ id: `paint3_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(12 12.75) rotate(77.692) scale(21.1102)" }, { children: [_jsx("stop", { offset: "0.507903", stopColor: "#7D6133", stopOpacity: "0" }), _jsx("stop", { offset: "1", stopColor: "#715B32" })] })), _jsxs("radialGradient", Object.assign({ id: `paint4_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(12.375 12.375) rotate(55.7131) scale(9.98515 7.23774)" }, { children: [_jsx("stop", { stopColor: "#FFB849" }), _jsx("stop", { offset: "1", stopColor: "#FFB847", stopOpacity: "0" })] })), _jsxs("radialGradient", Object.assign({ id: `paint5_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(15.375 13.5) rotate(9.86581) scale(8.75446)" }, { children: [_jsx("stop", { stopColor: "#FFA64B" }), _jsx("stop", { offset: "0.900412", stopColor: "#FFAE46", stopOpacity: "0" })] })), _jsxs("radialGradient", Object.assign({ id: `paint6_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(13.125 11.25) rotate(43.9708) scale(44.2897)" }, { children: [_jsx("stop", { offset: "0.185425", stopOpacity: "0" }), _jsx("stop", { offset: "1", stopOpacity: "0.4" })] })), _jsxs("radialGradient", Object.assign({ id: `paint7_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(9.66667 8.33333) rotate(135) scale(7.30677 3.78174)" }, { children: [_jsx("stop", { stopColor: "#392108" }), _jsx("stop", { offset: "1", stopColor: "#C87928", stopOpacity: "0" })] })), _jsxs("radialGradient", Object.assign({ id: `paint8_radial_${uniqueId}`, cx: "0", cy: "0", r: "1", gradientUnits: "userSpaceOnUse", gradientTransform: "translate(17.25 9) rotate(135) scale(6.0988 3.44287)" }, { children: [_jsx("stop", { stopColor: "#392108" }), _jsx("stop", { offset: "1", stopColor: "#C87928", stopOpacity: "0" })] })), _jsxs("linearGradient", Object.assign({ id: `paint9_linear_${uniqueId}`, x1: "16.6154", y1: "8.25", x2: "15.75", y2: "12.75", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#553B3E" }), _jsx("stop", { offset: "1", stopColor: "#3D2432" })] })), _jsxs("linearGradient", Object.assign({ id: `paint10_linear_${uniqueId}`, x1: "16.6154", y1: "8.25", x2: "15.75", y2: "12.75", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#553B3E" }), _jsx("stop", { offset: "1", stopColor: "#3D2432" })] })), _jsxs("linearGradient", Object.assign({ id: `paint11_linear_${uniqueId}`, x1: "12", y1: "15.25", x2: "12", y2: "16.25", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { stopColor: "#4F3C43" }), _jsx("stop", { offset: "1", stopColor: "#512756" })] })), _jsxs("linearGradient", Object.assign({ id: `paint12_linear_${uniqueId}`, x1: "16.1251", y1: "4.875", x2: "16.1251", y2: "5.625", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { offset: "0.0299084", stopColor: "#524049" }), _jsx("stop", { offset: "1", stopColor: "#4A2C42" })] })), _jsxs("linearGradient", Object.assign({ id: `paint13_linear_${uniqueId}`, x1: "7.87511", y1: "6", x2: "7.87511", y2: "7.125", gradientUnits: "userSpaceOnUse" }, { children: [_jsx("stop", { offset: "0.0299084", stopColor: "#524049" }), _jsx("stop", { offset: "1", stopColor: "#4A2C42" })] }))] })] })));
348
348
  });
349
+ import customMakecodeSvgImport from "./custom/makecode.svg";
350
+ export const customMakecodeSvg = customMakecodeSvgImport;
351
+ export const CustomMakecodeIcon = forwardRef((props, ref) => {
352
+ return (_jsxs("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M14.599 6.46154C14.368 6.46154 14.2188 6.21672 14.2885 6.00491C14.3609 5.78494 14.4 5.5507 14.4 5.30769C14.4 4.03319 13.3255 3 12 3C10.6745 3 9.6 4.03319 9.6 5.30769C9.6 5.5507 9.63906 5.78494 9.71148 6.00491C9.78121 6.21672 9.63201 6.46154 9.40096 6.46154H7.2C6.53726 6.46154 6 6.97813 6 7.61538V16.8462C6 17.4834 6.53726 18 7.2 18H16.8C17.4627 18 18 17.4834 18 16.8462V14.7298C18 14.5077 17.7454 14.3642 17.5251 14.4313C17.2963 14.5009 17.0527 14.5385 16.8 14.5385C15.4745 14.5385 14.4 13.5053 14.4 12.2308C14.4 10.9563 15.4745 9.92308 16.8 9.92308C17.0527 9.92308 17.2963 9.96064 17.5251 10.0303C17.7454 10.0973 18 9.95386 18 9.73169V7.61539C18 6.97813 17.4627 6.46154 16.8 6.46154H14.599Z", fill: "currentColor" }), _jsx("path", { d: "M21.5 14.3V18C21.5 19.6569 20.1569 21 18.5 21H17.5V19H18.5C19.0523 19 19.5 18.5523 19.5 18V13.9C19.5 13.0142 20.0759 12.2628 20.8738 12C20.0759 11.7372 19.5 10.9858 19.5 10.1V6C19.5 5.44772 19.0523 5 18.5 5H17.5V3H18.5C20.1569 3 21.5 4.34315 21.5 6V9.7C21.5 10.5284 22.1716 11.2 23 11.2H23.5V12.8H23C22.1716 12.8 21.5 13.4716 21.5 14.3Z", fill: "currentColor" }), _jsx("path", { d: "M2.5 18V14.3C2.5 13.4716 1.82843 12.8 1 12.8H0.5V11.2H1C1.82843 11.2 2.5 10.5284 2.5 9.7V6C2.5 4.34315 3.84315 3 5.5 3H6.5V5H5.5C4.94772 5 4.5 5.44772 4.5 6V10.1C4.5 10.9858 3.92408 11.7372 3.12623 12C3.92408 12.2628 4.5 13.0142 4.5 13.9V18C4.5 18.5523 4.94772 19 5.5 19H6.5V21H5.5C3.84315 21 2.5 19.6569 2.5 18Z", fill: "currentColor" })] })));
353
+ });
354
+ import customMakecodeColorSvgImport from "./custom/makecode-color.svg";
355
+ export const customMakecodeColorSvg = customMakecodeColorSvgImport;
356
+ export const CustomMakecodeColorIcon = forwardRef((props, ref) => {
357
+ return (_jsxs("svg", Object.assign({}, props, { ref: ref, width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("path", { d: "M2.5 18V14.3C2.5 13.4716 1.82843 12.8 1 12.8H0.5V11.2H1C1.82843 11.2 2.5 10.5284 2.5 9.7V6C2.5 4.34315 3.84315 3 5.5 3H6.5V5H5.5C4.94772 5 4.5 5.44772 4.5 6V10.1C4.5 10.9858 3.92408 11.7372 3.12623 12C3.92408 12.2628 4.5 13.0142 4.5 13.9V18C4.5 18.5523 4.94772 19 5.5 19H6.5V21H5.5C3.84315 21 2.5 19.6569 2.5 18ZM21.5 14.3V18C21.5 19.6569 20.1569 21 18.5 21H17.5V19H18.5C19.0523 19 19.5 18.5523 19.5 18V13.9C19.5 13.0142 20.0759 12.2628 20.8738 12C20.0759 11.7372 19.5 10.9858 19.5 10.1V6C19.5 5.44772 19.0523 5 18.5 5H17.5V3H18.5C20.1569 3 21.5 4.34315 21.5 6V9.7C21.5 10.5284 22.1716 11.2 23 11.2H23.5V12.8H23C22.1716 12.8 21.5 13.4716 21.5 14.3Z", fill: "#FFE0F9" }), _jsx("path", { d: "M14.599 6.46154C14.368 6.46154 14.2188 6.21672 14.2885 6.00491C14.3609 5.78494 14.4 5.5507 14.4 5.30769C14.4 4.03319 13.3255 3 12 3C10.6745 3 9.6 4.03319 9.6 5.30769C9.6 5.5507 9.63906 5.78494 9.71148 6.00491C9.78121 6.21672 9.63201 6.46154 9.40096 6.46154H7.2C6.53726 6.46154 6 6.97813 6 7.61538V16.8462C6 17.4834 6.53726 18 7.2 18H16.8C17.4627 18 18 17.4834 18 16.8462V14.7298C18 14.5077 17.7454 14.3642 17.5251 14.4313C17.2963 14.5009 17.0527 14.5385 16.8 14.5385C15.4745 14.5385 14.4 13.5053 14.4 12.2308C14.4 10.9563 15.4745 9.92308 16.8 9.92308C17.0527 9.92308 17.2963 9.96064 17.5251 10.0303C17.7454 10.0973 18 9.95386 18 9.73169V7.61539C18 6.97813 17.4627 6.46154 16.8 6.46154H14.599Z", fill: "#AA278F" })] })));
358
+ });
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M2.5 18V14.3C2.5 13.4716 1.82843 12.8 1 12.8H0.5V11.2H1C1.82843 11.2 2.5 10.5284 2.5 9.7V6C2.5 4.34315 3.84315 3 5.5 3H6.5V5H5.5C4.94772 5 4.5 5.44772 4.5 6V10.1C4.5 10.9858 3.92408 11.7372 3.12623 12C3.92408 12.2628 4.5 13.0142 4.5 13.9V18C4.5 18.5523 4.94772 19 5.5 19H6.5V21H5.5C3.84315 21 2.5 19.6569 2.5 18ZM21.5 14.3V18C21.5 19.6569 20.1569 21 18.5 21H17.5V19H18.5C19.0523 19 19.5 18.5523 19.5 18V13.9C19.5 13.0142 20.0759 12.2628 20.8738 12C20.0759 11.7372 19.5 10.9858 19.5 10.1V6C19.5 5.44772 19.0523 5 18.5 5H17.5V3H18.5C20.1569 3 21.5 4.34315 21.5 6V9.7C21.5 10.5284 22.1716 11.2 23 11.2H23.5V12.8H23C22.1716 12.8 21.5 13.4716 21.5 14.3Z" fill="#FFE0F9"/>
3
+ <path d="M14.599 6.46154C14.368 6.46154 14.2188 6.21672 14.2885 6.00491C14.3609 5.78494 14.4 5.5507 14.4 5.30769C14.4 4.03319 13.3255 3 12 3C10.6745 3 9.6 4.03319 9.6 5.30769C9.6 5.5507 9.63906 5.78494 9.71148 6.00491C9.78121 6.21672 9.63201 6.46154 9.40096 6.46154H7.2C6.53726 6.46154 6 6.97813 6 7.61538V16.8462C6 17.4834 6.53726 18 7.2 18H16.8C17.4627 18 18 17.4834 18 16.8462V14.7298C18 14.5077 17.7454 14.3642 17.5251 14.4313C17.2963 14.5009 17.0527 14.5385 16.8 14.5385C15.4745 14.5385 14.4 13.5053 14.4 12.2308C14.4 10.9563 15.4745 9.92308 16.8 9.92308C17.0527 9.92308 17.2963 9.96064 17.5251 10.0303C17.7454 10.0973 18 9.95386 18 9.73169V7.61539C18 6.97813 17.4627 6.46154 16.8 6.46154H14.599Z" fill="#AA278F"/>
4
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M14.599 6.46154C14.368 6.46154 14.2188 6.21672 14.2885 6.00491C14.3609 5.78494 14.4 5.5507 14.4 5.30769C14.4 4.03319 13.3255 3 12 3C10.6745 3 9.6 4.03319 9.6 5.30769C9.6 5.5507 9.63906 5.78494 9.71148 6.00491C9.78121 6.21672 9.63201 6.46154 9.40096 6.46154H7.2C6.53726 6.46154 6 6.97813 6 7.61538V16.8462C6 17.4834 6.53726 18 7.2 18H16.8C17.4627 18 18 17.4834 18 16.8462V14.7298C18 14.5077 17.7454 14.3642 17.5251 14.4313C17.2963 14.5009 17.0527 14.5385 16.8 14.5385C15.4745 14.5385 14.4 13.5053 14.4 12.2308C14.4 10.9563 15.4745 9.92308 16.8 9.92308C17.0527 9.92308 17.2963 9.96064 17.5251 10.0303C17.7454 10.0973 18 9.95386 18 9.73169V7.61539C18 6.97813 17.4627 6.46154 16.8 6.46154H14.599Z" fill="#363636"/>
3
+ <path d="M21.5 14.3V18C21.5 19.6569 20.1569 21 18.5 21H17.5V19H18.5C19.0523 19 19.5 18.5523 19.5 18V13.9C19.5 13.0142 20.0759 12.2628 20.8738 12C20.0759 11.7372 19.5 10.9858 19.5 10.1V6C19.5 5.44772 19.0523 5 18.5 5H17.5V3H18.5C20.1569 3 21.5 4.34315 21.5 6V9.7C21.5 10.5284 22.1716 11.2 23 11.2H23.5V12.8H23C22.1716 12.8 21.5 13.4716 21.5 14.3Z" fill="#363636"/>
4
+ <path d="M2.5 18V14.3C2.5 13.4716 1.82843 12.8 1 12.8H0.5V11.2H1C1.82843 11.2 2.5 10.5284 2.5 9.7V6C2.5 4.34315 3.84315 3 5.5 3H6.5V5H5.5C4.94772 5 4.5 5.44772 4.5 6V10.1C4.5 10.9858 3.92408 11.7372 3.12623 12C3.92408 12.2628 4.5 13.0142 4.5 13.9V18C4.5 18.5523 4.94772 19 5.5 19H6.5V21H5.5C3.84315 21 2.5 19.6569 2.5 18Z" fill="#363636"/>
5
+ </svg>
@@ -18,6 +18,7 @@ import { LayoutItemNode } from "./nodes/LayoutItemNode";
18
18
  import _ from "lodash";
19
19
  import { SheetSelectNode } from "./nodes/SheetSelectNode";
20
20
  import { SheetInputNode } from "./nodes/SheetInputNode";
21
+ import { SelfEvaluationNode } from "./nodes/SelfEvaluationNode";
21
22
  function validateValue(value) {
22
23
  var _a, _b;
23
24
  if (value && typeof value !== "object") {
@@ -80,6 +81,7 @@ export function LexicalEditor(props) {
80
81
  LayoutItemNode,
81
82
  SheetSelectNode,
82
83
  SheetInputNode,
84
+ SelfEvaluationNode,
83
85
  {
84
86
  replace: QuoteNode,
85
87
  with: (_node) => {
@@ -32,6 +32,7 @@ import ProblemSelectPlugin from "./plugins/ProblemSelectPlugin";
32
32
  import { LayoutPlugin } from "./plugins/LayoutPlugin";
33
33
  import SheetSelectPlugin from "./plugins/SheetSelectPlugin";
34
34
  import SheetInputPlugin from "./plugins/SheetInputPlugin";
35
+ import SelfEvaluationPlugin from "./plugins/SelfEvaluationPlugin";
35
36
  export default function Plugins(props) {
36
37
  const { className, contentEditableClassName, onChange, isSheetEnabled, isQuizEnabled, } = props;
37
38
  const isEditable = useLexicalEditable();
@@ -46,7 +47,7 @@ export default function Plugins(props) {
46
47
  onChange === null || onChange === void 0 ? void 0 : onChange(editorState.toJSON());
47
48
  },
48
49
  // ignore 하지 않으면 Form에서 수정하지 않았는데 Dirty로 처리됨.
49
- ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers: CODLE_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(LexicalClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {})] }));
50
+ ignoreSelectionChange: true }), _jsx(AutoFocusPlugin, {}), isEditable && (_jsxs(_Fragment, { children: [_jsx(TabIndentationPlugin, {}), _jsx(ComponentPickerMenuPlugin, { isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(MarkdownShortcutPlugin, { transformers: CODLE_TRANSFORMERS }), _jsx(HistoryPlugin, {})] })), floatingAnchorElem && isEditable && (_jsxs(_Fragment, { children: [_jsx(ComponentAdderPlugin, { anchorElem: floatingAnchorElem, isSheetEnabled: isSheetEnabled, isQuizEnabled: isQuizEnabled }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingLinkEditorPlugin, { anchorElem: floatingAnchorElem, isLinkEditMode: isLinkEditMode, setIsLinkEditMode: setIsLinkEditMode })] })), !isEditable && _jsx(LexicalClickableLinkPlugin, {}), _jsx(ListPlugin, {}), _jsx(HorizontalRulePlugin, {}), _jsx(ImagesPlugin, {}), _jsx(TablePlugin, {}), _jsx(LinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 5 }), _jsx(ProblemInputPlugin, {}), _jsx(ProblemSelectPlugin, {}), _jsx(LayoutPlugin, {}), _jsx(SheetSelectPlugin, {}), _jsx(SheetInputPlugin, {}), _jsx(SelfEvaluationPlugin, {})] }));
50
51
  }
51
52
  const ScrollArea = styled.div `
52
53
  min-height: 150px;
@@ -0,0 +1,11 @@
1
+ import { DistributiveOmit } from "@emotion/react";
2
+ import { InputProps } from "../../../..";
3
+ export type FormInputProps = DistributiveOmit<InputProps, "color" | "onChange" | "value" | "hintIcon" | "hintText"> & {
4
+ name: string;
5
+ control: any;
6
+ baseColor?: "default" | "base";
7
+ rules?: any;
8
+ /** html event에서 얻은 value를 form에 주입하기 전에 변환합니다. */
9
+ transform?: (value: string) => any;
10
+ };
11
+ export declare function FormInput(props: FormInputProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,51 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { ErrorWarningFillIcon, Input } from "../../../..";
14
+ import { Controller } from "react-hook-form";
15
+ import { useState } from "react";
16
+ export function FormInput(props) {
17
+ const { name, control, rules, baseColor = "default", transform = (value) => value } = props, inputComponentProps = __rest(props, ["name", "control", "rules", "baseColor", "transform"]);
18
+ const [inputFocused, setInputFocused] = useState(false);
19
+ return (_jsx(Controller, { name: name, control: control, rules: rules, render: ({ field: { onChange, value }, fieldState: { invalid, error }, }) => {
20
+ const onChangeHandler = (e) => {
21
+ onChange(transform(e.target.value));
22
+ };
23
+ // multiline 여부에 따라 inputProps의 type이 변경되므로 (union type)
24
+ // type-safety를 보장하기 위해 if 문을 분기하여 inputProps에 `name` 을 추가합니다.
25
+ // 코드 반복 없이 가능할까요?
26
+ if (inputComponentProps.multiline) {
27
+ const { inputProps } = inputComponentProps, other = __rest(inputComponentProps, ["inputProps"]);
28
+ return (_jsx(Input, Object.assign({ color: invalid
29
+ ? "activeDanger"
30
+ : inputFocused
31
+ ? "activePrimary"
32
+ : baseColor, onChange: onChangeHandler, value: value !== null && value !== void 0 ? value : "", hintIcon: invalid ? _jsx(ErrorWarningFillIcon, {}) : undefined, hintText: error === null || error === void 0 ? void 0 : error.message, inputProps: Object.assign(Object.assign({ name }, inputProps), { onFocus: () => {
33
+ setInputFocused(true);
34
+ }, onBlur: () => {
35
+ setInputFocused(false);
36
+ } }) }, other)));
37
+ }
38
+ else {
39
+ const { inputProps } = inputComponentProps, other = __rest(inputComponentProps, ["inputProps"]);
40
+ return (_jsx(Input, Object.assign({ color: invalid
41
+ ? "activeDanger"
42
+ : inputFocused
43
+ ? "activePrimary"
44
+ : baseColor, onChange: onChangeHandler, value: value !== null && value !== void 0 ? value : "", hintIcon: invalid ? _jsx(ErrorWarningFillIcon, {}) : undefined, hintText: error === null || error === void 0 ? void 0 : error.message, inputProps: Object.assign(Object.assign({ name }, inputProps), { onFocus: () => {
45
+ setInputFocused(true);
46
+ }, onBlur: () => {
47
+ setInputFocused(false);
48
+ } }) }, other)));
49
+ }
50
+ } }));
51
+ }
@@ -0,0 +1 @@
1
+ export * from "./FormInput";
@@ -0,0 +1 @@
1
+ export * from "./FormInput";
@@ -0,0 +1,16 @@
1
+ import { ToggleButtonDatum } from "../../../../../ToggleButtonGroup";
2
+ import { EvaluationItem } from "../../SelfEvaluationNode";
3
+ /** 데이터를 받아 자기평가 항목들과 ToggleButtonGroup을 그리는 컴포넌트입니다.
4
+ * 비지니스 로직이 포함되어 있지 않습니다.
5
+ */
6
+ export declare function Evaluation(props: {
7
+ className?: string;
8
+ /** 자기 평가 항목들 */
9
+ evaluations: EvaluationItem[];
10
+ /** ToggleButton의 데이터 배열 */
11
+ data: ToggleButtonDatum[];
12
+ /** 블럭을 클릭했을 때 실행될 콜백. 전달하지 않으면 cursor: pointer가 적용되지 않습니다. */
13
+ onClick?: () => void;
14
+ /** 전달하지 않으면 ToggleButtonGroup 호버, 클릭 동작이 없습니다. (pointer-events: none) */
15
+ onChange?: (evaluations: EvaluationItem[]) => void;
16
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,103 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import styled from "@emotion/styled";
4
+ import { css } from "@emotion/react";
5
+ import { ToggleButtonGroup, } from "../../../../../ToggleButtonGroup";
6
+ import _ from "lodash";
7
+ const TOGGLE_BUTTON_GROUP_WIDTH = 320;
8
+ /** 데이터를 받아 자기평가 항목들과 ToggleButtonGroup을 그리는 컴포넌트입니다.
9
+ * 비지니스 로직이 포함되어 있지 않습니다.
10
+ */
11
+ export function Evaluation(props) {
12
+ const { className, evaluations, data, onClick, onChange } = props;
13
+ return (_jsxs(Container, Object.assign({ className: className, onClick: onClick }, { children: [_jsx(Header, { children: _jsx(LabelArea, { children: data.map(({ label }, index) => (_jsx(Label, { children: label }, index))) }) }), evaluations.map(({ question, selectedLabelIndex }, index) => (_jsxs(Item, { children: [_jsx(Index, { children: index + 1 }), _jsx(Question, { children: question.text }), _jsx(StyledToggleButtonGroup, { data: data, activeIndex: selectedLabelIndex, setActiveIndex: !onChange
14
+ ? undefined
15
+ : (activeIndex) => {
16
+ const newEvaluations = _.cloneDeep(evaluations);
17
+ newEvaluations[index].selectedLabelIndex = activeIndex;
18
+ onChange(newEvaluations);
19
+ } })] }, index)))] })));
20
+ }
21
+ const Container = styled.div(({ onClick }) => css `
22
+ ${onClick && "cursor: pointer;"}
23
+ display: flex;
24
+ flex-direction: column;
25
+ align-items: flex-start;
26
+ align-self: stretch;
27
+ `);
28
+ const Header = styled.div(({ theme }) => css `
29
+ border-bottom: 1px solid ${theme.color.background.neutralAltActive};
30
+ display: flex;
31
+ padding: 8px 0px;
32
+ justify-content: flex-end;
33
+ align-items: center;
34
+ gap: 8px;
35
+ align-self: stretch;
36
+ `);
37
+ const LabelArea = styled.div `
38
+ display: flex;
39
+ width: ${TOGGLE_BUTTON_GROUP_WIDTH}px;
40
+ justify-content: space-between;
41
+ align-items: flex-start;
42
+ `;
43
+ const Label = styled.span(({ theme }) => css `
44
+ color: ${theme.color.foreground.neutralBaseDisabled};
45
+ text-align: center;
46
+ /* Default/Label/12px-Md */
47
+ font-family: Pretendard;
48
+ font-size: 12px;
49
+ font-style: normal;
50
+ font-weight: 500;
51
+ line-height: 16px; /* 133.333% */
52
+ `);
53
+ const Item = styled.div(({ theme }) => css `
54
+ display: flex;
55
+ padding: 4px 0px;
56
+ align-items: center;
57
+ gap: 8px;
58
+ align-self: stretch;
59
+ border-bottom: 1px solid ${theme.color.background.neutralAltActive};
60
+ `);
61
+ const Index = styled.div(({ theme }) => css `
62
+ display: flex;
63
+ width: 20px;
64
+ height: 20px;
65
+ padding: 4px;
66
+
67
+ user-select: none; /* Standard syntax */
68
+
69
+ border-radius: 4px;
70
+ background: ${theme.color.background.neutralBase};
71
+ border: 1px solid ${theme.color.background.neutralAltActive};
72
+
73
+ justify-content: center;
74
+ align-items: center;
75
+
76
+ color: ${theme.color.foreground.neutralBaseDisabled};
77
+ font-family: ${theme.fontFamily.ui};
78
+ font-size: 14px;
79
+ font-weight: 800;
80
+ line-height: 16px;
81
+ `);
82
+ const Question = styled.div(({ theme }) => css `
83
+ display: flex;
84
+ padding: 4px 8px;
85
+ flex-direction: column;
86
+ justify-content: center;
87
+ align-items: flex-start;
88
+ gap: 8px;
89
+ flex: 1 0 0;
90
+ align-self: stretch;
91
+
92
+ color: ${theme.color.foreground.neutralBase};
93
+ /* Default/Paragraph/16px-Rg */
94
+ font-family: ${theme.fontFamily.ui};
95
+ font-size: 16px;
96
+ font-style: normal;
97
+ font-weight: 400;
98
+ line-height: 24px; /* 150% */
99
+ `);
100
+ const StyledToggleButtonGroup = styled(ToggleButtonGroup) `
101
+ flex: none;
102
+ width: ${TOGGLE_BUTTON_GROUP_WIDTH}px;
103
+ `;
@@ -0,0 +1,7 @@
1
+ import { Control } from "react-hook-form";
2
+ import { SettingFormData } from "../SettingForm";
3
+ /** 아이콘, 레이블을 설정하는 Form입니다. */
4
+ export declare function FormIconAndLabel(props: {
5
+ control: Control<SettingFormData, any>;
6
+ labelsLength: number;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Controller } from "react-hook-form";
3
+ import { css, useTheme } from "@emotion/react";
4
+ import { ICON_DATA, ICON_TYPES } from "../../../../iconData";
5
+ import styled from "@emotion/styled";
6
+ import { Dropdown, DropdownItem } from "../../../../../../../Dropdown";
7
+ import { FormLabel } from "./FormLabel";
8
+ import { ArrowDownSFillIcon } from "../../../../../../../..";
9
+ /** 아이콘, 레이블을 설정하는 Form입니다. */
10
+ export function FormIconAndLabel(props) {
11
+ const { control, labelsLength } = props;
12
+ const theme = useTheme();
13
+ const iconDataMap = ICON_DATA(theme);
14
+ return (_jsx(Controller, { control: control, name: "iconType", render: ({ field: { value, onChange } }) => {
15
+ const { startIcon, title, icons } = iconDataMap[value];
16
+ return (_jsxs(_Fragment, { children: [_jsx(Dropdown, Object.assign({ label: "아이콘: " + title, size: "small", color: "grey", closeOnItemClick: true, bold: true, startIcon: startIcon, endIcon: _jsx(ArrowDownSFillIcon, {}), menuProps: {
17
+ menuCss: css `
18
+ width: 216px;
19
+ `,
20
+ anchorOrigin: {
21
+ vertical: "bottom",
22
+ horizontal: "center",
23
+ },
24
+ transformOrigin: {
25
+ vertical: "top",
26
+ horizontal: "center",
27
+ },
28
+ } }, { children: ICON_TYPES.map((type, index) => {
29
+ const { title, startIcon } = iconDataMap[type];
30
+ return (_jsx(DropdownItem, { index: index, label: title, preserveIconColor: true, startIcon: startIcon, onClick: () => {
31
+ onChange(type);
32
+ } }, index));
33
+ }) })), Array.from({ length: labelsLength }).map((_, index) => (_jsxs(LabelLine, { children: [_jsx(Icon, { children: icons[index].onIcon }), _jsx(FormLabel, { control: control, index: index })] }, index)))] }));
34
+ } }));
35
+ }
36
+ const LabelLine = styled.div `
37
+ display: flex;
38
+ align-items: flex-start;
39
+ gap: 4px;
40
+ align-self: stretch;
41
+ `;
42
+ const Icon = styled.div(({ theme }) => css `
43
+ display: flex;
44
+ min-width: 36px;
45
+ min-height: 36px;
46
+ justify-content: center;
47
+ align-items: center;
48
+ gap: 10px;
49
+
50
+ border-radius: 8px;
51
+ border: 0.5px solid ${theme.color.background.neutralAltActive};
52
+ `);
@@ -0,0 +1,7 @@
1
+ import { Control } from "react-hook-form";
2
+ import { SettingFormData } from "../SettingForm";
3
+ /** 레이블을 설정하는 Form입니다. */
4
+ export declare function FormLabel(props: {
5
+ control: Control<SettingFormData, any>;
6
+ index: number;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useController } from "react-hook-form";
3
+ import styled from "@emotion/styled";
4
+ import { css } from "@emotion/react";
5
+ import { FormInput } from "../../../../../Form";
6
+ const LABEL_RULES = {
7
+ required: "필수 입력 항목입니다.",
8
+ maxLength: 12,
9
+ };
10
+ /** 레이블을 설정하는 Form입니다. */
11
+ export function FormLabel(props) {
12
+ const { control, index } = props;
13
+ // endIcon에 들어갈 value, error를 사용하기 위해 useController를 사용합니다.
14
+ const { field: { value }, fieldState: { error }, } = useController({
15
+ control,
16
+ name: `labels.${index}`,
17
+ rules: LABEL_RULES,
18
+ });
19
+ return (_jsx(FormInput, { control: control, name: `labels.${index}`, rules: LABEL_RULES, size: "small", endIcon: _jsx(Counter, Object.assign({ error: Boolean(error) }, { children: value.length + "/" + LABEL_RULES.maxLength })), fullWidth: true }));
20
+ }
21
+ const Counter = styled.span(({ theme, error }) => css `
22
+ color: ${error
23
+ ? theme.color.foreground.dangerActive
24
+ : theme.color.foreground.neutralBase};
25
+ font-family: ${theme.fontFamily.ui};
26
+ font-size: 14px;
27
+ font-style: normal;
28
+ font-weight: 700;
29
+ line-height: 20px; /* 142.857% */
30
+ `);
@@ -0,0 +1,9 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { Control } from "react-hook-form";
3
+ import { SettingFormData } from "./SettingForm";
4
+ /** 평가 항목을 설정하는 Form입니다. */
5
+ export declare function FormQuestion(props: {
6
+ index: number;
7
+ control: Control<SettingFormData, any>;
8
+ onDelete?: () => void;
9
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import styled from "@emotion/styled";
3
+ import { css } from "@emotion/react";
4
+ import { DeleteBinLineIcon, SquareButton } from "../../../../../../..";
5
+ import { FormInput } from "../../../../Form";
6
+ /** 평가 항목을 설정하는 Form입니다. */
7
+ export function FormQuestion(props) {
8
+ const { control, index, onDelete } = props;
9
+ return (_jsxs(Item, { children: [_jsx(Index, { children: index + 1 }), _jsx(FormInput, { control: control, name: `evaluations.${index}.question.text`, rules: {
10
+ required: "필수 입력 항목입니다.",
11
+ }, size: "small", placeholder: `${index + 1}번 평가 항목`, multiline: true, fullWidth: true }), onDelete && (_jsx(SquareButton, { color: "white", size: "xsmall", icon: _jsx(DeleteBinLineIcon, {}), onClick: onDelete }))] }));
12
+ }
13
+ const Item = styled.div(({ theme }) => css `
14
+ display: flex;
15
+ padding: 4px 12px;
16
+ align-items: center;
17
+ gap: 4px;
18
+ align-self: stretch;
19
+ border-radius: 8px;
20
+ background: ${theme.color.background.neutralAlt};
21
+ `);
22
+ const Index = styled.div(({ theme }) => css `
23
+ display: flex;
24
+ width: 20px;
25
+ height: 20px;
26
+ padding: 4px;
27
+
28
+ user-select: none; /* Standard syntax */
29
+
30
+ border-radius: 4px;
31
+ background: ${theme.color.background.neutralBase};
32
+ border: 1px solid ${theme.color.background.neutralAltActive};
33
+
34
+ justify-content: center;
35
+ align-items: center;
36
+
37
+ color: ${theme.color.foreground.neutralBaseDisabled};
38
+ font-family: ${theme.fontFamily.ui};
39
+ font-size: 14px;
40
+ font-weight: 800;
41
+ line-height: 16px;
42
+ `);
@@ -0,0 +1,17 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { NodeKey } from "lexical";
3
+ import { EvaluationItem, IconType } from "../../../SelfEvaluationNode";
4
+ export interface SettingFormData {
5
+ iconType: IconType;
6
+ labels: string[];
7
+ evaluations: EvaluationItem[];
8
+ }
9
+ /** 자기평가 edit의 설정 컴포넌트입니다. */
10
+ export declare function SettingForm(props: {
11
+ className?: string;
12
+ iconType: IconType;
13
+ labels: string[];
14
+ evaluations: EvaluationItem[];
15
+ nodeKey: NodeKey;
16
+ onClose: () => void;
17
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,110 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { $getNodeByKey } from "lexical";
4
+ import { $isSelfEvaluationNode, } from "../../../SelfEvaluationNode";
5
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
+ import { useFieldArray, useForm } from "react-hook-form";
7
+ import styled from "@emotion/styled";
8
+ import { css } from "@emotion/react";
9
+ import { AddFillIcon, Button, EmojiStickerLineIcon, shadows, } from "../../../../../../..";
10
+ import { FormIconAndLabel } from "./FormIconAndLabel";
11
+ import { FormQuestion } from "./FormQuestion";
12
+ /** 자기평가 edit의 설정 컴포넌트입니다. */
13
+ export function SettingForm(props) {
14
+ const { className, iconType, labels, evaluations, nodeKey, onClose } = props;
15
+ const [editor] = useLexicalComposerContext();
16
+ const { control, handleSubmit } = useForm({
17
+ mode: "all",
18
+ defaultValues: {
19
+ iconType,
20
+ labels,
21
+ evaluations,
22
+ },
23
+ });
24
+ const { fields, append, remove } = useFieldArray({
25
+ control,
26
+ name: "evaluations",
27
+ keyName: "uid",
28
+ });
29
+ const onSubmit = (data) => {
30
+ editor.update(() => {
31
+ const node = $getNodeByKey(nodeKey);
32
+ if (!$isSelfEvaluationNode(node)) {
33
+ return;
34
+ }
35
+ node.setIconType(data.iconType);
36
+ node.setLabels(data.labels);
37
+ node.setEvaluations(data.evaluations);
38
+ });
39
+ onClose();
40
+ };
41
+ return (_jsxs(Form, Object.assign({ className: className, onSubmit: handleSubmit(onSubmit) }, { children: [_jsxs(Title, { children: [_jsx(EmojiStickerLineIcon, { css: css `
42
+ width: 12px;
43
+ height: 12px;
44
+ ` }), "3\uB2E8\uACC4 \uD3C9\uAC00"] }), _jsxs(Content, { children: [_jsxs(Left, { children: [_jsx(Label, { children: "\uD3C9\uAC00 \uD56D\uBAA9" }), fields.map((field, index) => (_jsx(FormQuestion, { index: index, control: control, onDelete: index !== 0
45
+ ? () => {
46
+ remove(index);
47
+ }
48
+ : undefined }, field.uid))), _jsx(Button, { color: "grey", size: "small", startIcon: _jsx(AddFillIcon, {}), label: "\uD3C9\uAC00 \uD56D\uBAA9 \uCD94\uAC00", onClick: () => {
49
+ append({
50
+ question: { text: "평가 항목을 입력하세요." },
51
+ selectedLabelIndex: null,
52
+ });
53
+ } })] }), _jsxs(Right, { children: [_jsx(Label, { children: "\uC544\uC774\uCF58, \uB808\uC774\uBE14" }), _jsx(FormIconAndLabel, { control: control, labelsLength: labels.length })] })] }), _jsxs(Buttons, { children: [_jsx(Button, { color: "grey", size: "xsmall", label: "\uB2EB\uAE30", onClick: onClose }), _jsx(Button, { color: "primary", size: "xsmall", label: "\uC774\uB300\uB85C \uB123\uAE30", bold: true, type: "submit" })] })] })));
54
+ }
55
+ const Form = styled.form(({ theme }) => css `
56
+ display: flex;
57
+ flex-direction: column;
58
+ border-radius: 6px;
59
+ border: 1px solid ${theme.color.background.neutralAltActive};
60
+ background: ${theme.color.background.neutralBase};
61
+ box-shadow: ${shadows.shadow08};
62
+ `);
63
+ const Title = styled.div(({ theme }) => css `
64
+ display: flex;
65
+ padding: 8px 12px;
66
+ gap: 4px;
67
+ align-items: center;
68
+ color: ${theme.color.foreground.neutralBase};
69
+ /* Default/Label/12px-Md */
70
+ font-family: ${theme.fontFamily.ui};
71
+ font-size: 12px;
72
+ font-style: normal;
73
+ font-weight: 500;
74
+ line-height: 16px; /* 133.333% */
75
+ `);
76
+ const Content = styled.div(({ theme }) => css `
77
+ display: flex;
78
+ border-top: 1px solid ${theme.color.background.neutralAltActive};
79
+ border-bottom: 1px solid ${theme.color.background.neutralAltActive};
80
+ `);
81
+ const Left = styled.div `
82
+ flex: 1;
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: 12px;
86
+ padding: 12px;
87
+ `;
88
+ const Right = styled.div `
89
+ width: 240px;
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: 8px;
93
+ padding: 12px;
94
+ `;
95
+ const Label = styled.div(({ theme }) => css `
96
+ color: ${theme.color.foreground.neutralBaseDisabled};
97
+ /* Default/Label/12px-Md */
98
+ font-family: ${theme.fontFamily.ui};
99
+ font-size: 12px;
100
+ font-style: normal;
101
+ font-weight: 500;
102
+ line-height: 16px; /* 133.333% */
103
+ `);
104
+ const Buttons = styled.div `
105
+ display: flex;
106
+ padding: 12px;
107
+ justify-content: flex-end;
108
+ align-items: center;
109
+ gap: 8px;
110
+ `;
@@ -0,0 +1,2 @@
1
+ export * from "./Evaluation";
2
+ export * from "./SettingForm";
@@ -0,0 +1,2 @@
1
+ export * from "./Evaluation";
2
+ export * from "./SettingForm";
@@ -0,0 +1,10 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { NodeKey } from "lexical";
3
+ import { EvaluationItem, IconType } from "../SelfEvaluationNode";
4
+ /** SelfEvaluationNode를 그리는 컴포넌트입니다. */
5
+ export declare function EvaluationComponent(props: {
6
+ iconType: IconType;
7
+ labels: string[];
8
+ evaluations: EvaluationItem[];
9
+ nodeKey: NodeKey;
10
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
3
+ import { $getNodeByKey } from "lexical";
4
+ import { $isSelfEvaluationNode, } from "../SelfEvaluationNode";
5
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
+ import { useContext, useState } from "react";
7
+ import useLexicalEditable from "@lexical/react/useLexicalEditable";
8
+ import { LexicalCustomConfigContext } from "../../../LexicalCustomConfigContext";
9
+ import { Evaluation, SettingForm } from "./Evaluation";
10
+ import { ICON_DATA } from "../iconData";
11
+ import { css, useTheme } from "@emotion/react";
12
+ import SquareButton from "../../../../../components/SquareButton";
13
+ import { Settings3FillIcon } from "../../../../../icons";
14
+ import _ from "lodash";
15
+ const EVALUATION_EDIT_WIDTH = 620;
16
+ /** SelfEvaluationNode를 그리는 컴포넌트입니다. */
17
+ export function EvaluationComponent(props) {
18
+ const { iconType, labels, evaluations, nodeKey } = props;
19
+ const theme = useTheme();
20
+ const [editor] = useLexicalComposerContext();
21
+ const isEditable = useLexicalEditable();
22
+ const { freezeProblemNode } = useContext(LexicalCustomConfigContext);
23
+ const [settingOpen, setSettingOpen] = useState(false);
24
+ const { icons } = ICON_DATA(theme)[iconType];
25
+ // label과 icons를 매핑하여 ToggelButtonData로 변환합니다.
26
+ // 만약 둘의 길이가 같지 않다면 짧은 길이에 맞춰집니다.
27
+ const data = _.zipWith(labels, icons, (label, { onIcon, offIcon }) => ({
28
+ label,
29
+ onIcon,
30
+ offIcon,
31
+ }));
32
+ // view
33
+ if (!isEditable) {
34
+ return (_jsx(Evaluation, { data: data, evaluations: evaluations, onChange: freezeProblemNode
35
+ ? undefined
36
+ : (evaluations) => {
37
+ editor.update(() => {
38
+ const node = $getNodeByKey(nodeKey);
39
+ if (!$isSelfEvaluationNode(node)) {
40
+ return;
41
+ }
42
+ node.setEvaluations(evaluations);
43
+ });
44
+ } }));
45
+ }
46
+ // edit
47
+ return (_jsxs(_Fragment, { children: [_jsxs("div", Object.assign({ css: css `
48
+ display: flex;
49
+ gap: 4px;
50
+ ` }, { children: [_jsx(Evaluation, { css: css `
51
+ width: ${EVALUATION_EDIT_WIDTH}px;
52
+ `, data: data, evaluations: evaluations, onClick: () => setSettingOpen((open) => !open) }), _jsx(SquareButton, { size: "small", color: "icon", icon: _jsx(Settings3FillIcon, {}), onClick: () => {
53
+ setSettingOpen((open) => !open);
54
+ } })] })), settingOpen && (_jsx(SettingForm, { css: css `
55
+ width: ${EVALUATION_EDIT_WIDTH}px;
56
+ `, iconType: iconType, labels: labels, evaluations: evaluations, nodeKey: nodeKey, onClose: () => setSettingOpen(false) }))] }));
57
+ }
@@ -0,0 +1 @@
1
+ export * from "./EvaluationComponent";
@@ -0,0 +1 @@
1
+ export * from "./EvaluationComponent";
@@ -0,0 +1,45 @@
1
+ import { DecoratorNode, EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from "lexical";
2
+ import { ReactNode } from "react";
3
+ export type IconType = "emoji" | "ascendingNumber" | "descendingNumber";
4
+ /** 자기 평가 항목 */
5
+ export interface EvaluationItem {
6
+ question: {
7
+ text: string;
8
+ };
9
+ selectedLabelIndex: number | null;
10
+ }
11
+ export interface SelfEvaluationPayload {
12
+ /** 아이콘 프리셋 타입 */
13
+ iconType: IconType;
14
+ /** 자기평가 레이블 */
15
+ labels: string[];
16
+ /** 자기평가 항목들 */
17
+ evaluations: EvaluationItem[];
18
+ key?: NodeKey;
19
+ }
20
+ export type SerializedSelfEvaluationNode = Spread<SelfEvaluationPayload, SerializedLexicalNode>;
21
+ /** 3단계 평가 입력칸을 나타내는 노드입니다.
22
+ * 도구 이름으로서는 "3단계 평가 입력 칸"으로 나타나지만, n단계로 확장 가능합니다.
23
+ */
24
+ export declare class SelfEvaluationNode extends DecoratorNode<ReactNode> {
25
+ __iconType: IconType;
26
+ __labels: string[];
27
+ __evaluations: EvaluationItem[];
28
+ isInline(): boolean;
29
+ static getType(): string;
30
+ getIconType(): IconType;
31
+ getLabels(): string[];
32
+ getEvaluations(): EvaluationItem[];
33
+ setIconType(iconType: IconType): void;
34
+ setLabels(labels: string[]): void;
35
+ setEvaluations(evaluations: EvaluationItem[]): void;
36
+ static clone(node: SelfEvaluationNode): SelfEvaluationNode;
37
+ constructor(iconType: IconType, labels: string[], evaluations: EvaluationItem[], key?: NodeKey);
38
+ createDOM(config: EditorConfig): HTMLElement;
39
+ updateDOM(): boolean;
40
+ static importJSON(serializedNode: SerializedSelfEvaluationNode): SelfEvaluationNode;
41
+ exportJSON(): SerializedSelfEvaluationNode;
42
+ decorate(): ReactNode;
43
+ }
44
+ export declare function $createSelfEvaluationNode(payload: SelfEvaluationPayload): SelfEvaluationNode;
45
+ export declare function $isSelfEvaluationNode(node: LexicalNode | null | undefined): node is SelfEvaluationNode;
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { $applyNodeReplacement, DecoratorNode, } from "lexical";
3
+ import { addClassNamesToElement } from "@lexical/utils";
4
+ import { EvaluationComponent } from "./EvaluationComponent";
5
+ /** 3단계 평가 입력칸을 나타내는 노드입니다.
6
+ * 도구 이름으로서는 "3단계 평가 입력 칸"으로 나타나지만, n단계로 확장 가능합니다.
7
+ */
8
+ export class SelfEvaluationNode extends DecoratorNode {
9
+ isInline() {
10
+ return false;
11
+ }
12
+ static getType() {
13
+ return "self-evaluation";
14
+ }
15
+ getIconType() {
16
+ return this.__iconType;
17
+ }
18
+ getLabels() {
19
+ return this.__labels;
20
+ }
21
+ getEvaluations() {
22
+ return this.__evaluations;
23
+ }
24
+ setIconType(iconType) {
25
+ const self = this.getWritable();
26
+ self.__iconType = iconType;
27
+ }
28
+ setLabels(labels) {
29
+ const self = this.getWritable();
30
+ self.__labels = labels;
31
+ }
32
+ setEvaluations(evaluations) {
33
+ const self = this.getWritable();
34
+ self.__evaluations = evaluations;
35
+ }
36
+ static clone(node) {
37
+ return new SelfEvaluationNode(node.__iconType, node.__labels, node.__evaluations);
38
+ }
39
+ constructor(iconType, labels, evaluations, key) {
40
+ super(key);
41
+ this.__iconType = iconType;
42
+ this.__labels = labels;
43
+ this.__evaluations = evaluations;
44
+ }
45
+ createDOM(config) {
46
+ // Define the DOM element here
47
+ const root = document.createElement("div");
48
+ addClassNamesToElement(root, config.theme.selfEvaluation);
49
+ return root;
50
+ }
51
+ updateDOM() {
52
+ return false;
53
+ }
54
+ static importJSON(serializedNode) {
55
+ return $createSelfEvaluationNode({
56
+ key: serializedNode.key,
57
+ iconType: serializedNode.iconType,
58
+ labels: serializedNode.labels,
59
+ evaluations: serializedNode.evaluations,
60
+ });
61
+ }
62
+ exportJSON() {
63
+ return {
64
+ type: "self-evaluation",
65
+ version: 1,
66
+ iconType: this.__iconType,
67
+ labels: this.__labels,
68
+ evaluations: this.__evaluations,
69
+ };
70
+ }
71
+ decorate() {
72
+ return (_jsx(EvaluationComponent, { iconType: this.__iconType, labels: this.__labels, evaluations: this.__evaluations, nodeKey: this.getKey() }));
73
+ }
74
+ }
75
+ export function $createSelfEvaluationNode(payload) {
76
+ const { iconType, labels, evaluations, key } = payload;
77
+ return $applyNodeReplacement(new SelfEvaluationNode(iconType, labels, evaluations, key));
78
+ }
79
+ export function $isSelfEvaluationNode(node) {
80
+ return node instanceof SelfEvaluationNode;
81
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { IconType } from "./SelfEvaluationNode";
3
+ import { Theme } from "@emotion/react";
4
+ interface IconData {
5
+ startIcon: React.ReactNode;
6
+ title: string;
7
+ icons: {
8
+ onIcon: React.ReactNode;
9
+ offIcon: React.ReactNode;
10
+ }[];
11
+ }
12
+ export declare const ICON_TYPES: IconType[];
13
+ export declare const ICON_DATA: (theme: Theme) => Record<IconType, IconData>;
14
+ export {};
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CustomEmoGoodColorIcon, CustomEmoGoodIcon, CustomEmoGreatColorIcon, CustomEmoGreatIcon, CustomEmoNeutralColorIcon, CustomEmoNeutralIcon, } from "../../../../icons/Custom";
3
+ import { Number1Icon, Number2Icon, Number3Icon } from "../../../../icons";
4
+ export const ICON_TYPES = [
5
+ "emoji",
6
+ "ascendingNumber",
7
+ "descendingNumber",
8
+ ];
9
+ export const ICON_DATA = (theme) => ({
10
+ emoji: {
11
+ startIcon: _jsx(CustomEmoGreatColorIcon, {}),
12
+ title: "이모지",
13
+ icons: [
14
+ {
15
+ onIcon: _jsx(CustomEmoGreatColorIcon, {}),
16
+ offIcon: _jsx(CustomEmoGreatIcon, {}),
17
+ },
18
+ { onIcon: _jsx(CustomEmoGoodColorIcon, {}), offIcon: _jsx(CustomEmoGoodIcon, {}) },
19
+ {
20
+ onIcon: _jsx(CustomEmoNeutralColorIcon, {}),
21
+ offIcon: _jsx(CustomEmoNeutralIcon, {}),
22
+ },
23
+ ],
24
+ },
25
+ ascendingNumber: {
26
+ startIcon: _jsx(Number1Icon, {}),
27
+ title: "숫자, 1-2-3",
28
+ icons: [
29
+ {
30
+ onIcon: _jsx(Number1Icon, { color: theme.color.background.primary }),
31
+ offIcon: _jsx(Number1Icon, {}),
32
+ },
33
+ {
34
+ onIcon: _jsx(Number2Icon, { color: theme.color.background.primary }),
35
+ offIcon: _jsx(Number2Icon, {}),
36
+ },
37
+ {
38
+ onIcon: _jsx(Number3Icon, { color: theme.color.background.primary }),
39
+ offIcon: _jsx(Number3Icon, {}),
40
+ },
41
+ ],
42
+ },
43
+ descendingNumber: {
44
+ startIcon: _jsx(Number3Icon, {}),
45
+ title: "숫자, 3-2-1",
46
+ icons: [
47
+ {
48
+ onIcon: _jsx(Number3Icon, { color: theme.color.background.primary }),
49
+ offIcon: _jsx(Number3Icon, {}),
50
+ },
51
+ {
52
+ onIcon: _jsx(Number2Icon, { color: theme.color.background.primary }),
53
+ offIcon: _jsx(Number2Icon, {}),
54
+ },
55
+ {
56
+ onIcon: _jsx(Number1Icon, { color: theme.color.background.primary }),
57
+ offIcon: _jsx(Number1Icon, {}),
58
+ },
59
+ ],
60
+ },
61
+ });
@@ -0,0 +1 @@
1
+ export * from "./SelfEvaluationNode";
@@ -0,0 +1 @@
1
+ export * from "./SelfEvaluationNode";
@@ -17,6 +17,7 @@ import { $isProblemInputNode } from "../../nodes";
17
17
  import { $isProblemSelectNode, } from "../../nodes/ProblemSelectNode";
18
18
  import { $isSheetInputNode } from "../../nodes/SheetInputNode";
19
19
  import { $isSheetSelectNode, } from "../../nodes/SheetSelectNode";
20
+ import { $isSelfEvaluationNode, } from "../../nodes/SelfEvaluationNode";
20
21
  function getParagraphContextMenuOptions(editor, node, setOpen) {
21
22
  return [
22
23
  new ComponentPickerOption("본문", {
@@ -221,6 +222,17 @@ function getSheetSelectContextMenuOptions(node) {
221
222
  }),
222
223
  ];
223
224
  }
225
+ function getSelfEvaluationContextMenuOptions(node) {
226
+ return [
227
+ new ComponentPickerOption("블록 삭제", {
228
+ icon: _jsx(CloseFillIcon, {}),
229
+ keywords: [],
230
+ onSelect: () => {
231
+ node.remove();
232
+ },
233
+ }),
234
+ ];
235
+ }
224
236
  function getColoredQuoteContextMenuOptions(editor, theme, node) {
225
237
  return [
226
238
  new ComponentPickerOption("회색", {
@@ -310,6 +322,9 @@ export function useContextMenuOptions(props) {
310
322
  else if ($isSheetSelectNode(node)) {
311
323
  return getSheetSelectContextMenuOptions(node);
312
324
  }
325
+ else if ($isSelfEvaluationNode(node)) {
326
+ return getSelfEvaluationContextMenuOptions(node);
327
+ }
313
328
  else if (node instanceof ParagraphNode) {
314
329
  return getParagraphContextMenuOptions(editor, node, setImageOpen);
315
330
  }
@@ -21,7 +21,7 @@ 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, FileList2LineIcon, } from "../../../../icons";
24
+ import { TextIcon, H1Icon, H2Icon, H3Icon, ListUnorderedIcon, ListOrderedIcon, DoubleQuotesLIcon, CodeViewIcon, SeparatorIcon, ImageLineIcon, InputMethodLineIcon, ListRadioIcon, LayoutColumnLineIcon, FileList2LineIcon, EmojiStickerLineIcon, } 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";
@@ -29,6 +29,7 @@ import { INSERT_PROBLEM_SELECT_COMMAND } from "../ProblemSelectPlugin";
29
29
  import { INSERT_LAYOUT_COMMAND } from "../LayoutPlugin";
30
30
  import { INSERT_SHEET_SELECT_COMMAND } from "../SheetSelectPlugin";
31
31
  import { INSERT_SHEET_INPUT_COMMAND } from "../SheetInputPlugin";
32
+ import { INSERT_SELF_EVALUATION_COMMAND } from "../SelfEvaluationPlugin";
32
33
  // import useModal from "../../hooks/useModal";
33
34
  // import catTypingGif from "../../images/cat-typing.gif";
34
35
  // import { INSERT_IMAGE_COMMAND, InsertImageDialog } from "../ImagesPlugin";
@@ -88,6 +89,22 @@ function getSheetContextOptions(editor, theme) {
88
89
  allowMultipleAnswers: false,
89
90
  }),
90
91
  }),
92
+ new ComponentPickerOption("3단계 평가 입력 칸", {
93
+ icon: _jsx(EmojiStickerLineIcon, { color: theme.color.foreground.primary }),
94
+ keywords: ["self evaluation", "3단계 평가 입력"],
95
+ onSelect: () => editor.dispatchCommand(INSERT_SELF_EVALUATION_COMMAND, {
96
+ iconType: "emoji",
97
+ labels: ["아주 잘했어요!", "보통이에요.", "잘 모르겠어요."],
98
+ evaluations: [
99
+ {
100
+ question: {
101
+ text: "평가 항목을 입력하세요.",
102
+ },
103
+ selectedLabelIndex: null,
104
+ },
105
+ ],
106
+ }),
107
+ }),
91
108
  new ComponentPickerOption("단답형 입력 칸", {
92
109
  icon: _jsx(InputMethodLineIcon, { color: theme.color.foreground.primary }),
93
110
  keywords: ["sheet short input", "단답형 입력"],
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { LexicalCommand } from "lexical";
3
+ import { SelfEvaluationPayload } from "../../nodes/SelfEvaluationNode";
4
+ export declare const INSERT_SELF_EVALUATION_COMMAND: LexicalCommand<SelfEvaluationPayload>;
5
+ export default function SelfEvaluationPlugin(): 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 { $createSelfEvaluationNode, SelfEvaluationNode, } from "../../nodes/SelfEvaluationNode";
6
+ export const INSERT_SELF_EVALUATION_COMMAND = createCommand("INSERT_SELF_EVALUATION_COMMAND");
7
+ export default function SelfEvaluationPlugin() {
8
+ const [editor] = useLexicalComposerContext();
9
+ useEffect(() => {
10
+ if (!editor.hasNodes([SelfEvaluationNode])) {
11
+ throw new Error("SelfEvaluationNode: SelfEvaluationNode not registered on editor");
12
+ }
13
+ editor.registerCommand(INSERT_SELF_EVALUATION_COMMAND, (payload) => {
14
+ const selfEvaluationNode = $createSelfEvaluationNode(payload);
15
+ $insertNodeToNearestRoot(selfEvaluationNode);
16
+ return true;
17
+ }, COMMAND_PRIORITY_EDITOR);
18
+ }, [editor]);
19
+ return null;
20
+ }
@@ -35,4 +35,5 @@ export declare function getTheme(theme: Theme, editable: boolean): {
35
35
  sheetInput: string;
36
36
  layoutContainer: string;
37
37
  layoutItem: string | false;
38
+ selfEvaluation: string;
38
39
  };
@@ -285,5 +285,12 @@ export function getTheme(theme, editable) {
285
285
  css `
286
286
  border: 1px dashed ${theme.color.background.neutralAltActive};
287
287
  `,
288
+ selfEvaluation: css `
289
+ display: flex;
290
+ flex-direction: column;
291
+ flex: 1;
292
+ gap: 4px;
293
+ margin-bottom: 8px;
294
+ `,
288
295
  };
289
296
  }
@@ -24,6 +24,6 @@ export declare function ToggleButtonGroup(props: {
24
24
  data: ToggleButtonDatum[];
25
25
  /** 활성화될 ToggleButton의 index */
26
26
  activeIndex: number | null;
27
- /** activeIndex set 함수 */
28
- setActiveIndex: (index: number | null) => void;
29
- }): import("react/jsx-runtime").JSX.Element;
27
+ /** activeIndex set 함수. 전달하지 않으면 pointer-events: none이 됩니다. */
28
+ setActiveIndex?: (index: number | null) => void;
29
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ /** @jsxImportSource @emotion/react */
2
3
  import styled from "@emotion/styled";
3
4
  import { ToggleButton } from "./ToggleButton";
5
+ import { css } from "@emotion/react";
4
6
  export const toggleButtonGroupClasses = {
5
7
  container: "ToggleButtonGroup-container",
6
8
  toggleButton: {
@@ -14,13 +16,16 @@ export const toggleButtonGroupClasses = {
14
16
  */
15
17
  export function ToggleButtonGroup(props) {
16
18
  const { className, data, activeIndex, setActiveIndex } = props;
17
- return (_jsx(Container, Object.assign({ className: `${className} ${toggleButtonGroupClasses.container}` }, { children: data.map((datum, index) => {
19
+ return (_jsx(Container, Object.assign({ className: `${className} ${toggleButtonGroupClasses.container}`, css: !setActiveIndex &&
20
+ css `
21
+ pointer-events: none;
22
+ ` }, { children: data.map((datum, index) => {
18
23
  const isFirst = index === 0;
19
24
  const isLast = index === data.length - 1;
20
25
  const isFirstAndLast = isFirst && isLast;
21
26
  const isActive = activeIndex === index;
22
27
  return (_jsx(ToggleButton, { isActive: isActive, onClick: () => {
23
- setActiveIndex(isActive ? null : index);
28
+ setActiveIndex === null || setActiveIndex === void 0 ? void 0 : setActiveIndex(isActive ? null : index);
24
29
  }, datum: datum, placement: isFirstAndLast
25
30
  ? "bottom"
26
31
  : isFirst
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.56.1",
3
+ "version": "1.57.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,