@elice/material-quiz 1.240718.0-trasncript.1 → 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, 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,39 +22,50 @@ import MaterialQuizInfo from './MaterialQuizInfo.js';
20
22
  import QuizResultBadge from './QuizResultBadge.js';
21
23
  import QuizSubmitStatusText from './QuizSubmitStatusText.js';
22
24
 
23
- const MaterialQuizSelectOne = ({
24
- hasInlinePassage
25
- }) => {
25
+ var MaterialQuizSelectOne = function MaterialQuizSelectOne(_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 === undefined || 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 === undefined || 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
  }
@@ -62,33 +75,31 @@ const MaterialQuizSelectOne = ({
62
75
  onDirty(true);
63
76
  };
64
77
  // quiz response fetcher
65
- React.useEffect(() => {
78
+ React.useEffect(function () {
66
79
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
67
- const controller = new AbortController();
68
- const {
69
- signal
70
- } = controller;
80
+ var controller = new AbortController();
81
+ var signal = controller.signal;
71
82
  getOrgMaterialQuizResponseGet({
72
83
  quizResponseId: materialQuiz.lastQuizResponseId
73
84
  }, {
74
- signal
75
- }).then(response => {
76
- const quizResponseAnswer = response.quizResponse.answer;
85
+ signal: signal
86
+ }).then(function (response) {
87
+ var quizResponseAnswer = response.quizResponse.answer;
77
88
  setMaterialQuizResponse(response.quizResponse);
78
89
  setSelectedAnswer(typeof response.quizResponse.answer === 'string' ? undefined : quizResponseAnswer[0]);
79
- }).catch(error => {
90
+ }).catch(function (error) {
80
91
  console.error(error);
81
92
  });
82
- return () => controller.abort();
93
+ return function () {
94
+ return controller.abort();
95
+ };
83
96
  }
84
97
  }, [materialQuiz, userId]);
85
98
  // quiz response fetcher
86
- React.useEffect(() => {
99
+ React.useEffect(function () {
87
100
  if (userId && materialQuiz) {
88
- const controller = new AbortController();
89
- const {
90
- signal
91
- } = controller;
101
+ var controller = new AbortController();
102
+ var signal = controller.signal;
92
103
  getOrgMaterialQuizResponseList({
93
104
  materialQuizId: materialQuiz.id,
94
105
  filterUserIds: [userId],
@@ -97,58 +108,84 @@ const MaterialQuizSelectOne = ({
97
108
  offset: 0,
98
109
  count: 1
99
110
  }, {
100
- signal
101
- }).then(response => {
102
- const quizResponse = response.quizResponses[0];
103
- const quizResponseAnswer = quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer;
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;
104
115
  setMaterialQuizResponse(quizResponse);
105
116
  setSelectedAnswer(quizResponseAnswer === null || quizResponseAnswer === void 0 ? void 0 : quizResponseAnswer[0]);
106
- }).catch(error => {
117
+ }).catch(function (error) {
107
118
  console.error(error);
108
119
  });
109
- return () => controller.abort();
120
+ return function () {
121
+ return controller.abort();
122
+ };
110
123
  }
111
124
  }, [materialQuiz, userId]);
112
125
  // submit handler
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, {
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, {
144
181
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
145
182
  titlePrefix: "Q.",
146
183
  onNext: onNext,
147
184
  isNextActive: isNextActive,
148
- submitStatus: React.createElement(QuizSubmitStatusText, {
185
+ submitStatus: jsx(QuizSubmitStatusText, {
149
186
  status: submitStatus
150
187
  }),
151
- submitResult: React.createElement(QuizResultBadge, {
188
+ submitResult: jsx(QuizResultBadge, {
152
189
  materialQuizResponse: materialQuizResponse
153
190
  }),
154
191
  bodyContainerRef: containerRef,
@@ -166,49 +203,54 @@ const MaterialQuizSelectOne = ({
166
203
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? base.color.gray6 : theme.palette.primary.main,
167
204
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? base.color.gray3 : theme.palette.primary.contrastText
168
205
  }
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));
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
+ });
212
254
  };
213
255
 
214
256
  export { MaterialQuizSelectOne as default };
@@ -1,50 +1,53 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
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
- const StyledShimmer = styled.div.withConfig({
7
+ var StyledShimmer = styled.div.withConfig({
8
8
  componentId: "sc-10uz5tw-0"
9
- })(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;"], ({
10
- vertical
11
- }) => vertical ? '0' : '8px');
12
- const StyledShimmerBody = styled.div.withConfig({
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({
13
14
  componentId: "sc-10uz5tw-1"
14
15
  })(["padding:1.5rem;background-color:", ";overflow-y:auto;height:100%;"], base.color.navy8);
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
- })));
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
+ });
48
51
  };
49
52
 
50
53
  export { MaterialQuizShimmer as default };