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