@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/cjs/components/eb-sortable/EbDraggable.js +33 -42
  2. package/cjs/components/eb-sortable/EbDroppable.js +20 -27
  3. package/cjs/components/markdown-editor/index.d.ts +2 -1
  4. package/cjs/components/markdown-editor/index.js +10 -19
  5. package/cjs/components/material-quiz/MaterialQuiz.js +83 -114
  6. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -36
  7. package/cjs/components/material-quiz/MaterialQuizInfo.js +149 -151
  8. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +127 -175
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +286 -360
  10. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +126 -172
  11. package/cjs/components/material-quiz/MaterialQuizShimmer.js +39 -46
  12. package/cjs/components/material-quiz/MaterialQuizText.js +115 -163
  13. package/cjs/components/material-quiz/QuizResultBadge.js +22 -32
  14. package/cjs/components/material-quiz/QuizSubmitStatusText.js +16 -21
  15. package/cjs/components/material-quiz/constants/color.js +5 -5
  16. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.js +93 -156
  18. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -259
  19. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -134
  20. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -130
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -64
  22. package/cjs/components/material-quiz/material-quiz-group/context/context.js +1 -5
  23. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +36 -47
  24. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +232 -280
  25. package/cjs/components/material-quiz-edit/context.js +2 -8
  26. package/cjs/components/material-quiz-edit/options/OptionEditor.js +46 -70
  27. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -174
  28. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -175
  29. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +144 -164
  30. package/cjs/components/material-quiz-edit/options/OptionText.js +82 -90
  31. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  32. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -156
  33. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +196 -288
  34. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -88
  35. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -108
  36. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  37. package/cjs/components/material-quiz-edit/utils/editValue.js +12 -21
  38. package/cjs/components/shared/QuestionBox.js +165 -198
  39. package/cjs/components/shared/QuizDraggbleDroppedOption.js +12 -11
  40. package/cjs/components/shared/QuizDraggbleDummyOption.js +16 -23
  41. package/cjs/components/shared/QuizDraggbleOption.js +59 -65
  42. package/cjs/components/shared/StyledMarkdown.js +1 -5
  43. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
  44. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  45. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
  46. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -59
  47. package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
  48. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  49. package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
  50. package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -52
  51. package/cjs/components/shared/utils/getQuestionStatusStyle.js +9 -7
  52. package/cjs/components/shared/utils/mergeRefs.js +6 -15
  53. package/cjs/constant/element.js +3 -3
  54. package/cjs/helpers/index.js +10 -8
  55. package/cjs/hooks/useCaculatePassage.js +20 -21
  56. package/es/components/eb-sortable/EbDraggable.js +33 -37
  57. package/es/components/eb-sortable/EbDroppable.js +20 -22
  58. package/es/components/markdown-editor/index.d.ts +2 -1
  59. package/es/components/markdown-editor/index.js +10 -15
  60. package/es/components/material-quiz/MaterialQuiz.js +83 -109
  61. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -32
  62. package/es/components/material-quiz/MaterialQuizInfo.js +150 -148
  63. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +127 -171
  64. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +287 -356
  65. package/es/components/material-quiz/MaterialQuizSelectOne.js +126 -168
  66. package/es/components/material-quiz/MaterialQuizShimmer.js +39 -42
  67. package/es/components/material-quiz/MaterialQuizText.js +115 -158
  68. package/es/components/material-quiz/QuizResultBadge.js +22 -27
  69. package/es/components/material-quiz/QuizSubmitStatusText.js +16 -17
  70. package/es/components/material-quiz/constants/color.js +5 -5
  71. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  72. package/es/components/material-quiz/context/MaterialQuizContext.js +94 -153
  73. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -253
  74. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -129
  75. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -125
  76. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -60
  77. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  78. package/es/components/material-quiz-edit/MaterialQuizEdit.js +36 -43
  79. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +229 -272
  80. package/es/components/material-quiz-edit/context.js +2 -4
  81. package/es/components/material-quiz-edit/options/OptionEditor.js +46 -64
  82. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -170
  83. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -171
  84. package/es/components/material-quiz-edit/options/OptionSelectOne.js +144 -159
  85. package/es/components/material-quiz-edit/options/OptionText.js +82 -86
  86. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
  87. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -151
  88. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +197 -283
  89. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -83
  90. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -103
  91. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
  92. package/es/components/material-quiz-edit/utils/editValue.js +12 -17
  93. package/es/components/shared/QuestionBox.js +165 -192
  94. package/es/components/shared/QuizDraggbleDroppedOption.js +12 -11
  95. package/es/components/shared/QuizDraggbleDummyOption.js +16 -19
  96. package/es/components/shared/QuizDraggbleOption.js +59 -61
  97. package/es/components/shared/StyledMarkdown.js +1 -1
  98. package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
  99. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  100. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
  101. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -54
  102. package/es/components/shared/question-radio/QuestionRadio.js +7 -9
  103. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  104. package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
  105. package/es/components/shared/question-radio/QuestionRadioOption.js +59 -47
  106. package/es/components/shared/utils/getQuestionStatusStyle.js +9 -7
  107. package/es/components/shared/utils/mergeRefs.js +6 -15
  108. package/es/constant/element.js +3 -3
  109. package/es/helpers/index.js +10 -8
  110. package/es/hooks/useCaculatePassage.js +20 -21
  111. package/package.json +15 -12
  112. package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -423
  113. package/cjs/components/material-quiz/index.js +0 -9
  114. package/cjs/components/material-quiz/locales/index.js +0 -13
  115. package/cjs/components/material-quiz-edit/index.js +0 -7
  116. package/cjs/components/material-quiz-edit/locales/index.js +0 -13
  117. package/cjs/components/shared/index.js +0 -19
  118. package/cjs/constant/index.js +0 -9
  119. package/cjs/hooks/index.js +0 -7
  120. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -408
  121. package/es/components/material-quiz/index.js +0 -2
  122. package/es/components/material-quiz/locales/index.js +0 -4
  123. package/es/components/material-quiz-edit/index.js +0 -1
  124. package/es/components/material-quiz-edit/locales/index.js +0 -4
  125. package/es/components/shared/index.js +0 -7
  126. package/es/constant/index.js +0 -1
  127. package/es/hooks/index.js +0 -1
@@ -1,5 +1,3 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
1
  import React from 'react';
4
2
  import { useFormContext, Controller } from 'react-hook-form';
5
3
  import { Transition } from 'react-transition-group';
@@ -18,33 +16,26 @@ import { checkTwoDimensionArray } from './utils/checkTwoDimensionArray.js';
18
16
  import { createRandomId } from './utils/randomId.js';
19
17
  import { useMaterialQuizEditContext } from './context.js';
20
18
 
21
- var MIN_TEXT_LENGTH = 1;
22
- var MAX_TEXT_LENGTH = 128;
23
- var MaterialQuizEditContent = function MaterialQuizEditContent() {
24
- var intl = useRawEliceIntl();
25
- var _useMaterialQuizEditC = useMaterialQuizEditContext(),
26
- disabled = _useMaterialQuizEditC.disabled,
27
- onFileUploadRequest = _useMaterialQuizEditC.onFileUploadRequest;
28
- var _useFormContext = useFormContext(),
29
- control = _useFormContext.control,
30
- watch = _useFormContext.watch,
31
- setValue = _useFormContext.setValue;
32
- var _watch = watch(['optionType', 'optionsDefault', 'answerInfoDefault', 'answerHint', 'explanationInfo', 'isAutoGrade', 'groups', 'optionsSetEnabled']),
33
- _watch2 = _slicedToArray(_watch, 8),
34
- watchedOptionType = _watch2[0],
35
- watchedOptionInfo = _watch2[1],
36
- watchedAnswerInfo = _watch2[2],
37
- watchedAnswerHint = _watch2[3],
38
- watchedExplanationInfo = _watch2[4],
39
- watchedIsAutoGrade = _watch2[5],
40
- watchedGroups = _watch2[6],
41
- optionsSetEnabled = _watch2[7];
19
+ const MIN_TEXT_LENGTH = 1;
20
+ const MAX_TEXT_LENGTH = 128;
21
+ const MaterialQuizEditContent = () => {
22
+ const intl = useRawEliceIntl();
23
+ const {
24
+ disabled,
25
+ onFileUploadRequest
26
+ } = useMaterialQuizEditContext();
27
+ const {
28
+ control,
29
+ watch,
30
+ setValue
31
+ } = useFormContext();
32
+ const [watchedOptionType, watchedOptionInfo, watchedAnswerInfo, watchedAnswerHint, watchedExplanationInfo, watchedIsAutoGrade, watchedGroups, optionsSetEnabled] = watch(['optionType', 'optionsDefault', 'answerInfoDefault', 'answerHint', 'explanationInfo', 'isAutoGrade', 'groups', 'optionsSetEnabled']);
42
33
  //
43
34
  // Change `options` according to `optionType`.
44
35
  //
45
- React.useEffect(function () {
46
- var get = function get() {
47
- var filteredNotMarkdownOptions = watchedOptionInfo === null || watchedOptionInfo === void 0 ? void 0 : watchedOptionInfo.filter(function (option) {
36
+ React.useEffect(() => {
37
+ const get = () => {
38
+ const filteredNotMarkdownOptions = watchedOptionInfo === null || watchedOptionInfo === void 0 ? void 0 : watchedOptionInfo.filter(option => {
48
39
  var _a;
49
40
  return !((_a = option.content) === null || _a === void 0 ? void 0 : _a.includes('![]'));
50
41
  });
@@ -73,7 +64,7 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
73
64
  }];
74
65
  }
75
66
  if (filteredNotMarkdownOptions.length) {
76
- return watchedOptionInfo.map(function (e) {
67
+ return watchedOptionInfo.map(e => {
77
68
  var _a;
78
69
  if ((_a = e.title) === null || _a === void 0 ? void 0 : _a.length) {
79
70
  return Object.assign(Object.assign({}, e), {
@@ -107,7 +98,7 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
107
98
  }];
108
99
  }
109
100
  if (filteredNotMarkdownOptions.length) {
110
- return watchedOptionInfo.map(function (e) {
101
+ return watchedOptionInfo.map(e => {
111
102
  var _a, _b;
112
103
  if (!((_a = e.content) === null || _a === void 0 ? void 0 : _a.includes('![]')) && !((_b = e.title) === null || _b === void 0 ? void 0 : _b.length)) {
113
104
  return Object.assign(Object.assign({}, e), {
@@ -132,15 +123,15 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
132
123
  //
133
124
  // Change `answerInfo` according to `optionType`.
134
125
  //
135
- React.useEffect(function () {
136
- var get = function get() {
126
+ React.useEffect(() => {
127
+ const get = () => {
137
128
  switch (watchedOptionType) {
138
129
  case enums.QuizOptionType.SelectOne:
139
130
  if (!Array.isArray(watchedAnswerInfo)) {
140
131
  return [0];
141
132
  }
142
133
  if (checkTwoDimensionArray(watchedAnswerInfo)) {
143
- var convertedAnswerInfo = watchedAnswerInfo;
134
+ const convertedAnswerInfo = watchedAnswerInfo;
144
135
  return flattenDeep(convertedAnswerInfo).slice(0, 1);
145
136
  }
146
137
  return watchedAnswerInfo.slice(0, 1);
@@ -168,8 +159,8 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
168
159
  //
169
160
  // Change `answerHint` according to `optionType`.
170
161
  //
171
- React.useEffect(function () {
172
- var get = function get() {
162
+ React.useEffect(() => {
163
+ const get = () => {
173
164
  switch (watchedOptionType) {
174
165
  case enums.QuizOptionType.SelectOne:
175
166
  case enums.QuizOptionType.SelectMultiple:
@@ -189,8 +180,8 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
189
180
  //
190
181
  // Change `isAutoGrade` according to `optionType`.
191
182
  //
192
- React.useEffect(function () {
193
- var get = function get() {
183
+ React.useEffect(() => {
184
+ const get = () => {
194
185
  switch (watchedOptionType) {
195
186
  case enums.QuizOptionType.SelectOne:
196
187
  case enums.QuizOptionType.SelectMultiple:
@@ -210,8 +201,8 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
210
201
  //
211
202
  // Change `groups` according to `optionType`.
212
203
  //
213
- React.useEffect(function () {
214
- var get = function get() {
204
+ React.useEffect(() => {
205
+ const get = () => {
215
206
  switch (watchedOptionType) {
216
207
  case enums.QuizOptionType.SelectOne:
217
208
  case enums.QuizOptionType.SelectMultiple:
@@ -246,7 +237,7 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
246
237
  * Input of option info and answer info,
247
238
  * according to option type.
248
239
  */
249
- var Option = React.useMemo(function () {
240
+ const Option = React.useMemo(() => {
250
241
  switch (watchedOptionType) {
251
242
  case enums.QuizOptionType.SelectOne:
252
243
  return OptionSelectOne;
@@ -265,16 +256,15 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
265
256
  /**
266
257
  * Render input for quiz title.
267
258
  */
268
- var renderQuestionTitleInput = function renderQuestionTitleInput() {
269
- return jsx(FormInputVerticalLayout, {
270
- label: jsx(Label, {
259
+ const renderQuestionTitleInput = () => {
260
+ return React.createElement(FormInputVerticalLayout, {
261
+ label: React.createElement(Label, {
271
262
  size: "small",
272
- required: true,
273
- children: intl.formatMessage({
274
- id: 'content.title'
275
- })
276
- }),
277
- input: jsx(Controller, {
263
+ required: true
264
+ }, intl.formatMessage({
265
+ id: 'content.title'
266
+ })),
267
+ input: React.createElement(Controller, {
278
268
  control: control,
279
269
  name: "questionTitle",
280
270
  rules: {
@@ -303,11 +293,12 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
303
293
  })
304
294
  }
305
295
  },
306
- render: function render(_ref) {
307
- var field = _ref.field,
308
- fieldState = _ref.fieldState;
296
+ render: ({
297
+ field,
298
+ fieldState
299
+ }) => {
309
300
  var _a;
310
- return jsx(Input, Object.assign({
301
+ return React.createElement(Input, Object.assign({
311
302
  size: "small",
312
303
  width: "full",
313
304
  minLength: MIN_TEXT_LENGTH,
@@ -325,169 +316,149 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
325
316
  /**
326
317
  * Render input for quiz description.
327
318
  */
328
- var renderQuestionDescriptionInput = function renderQuestionDescriptionInput() {
329
- return jsx(FormInputVerticalLayout, {
330
- label: jsx(Label, {
331
- size: "small",
332
- children: intl.formatMessage({
333
- id: 'content.description.title'
334
- })
335
- }),
336
- input: jsx(Controller, {
319
+ const renderQuestionDescriptionInput = () => {
320
+ return React.createElement(FormInputVerticalLayout, {
321
+ label: React.createElement(Label, {
322
+ size: "small"
323
+ }, intl.formatMessage({
324
+ id: 'content.description.title'
325
+ })),
326
+ input: React.createElement(Controller, {
337
327
  control: control,
338
328
  name: "questionDescription",
339
- render: function render(_ref2) {
340
- var field = _ref2.field;
341
- return jsx(MarkdownEditor, Object.assign({
342
- placeholder: intl.formatMessage({
343
- id: 'content.description.placeholder'
344
- }),
345
- onFileUploadRequest: onFileUploadRequest
346
- }, field));
347
- }
329
+ render: ({
330
+ field
331
+ }) => React.createElement(MarkdownEditor, Object.assign({
332
+ placeholder: intl.formatMessage({
333
+ id: 'content.description.placeholder'
334
+ }),
335
+ onFileUploadRequest: onFileUploadRequest
336
+ }, field))
348
337
  })
349
338
  });
350
339
  };
351
340
  /**
352
341
  * Render input of option type, option info and answer info.
353
342
  */
354
- var renderOptionInput = function renderOptionInput() {
355
- return jsx(FormInputVerticalLayout, {
356
- label: jsx(Label, {
343
+ const renderOptionInput = () => {
344
+ return React.createElement(FormInputVerticalLayout, {
345
+ label: React.createElement(Label, {
357
346
  size: "small",
358
- required: true,
359
- children: intl.formatMessage({
360
- id: 'content.option.title'
361
- })
362
- }),
363
- input: jsxs(Fragment, {
364
- children: [jsx(Controller, {
365
- control: control,
366
- name: "optionType",
367
- render: function render(_ref3) {
368
- var field = _ref3.field;
369
- return jsx(Tooltip, {
370
- title: disabled && intl.formatMessage({
371
- id: 'content.option.tooltip.disabled'
372
- }),
373
- placement: "top-end",
374
- children: jsxs(Stack, {
375
- direction: "row",
376
- justifyContent: "space-between",
377
- marginBottom: "0.5rem",
378
- children: [jsxs(TextField, Object.assign({
379
- select: true,
380
- disabled: disabled
381
- }, field, {
382
- onChange: function onChange(event) {
383
- var isTextQuizOption = Number(event.target.value) === enums.QuizOptionType.Text;
384
- if (isTextQuizOption) {
385
- setValue('optionsSetEnabled', false);
386
- }
387
- field.onChange(event);
388
- },
389
- children: [jsx(MenuItem, {
390
- value: enums.QuizOptionType.SelectOne,
391
- children: intl.formatMessage({
392
- id: 'content.option.select.items.selectOne'
393
- })
394
- }), jsx(MenuItem, {
395
- value: enums.QuizOptionType.SelectMultiple,
396
- children: intl.formatMessage({
397
- id: 'content.option.select.items.selectMultiple'
398
- })
399
- }), jsx(MenuItem, {
400
- value: enums.QuizOptionType.SelectMultipleOrder,
401
- children: intl.formatMessage({
402
- id: 'content.option.select.items.selectMultipleOrder'
403
- })
404
- }), jsx(MenuItem, {
405
- value: enums.QuizOptionType.Group,
406
- children: intl.formatMessage({
407
- id: 'content.option.select.items.group'
408
- })
409
- }), jsx(MenuItem, {
410
- value: enums.QuizOptionType.Text,
411
- children: intl.formatMessage({
412
- id: 'content.option.select.items.text'
413
- })
414
- })]
415
- })), watchedOptionType !== enums.QuizOptionType.Text ? jsx(Controller, {
416
- name: "optionsSetEnabled",
417
- control: control,
418
- render: function render(_ref4) {
419
- var field = _ref4.field;
420
- return jsx(Tooltip, {
421
- title: disabled ? '' : intl.formatMessage({
422
- id: 'content.option.optionsSetEnabled.tooltip'
423
- }),
424
- placement: "top",
425
- children: jsx(FormControlLabel, {
426
- disabled: disabled,
427
- label: intl.formatMessage({
428
- id: 'content.option.optionsSetEnabled.label'
429
- }),
430
- control: jsx(Switch, Object.assign({}, field, {
431
- checked: field.value
432
- }))
433
- })
434
- });
435
- }
436
- }) : null]
437
- })
438
- });
347
+ required: true
348
+ }, intl.formatMessage({
349
+ id: 'content.option.title'
350
+ })),
351
+ input: React.createElement(React.Fragment, null, React.createElement(Controller, {
352
+ control: control,
353
+ name: "optionType",
354
+ render: ({
355
+ field
356
+ }) => React.createElement(Tooltip, {
357
+ title: disabled && intl.formatMessage({
358
+ id: 'content.option.tooltip.disabled'
359
+ }),
360
+ placement: "top-end"
361
+ }, React.createElement(Stack, {
362
+ direction: "row",
363
+ justifyContent: "space-between",
364
+ marginBottom: "0.5rem"
365
+ }, React.createElement(TextField, Object.assign({
366
+ select: true,
367
+ disabled: disabled
368
+ }, field, {
369
+ onChange: event => {
370
+ const isTextQuizOption = Number(event.target.value) === enums.QuizOptionType.Text;
371
+ if (isTextQuizOption) {
372
+ setValue('optionsSetEnabled', false);
373
+ }
374
+ field.onChange(event);
439
375
  }
440
- }), watchedOptionType !== enums.QuizOptionType.Text && optionsSetEnabled ? jsxs(Alert, {
441
- severity: "info",
442
- sx: {
443
- marginBottom: '1rem'
444
- },
445
- children: [jsx(AlertTitle, {
446
- children: intl.formatMessage({
447
- id: 'content.option.alert.randomized.title'
448
- })
449
- }), intl.formatMessage({
450
- id: 'content.option.alert.randomized.description'
451
- })]
452
- }) : null, jsx(Transition, {
453
- in: watchedOptionType === enums.QuizOptionType.SelectMultipleOrder || watchedOptionType === enums.QuizOptionType.Group,
454
- timeout: 0,
455
- mountOnEnter: true,
456
- unmountOnExit: true,
457
- children: jsx(Box, {
458
- marginBottom: "0.5rem",
459
- children: jsx(StatusText, {
460
- role: "description",
461
- preWrap: true,
462
- children: intl.formatMessage({
463
- id: watchedOptionType === enums.QuizOptionType.SelectMultipleOrder ? 'content.option.statusText.dragNDrop' : 'content.option.statusText.dragNDropGroup'
464
- })
465
- })
376
+ }), React.createElement(MenuItem, {
377
+ value: enums.QuizOptionType.SelectOne,
378
+ children: intl.formatMessage({
379
+ id: 'content.option.select.items.selectOne'
466
380
  })
467
- }), jsx(Option, {})]
468
- })
381
+ }), React.createElement(MenuItem, {
382
+ value: enums.QuizOptionType.SelectMultiple,
383
+ children: intl.formatMessage({
384
+ id: 'content.option.select.items.selectMultiple'
385
+ })
386
+ }), React.createElement(MenuItem, {
387
+ value: enums.QuizOptionType.SelectMultipleOrder,
388
+ children: intl.formatMessage({
389
+ id: 'content.option.select.items.selectMultipleOrder'
390
+ })
391
+ }), React.createElement(MenuItem, {
392
+ value: enums.QuizOptionType.Group,
393
+ children: intl.formatMessage({
394
+ id: 'content.option.select.items.group'
395
+ })
396
+ }), React.createElement(MenuItem, {
397
+ value: enums.QuizOptionType.Text,
398
+ children: intl.formatMessage({
399
+ id: 'content.option.select.items.text'
400
+ })
401
+ })), watchedOptionType !== enums.QuizOptionType.Text ? React.createElement(Controller, {
402
+ name: "optionsSetEnabled",
403
+ control: control,
404
+ render: ({
405
+ field
406
+ }) => React.createElement(Tooltip, {
407
+ title: disabled ? '' : intl.formatMessage({
408
+ id: 'content.option.optionsSetEnabled.tooltip'
409
+ }),
410
+ placement: "top"
411
+ }, React.createElement(FormControlLabel, {
412
+ disabled: disabled,
413
+ label: intl.formatMessage({
414
+ id: 'content.option.optionsSetEnabled.label'
415
+ }),
416
+ control: React.createElement(Switch, Object.assign({}, field, {
417
+ checked: field.value
418
+ }))
419
+ }))
420
+ }) : null))
421
+ }), watchedOptionType !== enums.QuizOptionType.Text && optionsSetEnabled ? React.createElement(Alert, {
422
+ severity: "info",
423
+ sx: {
424
+ marginBottom: '1rem'
425
+ }
426
+ }, React.createElement(AlertTitle, null, intl.formatMessage({
427
+ id: 'content.option.alert.randomized.title'
428
+ })), intl.formatMessage({
429
+ id: 'content.option.alert.randomized.description'
430
+ })) : null, React.createElement(Transition, {
431
+ in: watchedOptionType === enums.QuizOptionType.SelectMultipleOrder || watchedOptionType === enums.QuizOptionType.Group,
432
+ timeout: 0,
433
+ mountOnEnter: true,
434
+ unmountOnExit: true
435
+ }, React.createElement(Box, {
436
+ marginBottom: "0.5rem"
437
+ }, React.createElement(StatusText, {
438
+ role: "description",
439
+ preWrap: true
440
+ }, intl.formatMessage({
441
+ id: watchedOptionType === enums.QuizOptionType.SelectMultipleOrder ? 'content.option.statusText.dragNDrop' : 'content.option.statusText.dragNDropGroup'
442
+ })))), React.createElement(Option, null))
469
443
  });
470
444
  };
471
445
  /**
472
446
  * Input of answer hint.
473
447
  */
474
- var renderAnswerHintInput = function renderAnswerHintInput() {
448
+ const renderAnswerHintInput = () => {
475
449
  if (watchedOptionType !== enums.QuizOptionType.Text) {
476
450
  return null;
477
451
  }
478
- return jsx(FormInputVerticalLayout, {
479
- label: jsx(Label, {
480
- size: "small",
481
- children: intl.formatMessage({
482
- id: 'content.answerHint.title'
483
- })
484
- }),
485
- description: jsx(Text, {
486
- children: intl.formatMessage({
487
- id: 'content.answerHint.description'
488
- })
489
- }),
490
- input: jsx(Controller, {
452
+ return React.createElement(FormInputVerticalLayout, {
453
+ label: React.createElement(Label, {
454
+ size: "small"
455
+ }, intl.formatMessage({
456
+ id: 'content.answerHint.title'
457
+ })),
458
+ description: React.createElement(Text, null, intl.formatMessage({
459
+ id: 'content.answerHint.description'
460
+ })),
461
+ input: React.createElement(Controller, {
491
462
  control: control,
492
463
  name: "answerHint",
493
464
  rules: {
@@ -510,11 +481,12 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
510
481
  })
511
482
  }
512
483
  },
513
- render: function render(_ref5) {
514
- var field = _ref5.field,
515
- fieldState = _ref5.fieldState;
484
+ render: ({
485
+ field,
486
+ fieldState
487
+ }) => {
516
488
  var _a, _b;
517
- return jsx(Input, Object.assign({
489
+ return React.createElement(Input, Object.assign({
518
490
  size: "small",
519
491
  width: "full",
520
492
  minLength: MIN_TEXT_LENGTH,
@@ -534,85 +506,70 @@ var MaterialQuizEditContent = function MaterialQuizEditContent() {
534
506
  /**
535
507
  * Input of explanation info.
536
508
  */
537
- var renderExplanationInfoInput = function renderExplanationInfoInput() {
538
- return jsx(FormInputVerticalLayout, {
539
- label: jsx(Label, {
540
- size: "small",
541
- children: intl.formatMessage({
542
- id: 'content.explanationInfo.title'
543
- })
544
- }),
545
- description: jsx(Text, {
546
- children: intl.formatMessage({
547
- id: 'content.explanationInfo.description'
548
- })
549
- }),
550
- input: jsxs(Fragment, {
551
- children: [jsx(Controller, {
552
- control: control,
553
- name: "explanationInfo.isEnabled",
554
- render: function render(_ref6) {
555
- var field = _ref6.field;
556
- return jsx(Checkbox, Object.assign({
557
- size: "small"
558
- }, field, {
559
- children: intl.formatMessage({
560
- id: 'content.explanationInfo.checkbox.label'
561
- })
562
- }));
509
+ const renderExplanationInfoInput = () => {
510
+ return React.createElement(FormInputVerticalLayout, {
511
+ label: React.createElement(Label, {
512
+ size: "small"
513
+ }, intl.formatMessage({
514
+ id: 'content.explanationInfo.title'
515
+ })),
516
+ description: React.createElement(Text, null, intl.formatMessage({
517
+ id: 'content.explanationInfo.description'
518
+ })),
519
+ input: React.createElement(React.Fragment, null, React.createElement(Controller, {
520
+ control: control,
521
+ name: "explanationInfo.isEnabled",
522
+ render: ({
523
+ field
524
+ }) => React.createElement(Checkbox, Object.assign({
525
+ size: "small"
526
+ }, field), intl.formatMessage({
527
+ id: 'content.explanationInfo.checkbox.label'
528
+ }))
529
+ }), React.createElement(Transition, {
530
+ in: watchedExplanationInfo.isEnabled,
531
+ timeout: 0,
532
+ mountOnEnter: true,
533
+ unmountOnExit: true
534
+ }, React.createElement(React.Fragment, null, React.createElement(Vspace, {
535
+ height: 1
536
+ }), React.createElement(Controller, {
537
+ control: control,
538
+ name: "explanationInfo.value",
539
+ rules: {
540
+ required: {
541
+ value: true,
542
+ message: intl.formatMessage({
543
+ id: 'content.explanationInfo.textarea.placeholder'
544
+ })
563
545
  }
564
- }), jsx(Transition, {
565
- in: watchedExplanationInfo.isEnabled,
566
- timeout: 0,
567
- mountOnEnter: true,
568
- unmountOnExit: true,
569
- children: jsxs(Fragment, {
570
- children: [jsx(Vspace, {
571
- height: 1
572
- }), jsx(Controller, {
573
- control: control,
574
- name: "explanationInfo.value",
575
- rules: {
576
- required: {
577
- value: true,
578
- message: intl.formatMessage({
579
- id: 'content.explanationInfo.textarea.placeholder'
580
- })
581
- }
582
- },
583
- render: function render(_ref7) {
584
- var field = _ref7.field,
585
- fieldState = _ref7.fieldState;
586
- var _a;
587
- return jsxs(Flex, {
588
- column: true,
589
- children: [fieldState.invalid ? jsxs(Fragment, {
590
- children: [jsx(StatusText, {
591
- children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
592
- role: "danger"
593
- }), jsx(Vspace, {
594
- height: 0.5
595
- })]
596
- }) : null, jsx(MarkdownEditor, Object.assign({
597
- placeholder: intl.formatMessage({
598
- id: 'content.explanationInfo.textarea.errorMessage.required'
599
- }),
600
- onFileUploadRequest: onFileUploadRequest
601
- }, field))]
602
- });
603
- }
604
- })]
605
- })
606
- })]
607
- })
546
+ },
547
+ render: ({
548
+ field,
549
+ fieldState
550
+ }) => {
551
+ var _a;
552
+ return React.createElement(Flex, {
553
+ column: true
554
+ }, fieldState.invalid ? React.createElement(React.Fragment, null, React.createElement(StatusText, {
555
+ children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
556
+ role: "danger"
557
+ }), React.createElement(Vspace, {
558
+ height: 0.5
559
+ })) : null, React.createElement(MarkdownEditor, Object.assign({
560
+ placeholder: intl.formatMessage({
561
+ id: 'content.explanationInfo.textarea.errorMessage.required'
562
+ }),
563
+ onFileUploadRequest: onFileUploadRequest
564
+ }, field)));
565
+ }
566
+ }))))
608
567
  });
609
568
  };
610
569
  //
611
570
  //
612
571
  //
613
- return jsxs(Fragment, {
614
- children: [renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput(), renderAnswerHintInput(), renderExplanationInfoInput()]
615
- });
572
+ return React.createElement(React.Fragment, null, renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput(), renderAnswerHintInput(), renderExplanationInfoInput());
616
573
  };
617
574
 
618
575
  export { MaterialQuizEditContent as default };
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- var MaterialQuizEditContext = React.createContext(null);
4
- var useMaterialQuizEditContext = function useMaterialQuizEditContext() {
5
- return React.useContext(MaterialQuizEditContext);
6
- };
3
+ const MaterialQuizEditContext = React.createContext(null);
4
+ const useMaterialQuizEditContext = () => React.useContext(MaterialQuizEditContext);
7
5
 
8
6
  export { MaterialQuizEditContext as default, useMaterialQuizEditContext };