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