@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, 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,50 +20,39 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
22
20
  import QuizResultBadge from './QuizResultBadge.js';
23
21
  import QuizSubmitStatusText from './QuizSubmitStatusText.js';
24
22
 
25
- var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
26
- var hasInlinePassage = _ref.hasInlinePassage;
23
+ const MaterialQuizSelectOne = ({
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 === undefined || 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 === undefined || 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
  }
@@ -75,31 +62,33 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
75
62
  onDirty(true);
76
63
  };
77
64
  // quiz response fetcher
78
- React.useEffect(function () {
65
+ React.useEffect(() => {
79
66
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
80
- var controller = new AbortController();
81
- var signal = controller.signal;
67
+ const controller = new AbortController();
68
+ const {
69
+ signal
70
+ } = controller;
82
71
  getOrgMaterialQuizResponseGet({
83
72
  quizResponseId: materialQuiz.lastQuizResponseId
84
73
  }, {
85
- signal: signal
86
- }).then(function (response) {
87
- var quizResponseAnswer = response.quizResponse.answer;
74
+ signal
75
+ }).then(response => {
76
+ const quizResponseAnswer = response.quizResponse.answer;
88
77
  setMaterialQuizResponse(response.quizResponse);
89
78
  setSelectedAnswer(typeof response.quizResponse.answer === 'string' ? undefined : quizResponseAnswer[0]);
90
- }).catch(function (error) {
79
+ }).catch(error => {
91
80
  console.error(error);
92
81
  });
93
- return function () {
94
- return controller.abort();
95
- };
82
+ return () => controller.abort();
96
83
  }
97
84
  }, [materialQuiz, userId]);
98
85
  // quiz response fetcher
99
- React.useEffect(function () {
86
+ React.useEffect(() => {
100
87
  if (userId && materialQuiz) {
101
- var controller = new AbortController();
102
- var signal = controller.signal;
88
+ const controller = new AbortController();
89
+ const {
90
+ signal
91
+ } = controller;
103
92
  getOrgMaterialQuizResponseList({
104
93
  materialQuizId: materialQuiz.id,
105
94
  filterUserIds: [userId],
@@ -108,84 +97,58 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
108
97
  offset: 0,
109
98
  count: 1
110
99
  }, {
111
- signal: signal
112
- }).then(function (response) {
113
- var quizResponse = response.quizResponses[0];
114
- var quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
100
+ signal
101
+ }).then(response => {
102
+ const quizResponse = response.quizResponses[0];
103
+ const quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
115
104
  setMaterialQuizResponse(quizResponse);
116
105
  setSelectedAnswer(quizResponseAnswer === null || quizResponseAnswer === void 0 ? void 0 : quizResponseAnswer[0]);
117
- }).catch(function (error) {
106
+ }).catch(error => {
118
107
  console.error(error);
119
108
  });
120
- return function () {
121
- return controller.abort();
122
- };
109
+ return () => controller.abort();
123
110
  }
124
111
  }, [materialQuiz, userId]);
125
112
  // submit handler
126
- var handleSubmit = /*#__PURE__*/function () {
127
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
128
- var _yield$postOrgMateria, quizResponseId, _yield$getOrgMaterial, quizResponse;
129
- return _regeneratorRuntime().wrap(function _callee$(_context) {
130
- while (1) switch (_context.prev = _context.next) {
131
- case 0:
132
- if (!(!materialQuiz || selectedAnswer === undefined)) {
133
- _context.next = 2;
134
- break;
135
- }
136
- return _context.abrupt("return");
137
- case 2:
138
- setSubmitStatus('pending');
139
- _context.prev = 3;
140
- _context.next = 6;
141
- return postOrgMaterialQuizResponseAdd({
142
- materialQuizId: materialQuiz.id,
143
- answer: [selectedAnswer]
144
- });
145
- case 6:
146
- _yield$postOrgMateria = _context.sent;
147
- quizResponseId = _yield$postOrgMateria.quizResponseId;
148
- _context.next = 10;
149
- return getOrgMaterialQuizResponseGet({
150
- quizResponseId: quizResponseId
151
- });
152
- case 10:
153
- _yield$getOrgMaterial = _context.sent;
154
- quizResponse = _yield$getOrgMaterial.quizResponse;
155
- setIsActive(false);
156
- setMaterialQuizResponse(quizResponse);
157
- void refreshOrgMaterialQuiz();
158
- onSubmit(true, getQuizResult(quizResponse));
159
- setSubmitStatus('resolved');
160
- setHasSubmitted(true);
161
- onDirty(false);
162
- _context.next = 26;
163
- break;
164
- case 21:
165
- _context.prev = 21;
166
- _context.t0 = _context["catch"](3);
167
- console.error(_context.t0);
168
- onSubmit(false);
169
- setSubmitStatus('rejected');
170
- case 26:
171
- case "end":
172
- return _context.stop();
173
- }
174
- }, _callee, null, [[3, 21]]);
175
- }));
176
- return function handleSubmit() {
177
- return _ref2.apply(this, arguments);
178
- };
179
- }();
180
- return jsx(QuestionBox, {
113
+ const handleSubmit = async () => {
114
+ if (!materialQuiz || selectedAnswer === undefined) {
115
+ return;
116
+ }
117
+ setSubmitStatus('pending');
118
+ try {
119
+ const {
120
+ quizResponseId
121
+ } = await postOrgMaterialQuizResponseAdd({
122
+ materialQuizId: materialQuiz.id,
123
+ answer: [selectedAnswer]
124
+ });
125
+ const {
126
+ quizResponse
127
+ } = await getOrgMaterialQuizResponseGet({
128
+ quizResponseId
129
+ });
130
+ setIsActive(false);
131
+ setMaterialQuizResponse(quizResponse);
132
+ void refreshOrgMaterialQuiz();
133
+ onSubmit(true, getQuizResult(quizResponse));
134
+ setSubmitStatus('resolved');
135
+ setHasSubmitted(true);
136
+ onDirty(false);
137
+ } catch (error) {
138
+ console.error(error);
139
+ onSubmit(false);
140
+ setSubmitStatus('rejected');
141
+ }
142
+ };
143
+ return React.createElement(QuestionBox, {
181
144
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
182
145
  titlePrefix: "Q.",
183
146
  onNext: onNext,
184
147
  isNextActive: isNextActive,
185
- submitStatus: jsx(QuizSubmitStatusText, {
148
+ submitStatus: React.createElement(QuizSubmitStatusText, {
186
149
  status: submitStatus
187
150
  }),
188
- submitResult: jsx(QuizResultBadge, {
151
+ submitResult: React.createElement(QuizResultBadge, {
189
152
  materialQuizResponse: materialQuizResponse
190
153
  }),
191
154
  bodyContainerRef: containerRef,
@@ -203,54 +166,49 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_ref) {
203
166
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
204
167
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
205
168
  }
206
- }],
207
- children: jsxs(Stack, {
208
- height: "100%",
209
- gap: "1rem",
210
- children: [hasInlinePassage && jsx("div", {
211
- id: MATERIAL_QUIZ_PASSIVE_ID,
212
- ref: questionRef,
213
- children: jsx(MaterialQuizInfo, {
214
- renderWithBox: false
215
- })
216
- }), materialQuiz ? jsxs("div", {
217
- id: MATERIAL_QUIZ_ANSWER_ID,
218
- children: [jsx(QuestionRadio, {
219
- selectedValue: selectedAnswer,
220
- onSelect: handleAnswerSelect,
221
- disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId,
222
- children: materialQuiz.options && course ? materialQuiz.options.map(function (option, index) {
223
- var _a, _b;
224
- var getIsSelected = function getIsSelected(index, materialQuizResponse) {
225
- var _a;
226
- if (!materialQuizResponse) {
227
- return false;
228
- }
229
- var materialQuizResponseAnswer = materialQuizResponse.answer;
230
- return (_a = materialQuizResponseAnswer === null || materialQuizResponseAnswer === void 0 ? void 0 : materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
231
- };
232
- var status = getOptionStatus({
233
- materialQuizResponse: materialQuizResponse,
234
- isSelected: getIsSelected(index, materialQuizResponse),
235
- isActive: isActive
236
- });
237
- var materialQuizAnswerInfo = materialQuiz.answerInfo;
238
- return jsx(QuestionRadioOption, {
239
- value: index,
240
- status: status,
241
- isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index)) !== null && _a !== void 0 ? _a : false,
242
- children: course.preference.renderMarkdownInQuizOptions ? jsx(StyledMarkdown, {
243
- children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
244
- paddingx: 0,
245
- paddingy: 0,
246
- dark: true
247
- }) : option === null || option === void 0 ? void 0 : option.content
248
- }, index);
249
- }) : null
250
- }), jsx(MaterialQuizAnswerExplanation, {})]
251
- }) : null]
252
- })
253
- });
169
+ }]
170
+ }, React.createElement(Stack, {
171
+ height: "100%",
172
+ gap: "1rem"
173
+ }, hasInlinePassage && React.createElement("div", {
174
+ id: MATERIAL_QUIZ_PASSIVE_ID,
175
+ ref: questionRef
176
+ }, React.createElement(MaterialQuizInfo, {
177
+ renderWithBox: false
178
+ })), materialQuiz ? React.createElement("div", {
179
+ id: MATERIAL_QUIZ_ANSWER_ID
180
+ }, React.createElement(QuestionRadio, {
181
+ selectedValue: selectedAnswer,
182
+ onSelect: handleAnswerSelect,
183
+ disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId
184
+ }, materialQuiz.options && course ? materialQuiz.options.map((option, index) => {
185
+ var _a, _b;
186
+ const getIsSelected = (index, materialQuizResponse) => {
187
+ var _a;
188
+ if (!materialQuizResponse) {
189
+ return false;
190
+ }
191
+ const materialQuizResponseAnswer = materialQuizResponse.answer;
192
+ return (_a = materialQuizResponseAnswer === null || materialQuizResponseAnswer === void 0 ? void 0 : materialQuizResponseAnswer.includes(index)) !== null && _a !== void 0 ? _a : false;
193
+ };
194
+ const status = getOptionStatus({
195
+ materialQuizResponse,
196
+ isSelected: getIsSelected(index, materialQuizResponse),
197
+ isActive
198
+ });
199
+ const materialQuizAnswerInfo = materialQuiz.answerInfo;
200
+ return React.createElement(QuestionRadioOption, {
201
+ key: index,
202
+ value: index,
203
+ status: status,
204
+ isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index)) !== null && _a !== void 0 ? _a : false
205
+ }, course.preference.renderMarkdownInQuizOptions ? React.createElement(StyledMarkdown, {
206
+ children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
207
+ paddingx: 0,
208
+ paddingy: 0,
209
+ dark: true
210
+ }) : option === null || option === void 0 ? void 0 : option.content);
211
+ }) : null), React.createElement(MaterialQuizAnswerExplanation, null)) : null));
254
212
  };
255
213
 
256
214
  export { MaterialQuizSelectOne as default };
@@ -1,53 +1,50 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
  import { Shimmer, Vspace } from '@elice/blocks';
3
3
  import { base } from '@elice/design-tokens';
4
4
  import styled from 'styled-components';
5
5
  import { useMaterialQuizState } from './context/MaterialQuizContext.js';
6
6
 
7
- var StyledShimmer = styled.div.withConfig({
7
+ const StyledShimmer = styled.div.withConfig({
8
8
  componentId: "sc-10uz5tw-0"
9
- })(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], function (_ref) {
10
- var vertical = _ref.vertical;
11
- return vertical ? '0' : '8px';
12
- });
13
- var StyledShimmerBody = styled.div.withConfig({
9
+ })(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], ({
10
+ vertical
11
+ }) => vertical ? '0' : '8px');
12
+ const StyledShimmerBody = styled.div.withConfig({
14
13
  componentId: "sc-10uz5tw-1"
15
14
  })(["padding:1.5rem;background-color:", ";overflow-y:auto;height:100%;"], base.color.navy8);
16
- var MaterialQuizShimmer = function MaterialQuizShimmer() {
17
- var _useMaterialQuizState = useMaterialQuizState(),
18
- vertical = _useMaterialQuizState.vertical;
19
- return jsx(StyledShimmer, {
20
- vertical: vertical,
21
- children: jsxs(StyledShimmerBody, {
22
- children: [jsx(Shimmer, {
23
- dark: true,
24
- borderRadius: '4px',
25
- width: "80%",
26
- height: '40px'
27
- }), jsx(Vspace, {
28
- height: 1
29
- }), jsx(Shimmer, {
30
- dark: true,
31
- borderRadius: '4px',
32
- width: "100%",
33
- height: '40px'
34
- }), jsx(Vspace, {
35
- height: 1
36
- }), jsx(Shimmer, {
37
- dark: true,
38
- borderRadius: '4px',
39
- width: "100%",
40
- height: '40px'
41
- }), jsx(Vspace, {
42
- height: 1
43
- }), jsx(Shimmer, {
44
- dark: true,
45
- borderRadius: '4px',
46
- width: "100%",
47
- height: '40px'
48
- })]
49
- })
50
- });
15
+ const MaterialQuizShimmer = () => {
16
+ const {
17
+ vertical
18
+ } = useMaterialQuizState();
19
+ return React.createElement(StyledShimmer, {
20
+ vertical: vertical
21
+ }, React.createElement(StyledShimmerBody, null, React.createElement(Shimmer, {
22
+ dark: true,
23
+ borderRadius: '4px',
24
+ width: "80%",
25
+ height: '40px'
26
+ }), React.createElement(Vspace, {
27
+ height: 1
28
+ }), React.createElement(Shimmer, {
29
+ dark: true,
30
+ borderRadius: '4px',
31
+ width: "100%",
32
+ height: '40px'
33
+ }), React.createElement(Vspace, {
34
+ height: 1
35
+ }), React.createElement(Shimmer, {
36
+ dark: true,
37
+ borderRadius: '4px',
38
+ width: "100%",
39
+ height: '40px'
40
+ }), React.createElement(Vspace, {
41
+ height: 1
42
+ }), React.createElement(Shimmer, {
43
+ dark: true,
44
+ borderRadius: '4px',
45
+ width: "100%",
46
+ height: '40px'
47
+ })));
51
48
  };
52
49
 
53
50
  export { MaterialQuizShimmer as default };