@elice/material-quiz 1.220803.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 (160) hide show
  1. package/README.md +3 -0
  2. package/cjs/components/eb-sortable/EbDraggable.d.ts +18 -0
  3. package/cjs/components/eb-sortable/EbDraggable.js +112 -0
  4. package/cjs/components/eb-sortable/EbDroppable.d.ts +13 -0
  5. package/cjs/components/eb-sortable/EbDroppable.js +60 -0
  6. package/cjs/components/eb-sortable/EbSortable.d.ts +17 -0
  7. package/cjs/components/material-quiz/MaterialQuiz.d.ts +4 -0
  8. package/cjs/components/material-quiz/MaterialQuiz.i18n.d.ts +25 -0
  9. package/cjs/components/material-quiz/MaterialQuiz.i18n.js +55 -0
  10. package/cjs/components/material-quiz/MaterialQuiz.js +114 -0
  11. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.d.ts +3 -0
  12. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +55 -0
  13. package/cjs/components/material-quiz/MaterialQuizError.d.ts +3 -0
  14. package/cjs/components/material-quiz/MaterialQuizInfo.d.ts +3 -0
  15. package/cjs/components/material-quiz/MaterialQuizInfo.js +74 -0
  16. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.d.ts +3 -0
  17. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +203 -0
  18. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +3 -0
  19. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +468 -0
  20. package/cjs/components/material-quiz/MaterialQuizSelectOne.d.ts +3 -0
  21. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +191 -0
  22. package/cjs/components/material-quiz/MaterialQuizShimmer.d.ts +3 -0
  23. package/cjs/components/material-quiz/MaterialQuizShimmer.js +61 -0
  24. package/cjs/components/material-quiz/MaterialQuizText.d.ts +3 -0
  25. package/cjs/components/material-quiz/MaterialQuizText.js +181 -0
  26. package/cjs/components/material-quiz/QuizResultBadge.d.ts +7 -0
  27. package/cjs/components/material-quiz/QuizResultBadge.js +48 -0
  28. package/cjs/components/material-quiz/QuizSubmitStatusText.d.ts +7 -0
  29. package/cjs/components/material-quiz/QuizSubmitStatusText.js +38 -0
  30. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +31 -0
  31. package/cjs/components/material-quiz/context/MaterialQuizContext.js +134 -0
  32. package/cjs/components/material-quiz/index.d.ts +3 -0
  33. package/cjs/components/material-quiz-edit/MaterialQuizEdit.d.ts +25 -0
  34. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +91 -0
  35. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.d.ts +3 -0
  36. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +463 -0
  37. package/cjs/components/material-quiz-edit/context.d.ts +6 -0
  38. package/cjs/components/material-quiz-edit/context.js +15 -0
  39. package/cjs/components/material-quiz-edit/index.d.ts +2 -0
  40. package/cjs/components/material-quiz-edit/locales.d.ts +34 -0
  41. package/cjs/components/material-quiz-edit/locales.js +73 -0
  42. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.d.ts +3 -0
  43. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +204 -0
  44. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.d.ts +3 -0
  45. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +205 -0
  46. package/cjs/components/material-quiz-edit/options/OptionSelectOne.d.ts +3 -0
  47. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +207 -0
  48. package/cjs/components/material-quiz-edit/options/OptionText.d.ts +3 -0
  49. package/cjs/components/material-quiz-edit/options/OptionText.js +99 -0
  50. package/cjs/components/material-quiz-edit/utils/editValue.d.ts +15 -0
  51. package/cjs/components/material-quiz-edit/utils/editValue.js +37 -0
  52. package/cjs/components/material-quiz-edit/utils/randomId.d.ts +4 -0
  53. package/cjs/components/material-quiz-edit/utils/randomId.js +12 -0
  54. package/cjs/components/shared/QuestionBox.d.ts +16 -0
  55. package/cjs/components/shared/QuestionBox.js +111 -0
  56. package/cjs/components/shared/QuizDraggbleDroppedOption.d.ts +12 -0
  57. package/cjs/components/shared/QuizDraggbleDroppedOption.js +31 -0
  58. package/cjs/components/shared/QuizDraggbleDummyOption.d.ts +8 -0
  59. package/cjs/components/shared/QuizDraggbleDummyOption.js +36 -0
  60. package/cjs/components/shared/QuizDraggbleOption.d.ts +14 -0
  61. package/cjs/components/shared/QuizDraggbleOption.js +191 -0
  62. package/cjs/components/shared/StyledMarkdown.d.ts +3 -0
  63. package/cjs/components/shared/StyledMarkdown.js +14 -0
  64. package/cjs/components/shared/index.d.ts +7 -0
  65. package/cjs/components/shared/question-checkbox/QuestionCheckbox.d.ts +8 -0
  66. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +26 -0
  67. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +9 -0
  68. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +42 -0
  69. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.d.ts +9 -0
  70. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +188 -0
  71. package/cjs/components/shared/question-radio/QuestionRadio.d.ts +8 -0
  72. package/cjs/components/shared/question-radio/QuestionRadio.js +26 -0
  73. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +9 -0
  74. package/cjs/components/shared/question-radio/QuestionRadioContext.js +42 -0
  75. package/cjs/components/shared/question-radio/QuestionRadioOption.d.ts +9 -0
  76. package/cjs/components/shared/question-radio/QuestionRadioOption.js +156 -0
  77. package/cjs/helpers/index.d.ts +50 -0
  78. package/cjs/helpers/index.js +86 -0
  79. package/cjs/index.d.ts +3 -0
  80. package/cjs/index.js +27 -0
  81. package/es/components/eb-sortable/EbDraggable.d.ts +18 -0
  82. package/es/components/eb-sortable/EbDraggable.js +105 -0
  83. package/es/components/eb-sortable/EbDroppable.d.ts +13 -0
  84. package/es/components/eb-sortable/EbDroppable.js +53 -0
  85. package/es/components/eb-sortable/EbSortable.d.ts +17 -0
  86. package/es/components/material-quiz/MaterialQuiz.d.ts +4 -0
  87. package/es/components/material-quiz/MaterialQuiz.i18n.d.ts +25 -0
  88. package/es/components/material-quiz/MaterialQuiz.i18n.js +50 -0
  89. package/es/components/material-quiz/MaterialQuiz.js +106 -0
  90. package/es/components/material-quiz/MaterialQuizAnswerExplanation.d.ts +3 -0
  91. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +48 -0
  92. package/es/components/material-quiz/MaterialQuizError.d.ts +3 -0
  93. package/es/components/material-quiz/MaterialQuizInfo.d.ts +3 -0
  94. package/es/components/material-quiz/MaterialQuizInfo.js +68 -0
  95. package/es/components/material-quiz/MaterialQuizSelectMultiple.d.ts +3 -0
  96. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +197 -0
  97. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.d.ts +3 -0
  98. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +461 -0
  99. package/es/components/material-quiz/MaterialQuizSelectOne.d.ts +3 -0
  100. package/es/components/material-quiz/MaterialQuizSelectOne.js +185 -0
  101. package/es/components/material-quiz/MaterialQuizShimmer.d.ts +3 -0
  102. package/es/components/material-quiz/MaterialQuizShimmer.js +54 -0
  103. package/es/components/material-quiz/MaterialQuizText.d.ts +3 -0
  104. package/es/components/material-quiz/MaterialQuizText.js +174 -0
  105. package/es/components/material-quiz/QuizResultBadge.d.ts +7 -0
  106. package/es/components/material-quiz/QuizResultBadge.js +42 -0
  107. package/es/components/material-quiz/QuizSubmitStatusText.d.ts +7 -0
  108. package/es/components/material-quiz/QuizSubmitStatusText.js +32 -0
  109. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +31 -0
  110. package/es/components/material-quiz/context/MaterialQuizContext.js +124 -0
  111. package/es/components/material-quiz/index.d.ts +3 -0
  112. package/es/components/material-quiz-edit/MaterialQuizEdit.d.ts +25 -0
  113. package/es/components/material-quiz-edit/MaterialQuizEdit.js +86 -0
  114. package/es/components/material-quiz-edit/MaterialQuizEditContent.d.ts +3 -0
  115. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +456 -0
  116. package/es/components/material-quiz-edit/context.d.ts +6 -0
  117. package/es/components/material-quiz-edit/context.js +6 -0
  118. package/es/components/material-quiz-edit/index.d.ts +2 -0
  119. package/es/components/material-quiz-edit/locales.d.ts +34 -0
  120. package/es/components/material-quiz-edit/locales.js +68 -0
  121. package/es/components/material-quiz-edit/options/OptionSelectMultiple.d.ts +3 -0
  122. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +197 -0
  123. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.d.ts +3 -0
  124. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +198 -0
  125. package/es/components/material-quiz-edit/options/OptionSelectOne.d.ts +3 -0
  126. package/es/components/material-quiz-edit/options/OptionSelectOne.js +200 -0
  127. package/es/components/material-quiz-edit/options/OptionText.d.ts +3 -0
  128. package/es/components/material-quiz-edit/options/OptionText.js +93 -0
  129. package/es/components/material-quiz-edit/utils/editValue.d.ts +15 -0
  130. package/es/components/material-quiz-edit/utils/editValue.js +32 -0
  131. package/es/components/material-quiz-edit/utils/randomId.d.ts +4 -0
  132. package/es/components/material-quiz-edit/utils/randomId.js +8 -0
  133. package/es/components/shared/QuestionBox.d.ts +16 -0
  134. package/es/components/shared/QuestionBox.js +101 -0
  135. package/es/components/shared/QuizDraggbleDroppedOption.d.ts +12 -0
  136. package/es/components/shared/QuizDraggbleDroppedOption.js +25 -0
  137. package/es/components/shared/QuizDraggbleDummyOption.d.ts +8 -0
  138. package/es/components/shared/QuizDraggbleDummyOption.js +29 -0
  139. package/es/components/shared/QuizDraggbleOption.d.ts +14 -0
  140. package/es/components/shared/QuizDraggbleOption.js +184 -0
  141. package/es/components/shared/StyledMarkdown.d.ts +3 -0
  142. package/es/components/shared/StyledMarkdown.js +8 -0
  143. package/es/components/shared/index.d.ts +7 -0
  144. package/es/components/shared/question-checkbox/QuestionCheckbox.d.ts +8 -0
  145. package/es/components/shared/question-checkbox/QuestionCheckbox.js +19 -0
  146. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +9 -0
  147. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +33 -0
  148. package/es/components/shared/question-checkbox/QuestionCheckboxOption.d.ts +9 -0
  149. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +181 -0
  150. package/es/components/shared/question-radio/QuestionRadio.d.ts +8 -0
  151. package/es/components/shared/question-radio/QuestionRadio.js +19 -0
  152. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +9 -0
  153. package/es/components/shared/question-radio/QuestionRadioContext.js +33 -0
  154. package/es/components/shared/question-radio/QuestionRadioOption.d.ts +9 -0
  155. package/es/components/shared/question-radio/QuestionRadioOption.js +149 -0
  156. package/es/helpers/index.d.ts +50 -0
  157. package/es/helpers/index.js +78 -0
  158. package/es/index.d.ts +3 -0
  159. package/es/index.js +10 -0
  160. package/package.json +75 -0
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+ import $ from 'jquery';
3
+ import 'jquery-ui/ui/widgets/draggable';
4
+
5
+ const EbDraggable = ({
6
+ children,
7
+ id,
8
+ disabled = false,
9
+ revert = true,
10
+ clone = false,
11
+ className,
12
+ onStart,
13
+ onStop,
14
+ onDrag,
15
+ onCreate
16
+ }) => {
17
+ const rootEl = React.useRef(null);
18
+ const onStartCallback = React.useCallback((event, ui) => {
19
+ if (onStart) {
20
+ return onStart(event, ui);
21
+ } else {
22
+ return () => {
23
+ return;
24
+ };
25
+ }
26
+ }, [onStart]);
27
+ const onStopCallback = React.useCallback((event, ui) => {
28
+ if (onStop) {
29
+ return onStop(event, ui);
30
+ } else {
31
+ return () => {
32
+ return;
33
+ };
34
+ }
35
+ }, [onStop]);
36
+ const onDragCallback = React.useCallback((event, ui) => {
37
+ if (onDrag) {
38
+ return onDrag(event, ui);
39
+ } else {
40
+ return () => {
41
+ return;
42
+ };
43
+ }
44
+ }, [onDrag]);
45
+ const onCreateCallback = React.useCallback((event, ui) => {
46
+ if (onCreate) {
47
+ return onCreate(event, ui);
48
+ } else {
49
+ return () => {
50
+ return;
51
+ };
52
+ }
53
+ }, [onCreate]);
54
+ React.useEffect(() => {
55
+ if (!rootEl.current) {
56
+ return;
57
+ }
58
+
59
+ const draggableEl = $(rootEl.current);
60
+ draggableEl.draggable(Object.assign(Object.assign(Object.assign(Object.assign({}, disabled ? {
61
+ disabled
62
+ } : null), revert ? {
63
+ revert
64
+ } : null), clone ? {
65
+ helper: 'clone'
66
+ } : null), {
67
+ zIndex: 200,
68
+ revertDuration: 0,
69
+ start: (event, ui) => {
70
+ if (!onStartCallback) {
71
+ return;
72
+ }
73
+
74
+ onStartCallback(event, ui);
75
+ },
76
+ stop: (event, ui) => {
77
+ if (!onStopCallback) {
78
+ return;
79
+ } // draggableEl.draggable('cancel');
80
+
81
+
82
+ onStopCallback(event, ui);
83
+ },
84
+ drag: (event, ui) => {
85
+ onDragCallback(event, ui);
86
+ },
87
+ create: (event, ui) => {
88
+ onCreateCallback(event, ui);
89
+ }
90
+ }));
91
+ return () => {
92
+ draggableEl.draggable('destroy');
93
+ };
94
+ }, [clone, disabled, onCreateCallback, onDragCallback, onStartCallback, onStopCallback, revert]);
95
+ return React.createElement("div", {
96
+ ref: rootEl,
97
+ id: id,
98
+ className: className,
99
+ style: {
100
+ cursor: disabled ? 'auto' : 'move'
101
+ }
102
+ }, children);
103
+ };
104
+
105
+ export { EbDraggable as default };
@@ -0,0 +1,13 @@
1
+ /// <reference types="jquery" />
2
+ /// <reference types="jqueryui" />
3
+ import React from 'react';
4
+ import 'jquery-ui/ui/widgets/droppable';
5
+ export interface EbDroppableProps {
6
+ id?: string;
7
+ className?: string;
8
+ disabled?: boolean;
9
+ accept?: JQuery.Selector;
10
+ onDrop?: (event: JQueryEventObject, ui: JQueryUI.DroppableEventUIParam) => void;
11
+ }
12
+ declare const EbDroppable: React.FC<EbDroppableProps>;
13
+ export default EbDroppable;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import $ from 'jquery';
3
+ import 'jquery-ui/ui/widgets/droppable';
4
+
5
+ const EbDroppable = ({
6
+ children,
7
+ id,
8
+ disabled = false,
9
+ accept,
10
+ className,
11
+ onDrop
12
+ }) => {
13
+ const rootEl = React.useRef(null);
14
+ const onDropCallback = React.useCallback((event, ui) => {
15
+ if (onDrop) {
16
+ return onDrop(event, ui);
17
+ } else {
18
+ return () => {
19
+ return;
20
+ };
21
+ }
22
+ }, [onDrop]);
23
+ React.useEffect(() => {
24
+ if (!rootEl.current) {
25
+ return;
26
+ }
27
+
28
+ const draggableEl = $(rootEl.current);
29
+ draggableEl.droppable(Object.assign(Object.assign(Object.assign({}, disabled ? {
30
+ disabled
31
+ } : null), accept ? {
32
+ accept
33
+ } : null), {
34
+ drop: (event, ui) => {
35
+ if (!onDropCallback) {
36
+ return;
37
+ }
38
+
39
+ onDropCallback(event, ui);
40
+ }
41
+ }));
42
+ return () => {
43
+ draggableEl.droppable('destroy');
44
+ };
45
+ }, [accept, disabled, onDropCallback]);
46
+ return React.createElement("div", {
47
+ ref: rootEl,
48
+ id: id,
49
+ className: className
50
+ }, children);
51
+ };
52
+
53
+ export { EbDroppable as default };
@@ -0,0 +1,17 @@
1
+ /// <reference types="jquery" />
2
+ /// <reference types="jqueryui" />
3
+ import React from 'react';
4
+ import 'jquery-ui/ui/widgets/sortable.js';
5
+ import 'jquery-ui/ui/widgets/sortable';
6
+ declare type SortedIds = string[];
7
+ interface EbSortableProps {
8
+ id?: string;
9
+ className?: string;
10
+ connectWith?: JQuery.Selector;
11
+ onStart?: (event: JQueryEventObject, ui: JQueryUI.SortableUIParams, ids: SortedIds) => void;
12
+ onStop?: (event: JQueryEventObject, ui: JQueryUI.SortableUIParams, ids: SortedIds) => void;
13
+ onRemove?: (event: JQueryEventObject, ui: JQueryUI.SortableUIParams, targetIndex: number, receivedId: string) => void;
14
+ onReceive?: (event: JQueryEventObject, ui: JQueryUI.SortableUIParams, targetIndex: number, receivedId: string) => void;
15
+ }
16
+ declare const EbSortable: React.FC<EbSortableProps>;
17
+ export default EbSortable;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { MaterialQuizProps } from './context/MaterialQuizContext';
3
+ declare const MaterialQuizContainer: React.FC<MaterialQuizProps>;
4
+ export default MaterialQuizContainer;
@@ -0,0 +1,25 @@
1
+ export declare const en: {
2
+ 'materialQuiz.error': string;
3
+ 'materialQuiz.submit': string;
4
+ 'materialQuiz.submittedAnswer': string;
5
+ 'materialQuiz.answer': string;
6
+ 'materialQuiz.next': string;
7
+ 'materialQuiz.myAnswer': string;
8
+ 'materialQuiz.empty.title': string;
9
+ 'materialQuiz.empty.description': string;
10
+ 'materialQuiz.survey.empty.title': string;
11
+ 'materialQuiz.survey.empty.description': string;
12
+ 'materialQuiz.submitStatus.success': string;
13
+ 'materialQuiz.submitStatus.failure': string;
14
+ 'materialQuiz.resultStatus.correct': string;
15
+ 'materialQuiz.resultStatus.wrong': string;
16
+ 'materialQuiz.resultStatus.submitted': string;
17
+ 'materialQuiz.explanation.close': string;
18
+ 'materialQuiz.explanation.show': string;
19
+ 'materialQuiz.explanation.empty': string;
20
+ 'materialQuiz.text.placeholder': string;
21
+ 'materialQuiz.text.correct': string;
22
+ 'materialQuiz.text.wrong': string;
23
+ 'materialQuiz.order.answerEmpty': string;
24
+ };
25
+ export declare const ko: typeof en;
@@ -0,0 +1,50 @@
1
+ const en = {
2
+ 'materialQuiz.error': 'Failed to fetch quiz',
3
+ 'materialQuiz.submit': 'Submit',
4
+ 'materialQuiz.submittedAnswer': 'Submitted Answer',
5
+ 'materialQuiz.answer': 'Answer',
6
+ 'materialQuiz.next': 'Next question >',
7
+ 'materialQuiz.myAnswer': 'My answer',
8
+ 'materialQuiz.empty.title': 'Quiz is now preparing.',
9
+ 'materialQuiz.empty.description': 'Please check again after quiz posting!',
10
+ 'materialQuiz.survey.empty.title': 'Survey is now preparing.',
11
+ 'materialQuiz.survey.empty.description': 'Please check again after survey posting!',
12
+ 'materialQuiz.submitStatus.success': 'Submitted',
13
+ 'materialQuiz.submitStatus.failure': 'Failed to submit',
14
+ 'materialQuiz.resultStatus.correct': 'Correct',
15
+ 'materialQuiz.resultStatus.wrong': 'Wrong',
16
+ 'materialQuiz.resultStatus.submitted': 'Submitted',
17
+ 'materialQuiz.explanation.close': 'close quiz explanations',
18
+ 'materialQuiz.explanation.show': 'show quiz explanations',
19
+ 'materialQuiz.explanation.empty': 'no explanations',
20
+ 'materialQuiz.text.placeholder': 'please fill the answer',
21
+ 'materialQuiz.text.correct': `that's correct!`,
22
+ 'materialQuiz.text.wrong': `that's wrong. try it again!`,
23
+ 'materialQuiz.order.answerEmpty': 'You could move the options back here'
24
+ };
25
+ const ko = {
26
+ 'materialQuiz.error': '퀴즈를 불러오는데 실패했습니다.\n잠시 후 다시 시도해주세요.',
27
+ 'materialQuiz.submit': '제출',
28
+ 'materialQuiz.submittedAnswer': '제출한 답',
29
+ 'materialQuiz.answer': '정답',
30
+ 'materialQuiz.next': '다음 문제로 이동 >',
31
+ 'materialQuiz.myAnswer': '내 답안',
32
+ 'materialQuiz.empty.title': '퀴즈가 준비 중 입니다.',
33
+ 'materialQuiz.empty.description': '퀴즈 게시 후 다시 확인해주세요!',
34
+ 'materialQuiz.survey.empty.title': '설문조사 준비 중 입니다.',
35
+ 'materialQuiz.survey.empty.description': '설문지 게시 후 다시 확인해주세요!',
36
+ 'materialQuiz.submitStatus.success': '제출되었습니다.',
37
+ 'materialQuiz.submitStatus.failure': '제출에 실패하였습니다.',
38
+ 'materialQuiz.resultStatus.correct': '정답',
39
+ 'materialQuiz.resultStatus.wrong': '오답',
40
+ 'materialQuiz.resultStatus.submitted': '제출완료',
41
+ 'materialQuiz.explanation.close': '퀴즈해설 닫기',
42
+ 'materialQuiz.explanation.show': '퀴즈 해설 보기',
43
+ 'materialQuiz.explanation.empty': '작성된 해설이 없습니다.',
44
+ 'materialQuiz.text.placeholder': '답을 입력하세요.',
45
+ 'materialQuiz.text.correct': '정답입니다.',
46
+ 'materialQuiz.text.wrong': '오답입니다. 다시 답안을 제출해보세요.',
47
+ 'materialQuiz.order.answerEmpty': '항목을 다시 이곳으로 옮길 수 있습니다.'
48
+ };
49
+
50
+ export { en, ko };
@@ -0,0 +1,106 @@
1
+ import React from 'react';
2
+ import { IntlProvider } from 'react-intl';
3
+ import { useMeasure } from 'react-use';
4
+ import { base } from '@elice/design-tokens';
5
+ import { enums } from '@elice/types';
6
+ import styled from 'styled-components';
7
+ import { MaterialQuizProvider, useMaterialQuizState, useMaterialQuizDispatch } from './context/MaterialQuizContext.js';
8
+ import MaterialQuizShimmer from './MaterialQuizShimmer.js';
9
+ import MaterialQuizInfo from './MaterialQuizInfo.js';
10
+ import * as MaterialQuiz_i18n from './MaterialQuiz.i18n.js';
11
+ import { en } from './MaterialQuiz.i18n.js';
12
+
13
+ const AsyncMaterialQuizSelectMultiple = React.lazy(() => import('./MaterialQuizSelectMultiple.js'));
14
+ const AsyncMaterialQuizSelectMultipleOrder = React.lazy(() => import('./MaterialQuizSelectMultipleOrder.js'));
15
+ const AsyncMaterialQuizText = React.lazy(() => import('./MaterialQuizText.js'));
16
+ const AsyncMaterialQuizSelectOne = React.lazy(() => import('./MaterialQuizSelectOne.js'));
17
+ const StyledMaterialQuizInfo = styled.div.withConfig({
18
+ componentId: "sc-1eyn8fb-0"
19
+ })([""]);
20
+ const StyledMaterialQuizContent = styled.div.withConfig({
21
+ componentId: "sc-1eyn8fb-1"
22
+ })(["min-width:0;"]);
23
+ const StyledMaterialQuizWrapper = styled.div.withConfig({
24
+ componentId: "sc-1eyn8fb-2"
25
+ })(["display:flex;width:100%;height:100%;flex-direction:", ";& > *{flex:", ";}& > *:first-child{margin-right:", ";margin-bottom:", ";}", "{height:", ";overflow-y:", ";}"], ({
26
+ vertical
27
+ }) => vertical ? 'column' : 'row', ({
28
+ vertical
29
+ }) => vertical ? 'auto' : '1 0 calc(50% - 1rem);', ({
30
+ vertical
31
+ }) => vertical ? '0' : '1rem', ({
32
+ vertical
33
+ }) => vertical ? '1rem' : '0', StyledMaterialQuizInfo, ({
34
+ vertical
35
+ }) => vertical ? 'auto' : '100%', ({
36
+ vertical
37
+ }) => vertical ? 'intial' : 'auto');
38
+
39
+ const MaterialQuiz = () => {
40
+ const {
41
+ materialQuiz,
42
+ vertical
43
+ } = useMaterialQuizState();
44
+ const {
45
+ setVertical
46
+ } = useMaterialQuizDispatch();
47
+ const [ref, {
48
+ width
49
+ }] = useMeasure();
50
+ React.useEffect(() => {
51
+ if (width > 0) {
52
+ setVertical(width <= base.screen.medium);
53
+ }
54
+ }, [width, setVertical]);
55
+ let Component = null;
56
+
57
+ switch (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.optionType) {
58
+ case enums.QuizOptionType.SelectOne:
59
+ Component = React.createElement(AsyncMaterialQuizSelectOne, null);
60
+ break;
61
+
62
+ case enums.QuizOptionType.SelectMultiple:
63
+ Component = React.createElement(AsyncMaterialQuizSelectMultiple, null);
64
+ break;
65
+
66
+ case enums.QuizOptionType.Text:
67
+ Component = React.createElement(AsyncMaterialQuizText, null);
68
+ break;
69
+
70
+ case enums.QuizOptionType.SelectMultipleOrder:
71
+ Component = React.createElement(AsyncMaterialQuizSelectMultipleOrder, null);
72
+ break;
73
+
74
+ default:
75
+ Component = React.createElement(MaterialQuizShimmer, null);
76
+ break;
77
+ }
78
+
79
+ return React.createElement(React.Suspense, {
80
+ fallback: null
81
+ }, React.createElement(StyledMaterialQuizWrapper, {
82
+ ref: ref,
83
+ vertical: vertical
84
+ }, React.createElement(StyledMaterialQuizInfo, null, React.createElement(MaterialQuizInfo, null)), React.createElement(StyledMaterialQuizContent, null, Component)));
85
+ };
86
+
87
+ const MaterialQuizContainer = ({
88
+ materialQuizId,
89
+ userId,
90
+ locale = 'en',
91
+ onSubmit,
92
+ onNext
93
+ }) => {
94
+ return React.createElement(IntlProvider, {
95
+ locale: locale,
96
+ defaultLocale: "en",
97
+ messages: locale in MaterialQuiz_i18n ? MaterialQuiz_i18n[locale] : en
98
+ }, React.createElement(MaterialQuizProvider, {
99
+ materialQuizId: materialQuizId,
100
+ userId: userId,
101
+ onSubmit: onSubmit,
102
+ onNext: onNext
103
+ }, React.createElement(MaterialQuiz, null)));
104
+ };
105
+
106
+ export { MaterialQuizContainer as default };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const MaterialQuizAnswerExplanation: React.FC;
3
+ export default MaterialQuizAnswerExplanation;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { Accordion, Flex, Text } from '@elice/blocks';
4
+ import { base } from '@elice/design-tokens';
5
+ import { MarkdownSSR } from '@elice/markdown';
6
+ import { enums } from '@elice/types';
7
+ import styled from 'styled-components';
8
+ import { useMaterialQuizState } from './context/MaterialQuizContext.js';
9
+
10
+ const StyledMarkdownSSR = styled(MarkdownSSR).withConfig({
11
+ componentId: "sc-18kg5i5-0"
12
+ })(["p{margin:0 !important;}"]);
13
+ const StyledAccordion = styled(Accordion).withConfig({
14
+ componentId: "sc-18kg5i5-1"
15
+ })(["border-radius:8px;overflow:hidden;background-color:", " !important;border-radius:8px;overflow:hidden;& > *:first-child{background-color:", " !important;}& > *:last-child{background-color:", " !important;}"], base.color.navy5, base.color.navy5, base.color.navy4);
16
+
17
+ const MaterialQuizAnswerExplanation = () => {
18
+ const {
19
+ lecture,
20
+ materialQuiz
21
+ } = useMaterialQuizState();
22
+ const intl = useIntl();
23
+
24
+ if (!materialQuiz || !materialQuiz.explanationInfo.isEnabled || !materialQuiz.isResponded || (lecture === null || lecture === void 0 ? void 0 : lecture.lectureType) === enums.LectureType.Test && (lecture === null || lecture === void 0 ? void 0 : lecture.testUserStatus) !== enums.LectureTestUserStatus.Completed) {
25
+ return null;
26
+ }
27
+
28
+ return React.createElement(Flex, {
29
+ column: true,
30
+ margintop: "1rem"
31
+ }, React.createElement(StyledAccordion, {
32
+ dark: true,
33
+ header: intl.formatMessage({
34
+ id: 'materialQuiz.explanation.show'
35
+ })
36
+ }, materialQuiz.explanationInfo.isEnabled ? React.createElement(StyledMarkdownSSR, {
37
+ dark: true,
38
+ children: materialQuiz.explanationInfo.value
39
+ }) : React.createElement(Text, {
40
+ role: "info",
41
+ lineHeight: 1.4,
42
+ userSelect: "none"
43
+ }, intl.formatMessage({
44
+ id: 'materialQuiz.explanation.empty'
45
+ }))));
46
+ };
47
+
48
+ export { MaterialQuizAnswerExplanation as default };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const MaterialQuizError: React.FC;
3
+ export default MaterialQuizError;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const MaterialQuizInfo: React.FC;
3
+ export default MaterialQuizInfo;
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { Flex, Text, Shimmer, Vspace } from '@elice/blocks';
3
+ import { base } from '@elice/design-tokens';
4
+ import { MarkdownSSR } from '@elice/markdown';
5
+ import QuestionBox from '../shared/QuestionBox.js';
6
+ import { useMaterialQuizState } from './context/MaterialQuizContext.js';
7
+ import MaterialQuizAnswerExplanation from './MaterialQuizAnswerExplanation.js';
8
+
9
+ const MaterialQuizInfo = () => {
10
+ const {
11
+ materialQuiz
12
+ } = useMaterialQuizState();
13
+ return React.createElement(QuestionBox, {
14
+ title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.title
15
+ }, materialQuiz ? React.createElement(Flex, null, React.createElement(Text, {
16
+ bold: true,
17
+ size: "large",
18
+ customStyles: {
19
+ color: base.color.primary3,
20
+ marginRight: '0.5rem'
21
+ }
22
+ }, 'Q.'), React.createElement(Text, {
23
+ bold: true,
24
+ role: "white",
25
+ size: "large",
26
+ wordBreak: "break-word"
27
+ }, materialQuiz.questionTitle)) : React.createElement(Shimmer, {
28
+ dark: true,
29
+ borderRadius: '4px',
30
+ width: "80%",
31
+ height: '40px'
32
+ }), React.createElement(Vspace, {
33
+ height: 1
34
+ }), materialQuiz ? React.createElement(MarkdownSSR, {
35
+ children: materialQuiz.questionDescription,
36
+ dark: true,
37
+ paddingx: 0,
38
+ paddingy: 0
39
+ }) : React.createElement(React.Fragment, null, React.createElement(Shimmer, {
40
+ dark: true,
41
+ borderRadius: '4px',
42
+ width: "80%",
43
+ height: '40px'
44
+ }), React.createElement(Vspace, {
45
+ height: 1
46
+ }), React.createElement(Shimmer, {
47
+ dark: true,
48
+ borderRadius: '4px',
49
+ width: "100%",
50
+ height: '40px'
51
+ }), React.createElement(Vspace, {
52
+ height: 1
53
+ }), React.createElement(Shimmer, {
54
+ dark: true,
55
+ borderRadius: '4px',
56
+ width: "100%",
57
+ height: '40px'
58
+ }), React.createElement(Vspace, {
59
+ height: 1
60
+ }), React.createElement(Shimmer, {
61
+ dark: true,
62
+ borderRadius: '4px',
63
+ width: "100%",
64
+ height: '40px'
65
+ })), React.createElement(MaterialQuizAnswerExplanation, null));
66
+ };
67
+
68
+ export { MaterialQuizInfo as default };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const MaterialQuizSelectMultiple: React.FC;
3
+ export default MaterialQuizSelectMultiple;