@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.2

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 (127) hide show
  1. package/cjs/components/eb-sortable/EbDraggable.js +33 -42
  2. package/cjs/components/eb-sortable/EbDroppable.js +20 -27
  3. package/cjs/components/markdown-editor/index.d.ts +2 -1
  4. package/cjs/components/markdown-editor/index.js +10 -19
  5. package/cjs/components/material-quiz/MaterialQuiz.js +83 -114
  6. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -36
  7. package/cjs/components/material-quiz/MaterialQuizInfo.js +149 -151
  8. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +127 -175
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +286 -360
  10. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +126 -172
  11. package/cjs/components/material-quiz/MaterialQuizShimmer.js +39 -46
  12. package/cjs/components/material-quiz/MaterialQuizText.js +115 -163
  13. package/cjs/components/material-quiz/QuizResultBadge.js +22 -32
  14. package/cjs/components/material-quiz/QuizSubmitStatusText.js +16 -21
  15. package/cjs/components/material-quiz/constants/color.js +5 -5
  16. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.js +93 -156
  18. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -259
  19. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -134
  20. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -130
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -64
  22. package/cjs/components/material-quiz/material-quiz-group/context/context.js +1 -5
  23. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +36 -47
  24. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +232 -280
  25. package/cjs/components/material-quiz-edit/context.js +2 -8
  26. package/cjs/components/material-quiz-edit/options/OptionEditor.js +46 -70
  27. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -174
  28. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -175
  29. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +144 -164
  30. package/cjs/components/material-quiz-edit/options/OptionText.js +82 -90
  31. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  32. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -156
  33. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +196 -288
  34. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -88
  35. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -108
  36. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  37. package/cjs/components/material-quiz-edit/utils/editValue.js +12 -21
  38. package/cjs/components/shared/QuestionBox.js +165 -198
  39. package/cjs/components/shared/QuizDraggbleDroppedOption.js +12 -11
  40. package/cjs/components/shared/QuizDraggbleDummyOption.js +16 -23
  41. package/cjs/components/shared/QuizDraggbleOption.js +59 -65
  42. package/cjs/components/shared/StyledMarkdown.js +1 -5
  43. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
  44. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  45. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
  46. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -59
  47. package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
  48. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  49. package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
  50. package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -52
  51. package/cjs/components/shared/utils/getQuestionStatusStyle.js +9 -7
  52. package/cjs/components/shared/utils/mergeRefs.js +6 -15
  53. package/cjs/constant/element.js +3 -3
  54. package/cjs/helpers/index.js +10 -8
  55. package/cjs/hooks/useCaculatePassage.js +20 -21
  56. package/es/components/eb-sortable/EbDraggable.js +33 -37
  57. package/es/components/eb-sortable/EbDroppable.js +20 -22
  58. package/es/components/markdown-editor/index.d.ts +2 -1
  59. package/es/components/markdown-editor/index.js +10 -15
  60. package/es/components/material-quiz/MaterialQuiz.js +83 -109
  61. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -32
  62. package/es/components/material-quiz/MaterialQuizInfo.js +150 -148
  63. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +127 -171
  64. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +287 -356
  65. package/es/components/material-quiz/MaterialQuizSelectOne.js +126 -168
  66. package/es/components/material-quiz/MaterialQuizShimmer.js +39 -42
  67. package/es/components/material-quiz/MaterialQuizText.js +115 -158
  68. package/es/components/material-quiz/QuizResultBadge.js +22 -27
  69. package/es/components/material-quiz/QuizSubmitStatusText.js +16 -17
  70. package/es/components/material-quiz/constants/color.js +5 -5
  71. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  72. package/es/components/material-quiz/context/MaterialQuizContext.js +94 -153
  73. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -253
  74. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -129
  75. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -125
  76. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -60
  77. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  78. package/es/components/material-quiz-edit/MaterialQuizEdit.js +36 -43
  79. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +229 -272
  80. package/es/components/material-quiz-edit/context.js +2 -4
  81. package/es/components/material-quiz-edit/options/OptionEditor.js +46 -64
  82. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -170
  83. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -171
  84. package/es/components/material-quiz-edit/options/OptionSelectOne.js +144 -159
  85. package/es/components/material-quiz-edit/options/OptionText.js +82 -86
  86. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  87. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -151
  88. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +197 -283
  89. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -83
  90. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -103
  91. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  92. package/es/components/material-quiz-edit/utils/editValue.js +12 -17
  93. package/es/components/shared/QuestionBox.js +165 -192
  94. package/es/components/shared/QuizDraggbleDroppedOption.js +12 -11
  95. package/es/components/shared/QuizDraggbleDummyOption.js +16 -19
  96. package/es/components/shared/QuizDraggbleOption.js +59 -61
  97. package/es/components/shared/StyledMarkdown.js +1 -1
  98. package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
  99. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  100. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
  101. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -54
  102. package/es/components/shared/question-radio/QuestionRadio.js +7 -9
  103. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  104. package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
  105. package/es/components/shared/question-radio/QuestionRadioOption.js +59 -47
  106. package/es/components/shared/utils/getQuestionStatusStyle.js +9 -7
  107. package/es/components/shared/utils/mergeRefs.js +6 -15
  108. package/es/constant/element.js +3 -3
  109. package/es/helpers/index.js +10 -8
  110. package/es/hooks/useCaculatePassage.js +20 -21
  111. package/package.json +15 -12
  112. package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -423
  113. package/cjs/components/material-quiz/index.js +0 -9
  114. package/cjs/components/material-quiz/locales/index.js +0 -13
  115. package/cjs/components/material-quiz-edit/index.js +0 -7
  116. package/cjs/components/material-quiz-edit/locales/index.js +0 -13
  117. package/cjs/components/shared/index.js +0 -19
  118. package/cjs/constant/index.js +0 -9
  119. package/cjs/hooks/index.js +0 -7
  120. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -408
  121. package/es/components/material-quiz/index.js +0 -2
  122. package/es/components/material-quiz/locales/index.js +0 -4
  123. package/es/components/material-quiz-edit/index.js +0 -1
  124. package/es/components/material-quiz-edit/locales/index.js +0 -4
  125. package/es/components/shared/index.js +0 -7
  126. package/es/constant/index.js +0 -1
  127. package/es/hooks/index.js +0 -1
@@ -1,5 +1,3 @@
1
- import { slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
1
  import React from 'react';
4
2
  import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
5
3
  import { Flex } from '@elice/blocks';
@@ -17,76 +15,69 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
17
15
  import QuizResultBadge from './QuizResultBadge.js';
18
16
  import QuizSubmitStatusText from './QuizSubmitStatusText.js';
19
17
 
20
- var StyledTextarea = styled.textarea.withConfig({
18
+ const StyledTextarea = styled.textarea.withConfig({
21
19
  componentId: "sc-186cnpj-0"
22
- })(["min-height:12rem;width:100%;padding:1rem 1.375rem;font-size:1rem;color:", ";border-radius:4px;resize:vertical;line-height:1.5rem;outline:none;border:1px solid ", ";background-color:", ";&::placeholder{color:", ";}&:hover{cursor:", ";}"], base.color.navy2, base.color.navy6, base.color.navy7, base.color.navy2, function (_ref) {
23
- var disabled = _ref.disabled;
24
- return disabled ? 'not-allowed' : 'text';
25
- });
26
- var StyledLabel = styled.label.withConfig({
20
+ })(["min-height:12rem;width:100%;padding:1rem 1.375rem;font-size:1rem;color:", ";border-radius:4px;resize:vertical;line-height:1.5rem;outline:none;border:1px solid ", ";background-color:", ";&::placeholder{color:", ";}&:hover{cursor:", ";}"], base.color.navy2, base.color.navy6, base.color.navy7, base.color.navy2, ({
21
+ disabled
22
+ }) => disabled ? 'not-allowed' : 'text');
23
+ const StyledLabel = styled.label.withConfig({
27
24
  componentId: "sc-186cnpj-1"
28
25
  })(["font-size:0.875rem;margin-bottom:0.5rem;color:", ";"], base.color.navy1);
29
- var MaterialQuizText = function MaterialQuizText(_ref2) {
30
- var hasInlinePassage = _ref2.hasInlinePassage;
26
+ const MaterialQuizText = ({
27
+ hasInlinePassage
28
+ }) => {
31
29
  // context
32
- var _useMaterialQuizState = useMaterialQuizState(),
33
- lecture = _useMaterialQuizState.lecture,
34
- materialQuiz = _useMaterialQuizState.materialQuiz,
35
- userId = _useMaterialQuizState.userId;
36
- var _useMaterialQuizDispa = useMaterialQuizDispatch(),
37
- onSubmit = _useMaterialQuizDispa.onSubmit,
38
- onNext = _useMaterialQuizDispa.onNext,
39
- refreshOrgMaterialQuiz = _useMaterialQuizDispa.refreshOrgMaterialQuiz,
40
- onDirty = _useMaterialQuizDispa.onDirty;
41
- var theme = useTheme();
30
+ const {
31
+ lecture,
32
+ materialQuiz,
33
+ userId
34
+ } = useMaterialQuizState();
35
+ const {
36
+ onSubmit,
37
+ onNext,
38
+ refreshOrgMaterialQuiz,
39
+ onDirty
40
+ } = useMaterialQuizDispatch();
41
+ const theme = useTheme();
42
42
  // state
43
- var intl = useRawEliceIntl();
44
- var _React$useState = React.useState(),
45
- _React$useState2 = _slicedToArray(_React$useState, 2),
46
- materialQuizResponse = _React$useState2[0],
47
- setMaterialQuizResponse = _React$useState2[1];
48
- var _React$useState3 = React.useState('idle'),
49
- _React$useState4 = _slicedToArray(_React$useState3, 2),
50
- submitStatus = _React$useState4[0],
51
- setSubmitStatus = _React$useState4[1];
52
- var _useCaculatePassage = useCaculatePassage(),
53
- containerRef = _useCaculatePassage.containerRef,
54
- questionRef = _useCaculatePassage.questionRef;
55
- var _React$useState5 = React.useState(''),
56
- _React$useState6 = _slicedToArray(_React$useState5, 2),
57
- answer = _React$useState6[0],
58
- setAnswer = _React$useState6[1];
59
- var _React$useState7 = React.useState(false),
60
- _React$useState8 = _slicedToArray(_React$useState7, 2),
61
- hasSubmitted = _React$useState8[0],
62
- setHasSubmitted = _React$useState8[1];
63
- var isNextActive = hasSubmitted && typeof onNext === 'function';
64
- var isDisabled = answer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
43
+ const intl = useRawEliceIntl();
44
+ const [materialQuizResponse, setMaterialQuizResponse] = React.useState();
45
+ const [submitStatus, setSubmitStatus] = React.useState('idle');
46
+ const {
47
+ containerRef,
48
+ questionRef
49
+ } = useCaculatePassage();
50
+ const [answer, setAnswer] = React.useState('');
51
+ const [hasSubmitted, setHasSubmitted] = React.useState(false);
52
+ const isNextActive = hasSubmitted && typeof onNext === 'function';
53
+ const isDisabled = answer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
65
54
  // quiz response fetcher
66
- React.useEffect(function () {
55
+ React.useEffect(() => {
67
56
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
68
- var controller = new AbortController();
69
- var signal = controller.signal;
57
+ const controller = new AbortController();
58
+ const {
59
+ signal
60
+ } = controller;
70
61
  getOrgMaterialQuizResponseGet({
71
62
  quizResponseId: materialQuiz.lastQuizResponseId
72
63
  }, {
73
- signal: signal
74
- }).then(function (response) {
64
+ signal
65
+ }).then(response => {
75
66
  setMaterialQuizResponse(response.quizResponse);
76
67
  setAnswer(response.quizResponse.answer);
77
- }).catch(function (error) {
68
+ }).catch(error => {
78
69
  console.error(error);
79
70
  });
80
- return function () {
81
- return controller.abort();
82
- };
71
+ return () => controller.abort();
83
72
  }
84
73
  }, [materialQuiz, userId]);
85
74
  // quiz response fetcher
86
- React.useEffect(function () {
75
+ React.useEffect(() => {
87
76
  if (userId && materialQuiz) {
88
- var controller = new AbortController();
89
- var signal = controller.signal;
77
+ const controller = new AbortController();
78
+ const {
79
+ signal
80
+ } = controller;
90
81
  getOrgMaterialQuizResponseList({
91
82
  materialQuizId: materialQuiz.id,
92
83
  filterUserIds: [userId],
@@ -95,74 +86,48 @@ var MaterialQuizText = function MaterialQuizText(_ref2) {
95
86
  offset: 0,
96
87
  count: 1
97
88
  }, {
98
- signal: signal
99
- }).then(function (response) {
100
- var quizResponse = response.quizResponses[0];
89
+ signal
90
+ }).then(response => {
91
+ const quizResponse = response.quizResponses[0];
101
92
  setMaterialQuizResponse(quizResponse);
102
93
  setAnswer(typeof (quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer) === 'string' ? quizResponse.answer : '');
103
- }).catch(function (error) {
94
+ }).catch(error => {
104
95
  console.error(error);
105
96
  });
106
- return function () {
107
- return controller.abort();
108
- };
97
+ return () => controller.abort();
109
98
  }
110
99
  }, [materialQuiz, userId]);
111
100
  // submit handler
112
- var handleSubmit = /*#__PURE__*/function () {
113
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
114
- var _yield$postOrgMateria, quizResponseId, _yield$getOrgMaterial, quizResponse;
115
- return _regeneratorRuntime().wrap(function _callee$(_context) {
116
- while (1) switch (_context.prev = _context.next) {
117
- case 0:
118
- if (materialQuiz) {
119
- _context.next = 2;
120
- break;
121
- }
122
- return _context.abrupt("return");
123
- case 2:
124
- setSubmitStatus('pending');
125
- _context.prev = 3;
126
- _context.next = 6;
127
- return postOrgMaterialQuizResponseAdd({
128
- materialQuizId: materialQuiz.id,
129
- answer: JSON.stringify(answer)
130
- });
131
- case 6:
132
- _yield$postOrgMateria = _context.sent;
133
- quizResponseId = _yield$postOrgMateria.quizResponseId;
134
- _context.next = 10;
135
- return getOrgMaterialQuizResponseGet({
136
- quizResponseId: quizResponseId
137
- });
138
- case 10:
139
- _yield$getOrgMaterial = _context.sent;
140
- quizResponse = _yield$getOrgMaterial.quizResponse;
141
- setHasSubmitted(true);
142
- setMaterialQuizResponse(quizResponse);
143
- void refreshOrgMaterialQuiz();
144
- onSubmit(true, getQuizResult(quizResponse));
145
- setSubmitStatus('resolved');
146
- onDirty(false);
147
- _context.next = 25;
148
- break;
149
- case 20:
150
- _context.prev = 20;
151
- _context.t0 = _context["catch"](3);
152
- console.error(_context.t0);
153
- onSubmit(false);
154
- setSubmitStatus('rejected');
155
- case 25:
156
- case "end":
157
- return _context.stop();
158
- }
159
- }, _callee, null, [[3, 20]]);
160
- }));
161
- return function handleSubmit() {
162
- return _ref3.apply(this, arguments);
163
- };
164
- }();
165
- var commonProps = {
101
+ const handleSubmit = async () => {
102
+ if (!materialQuiz) {
103
+ return;
104
+ }
105
+ setSubmitStatus('pending');
106
+ try {
107
+ const {
108
+ quizResponseId
109
+ } = await postOrgMaterialQuizResponseAdd({
110
+ materialQuizId: materialQuiz.id,
111
+ answer: JSON.stringify(answer)
112
+ });
113
+ const {
114
+ quizResponse
115
+ } = await getOrgMaterialQuizResponseGet({
116
+ quizResponseId
117
+ });
118
+ setHasSubmitted(true);
119
+ setMaterialQuizResponse(quizResponse);
120
+ void refreshOrgMaterialQuiz();
121
+ onSubmit(true, getQuizResult(quizResponse));
122
+ setSubmitStatus('resolved');
123
+ onDirty(false);
124
+ } catch (error) {
125
+ console.error(error);
126
+ onSubmit(false);
127
+ setSubmitStatus('rejected');
128
+ }
129
+ };
130
+ const commonProps = {
166
131
  type: 'text',
167
132
  autoFocus: answer.length === 0,
168
133
  disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId,
@@ -170,20 +135,20 @@ var MaterialQuizText = function MaterialQuizText(_ref2) {
170
135
  id: 'materialQuiz.text.placeholder'
171
136
  }),
172
137
  value: answer,
173
- onChange: function onChange(e) {
138
+ onChange: e => {
174
139
  setHasSubmitted(false);
175
140
  setAnswer(e.target.value);
176
141
  onDirty(true);
177
142
  }
178
143
  };
179
- return jsx(QuestionBox, {
144
+ return React.createElement(QuestionBox, {
180
145
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
181
146
  titlePrefix: "Q.",
182
147
  onNext: onNext,
183
- submitResult: jsx(QuizResultBadge, {
148
+ submitResult: React.createElement(QuizResultBadge, {
184
149
  materialQuizResponse: materialQuizResponse
185
150
  }),
186
- submitStatus: jsx(QuizSubmitStatusText, {
151
+ submitStatus: React.createElement(QuizSubmitStatusText, {
187
152
  status: submitStatus
188
153
  }),
189
154
  isNextActive: isNextActive,
@@ -202,45 +167,37 @@ var MaterialQuizText = function MaterialQuizText(_ref2) {
202
167
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
203
168
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
204
169
  }
205
- }],
206
- children: jsxs(Stack, {
207
- height: "100%",
208
- gap: "1rem",
209
- children: [hasInlinePassage && jsx("div", {
210
- id: MATERIAL_QUIZ_PASSIVE_ID,
211
- ref: questionRef,
212
- children: jsx(MaterialQuizInfo, {
213
- renderWithBox: false
214
- })
215
- }), jsxs("div", {
216
- id: MATERIAL_QUIZ_ANSWER_ID,
217
- children: [jsxs(Flex, {
218
- column: true,
219
- children: [userId ? jsx(StyledLabel, {
220
- htmlFor: "quiz-text-answer",
221
- children: intl.formatMessage({
222
- id: 'materialQuiz.submittedAnswer'
223
- })
224
- }) : null, jsx(StyledTextarea, Object.assign({
225
- id: "quiz-text-answer"
226
- }, commonProps))]
227
- }), userId ? jsxs(Flex, {
228
- column: true,
229
- margintop: "1rem",
230
- children: [jsx(StyledLabel, {
231
- htmlFor: "quiz-text-submitted-answer",
232
- children: intl.formatMessage({
233
- id: 'materialQuiz.answer'
234
- })
235
- }), jsx(StyledTextarea, {
236
- id: "quiz-text-submitted-answer",
237
- disabled: true,
238
- value: typeof (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo) === 'string' ? materialQuiz.answerInfo : ''
239
- })]
240
- }) : null]
241
- }), jsx(MaterialQuizAnswerExplanation, {})]
242
- })
243
- });
170
+ }]
171
+ }, React.createElement(Stack, {
172
+ height: "100%",
173
+ gap: "1rem"
174
+ }, hasInlinePassage && React.createElement("div", {
175
+ id: MATERIAL_QUIZ_PASSIVE_ID,
176
+ ref: questionRef
177
+ }, React.createElement(MaterialQuizInfo, {
178
+ renderWithBox: false
179
+ })), React.createElement("div", {
180
+ id: MATERIAL_QUIZ_ANSWER_ID
181
+ }, React.createElement(Flex, {
182
+ column: true
183
+ }, userId ? React.createElement(StyledLabel, {
184
+ htmlFor: "quiz-text-answer"
185
+ }, intl.formatMessage({
186
+ id: 'materialQuiz.submittedAnswer'
187
+ })) : null, React.createElement(StyledTextarea, Object.assign({
188
+ id: "quiz-text-answer"
189
+ }, commonProps))), userId ? React.createElement(Flex, {
190
+ column: true,
191
+ margintop: "1rem"
192
+ }, React.createElement(StyledLabel, {
193
+ htmlFor: "quiz-text-submitted-answer"
194
+ }, intl.formatMessage({
195
+ id: 'materialQuiz.answer'
196
+ })), React.createElement(StyledTextarea, {
197
+ id: "quiz-text-submitted-answer",
198
+ disabled: true,
199
+ value: typeof (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerInfo) === 'string' ? materialQuiz.answerInfo : ''
200
+ })) : null), React.createElement(MaterialQuizAnswerExplanation, null)));
244
201
  };
245
202
 
246
203
  export { MaterialQuizText as default };
@@ -1,4 +1,3 @@
1
- import { jsx } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
  import { BadgeNext } from '@elice/blocks';
4
3
  import { useRawEliceIntl } from '@elice/intl';
@@ -6,43 +5,39 @@ import styled from 'styled-components';
6
5
  import { getQuizResultStatus, QuizResultStatus } from '../../helpers/index.js';
7
6
  import { CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR, WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR } from './constants/color.js';
8
7
 
9
- var StyledGreenBadgeNext = styled(BadgeNext).withConfig({
8
+ const StyledGreenBadgeNext = styled(BadgeNext).withConfig({
10
9
  componentId: "sc-1iksspv-0"
11
10
  })(["background-color:", ";color:", ";"], CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR);
12
- var StyledRedBadgeNext = styled(BadgeNext).withConfig({
11
+ const StyledRedBadgeNext = styled(BadgeNext).withConfig({
13
12
  componentId: "sc-1iksspv-1"
14
13
  })(["background-color:", ";color:", ";"], WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR);
15
- var QuizResultBadge = function QuizResultBadge(_ref) {
16
- var materialQuizResponse = _ref.materialQuizResponse;
17
- var intl = useRawEliceIntl();
18
- var status = React.useMemo(function () {
19
- return getQuizResultStatus(materialQuizResponse);
20
- }, [materialQuizResponse]);
14
+ const QuizResultBadge = ({
15
+ materialQuizResponse
16
+ }) => {
17
+ const intl = useRawEliceIntl();
18
+ const status = React.useMemo(() => getQuizResultStatus(materialQuizResponse), [materialQuizResponse]);
21
19
  switch (status) {
22
20
  case QuizResultStatus.Correct:
23
- return jsx(StyledGreenBadgeNext, {
21
+ return React.createElement(StyledGreenBadgeNext, {
24
22
  type: "quiet",
25
- role: "green",
26
- children: intl.formatMessage({
27
- id: 'materialQuiz.resultStatus.correct'
28
- })
29
- });
23
+ role: "green"
24
+ }, intl.formatMessage({
25
+ id: 'materialQuiz.resultStatus.correct'
26
+ }));
30
27
  case QuizResultStatus.Wrong:
31
- return jsx(StyledRedBadgeNext, {
28
+ return React.createElement(StyledRedBadgeNext, {
32
29
  type: "quiet",
33
- role: "red",
34
- children: intl.formatMessage({
35
- id: 'materialQuiz.resultStatus.wrong'
36
- })
37
- });
30
+ role: "red"
31
+ }, intl.formatMessage({
32
+ id: 'materialQuiz.resultStatus.wrong'
33
+ }));
38
34
  case QuizResultStatus.Submitted:
39
- return jsx(BadgeNext, {
35
+ return React.createElement(BadgeNext, {
40
36
  type: "quiet",
41
- role: "primary",
42
- children: intl.formatMessage({
43
- id: 'materialQuiz.resultStatus.submitted'
44
- })
45
- });
37
+ role: "primary"
38
+ }, intl.formatMessage({
39
+ id: 'materialQuiz.resultStatus.submitted'
40
+ }));
46
41
  default:
47
42
  return null;
48
43
  }
@@ -1,32 +1,31 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
  import { StatusText } from '@elice/blocks';
3
3
  import { useRawEliceIntl } from '@elice/intl';
4
4
  import styled from 'styled-components';
5
5
  import { SUCCESS_TEXT_COLOR } from './constants/color.js';
6
6
 
7
- var StyledSuccessStatusText = styled(StatusText).withConfig({
7
+ const StyledSuccessStatusText = styled(StatusText).withConfig({
8
8
  componentId: "sc-1obyi4p-0"
9
9
  })(["color:", ";"], SUCCESS_TEXT_COLOR);
10
- var QuizSubmitStatusText = function QuizSubmitStatusText(_ref) {
11
- var status = _ref.status;
12
- var intl = useRawEliceIntl();
10
+ const QuizSubmitStatusText = ({
11
+ status
12
+ }) => {
13
+ const intl = useRawEliceIntl();
13
14
  switch (status) {
14
15
  case 'resolved':
15
- return jsx(StyledSuccessStatusText, {
16
+ return React.createElement(StyledSuccessStatusText, {
16
17
  role: "success",
17
- size: "small",
18
- children: intl.formatMessage({
19
- id: 'materialQuiz.submitStatus.success'
20
- })
21
- });
18
+ size: "small"
19
+ }, intl.formatMessage({
20
+ id: 'materialQuiz.submitStatus.success'
21
+ }));
22
22
  case 'rejected':
23
- return jsx(StatusText, {
23
+ return React.createElement(StatusText, {
24
24
  role: "danger",
25
- size: "small",
26
- children: intl.formatMessage({
27
- id: 'materialQuiz.submitStatus.failure'
28
- })
29
- });
25
+ size: "small"
26
+ }, intl.formatMessage({
27
+ id: 'materialQuiz.submitStatus.failure'
28
+ }));
30
29
  default:
31
30
  return null;
32
31
  }
@@ -1,9 +1,9 @@
1
1
  import { colors } from '@elice/mui-system';
2
2
 
3
- var CORRECT_TEXT_COLOR = colors.green[800];
4
- var CORRECT_BACKGROUND_COLOR = colors.green[50];
5
- var WRONG_TEXT_COLOR = colors.red[800];
6
- var WRONG_BACKGROUND_COLOR = colors.red[50];
7
- var SUCCESS_TEXT_COLOR = colors.green[400];
3
+ const CORRECT_TEXT_COLOR = colors.green[800];
4
+ const CORRECT_BACKGROUND_COLOR = colors.green[50];
5
+ const WRONG_TEXT_COLOR = colors.red[800];
6
+ const WRONG_BACKGROUND_COLOR = colors.red[50];
7
+ const SUCCESS_TEXT_COLOR = colors.green[400];
8
8
 
9
9
  export { CORRECT_BACKGROUND_COLOR, CORRECT_TEXT_COLOR, SUCCESS_TEXT_COLOR, WRONG_BACKGROUND_COLOR, WRONG_TEXT_COLOR };
@@ -31,7 +31,7 @@ interface DispatchContextType {
31
31
  setIsLongPassage: React.Dispatch<React.SetStateAction<boolean>>;
32
32
  setIsInitialLoading: React.Dispatch<React.SetStateAction<boolean>>;
33
33
  }
34
- declare function MaterialQuizProvider({ materialQuizId, userId, onSubmit, onDirty, onNext, children, }: MaterialQuizProviderProps): JSX.Element;
34
+ declare function MaterialQuizProvider({ materialQuizId, userId, onSubmit, onDirty, onNext, children, }: MaterialQuizProviderProps): React.JSX.Element;
35
35
  declare function useMaterialQuizState(): State;
36
36
  declare function useMaterialQuizDispatch(): DispatchContextType;
37
37
  export { MaterialQuizProvider, useMaterialQuizState, useMaterialQuizDispatch };