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