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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +423 -0
  2. package/cjs/components/eb-sortable/EbDraggable.js +42 -33
  3. package/cjs/components/eb-sortable/EbDroppable.js +27 -20
  4. package/cjs/components/markdown-editor/index.d.ts +1 -2
  5. package/cjs/components/markdown-editor/index.js +19 -10
  6. package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
  7. package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
  8. package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
  9. package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
  10. package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
  11. package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
  12. package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
  13. package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
  14. package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
  15. package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
  16. package/cjs/components/material-quiz/constants/color.js +5 -5
  17. package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  18. package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
  19. package/cjs/components/material-quiz/index.js +9 -0
  20. package/cjs/components/material-quiz/locales/index.js +13 -0
  21. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
  22. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
  23. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
  24. package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
  25. package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
  26. package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
  27. package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
  28. package/cjs/components/material-quiz-edit/context.js +8 -2
  29. package/cjs/components/material-quiz-edit/index.js +7 -0
  30. package/cjs/components/material-quiz-edit/locales/index.js +13 -0
  31. package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
  32. package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
  33. package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
  34. package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
  35. package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
  36. package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  37. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
  38. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
  39. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
  40. package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
  41. package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  42. package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
  43. package/cjs/components/shared/QuestionBox.js +198 -165
  44. package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
  45. package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
  46. package/cjs/components/shared/QuizDraggbleOption.js +65 -59
  47. package/cjs/components/shared/StyledMarkdown.js +5 -1
  48. package/cjs/components/shared/index.js +19 -0
  49. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
  50. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  51. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
  52. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +59 -68
  53. package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
  54. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  55. package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
  56. package/cjs/components/shared/question-radio/QuestionRadioOption.js +52 -59
  57. package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
  58. package/cjs/components/shared/utils/mergeRefs.js +15 -6
  59. package/cjs/constant/element.js +3 -3
  60. package/cjs/constant/index.js +9 -0
  61. package/cjs/helpers/index.js +8 -10
  62. package/cjs/hooks/index.js +7 -0
  63. package/cjs/hooks/useCaculatePassage.js +21 -20
  64. package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
  65. package/es/components/eb-sortable/EbDraggable.js +37 -33
  66. package/es/components/eb-sortable/EbDroppable.js +22 -20
  67. package/es/components/markdown-editor/index.d.ts +1 -2
  68. package/es/components/markdown-editor/index.js +15 -10
  69. package/es/components/material-quiz/MaterialQuiz.js +109 -83
  70. package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
  71. package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
  72. package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
  73. package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
  74. package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
  75. package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
  76. package/es/components/material-quiz/MaterialQuizText.js +158 -115
  77. package/es/components/material-quiz/QuizResultBadge.js +27 -22
  78. package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
  79. package/es/components/material-quiz/constants/color.js +5 -5
  80. package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
  81. package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
  82. package/es/components/material-quiz/index.js +2 -0
  83. package/es/components/material-quiz/locales/index.js +4 -0
  84. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
  85. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
  86. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
  87. package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
  88. package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
  89. package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
  90. package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
  91. package/es/components/material-quiz-edit/context.js +4 -2
  92. package/es/components/material-quiz-edit/index.js +1 -0
  93. package/es/components/material-quiz-edit/locales/index.js +4 -0
  94. package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
  95. package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
  96. package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
  97. package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
  98. package/es/components/material-quiz-edit/options/OptionText.js +86 -82
  99. package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
  100. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
  101. package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
  102. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
  103. package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
  104. package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
  105. package/es/components/material-quiz-edit/utils/editValue.js +17 -12
  106. package/es/components/shared/QuestionBox.js +192 -165
  107. package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
  108. package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
  109. package/es/components/shared/QuizDraggbleOption.js +61 -59
  110. package/es/components/shared/StyledMarkdown.js +1 -1
  111. package/es/components/shared/index.js +7 -0
  112. package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
  113. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  114. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
  115. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +54 -68
  116. package/es/components/shared/question-radio/QuestionRadio.js +9 -7
  117. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  118. package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
  119. package/es/components/shared/question-radio/QuestionRadioOption.js +47 -59
  120. package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
  121. package/es/components/shared/utils/mergeRefs.js +15 -6
  122. package/es/constant/element.js +3 -3
  123. package/es/constant/index.js +1 -0
  124. package/es/helpers/index.js +8 -10
  125. package/es/hooks/index.js +1 -0
  126. package/es/hooks/useCaculatePassage.js +21 -20
  127. package/package.json +12 -15
@@ -1,3 +1,4 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
1
2
  import React from 'react';
2
3
  import { useFormContext, useFieldArray, useWatch, Controller } from 'react-hook-form';
3
4
  import { arrayMove } from 'react-sortable-hoc';
@@ -11,50 +12,47 @@ import { useMaterialQuizEditContext } from '../context.js';
11
12
  import { createRandomId } from '../utils/randomId.js';
12
13
  import OptionEditor from './OptionEditor.js';
13
14
 
14
- const MIN_OPTION_INFO_COUNT = 2;
15
- const MAX_OPTION_INFO_COUNT = 20;
16
- const StyledWrap = styled.div.withConfig({
15
+ var MIN_OPTION_INFO_COUNT = 2;
16
+ var MAX_OPTION_INFO_COUNT = 20;
17
+ var StyledWrap = styled.div.withConfig({
17
18
  componentId: "sc-vizer2-0"
18
19
  })(["& > ul{display:flex;flex-direction:column;gap:0.75rem;}"]);
19
- const StyledInputGroup = styled(SortableListGroup).withConfig({
20
+ var StyledInputGroup = styled(SortableListGroup).withConfig({
20
21
  componentId: "sc-vizer2-1"
21
22
  })(["width:100%;.em-option-editor{margin-bottom:0.5rem;&:last-of-type{margin-bottom:0;}}"]);
22
- const StyledInputPrefixRadioOption = styled(RadioOption).withConfig({
23
+ var StyledInputPrefixRadioOption = styled(RadioOption).withConfig({
23
24
  componentId: "sc-vizer2-2"
24
25
  })([".eb-radio-option__label{display:none;}"]);
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,
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,
47
45
  name: 'answerInfoDefault'
48
46
  });
49
- const watchedOptions = useWatch({
50
- control,
47
+ var watchedOptions = useWatch({
48
+ control: control,
51
49
  name: 'optionsDefault'
52
50
  });
53
51
  /**
54
52
  * Update answer info.
55
53
  */
56
- const updateAnswerInfo = index => {
57
- const prevAnswerInfo = getValues('answerInfoDefault');
54
+ var updateAnswerInfo = function updateAnswerInfo(index) {
55
+ var prevAnswerInfo = getValues('answerInfoDefault');
58
56
  if (!Array.isArray(prevAnswerInfo)) {
59
57
  return;
60
58
  }
@@ -66,7 +64,7 @@ const OptionSelectOne = () => {
66
64
  /**
67
65
  * Append option info.
68
66
  */
69
- const appendOptionInfo = () => {
67
+ var appendOptionInfo = function appendOptionInfo() {
70
68
  appendOptionInfoFieldItem({
71
69
  id: createRandomId(),
72
70
  title: '',
@@ -76,10 +74,10 @@ const OptionSelectOne = () => {
76
74
  /**
77
75
  * Remove item from option info at index.
78
76
  */
79
- const removeOptionInfo = index => {
77
+ var removeOptionInfo = function removeOptionInfo(index) {
80
78
  // set answer info to 0 index,
81
79
  // if this option is selected as answer.
82
- const curAnswerInfo = getValues('answerInfoDefault');
80
+ var curAnswerInfo = getValues('answerInfoDefault');
83
81
  if (Array.isArray(curAnswerInfo) && curAnswerInfo.includes(index)) {
84
82
  updateAnswerInfo(0);
85
83
  }
@@ -88,16 +86,19 @@ const OptionSelectOne = () => {
88
86
  /**
89
87
  * Sort options based on the old and new index.
90
88
  */
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);
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
+ });
101
102
  setValue('answerInfoDefault', [updatedAnswer]);
102
103
  moveOptionInfoFieldItem(oldIndex, newIndex);
103
104
  };
@@ -107,109 +108,123 @@ const OptionSelectOne = () => {
107
108
  if (!Array.isArray(watchedAnswerInfo)) {
108
109
  return null;
109
110
  }
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
- });
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;
119
123
  }
120
- return true;
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
+ });
121
142
  }
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'
154
- })
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,
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,
187
215
  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
- })))));
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
+ })
224
+ })
225
+ })
226
+ })]
227
+ });
213
228
  };
214
229
 
215
230
  export { OptionSelectOne as default };
@@ -1,5 +1,5 @@
1
1
  import _styled from '@emotion/styled/base';
2
- import React from 'react';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
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,101 +10,105 @@ import { useMaterialQuizEditContext } from '../context.js';
10
10
  //
11
11
  //
12
12
  //
13
- const MIN_TEXT_LENGTH = 1;
14
- const MAX_TEXT_LENGTH = 128;
13
+ var MIN_TEXT_LENGTH = 1;
14
+ var MAX_TEXT_LENGTH = 128;
15
15
  //
16
16
  //
17
17
  //
18
- const StyledInput = /*#__PURE__*/_styled(Input, {
18
+ var StyledInput = /*#__PURE__*/_styled(Input, {
19
19
  target: "edimfaf0"
20
- })("&>:first-child{", ({
21
- disabled
22
- }) => disabled && /*#__PURE__*/css("background-color:", base.color.gray2, ";"), ";}");
20
+ })("&>:first-child{", function (_ref) {
21
+ var disabled = _ref.disabled;
22
+ return disabled && /*#__PURE__*/css("background-color:", base.color.gray2, ";");
23
+ }, ";}");
23
24
  //
24
25
  //
25
26
  //
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,
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,
36
35
  name: 'isAutoGrade'
37
36
  });
38
37
  //
39
38
  //
40
39
  //
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
- })
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
- })
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
+ }
59
69
  },
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
- })
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
+ }));
68
89
  }
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
- }));
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
+ }));
109
+ }
110
+ })]
111
+ });
108
112
  };
109
113
 
110
114
  export { OptionText as default };
@@ -1,19 +1,20 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
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
- const OptionGroup = () => {
6
+ var OptionGroup = function OptionGroup() {
7
7
  //
8
8
  //
9
9
  //
10
- return React.createElement(Flex, {
10
+ return jsxs(Flex, {
11
11
  column: true,
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));
12
+ margintop: "1.5rem",
13
+ children: [jsx(OptionGroupGroupInfo, {}), jsx(Hr, {
14
+ marginStart: "1.5rem",
15
+ marginEnd: "1.5rem"
16
+ }), jsx(OptionGroupAnswerInfo, {})]
17
+ });
17
18
  };
18
19
 
19
20
  export { OptionGroup as default };