@elice/material-quiz 1.240718.0-trasncript.0 → 1.240718.0-trasncript.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/_virtual/_rollupPluginBabelHelpers.js +423 -0
  2. package/cjs/components/eb-sortable/EbDraggable.js +42 -33
  3. package/cjs/components/eb-sortable/EbDroppable.js +27 -20
  4. package/cjs/components/markdown-editor/index.d.ts +1 -2
  5. package/cjs/components/markdown-editor/index.js +19 -10
  6. package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
  7. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
  8. package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
  10. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
  11. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
  12. package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
  13. package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
  14. package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
  15. package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
  16. package/cjs/components/material-quiz/constants/color.js +5 -5
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  18. package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
  19. package/cjs/components/material-quiz/index.js +9 -0
  20. package/cjs/components/material-quiz/locales/index.js +13 -0
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
  22. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
  23. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
  24. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
  25. package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
  26. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
  27. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
  28. package/cjs/components/material-quiz-edit/context.js +8 -2
  29. package/cjs/components/material-quiz-edit/index.js +7 -0
  30. package/cjs/components/material-quiz-edit/locales/index.js +13 -0
  31. package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
  32. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
  33. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
  34. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
  35. package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
  36. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  37. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
  38. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
  39. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
  40. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
  41. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  42. package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
  43. package/cjs/components/shared/QuestionBox.js +198 -165
  44. package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
  45. package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
  46. package/cjs/components/shared/QuizDraggbleOption.js +65 -59
  47. package/cjs/components/shared/StyledMarkdown.js +5 -1
  48. package/cjs/components/shared/index.js +19 -0
  49. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
  50. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  51. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
  52. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
  53. package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
  54. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  55. package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
  56. package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
  57. package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
  58. package/cjs/components/shared/utils/mergeRefs.js +15 -6
  59. package/cjs/constant/element.js +3 -3
  60. package/cjs/constant/index.js +9 -0
  61. package/cjs/helpers/index.js +8 -10
  62. package/cjs/hooks/index.js +7 -0
  63. package/cjs/hooks/useCaculatePassage.js +21 -20
  64. package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
  65. package/es/components/eb-sortable/EbDraggable.js +37 -33
  66. package/es/components/eb-sortable/EbDroppable.js +22 -20
  67. package/es/components/markdown-editor/index.d.ts +1 -2
  68. package/es/components/markdown-editor/index.js +15 -10
  69. package/es/components/material-quiz/MaterialQuiz.js +109 -83
  70. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
  71. package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
  72. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
  73. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
  74. package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
  75. package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
  76. package/es/components/material-quiz/MaterialQuizText.js +158 -115
  77. package/es/components/material-quiz/QuizResultBadge.js +27 -22
  78. package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
  79. package/es/components/material-quiz/constants/color.js +5 -5
  80. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  81. package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
  82. package/es/components/material-quiz/index.js +2 -0
  83. package/es/components/material-quiz/locales/index.js +4 -0
  84. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
  85. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
  86. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
  87. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
  88. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  89. package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
  90. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
  91. package/es/components/material-quiz-edit/context.js +4 -2
  92. package/es/components/material-quiz-edit/index.js +1 -0
  93. package/es/components/material-quiz-edit/locales/index.js +4 -0
  94. package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
  95. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
  96. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
  97. package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
  98. package/es/components/material-quiz-edit/options/OptionText.js +86 -82
  99. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  100. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
  101. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
  102. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
  103. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
  104. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  105. package/es/components/material-quiz-edit/utils/editValue.js +17 -12
  106. package/es/components/shared/QuestionBox.js +192 -165
  107. package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
  108. package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
  109. package/es/components/shared/QuizDraggbleOption.js +61 -59
  110. package/es/components/shared/StyledMarkdown.js +1 -1
  111. package/es/components/shared/index.js +7 -0
  112. package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
  113. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  114. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
  115. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
  116. package/es/components/shared/question-radio/QuestionRadio.js +9 -7
  117. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  118. package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
  119. package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
  120. package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
  121. package/es/components/shared/utils/mergeRefs.js +15 -6
  122. package/es/constant/element.js +3 -3
  123. package/es/constant/index.js +1 -0
  124. package/es/helpers/index.js +8 -10
  125. package/es/hooks/index.js +1 -0
  126. package/es/hooks/useCaculatePassage.js +21 -20
  127. package/package.json +12 -15
@@ -1,3 +1,5 @@
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';
1
3
  import React from 'react';
2
4
  import { getOrgMaterialQuizResponseGet, getOrgMaterialQuizResponseList, postOrgMaterialQuizResponseAdd } from '@elice/api-client';
3
5
  import { base } from '@elice/design-tokens';
@@ -20,62 +22,73 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
20
22
  import QuizResultBadge from './QuizResultBadge.js';
21
23
  import QuizSubmitStatusText from './QuizSubmitStatusText.js';
22
24
 
23
- const MaterialQuizSelectMultiple = ({
24
- hasInlinePassage
25
- }) => {
25
+ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple(_ref) {
26
+ var hasInlinePassage = _ref.hasInlinePassage;
26
27
  // context
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();
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();
40
39
  // state
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();
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;
49
56
  // Whether user has clicked any options
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;
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;
54
67
  // answer select handler
55
- const handleAnswerSelect = index => {
68
+ var handleAnswerSelect = function handleAnswerSelect(index) {
56
69
  if (checkUserLectureTestEnded(lecture) || !!userId) {
57
70
  return;
58
71
  }
59
72
  onDirty(true);
60
73
  setHasSubmitted(false);
61
74
  setIsActive(true);
62
- setSelectedAnswer(prevState => {
63
- const newState = prevState.includes(index) ? prevState.filter(ident => ident !== index) : [...prevState, index];
75
+ setSelectedAnswer(function (prevState) {
76
+ var newState = prevState.includes(index) ? prevState.filter(function (ident) {
77
+ return ident !== index;
78
+ }) : [].concat(_toConsumableArray(prevState), [index]);
64
79
  return newState;
65
80
  });
66
81
  };
67
82
  // quiz response fetcher
68
- React.useEffect(() => {
83
+ React.useEffect(function () {
69
84
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
70
- const controller = new AbortController();
71
- const {
72
- signal
73
- } = controller;
85
+ var controller = new AbortController();
86
+ var signal = controller.signal;
74
87
  getOrgMaterialQuizResponseGet({
75
88
  quizResponseId: materialQuiz.lastQuizResponseId
76
89
  }, {
77
- signal
78
- }).then(response => {
90
+ signal: signal
91
+ }).then(function (response) {
79
92
  setMaterialQuizResponse(response.quizResponse);
80
93
  // when user submitted answers and not get the result yet, update selected options (for example, test quiz)
81
94
  // when is is a survey type quiz
@@ -85,19 +98,19 @@ const MaterialQuizSelectMultiple = ({
85
98
  setSelectedAnswer(response.quizResponse.answer);
86
99
  }
87
100
  setSelectedAnswer(response.quizResponse.answer);
88
- }).catch(error => {
101
+ }).catch(function (error) {
89
102
  console.error(error);
90
103
  });
91
- return () => controller.abort();
104
+ return function () {
105
+ return controller.abort();
106
+ };
92
107
  }
93
108
  }, [materialQuiz, userId]);
94
109
  // quiz response fetcher
95
- React.useEffect(() => {
110
+ React.useEffect(function () {
96
111
  if (userId && materialQuiz) {
97
- const controller = new AbortController();
98
- const {
99
- signal
100
- } = controller;
112
+ var controller = new AbortController();
113
+ var signal = controller.signal;
101
114
  getOrgMaterialQuizResponseList({
102
115
  materialQuizId: materialQuiz.id,
103
116
  filterUserIds: [userId],
@@ -106,58 +119,84 @@ const MaterialQuizSelectMultiple = ({
106
119
  offset: 0,
107
120
  count: 1
108
121
  }, {
109
- signal
110
- }).then(response => {
111
- const quizResponse = response.quizResponses[0];
112
- const quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
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;
113
126
  setMaterialQuizResponse(quizResponse);
114
127
  setSelectedAnswer(Array.isArray(quizResponseAnswer) ? quizResponseAnswer : []);
115
- }).catch(error => {
128
+ }).catch(function (error) {
116
129
  console.error(error);
117
130
  });
118
- return () => controller.abort();
131
+ return function () {
132
+ return controller.abort();
133
+ };
119
134
  }
120
135
  }, [materialQuiz, userId]);
121
136
  // submit handler
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, {
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, {
153
192
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
154
193
  titlePrefix: "Q.",
155
194
  onNext: onNext,
156
195
  isNextActive: isNextActive,
157
- submitResult: React.createElement(QuizResultBadge, {
196
+ submitResult: jsx(QuizResultBadge, {
158
197
  materialQuizResponse: materialQuizResponse
159
198
  }),
160
- submitStatus: React.createElement(QuizSubmitStatusText, {
199
+ submitStatus: jsx(QuizSubmitStatusText, {
161
200
  status: submitStatus
162
201
  }),
163
202
  bodyContainerRef: containerRef,
@@ -175,49 +214,54 @@ const MaterialQuizSelectMultiple = ({
175
214
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
176
215
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
177
216
  }
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))));
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
+ });
221
265
  };
222
266
 
223
267
  export { MaterialQuizSelectMultiple as default };