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

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, toConsumableArray as _toConsumableArray, 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 { base } from '@elice/design-tokens';
@@ -22,73 +20,62 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
22
20
  import QuizResultBadge from './QuizResultBadge.js';
23
21
  import QuizSubmitStatusText from './QuizSubmitStatusText.js';
24
22
 
25
- var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
26
- var hasInlinePassage = _ref.hasInlinePassage;
23
+ const MaterialQuizSelectMultiple = ({
24
+ hasInlinePassage
25
+ }) => {
27
26
  // context
28
- var _useMaterialQuizState = useMaterialQuizState(),
29
- course = _useMaterialQuizState.course,
30
- lecture = _useMaterialQuizState.lecture,
31
- materialQuiz = _useMaterialQuizState.materialQuiz,
32
- userId = _useMaterialQuizState.userId;
33
- var _useMaterialQuizDispa = useMaterialQuizDispatch(),
34
- onSubmit = _useMaterialQuizDispa.onSubmit,
35
- onNext = _useMaterialQuizDispa.onNext,
36
- refreshOrgMaterialQuiz = _useMaterialQuizDispa.refreshOrgMaterialQuiz,
37
- onDirty = _useMaterialQuizDispa.onDirty;
38
- var theme = useTheme();
27
+ const {
28
+ course,
29
+ lecture,
30
+ materialQuiz,
31
+ userId
32
+ } = useMaterialQuizState();
33
+ const {
34
+ onSubmit,
35
+ onNext,
36
+ refreshOrgMaterialQuiz,
37
+ onDirty
38
+ } = useMaterialQuizDispatch();
39
+ const theme = useTheme();
39
40
  // state
40
- var intl = useRawEliceIntl();
41
- var _React$useState = React.useState([]),
42
- _React$useState2 = _slicedToArray(_React$useState, 2),
43
- selectedAnswer = _React$useState2[0],
44
- setSelectedAnswer = _React$useState2[1];
45
- var _React$useState3 = React.useState(),
46
- _React$useState4 = _slicedToArray(_React$useState3, 2),
47
- materialQuizResponse = _React$useState4[0],
48
- setMaterialQuizResponse = _React$useState4[1];
49
- var _React$useState5 = React.useState('idle'),
50
- _React$useState6 = _slicedToArray(_React$useState5, 2),
51
- submitStatus = _React$useState6[0],
52
- setSubmitStatus = _React$useState6[1];
53
- var _useCaculatePassage = useCaculatePassage(),
54
- containerRef = _useCaculatePassage.containerRef,
55
- questionRef = _useCaculatePassage.questionRef;
41
+ const intl = useRawEliceIntl();
42
+ const [selectedAnswer, setSelectedAnswer] = React.useState([]);
43
+ const [materialQuizResponse, setMaterialQuizResponse] = React.useState();
44
+ const [submitStatus, setSubmitStatus] = React.useState('idle');
45
+ const {
46
+ containerRef,
47
+ questionRef
48
+ } = useCaculatePassage();
56
49
  // Whether user has clicked any options
57
- var _React$useState7 = React.useState(false),
58
- _React$useState8 = _slicedToArray(_React$useState7, 2),
59
- isActive = _React$useState8[0],
60
- setIsActive = _React$useState8[1];
61
- var _React$useState9 = React.useState(false),
62
- _React$useState10 = _slicedToArray(_React$useState9, 2),
63
- hasSubmitted = _React$useState10[0],
64
- setHasSubmitted = _React$useState10[1];
65
- var isNextActive = hasSubmitted && typeof onNext === 'function';
66
- var isDisabled = selectedAnswer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
50
+ const [isActive, setIsActive] = React.useState(false);
51
+ const [hasSubmitted, setHasSubmitted] = React.useState(false);
52
+ const isNextActive = hasSubmitted && typeof onNext === 'function';
53
+ const isDisabled = selectedAnswer.length === 0 || checkUserLectureTestEnded(lecture) || !!userId;
67
54
  // answer select handler
68
- var handleAnswerSelect = function handleAnswerSelect(index) {
55
+ const handleAnswerSelect = index => {
69
56
  if (checkUserLectureTestEnded(lecture) || !!userId) {
70
57
  return;
71
58
  }
72
59
  onDirty(true);
73
60
  setHasSubmitted(false);
74
61
  setIsActive(true);
75
- setSelectedAnswer(function (prevState) {
76
- var newState = prevState.includes(index) ? prevState.filter(function (ident) {
77
- return ident !== index;
78
- }) : [].concat(_toConsumableArray(prevState), [index]);
62
+ setSelectedAnswer(prevState => {
63
+ const newState = prevState.includes(index) ? prevState.filter(ident => ident !== index) : [...prevState, index];
79
64
  return newState;
80
65
  });
81
66
  };
82
67
  // quiz response fetcher
83
- React.useEffect(function () {
68
+ React.useEffect(() => {
84
69
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
85
- var controller = new AbortController();
86
- var signal = controller.signal;
70
+ const controller = new AbortController();
71
+ const {
72
+ signal
73
+ } = controller;
87
74
  getOrgMaterialQuizResponseGet({
88
75
  quizResponseId: materialQuiz.lastQuizResponseId
89
76
  }, {
90
- signal: signal
91
- }).then(function (response) {
77
+ signal
78
+ }).then(response => {
92
79
  setMaterialQuizResponse(response.quizResponse);
93
80
  // when user submitted answers and not get the result yet, update selected options (for example, test quiz)
94
81
  // when is is a survey type quiz
@@ -98,19 +85,19 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
98
85
  setSelectedAnswer(response.quizResponse.answer);
99
86
  }
100
87
  setSelectedAnswer(response.quizResponse.answer);
101
- }).catch(function (error) {
88
+ }).catch(error => {
102
89
  console.error(error);
103
90
  });
104
- return function () {
105
- return controller.abort();
106
- };
91
+ return () => controller.abort();
107
92
  }
108
93
  }, [materialQuiz, userId]);
109
94
  // quiz response fetcher
110
- React.useEffect(function () {
95
+ React.useEffect(() => {
111
96
  if (userId && materialQuiz) {
112
- var controller = new AbortController();
113
- var signal = controller.signal;
97
+ const controller = new AbortController();
98
+ const {
99
+ signal
100
+ } = controller;
114
101
  getOrgMaterialQuizResponseList({
115
102
  materialQuizId: materialQuiz.id,
116
103
  filterUserIds: [userId],
@@ -119,84 +106,58 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
119
106
  offset: 0,
120
107
  count: 1
121
108
  }, {
122
- signal: signal
123
- }).then(function (response) {
124
- var quizResponse = response.quizResponses[0];
125
- var quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
109
+ signal
110
+ }).then(response => {
111
+ const quizResponse = response.quizResponses[0];
112
+ const quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
126
113
  setMaterialQuizResponse(quizResponse);
127
114
  setSelectedAnswer(Array.isArray(quizResponseAnswer) ? quizResponseAnswer : []);
128
- }).catch(function (error) {
115
+ }).catch(error => {
129
116
  console.error(error);
130
117
  });
131
- return function () {
132
- return controller.abort();
133
- };
118
+ return () => controller.abort();
134
119
  }
135
120
  }, [materialQuiz, userId]);
136
121
  // submit handler
137
- var handleSubmit = /*#__PURE__*/function () {
138
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
139
- var _yield$postOrgMateria, quizResponseId, _yield$getOrgMaterial, quizResponse;
140
- return _regeneratorRuntime().wrap(function _callee$(_context) {
141
- while (1) switch (_context.prev = _context.next) {
142
- case 0:
143
- if (materialQuiz) {
144
- _context.next = 2;
145
- break;
146
- }
147
- return _context.abrupt("return");
148
- case 2:
149
- setSubmitStatus('pending');
150
- _context.prev = 3;
151
- _context.next = 6;
152
- return postOrgMaterialQuizResponseAdd({
153
- materialQuizId: materialQuiz.id,
154
- answer: selectedAnswer
155
- });
156
- case 6:
157
- _yield$postOrgMateria = _context.sent;
158
- quizResponseId = _yield$postOrgMateria.quizResponseId;
159
- _context.next = 10;
160
- return getOrgMaterialQuizResponseGet({
161
- quizResponseId: quizResponseId
162
- });
163
- case 10:
164
- _yield$getOrgMaterial = _context.sent;
165
- quizResponse = _yield$getOrgMaterial.quizResponse;
166
- setIsActive(false);
167
- setMaterialQuizResponse(quizResponse);
168
- void refreshOrgMaterialQuiz();
169
- onSubmit(true, getQuizResult(quizResponse));
170
- setSubmitStatus('resolved');
171
- setHasSubmitted(true);
172
- onDirty(false);
173
- _context.next = 26;
174
- break;
175
- case 21:
176
- _context.prev = 21;
177
- _context.t0 = _context["catch"](3);
178
- console.error(_context.t0);
179
- onSubmit(false);
180
- setSubmitStatus('rejected');
181
- case 26:
182
- case "end":
183
- return _context.stop();
184
- }
185
- }, _callee, null, [[3, 21]]);
186
- }));
187
- return function handleSubmit() {
188
- return _ref2.apply(this, arguments);
189
- };
190
- }();
191
- return jsx(QuestionBox, {
122
+ const handleSubmit = async () => {
123
+ if (!materialQuiz) {
124
+ return;
125
+ }
126
+ setSubmitStatus('pending');
127
+ try {
128
+ const {
129
+ quizResponseId
130
+ } = await postOrgMaterialQuizResponseAdd({
131
+ materialQuizId: materialQuiz.id,
132
+ answer: selectedAnswer
133
+ });
134
+ const {
135
+ quizResponse
136
+ } = await getOrgMaterialQuizResponseGet({
137
+ quizResponseId
138
+ });
139
+ setIsActive(false);
140
+ setMaterialQuizResponse(quizResponse);
141
+ void refreshOrgMaterialQuiz();
142
+ onSubmit(true, getQuizResult(quizResponse));
143
+ setSubmitStatus('resolved');
144
+ setHasSubmitted(true);
145
+ onDirty(false);
146
+ } catch (error) {
147
+ console.error(error);
148
+ onSubmit(false);
149
+ setSubmitStatus('rejected');
150
+ }
151
+ };
152
+ return React.createElement(QuestionBox, {
192
153
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
193
154
  titlePrefix: "Q.",
194
155
  onNext: onNext,
195
156
  isNextActive: isNextActive,
196
- submitResult: jsx(QuizResultBadge, {
157
+ submitResult: React.createElement(QuizResultBadge, {
197
158
  materialQuizResponse: materialQuizResponse
198
159
  }),
199
- submitStatus: jsx(QuizSubmitStatusText, {
160
+ submitStatus: React.createElement(QuizSubmitStatusText, {
200
161
  status: submitStatus
201
162
  }),
202
163
  bodyContainerRef: containerRef,
@@ -214,54 +175,49 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
214
175
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
215
176
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
216
177
  }
217
- }],
218
- children: jsxs(Stack, {
219
- height: "100%",
220
- gap: "1rem",
221
- children: [hasInlinePassage && jsx("div", {
222
- id: MATERIAL_QUIZ_PASSIVE_ID,
223
- ref: questionRef,
224
- children: jsx(MaterialQuizInfo, {
225
- renderWithBox: false
226
- })
227
- }), jsxs("div", {
228
- id: MATERIAL_QUIZ_ANSWER_ID,
229
- children: [jsx(QuestionCheckbox, {
230
- onSelect: handleAnswerSelect,
231
- selectedOptions: selectedAnswer,
232
- disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId,
233
- children: (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) && course ? materialQuiz.options.map(function (option, index) {
234
- var _a;
235
- var getIsSelected = function getIsSelected(index, materialQuizResponse) {
236
- var _a;
237
- if (!materialQuizResponse) {
238
- return false;
239
- }
240
- var materialQuizResponseAnswer = materialQuizResponse.answer;
241
- return (_a = materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
242
- };
243
- var status = getOptionStatus({
244
- materialQuizResponse: materialQuizResponse,
245
- isSelected: getIsSelected(index, materialQuizResponse),
246
- isActive: isActive
247
- });
248
- var materialQuizAnswerInfo = materialQuiz.answerInfo;
249
- return jsx(QuestionCheckboxOption, {
250
- value: index,
251
- status: status,
252
- isAnswer: !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index),
253
- children: course.preference.renderMarkdownInQuizOptions ? jsx(StyledMarkdown, {
254
- children: (_a = option === null || option === void 0 ? void 0 : option.content) !== null && _a !== void 0 ? _a : '',
255
- paddingx: 0,
256
- paddingy: 0,
257
- dark: true
258
- }) : option === null || option === void 0 ? void 0 : option.content
259
- }, index);
260
- }) : null
261
- }), jsx(MaterialQuizAnswerExplanation, {})]
262
- })]
263
- })
264
- });
178
+ }]
179
+ }, React.createElement(Stack, {
180
+ height: "100%",
181
+ gap: "1rem"
182
+ }, hasInlinePassage && React.createElement("div", {
183
+ id: MATERIAL_QUIZ_PASSIVE_ID,
184
+ ref: questionRef
185
+ }, React.createElement(MaterialQuizInfo, {
186
+ renderWithBox: false
187
+ })), React.createElement("div", {
188
+ id: MATERIAL_QUIZ_ANSWER_ID
189
+ }, React.createElement(QuestionCheckbox, {
190
+ onSelect: handleAnswerSelect,
191
+ selectedOptions: selectedAnswer,
192
+ disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId
193
+ }, (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) && course ? materialQuiz.options.map((option, index) => {
194
+ var _a;
195
+ const getIsSelected = (index, materialQuizResponse) => {
196
+ var _a;
197
+ if (!materialQuizResponse) {
198
+ return false;
199
+ }
200
+ const materialQuizResponseAnswer = materialQuizResponse.answer;
201
+ return (_a = materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
202
+ };
203
+ const status = getOptionStatus({
204
+ materialQuizResponse,
205
+ isSelected: getIsSelected(index, materialQuizResponse),
206
+ isActive
207
+ });
208
+ const materialQuizAnswerInfo = materialQuiz.answerInfo;
209
+ return React.createElement(QuestionCheckboxOption, {
210
+ key: index,
211
+ value: index,
212
+ status: status,
213
+ isAnswer: !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index)
214
+ }, course.preference.renderMarkdownInQuizOptions ? React.createElement(StyledMarkdown, {
215
+ children: (_a = option === null || option === void 0 ? void 0 : option.content) !== null && _a !== void 0 ? _a : '',
216
+ paddingx: 0,
217
+ paddingy: 0,
218
+ dark: true
219
+ }) : option === null || option === void 0 ? void 0 : option.content);
220
+ }) : null), React.createElement(MaterialQuizAnswerExplanation, null))));
265
221
  };
266
222
 
267
223
  export { MaterialQuizSelectMultiple as default };