@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
@@ -2,6 +2,8 @@
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');
5
7
  var React = require('react');
6
8
  var apiClient = require('@elice/api-client');
7
9
  var blocks = require('@elice/blocks');
@@ -19,69 +21,81 @@ var MaterialQuizInfo = require('./MaterialQuizInfo.js');
19
21
  var QuizResultBadge = require('./QuizResultBadge.js');
20
22
  var QuizSubmitStatusText = require('./QuizSubmitStatusText.js');
21
23
 
22
- const StyledTextarea = styled.textarea.withConfig({
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({
23
30
  componentId: "sc-186cnpj-0"
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({
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({
28
36
  componentId: "sc-186cnpj-1"
29
37
  })(["font-size:0.875rem;margin-bottom:0.5rem;color:", ";"], designTokens.base.color.navy1);
30
- const MaterialQuizText = ({
31
- hasInlinePassage
32
- }) => {
38
+ var MaterialQuizText = function MaterialQuizText(_ref2) {
39
+ var hasInlinePassage = _ref2.hasInlinePassage;
33
40
  // context
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();
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();
46
51
  // state
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;
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;
58
74
  // quiz response fetcher
59
- React.useEffect(() => {
75
+ React__default.default.useEffect(function () {
60
76
  if (!userId && (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.lastQuizResponseId)) {
61
- const controller = new AbortController();
62
- const {
63
- signal
64
- } = controller;
77
+ var controller = new AbortController();
78
+ var signal = controller.signal;
65
79
  apiClient.getOrgMaterialQuizResponseGet({
66
80
  quizResponseId: materialQuiz.lastQuizResponseId
67
81
  }, {
68
- signal
69
- }).then(response => {
82
+ signal: signal
83
+ }).then(function (response) {
70
84
  setMaterialQuizResponse(response.quizResponse);
71
85
  setAnswer(response.quizResponse.answer);
72
- }).catch(error => {
86
+ }).catch(function (error) {
73
87
  console.error(error);
74
88
  });
75
- return () => controller.abort();
89
+ return function () {
90
+ return controller.abort();
91
+ };
76
92
  }
77
93
  }, [materialQuiz, userId]);
78
94
  // quiz response fetcher
79
- React.useEffect(() => {
95
+ React__default.default.useEffect(function () {
80
96
  if (userId && materialQuiz) {
81
- const controller = new AbortController();
82
- const {
83
- signal
84
- } = controller;
97
+ var controller = new AbortController();
98
+ var signal = controller.signal;
85
99
  apiClient.getOrgMaterialQuizResponseList({
86
100
  materialQuizId: materialQuiz.id,
87
101
  filterUserIds: [userId],
@@ -90,48 +104,74 @@ const MaterialQuizText = ({
90
104
  offset: 0,
91
105
  count: 1
92
106
  }, {
93
- signal
94
- }).then(response => {
95
- const quizResponse = response.quizResponses[0];
107
+ signal: signal
108
+ }).then(function (response) {
109
+ var quizResponse = response.quizResponses[0];
96
110
  setMaterialQuizResponse(quizResponse);
97
111
  setAnswer(typeof (quizResponse === null || quizResponse === void 0 ? void 0 : quizResponse.answer) === 'string' ? quizResponse.answer : '');
98
- }).catch(error => {
112
+ }).catch(function (error) {
99
113
  console.error(error);
100
114
  });
101
- return () => controller.abort();
115
+ return function () {
116
+ return controller.abort();
117
+ };
102
118
  }
103
119
  }, [materialQuiz, userId]);
104
120
  // submit handler
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 = {
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 = {
135
175
  type: 'text',
136
176
  autoFocus: answer.length === 0,
137
177
  disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId,
@@ -139,20 +179,20 @@ const MaterialQuizText = ({
139
179
  id: 'materialQuiz.text.placeholder'
140
180
  }),
141
181
  value: answer,
142
- onChange: e => {
182
+ onChange: function onChange(e) {
143
183
  setHasSubmitted(false);
144
184
  setAnswer(e.target.value);
145
185
  onDirty(true);
146
186
  }
147
187
  };
148
- return React.createElement(QuestionBox.default, {
188
+ return jsxRuntime.jsx(QuestionBox.default, {
149
189
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
150
190
  titlePrefix: "Q.",
151
191
  onNext: onNext,
152
- submitResult: React.createElement(QuizResultBadge.default, {
192
+ submitResult: jsxRuntime.jsx(QuizResultBadge.default, {
153
193
  materialQuizResponse: materialQuizResponse
154
194
  }),
155
- submitStatus: React.createElement(QuizSubmitStatusText.default, {
195
+ submitStatus: jsxRuntime.jsx(QuizSubmitStatusText.default, {
156
196
  status: submitStatus
157
197
  }),
158
198
  isNextActive: isNextActive,
@@ -171,37 +211,45 @@ const MaterialQuizText = ({
171
211
  backgroundColor: isNextActive ? theme.palette.secondary.main : isDisabled ? designTokens.base.color.gray6 : theme.palette.primary.main,
172
212
  color: isNextActive ? theme.palette.secondary.contrastText : isDisabled ? designTokens.base.color.gray3 : theme.palette.primary.contrastText
173
213
  }
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)));
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
+ });
205
253
  };
206
254
 
207
255
  exports.default = MaterialQuizText;
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var jsxRuntime = require('react/jsx-runtime');
5
6
  var React = require('react');
6
7
  var blocks = require('@elice/blocks');
7
8
  var intl = require('@elice/intl');
@@ -9,39 +10,48 @@ var styled = require('styled-components');
9
10
  var index = require('../../helpers/index.js');
10
11
  var color = require('./constants/color.js');
11
12
 
12
- const StyledGreenBadgeNext = styled(blocks.BadgeNext).withConfig({
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({
13
19
  componentId: "sc-1iksspv-0"
14
20
  })(["background-color:", ";color:", ";"], color.CORRECT_BACKGROUND_COLOR, color.CORRECT_TEXT_COLOR);
15
- const StyledRedBadgeNext = styled(blocks.BadgeNext).withConfig({
21
+ var StyledRedBadgeNext = styled__default.default(blocks.BadgeNext).withConfig({
16
22
  componentId: "sc-1iksspv-1"
17
23
  })(["background-color:", ";color:", ";"], color.WRONG_BACKGROUND_COLOR, color.WRONG_TEXT_COLOR);
18
- const QuizResultBadge = ({
19
- materialQuizResponse
20
- }) => {
21
- const intl$1 = intl.useRawEliceIntl();
22
- const status = React.useMemo(() => index.getQuizResultStatus(materialQuizResponse), [materialQuizResponse]);
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]);
23
30
  switch (status) {
24
31
  case index.QuizResultStatus.Correct:
25
- return React.createElement(StyledGreenBadgeNext, {
32
+ return jsxRuntime.jsx(StyledGreenBadgeNext, {
26
33
  type: "quiet",
27
- role: "green"
28
- }, intl$1.formatMessage({
29
- id: 'materialQuiz.resultStatus.correct'
30
- }));
34
+ role: "green",
35
+ children: intl$1.formatMessage({
36
+ id: 'materialQuiz.resultStatus.correct'
37
+ })
38
+ });
31
39
  case index.QuizResultStatus.Wrong:
32
- return React.createElement(StyledRedBadgeNext, {
40
+ return jsxRuntime.jsx(StyledRedBadgeNext, {
33
41
  type: "quiet",
34
- role: "red"
35
- }, intl$1.formatMessage({
36
- id: 'materialQuiz.resultStatus.wrong'
37
- }));
42
+ role: "red",
43
+ children: intl$1.formatMessage({
44
+ id: 'materialQuiz.resultStatus.wrong'
45
+ })
46
+ });
38
47
  case index.QuizResultStatus.Submitted:
39
- return React.createElement(blocks.BadgeNext, {
48
+ return jsxRuntime.jsx(blocks.BadgeNext, {
40
49
  type: "quiet",
41
- role: "primary"
42
- }, intl$1.formatMessage({
43
- id: 'materialQuiz.resultStatus.submitted'
44
- }));
50
+ role: "primary",
51
+ children: intl$1.formatMessage({
52
+ id: 'materialQuiz.resultStatus.submitted'
53
+ })
54
+ });
45
55
  default:
46
56
  return null;
47
57
  }
@@ -2,34 +2,39 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
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
- const StyledSuccessStatusText = styled(blocks.StatusText).withConfig({
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({
12
16
  componentId: "sc-1obyi4p-0"
13
17
  })(["color:", ";"], color.SUCCESS_TEXT_COLOR);
14
- const QuizSubmitStatusText = ({
15
- status
16
- }) => {
17
- const intl$1 = intl.useRawEliceIntl();
18
+ var QuizSubmitStatusText = function QuizSubmitStatusText(_ref) {
19
+ var status = _ref.status;
20
+ var intl$1 = intl.useRawEliceIntl();
18
21
  switch (status) {
19
22
  case 'resolved':
20
- return React.createElement(StyledSuccessStatusText, {
23
+ return jsxRuntime.jsx(StyledSuccessStatusText, {
21
24
  role: "success",
22
- size: "small"
23
- }, intl$1.formatMessage({
24
- id: 'materialQuiz.submitStatus.success'
25
- }));
25
+ size: "small",
26
+ children: intl$1.formatMessage({
27
+ id: 'materialQuiz.submitStatus.success'
28
+ })
29
+ });
26
30
  case 'rejected':
27
- return React.createElement(blocks.StatusText, {
31
+ return jsxRuntime.jsx(blocks.StatusText, {
28
32
  role: "danger",
29
- size: "small"
30
- }, intl$1.formatMessage({
31
- id: 'materialQuiz.submitStatus.failure'
32
- }));
33
+ size: "small",
34
+ children: intl$1.formatMessage({
35
+ id: 'materialQuiz.submitStatus.failure'
36
+ })
37
+ });
33
38
  default:
34
39
  return null;
35
40
  }
@@ -2,11 +2,11 @@
2
2
 
3
3
  var muiSystem = require('@elice/mui-system');
4
4
 
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];
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];
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): 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 };