@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,4 +1,3 @@
1
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
1
  import React from 'react';
3
2
  import { useFormContext, useFieldArray, useWatch, Controller } from 'react-hook-form';
4
3
  import { arrayMove } from 'react-sortable-hoc';
@@ -12,47 +11,50 @@ import { useMaterialQuizEditContext } from '../context.js';
12
11
  import { createRandomId } from '../utils/randomId.js';
13
12
  import OptionEditor from './OptionEditor.js';
14
13
 
15
- var MIN_OPTION_INFO_COUNT = 2;
16
- var MAX_OPTION_INFO_COUNT = 20;
17
- var StyledWrap = styled.div.withConfig({
14
+ const MIN_OPTION_INFO_COUNT = 2;
15
+ const MAX_OPTION_INFO_COUNT = 20;
16
+ const StyledWrap = styled.div.withConfig({
18
17
  componentId: "sc-vizer2-0"
19
18
  })(["& > ul{display:flex;flex-direction:column;gap:0.75rem;}"]);
20
- var StyledInputGroup = styled(SortableListGroup).withConfig({
19
+ const StyledInputGroup = styled(SortableListGroup).withConfig({
21
20
  componentId: "sc-vizer2-1"
22
21
  })(["width:100%;.em-option-editor{margin-bottom:0.5rem;&:last-of-type{margin-bottom:0;}}"]);
23
- var StyledInputPrefixRadioOption = styled(RadioOption).withConfig({
22
+ const StyledInputPrefixRadioOption = styled(RadioOption).withConfig({
24
23
  componentId: "sc-vizer2-2"
25
24
  })([".eb-radio-option__label{display:none;}"]);
26
- var OptionSelectOne = function OptionSelectOne() {
27
- var intl = useRawEliceIntl();
28
- var _useMaterialQuizEditC = useMaterialQuizEditContext(),
29
- disabled = _useMaterialQuizEditC.disabled;
30
- var _useFormContext = useFormContext(),
31
- control = _useFormContext.control,
32
- getValues = _useFormContext.getValues,
33
- setValue = _useFormContext.setValue;
34
- var _useFieldArray = useFieldArray({
35
- name: 'optionsDefault',
36
- keyName: 'id',
37
- shouldUnregister: true
38
- }),
39
- optionInfoFields = _useFieldArray.fields,
40
- appendOptionInfoFieldItem = _useFieldArray.append,
41
- removeOptionInfoFieldItem = _useFieldArray.remove,
42
- moveOptionInfoFieldItem = _useFieldArray.move;
43
- var watchedAnswerInfo = useWatch({
44
- control: control,
25
+ const OptionSelectOne = () => {
26
+ const intl = useRawEliceIntl();
27
+ const {
28
+ disabled
29
+ } = useMaterialQuizEditContext();
30
+ const {
31
+ control,
32
+ getValues,
33
+ setValue
34
+ } = useFormContext();
35
+ const {
36
+ fields: optionInfoFields,
37
+ append: appendOptionInfoFieldItem,
38
+ remove: removeOptionInfoFieldItem,
39
+ move: moveOptionInfoFieldItem
40
+ } = useFieldArray({
41
+ name: 'optionsDefault',
42
+ keyName: 'id',
43
+ shouldUnregister: true
44
+ });
45
+ const watchedAnswerInfo = useWatch({
46
+ control,
45
47
  name: 'answerInfoDefault'
46
48
  });
47
- var watchedOptions = useWatch({
48
- control: control,
49
+ const watchedOptions = useWatch({
50
+ control,
49
51
  name: 'optionsDefault'
50
52
  });
51
53
  /**
52
54
  * Update answer info.
53
55
  */
54
- var updateAnswerInfo = function updateAnswerInfo(index) {
55
- var prevAnswerInfo = getValues('answerInfoDefault');
56
+ const updateAnswerInfo = index => {
57
+ const prevAnswerInfo = getValues('answerInfoDefault');
56
58
  if (!Array.isArray(prevAnswerInfo)) {
57
59
  return;
58
60
  }
@@ -64,7 +66,7 @@ var OptionSelectOne = function OptionSelectOne() {
64
66
  /**
65
67
  * Append option info.
66
68
  */
67
- var appendOptionInfo = function appendOptionInfo() {
69
+ const appendOptionInfo = () => {
68
70
  appendOptionInfoFieldItem({
69
71
  id: createRandomId(),
70
72
  title: '',
@@ -74,10 +76,10 @@ var OptionSelectOne = function OptionSelectOne() {
74
76
  /**
75
77
  * Remove item from option info at index.
76
78
  */
77
- var removeOptionInfo = function removeOptionInfo(index) {
79
+ const removeOptionInfo = index => {
78
80
  // set answer info to 0 index,
79
81
  // if this option is selected as answer.
80
- var curAnswerInfo = getValues('answerInfoDefault');
82
+ const curAnswerInfo = getValues('answerInfoDefault');
81
83
  if (Array.isArray(curAnswerInfo) && curAnswerInfo.includes(index)) {
82
84
  updateAnswerInfo(0);
83
85
  }
@@ -86,19 +88,16 @@ var OptionSelectOne = function OptionSelectOne() {
86
88
  /**
87
89
  * Sort options based on the old and new index.
88
90
  */
89
- var handleSortEnd = function handleSortEnd(_ref) {
90
- var oldIndex = _ref.oldIndex,
91
- newIndex = _ref.newIndex;
92
- var prevAnswerInfo = cloneDeep(watchedAnswerInfo);
93
- var prevOptions = cloneDeep(watchedOptions).map(function (option, index) {
94
- return Object.assign(Object.assign({}, option), {
95
- isAnswer: prevAnswerInfo.includes(index)
96
- });
97
- });
98
- var updatedOptions = arrayMove(prevOptions, oldIndex, newIndex);
99
- var updatedAnswer = updatedOptions.findIndex(function (option) {
100
- return option.isAnswer;
101
- });
91
+ const handleSortEnd = ({
92
+ oldIndex,
93
+ newIndex
94
+ }) => {
95
+ const prevAnswerInfo = cloneDeep(watchedAnswerInfo);
96
+ const prevOptions = cloneDeep(watchedOptions).map((option, index) => Object.assign(Object.assign({}, option), {
97
+ isAnswer: prevAnswerInfo.includes(index)
98
+ }));
99
+ const updatedOptions = arrayMove(prevOptions, oldIndex, newIndex);
100
+ const updatedAnswer = updatedOptions.findIndex(option => option.isAnswer);
102
101
  setValue('answerInfoDefault', [updatedAnswer]);
103
102
  moveOptionInfoFieldItem(oldIndex, newIndex);
104
103
  };
@@ -108,123 +107,109 @@ var OptionSelectOne = function OptionSelectOne() {
108
107
  if (!Array.isArray(watchedAnswerInfo)) {
109
108
  return null;
110
109
  }
111
- return jsxs(StyledWrap, {
112
- children: [jsx(Controller, {
113
- name: "answerInfoDefault",
114
- control: control,
115
- rules: {
116
- validate: function validate(v) {
117
- if (Array.isArray(v) && v.length < 1) {
118
- return intl.formatMessage({
119
- id: 'content.option.errorMessage.required'
120
- });
121
- }
122
- return true;
110
+ return React.createElement(StyledWrap, null, React.createElement(Controller, {
111
+ name: "answerInfoDefault",
112
+ control: control,
113
+ rules: {
114
+ validate: v => {
115
+ if (Array.isArray(v) && v.length < 1) {
116
+ return intl.formatMessage({
117
+ id: 'content.option.errorMessage.required'
118
+ });
123
119
  }
124
- },
125
- render: function render(_ref2) {
126
- var fieldState = _ref2.fieldState;
127
- var _a;
128
- return jsx(Transition, {
129
- in: fieldState.invalid,
130
- timeout: 0,
131
- mountOnEnter: true,
132
- unmountOnExit: true,
133
- children: jsxs(Fragment, {
134
- children: [jsx(StatusText, {
135
- children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
136
- role: "danger"
137
- }), jsx(Vspace, {
138
- height: 0.5
139
- })]
140
- })
141
- });
120
+ return true;
142
121
  }
143
- }), jsx(StyledInputGroup, {
144
- useDragHandle: true,
145
- pressDelay: 100,
146
- onSortEnd: handleSortEnd,
147
- children: optionInfoFields.map(function (_ref3, index) {
148
- var id = _ref3.id;
149
- return jsx(Controller, {
150
- control: control,
151
- name: "optionsDefault.".concat(index, ".content"),
152
- rules: {
153
- required: {
154
- value: true,
155
- message: intl.formatMessage({
156
- id: 'option.common.select.errorMessage.required'
157
- })
158
- }
159
- },
160
- render: function render(_ref4) {
161
- var field = _ref4.field,
162
- fieldState = _ref4.fieldState;
163
- var _a;
164
- return jsx(OptionEditor, Object.assign({
165
- index: index,
166
- invalid: fieldState.invalid,
167
- invalidText: (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
168
- placeholder: intl.formatMessage({
169
- id: 'option.common.select.placeholder'
170
- }),
171
- readOnly: disabled,
172
- prefix: jsxs(Radio, {
173
- value: watchedAnswerInfo[0],
174
- disabled: disabled,
175
- onChange: updateAnswerInfo,
176
- children: [jsx(StyledInputPrefixRadioOption, {
177
- value: index
178
- }), jsx(React.Fragment, {})]
179
- }),
180
- suffix: jsx(Tooltip, {
181
- title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl.formatMessage({
182
- id: 'option.common.select.tooltip.minOptionInfoItem'
183
- }) : undefined,
184
- placement: "top-start",
185
- children: jsx("span", {
186
- children: jsx(IconButton, {
187
- icon: eilMathsignMultiplyBasic,
188
- size: "tiny",
189
- role: "grey9",
190
- border: false,
191
- transparent: true,
192
- disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
193
- onClick: function onClick() {
194
- return removeOptionInfo(index);
195
- }
196
- })
197
- })
198
- })
199
- }, field));
200
- }
201
- }, id);
202
- })
203
- }), jsx(Vspace, {
204
- height: 0.5
205
- }), jsx(Tooltip, {
206
- title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl.formatMessage({
207
- id: 'option.common.select.tooltip.maxOptionInfoItem'
208
- }) : undefined,
209
- placement: "bottom",
210
- children: jsx("span", {
211
- children: jsx(Button, {
212
- block: true,
213
- size: "micro",
214
- borderDashed: true,
215
- transparent: true,
216
- icon: jsx(Icon, {
217
- icon: eilMathsignAddCircle
218
- }),
219
- disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
220
- onClick: appendOptionInfo,
221
- children: intl.formatMessage({
222
- id: 'option.common.select.addButton'
223
- })
122
+ },
123
+ render: ({
124
+ fieldState
125
+ }) => {
126
+ var _a;
127
+ return React.createElement(Transition, {
128
+ in: fieldState.invalid,
129
+ timeout: 0,
130
+ mountOnEnter: true,
131
+ unmountOnExit: true
132
+ }, React.createElement(React.Fragment, null, React.createElement(StatusText, {
133
+ children: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
134
+ role: "danger"
135
+ }), React.createElement(Vspace, {
136
+ height: 0.5
137
+ })));
138
+ }
139
+ }), React.createElement(StyledInputGroup, {
140
+ useDragHandle: true,
141
+ pressDelay: 100,
142
+ onSortEnd: handleSortEnd
143
+ }, optionInfoFields.map(({
144
+ id
145
+ }, index) => React.createElement(Controller, {
146
+ key: id,
147
+ control: control,
148
+ name: `optionsDefault.${index}.content`,
149
+ rules: {
150
+ required: {
151
+ value: true,
152
+ message: intl.formatMessage({
153
+ id: 'option.common.select.errorMessage.required'
224
154
  })
225
- })
226
- })]
227
- });
155
+ }
156
+ },
157
+ render: ({
158
+ field,
159
+ fieldState
160
+ }) => {
161
+ var _a;
162
+ return React.createElement(OptionEditor, Object.assign({
163
+ index: index,
164
+ invalid: fieldState.invalid,
165
+ invalidText: (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
166
+ placeholder: intl.formatMessage({
167
+ id: 'option.common.select.placeholder'
168
+ }),
169
+ readOnly: disabled,
170
+ prefix: React.createElement(Radio, {
171
+ value: watchedAnswerInfo[0],
172
+ disabled: disabled,
173
+ onChange: updateAnswerInfo
174
+ }, React.createElement(StyledInputPrefixRadioOption, {
175
+ value: index
176
+ }), React.createElement(React.Fragment, null)),
177
+ suffix: React.createElement(Tooltip, {
178
+ title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl.formatMessage({
179
+ id: 'option.common.select.tooltip.minOptionInfoItem'
180
+ }) : undefined,
181
+ placement: "top-start"
182
+ }, React.createElement("span", null, React.createElement(IconButton, {
183
+ icon: eilMathsignMultiplyBasic,
184
+ size: "tiny",
185
+ role: "grey9",
186
+ border: false,
187
+ transparent: true,
188
+ disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
189
+ onClick: () => removeOptionInfo(index)
190
+ })))
191
+ }, field));
192
+ }
193
+ }))), React.createElement(Vspace, {
194
+ height: 0.5
195
+ }), React.createElement(Tooltip, {
196
+ title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl.formatMessage({
197
+ id: 'option.common.select.tooltip.maxOptionInfoItem'
198
+ }) : undefined,
199
+ placement: "bottom"
200
+ }, React.createElement("span", null, React.createElement(Button, {
201
+ block: true,
202
+ size: "micro",
203
+ borderDashed: true,
204
+ transparent: true,
205
+ icon: React.createElement(Icon, {
206
+ icon: eilMathsignAddCircle
207
+ }),
208
+ disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
209
+ onClick: appendOptionInfo
210
+ }, intl.formatMessage({
211
+ id: 'option.common.select.addButton'
212
+ })))));
228
213
  };
229
214
 
230
215
  export { OptionSelectOne as default };
@@ -1,5 +1,5 @@
1
1
  import _styled from '@emotion/styled/base';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
3
  import { useFormContext, useWatch, Controller } from 'react-hook-form';
4
4
  import { Vspace, Checkbox, Input } from '@elice/blocks';
5
5
  import { base } from '@elice/design-tokens';
@@ -10,105 +10,101 @@ import { useMaterialQuizEditContext } from '../context.js';
10
10
  //
11
11
  //
12
12
  //
13
- var MIN_TEXT_LENGTH = 1;
14
- var MAX_TEXT_LENGTH = 128;
13
+ const MIN_TEXT_LENGTH = 1;
14
+ const MAX_TEXT_LENGTH = 128;
15
15
  //
16
16
  //
17
17
  //
18
- var StyledInput = /*#__PURE__*/_styled(Input, {
18
+ const StyledInput = /*#__PURE__*/_styled(Input, {
19
19
  target: "edimfaf0"
20
- })("&>:first-child{", function (_ref) {
21
- var disabled = _ref.disabled;
22
- return disabled && /*#__PURE__*/css("background-color:", base.color.gray2, ";");
23
- }, ";}");
20
+ })("&>:first-child{", ({
21
+ disabled
22
+ }) => disabled && /*#__PURE__*/css("background-color:", base.color.gray2, ";"), ";}");
24
23
  //
25
24
  //
26
25
  //
27
- var OptionText = function OptionText() {
28
- var intl = useRawEliceIntl();
29
- var _useMaterialQuizEditC = useMaterialQuizEditContext(),
30
- disabled = _useMaterialQuizEditC.disabled;
31
- var _useFormContext = useFormContext(),
32
- control = _useFormContext.control;
33
- var watchedIsAutoGrade = useWatch({
34
- control: control,
26
+ const OptionText = () => {
27
+ const intl = useRawEliceIntl();
28
+ const {
29
+ disabled
30
+ } = useMaterialQuizEditContext();
31
+ const {
32
+ control
33
+ } = useFormContext();
34
+ const watchedIsAutoGrade = useWatch({
35
+ control,
35
36
  name: 'isAutoGrade'
36
37
  });
37
38
  //
38
39
  //
39
40
  //
40
- return jsxs(Fragment, {
41
- children: [jsx(Controller, {
42
- control: control,
43
- name: "answerInfoDefault",
44
- rules: {
45
- required: {
46
- value: watchedIsAutoGrade,
47
- message: intl.formatMessage({
48
- id: 'option.text.answerInfo.errorMessage.required'
49
- })
50
- },
51
- minLength: {
52
- value: MIN_TEXT_LENGTH,
53
- message: intl.formatMessage({
54
- id: 'common.errorMessage.range'
55
- }, {
56
- min: MIN_TEXT_LENGTH,
57
- max: MAX_TEXT_LENGTH
58
- })
59
- },
60
- maxLength: {
61
- value: MAX_TEXT_LENGTH,
62
- message: intl.formatMessage({
63
- id: 'common.errorMessage.range'
64
- }, {
65
- min: MIN_TEXT_LENGTH,
66
- max: MAX_TEXT_LENGTH
67
- })
68
- }
41
+ return React.createElement(React.Fragment, null, React.createElement(Controller, {
42
+ control: control,
43
+ name: "answerInfoDefault",
44
+ rules: {
45
+ required: {
46
+ value: watchedIsAutoGrade,
47
+ message: intl.formatMessage({
48
+ id: 'option.text.answerInfo.errorMessage.required'
49
+ })
69
50
  },
70
- render: function render(_ref2) {
71
- var field = _ref2.field,
72
- fieldState = _ref2.fieldState;
73
- var _a;
74
- return jsx(StyledInput, Object.assign({
75
- size: "small",
76
- width: "full",
77
- minLength: MIN_TEXT_LENGTH,
78
- maxLength: MAX_TEXT_LENGTH,
79
- readOnly: disabled,
80
- disabled: !watchedIsAutoGrade,
81
- invalid: fieldState.invalid,
82
- invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
83
- helpText: intl.formatMessage({
84
- id: 'option.text.answerInfo.hintText'
85
- })
86
- }, field, {
87
- value: field.value
88
- }));
89
- }
90
- }), jsx(Vspace, {
91
- height: 0.5
92
- }), jsx(Controller, {
93
- control: control,
94
- name: "isAutoGrade",
95
- render: function render(_ref3) {
96
- var field = _ref3.field;
97
- return jsx(Checkbox, Object.assign({
98
- size: "small"
99
- }, field, {
100
- value: !field.value,
101
- checked: !field.value,
102
- onChange: function onChange(v) {
103
- return field.onChange(!v);
104
- },
105
- children: intl.formatMessage({
106
- id: 'option.text.isAutoGrade.checkbox.label'
107
- })
108
- }));
51
+ minLength: {
52
+ value: MIN_TEXT_LENGTH,
53
+ message: intl.formatMessage({
54
+ id: 'common.errorMessage.range'
55
+ }, {
56
+ min: MIN_TEXT_LENGTH,
57
+ max: MAX_TEXT_LENGTH
58
+ })
59
+ },
60
+ maxLength: {
61
+ value: MAX_TEXT_LENGTH,
62
+ message: intl.formatMessage({
63
+ id: 'common.errorMessage.range'
64
+ }, {
65
+ min: MIN_TEXT_LENGTH,
66
+ max: MAX_TEXT_LENGTH
67
+ })
109
68
  }
110
- })]
111
- });
69
+ },
70
+ render: ({
71
+ field,
72
+ fieldState
73
+ }) => {
74
+ var _a;
75
+ return React.createElement(StyledInput, Object.assign({
76
+ size: "small",
77
+ width: "full",
78
+ minLength: MIN_TEXT_LENGTH,
79
+ maxLength: MAX_TEXT_LENGTH,
80
+ readOnly: disabled,
81
+ disabled: !watchedIsAutoGrade,
82
+ invalid: fieldState.invalid,
83
+ invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message,
84
+ helpText: intl.formatMessage({
85
+ id: 'option.text.answerInfo.hintText'
86
+ })
87
+ }, field, {
88
+ value: field.value
89
+ }));
90
+ }
91
+ }), React.createElement(Vspace, {
92
+ height: 0.5
93
+ }), React.createElement(Controller, {
94
+ control: control,
95
+ name: "isAutoGrade",
96
+ render: ({
97
+ field
98
+ }) => React.createElement(Checkbox, Object.assign({
99
+ size: "small"
100
+ }, field, {
101
+ value: !field.value,
102
+ checked: !field.value,
103
+ onChange: v => field.onChange(!v)
104
+ }), intl.formatMessage({
105
+ id: 'option.text.isAutoGrade.checkbox.label'
106
+ }))
107
+ }));
112
108
  };
113
109
 
114
110
  export { OptionText as default };
@@ -1,20 +1,19 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import React from 'react';
2
2
  import { Flex, Hr } from '@elice/blocks';
3
3
  import OptionGroupAnswerInfo from './OptionGroupAnswerInfo.js';
4
4
  import OptionGroupGroupInfo from './OptionGroupGroupInfo.js';
5
5
 
6
- var OptionGroup = function OptionGroup() {
6
+ const OptionGroup = () => {
7
7
  //
8
8
  //
9
9
  //
10
- return jsxs(Flex, {
10
+ return React.createElement(Flex, {
11
11
  column: true,
12
- margintop: "1.5rem",
13
- children: [jsx(OptionGroupGroupInfo, {}), jsx(Hr, {
14
- marginStart: "1.5rem",
15
- marginEnd: "1.5rem"
16
- }), jsx(OptionGroupAnswerInfo, {})]
17
- });
12
+ margintop: "1.5rem"
13
+ }, React.createElement(OptionGroupGroupInfo, null), React.createElement(Hr, {
14
+ marginStart: "1.5rem",
15
+ marginEnd: "1.5rem"
16
+ }), React.createElement(OptionGroupAnswerInfo, null));
18
17
  };
19
18
 
20
19
  export { OptionGroup as default };