@elice/material-survey 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 (67) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +399 -0
  2. package/cjs/components/markdown-editor/index.d.ts +1 -2
  3. package/cjs/components/markdown-editor/index.js +19 -10
  4. package/cjs/components/material-survey/MaterialSurvey.js +82 -57
  5. package/cjs/components/material-survey/MaterialSurveyInfo.js +69 -59
  6. package/cjs/components/material-survey/MaterialSurveySelectMultiple.js +131 -90
  7. package/cjs/components/material-survey/MaterialSurveySelectOne.js +125 -86
  8. package/cjs/components/material-survey/MaterialSurveyShimmer.js +47 -40
  9. package/cjs/components/material-survey/MaterialSurveyText.js +114 -75
  10. package/cjs/components/material-survey/SurveyResultBadge.js +17 -10
  11. package/cjs/components/material-survey/SurveySubmitStatusText.js +21 -16
  12. package/cjs/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
  13. package/cjs/components/material-survey/context/MaterialSurveyContext.js +115 -74
  14. package/cjs/components/material-survey/index.js +9 -0
  15. package/cjs/components/material-survey/locales/index.js +13 -0
  16. package/cjs/components/material-survey-edit/MaterialSurveyEdit.js +49 -36
  17. package/cjs/components/material-survey-edit/MaterialSurveyEditContent.js +113 -91
  18. package/cjs/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +100 -87
  19. package/cjs/components/material-survey-edit/context.js +8 -2
  20. package/cjs/components/material-survey-edit/index.js +7 -0
  21. package/cjs/components/material-survey-edit/locales/index.js +13 -0
  22. package/cjs/components/material-survey-edit/utils/editValue.js +17 -11
  23. package/cjs/components/shared/StyledMarkdown.js +5 -1
  24. package/cjs/components/shared/SurveyContentBox.js +85 -74
  25. package/cjs/components/shared/index.js +13 -0
  26. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
  27. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  28. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
  29. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +66 -89
  30. package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
  31. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  32. package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
  33. package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -80
  34. package/es/_virtual/_rollupPluginBabelHelpers.js +386 -0
  35. package/es/components/markdown-editor/index.d.ts +1 -2
  36. package/es/components/markdown-editor/index.js +15 -10
  37. package/es/components/material-survey/MaterialSurvey.js +77 -57
  38. package/es/components/material-survey/MaterialSurveyInfo.js +65 -59
  39. package/es/components/material-survey/MaterialSurveySelectMultiple.js +127 -90
  40. package/es/components/material-survey/MaterialSurveySelectOne.js +121 -86
  41. package/es/components/material-survey/MaterialSurveyShimmer.js +43 -40
  42. package/es/components/material-survey/MaterialSurveyText.js +109 -75
  43. package/es/components/material-survey/SurveyResultBadge.js +13 -10
  44. package/es/components/material-survey/SurveySubmitStatusText.js +17 -16
  45. package/es/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
  46. package/es/components/material-survey/context/MaterialSurveyContext.js +112 -75
  47. package/es/components/material-survey/index.js +2 -0
  48. package/es/components/material-survey/locales/index.js +4 -0
  49. package/es/components/material-survey-edit/MaterialSurveyEdit.js +45 -36
  50. package/es/components/material-survey-edit/MaterialSurveyEditContent.js +107 -90
  51. package/es/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +96 -87
  52. package/es/components/material-survey-edit/context.js +4 -2
  53. package/es/components/material-survey-edit/index.js +1 -0
  54. package/es/components/material-survey-edit/locales/index.js +4 -0
  55. package/es/components/material-survey-edit/utils/editValue.js +17 -11
  56. package/es/components/shared/StyledMarkdown.js +1 -1
  57. package/es/components/shared/SurveyContentBox.js +81 -74
  58. package/es/components/shared/index.js +4 -0
  59. package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
  60. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  61. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
  62. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +61 -89
  63. package/es/components/shared/question-radio/QuestionRadio.js +9 -7
  64. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  65. package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
  66. package/es/components/shared/question-radio/QuestionRadioOption.js +54 -80
  67. package/package.json +9 -12
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
5
7
  var React = require('react');
6
8
  var reactHookForm = require('react-hook-form');
7
9
  var blocks = require('@elice/blocks');
@@ -13,28 +15,34 @@ var randomId = require('./utils/randomId.js');
13
15
  var context = require('./context.js');
14
16
  var MaterialSurveyEditOptionSelect = require('./MaterialSurveyEditOptionSelect.js');
15
17
 
16
- const MIN_TEXT_LENGTH = 1;
17
- const MAX_TEXT_LENGTH = 128;
18
- const StyledSurveyOptionTypeSelectWrap = styled.div.withConfig({
18
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
19
+
20
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
21
+ var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
22
+
23
+ var MIN_TEXT_LENGTH = 1;
24
+ var MAX_TEXT_LENGTH = 128;
25
+ var StyledSurveyOptionTypeSelectWrap = styled__default.default.div.withConfig({
19
26
  componentId: "sc-r4ms68-0"
20
27
  })(["display:flex;max-width:12rem;"]);
21
- const MaterialSurveyEditContent = () => {
22
- const intl$1 = intl.useRawEliceIntl();
23
- const {
24
- disabled,
25
- onFileUploadRequest
26
- } = context.useMaterialSurveyEditContext();
27
- const {
28
- control,
29
- watch,
30
- setValue
31
- } = reactHookForm.useFormContext();
32
- const [watchedOptionType, watchedOptionInfo] = watch(['questionInfoList.0.optionType', 'questionInfoList.0.optionInfo']);
28
+ var MaterialSurveyEditContent = function MaterialSurveyEditContent() {
29
+ var intl$1 = intl.useRawEliceIntl();
30
+ var _useMaterialSurveyEdi = context.useMaterialSurveyEditContext(),
31
+ disabled = _useMaterialSurveyEdi.disabled,
32
+ onFileUploadRequest = _useMaterialSurveyEdi.onFileUploadRequest;
33
+ var _useFormContext = reactHookForm.useFormContext(),
34
+ control = _useFormContext.control,
35
+ watch = _useFormContext.watch,
36
+ setValue = _useFormContext.setValue;
37
+ var _watch = watch(['questionInfoList.0.optionType', 'questionInfoList.0.optionInfo']),
38
+ _watch2 = _rollupPluginBabelHelpers.slicedToArray(_watch, 2),
39
+ watchedOptionType = _watch2[0],
40
+ watchedOptionInfo = _watch2[1];
33
41
  //
34
42
  // Change `optionInfo` according to `optionType`.
35
43
  //
36
- React.useEffect(() => {
37
- const get = () => {
44
+ React__default.default.useEffect(function () {
45
+ var get = function get() {
38
46
  switch (watchedOptionType) {
39
47
  case types.enums.SurveyOptionType.SelectOne:
40
48
  case types.enums.SurveyOptionType.SelectMultiple:
@@ -69,28 +77,29 @@ const MaterialSurveyEditContent = () => {
69
77
  * Input of option info and answer info,
70
78
  * according to option type.
71
79
  */
72
- const Option = React.useMemo(() => {
80
+ var Option = React__default.default.useMemo(function () {
73
81
  switch (watchedOptionType) {
74
82
  case types.enums.SurveyOptionType.SelectOne:
75
83
  case types.enums.SurveyOptionType.SelectMultiple:
76
84
  return MaterialSurveyEditOptionSelect.default;
77
85
  case types.enums.SurveyOptionType.Text:
78
86
  default:
79
- return React.Fragment;
87
+ return React__default.default.Fragment;
80
88
  }
81
89
  }, [watchedOptionType]);
82
90
  /**
83
91
  * Render input for survey title.
84
92
  */
85
- const renderQuestionTitleInput = () => {
86
- return React.createElement(blocks.FormInputVerticalLayout, {
87
- label: React.createElement(blocks.Label, {
93
+ var renderQuestionTitleInput = function renderQuestionTitleInput() {
94
+ return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
95
+ label: jsxRuntime.jsx(blocks.Label, {
88
96
  size: "small",
89
- required: true
90
- }, intl$1.formatMessage({
91
- id: 'content.title'
92
- })),
93
- input: React.createElement(reactHookForm.Controller, {
97
+ required: true,
98
+ children: intl$1.formatMessage({
99
+ id: 'content.title'
100
+ })
101
+ }),
102
+ input: jsxRuntime.jsx(reactHookForm.Controller, {
94
103
  control: control,
95
104
  name: "questionInfoList.0.questionTitle",
96
105
  rules: {
@@ -119,12 +128,11 @@ const MaterialSurveyEditContent = () => {
119
128
  })
120
129
  }
121
130
  },
122
- render: ({
123
- field,
124
- fieldState
125
- }) => {
131
+ render: function render(_ref) {
132
+ var field = _ref.field,
133
+ fieldState = _ref.fieldState;
126
134
  var _a;
127
- return React.createElement(blocks.Input, Object.assign({
135
+ return jsxRuntime.jsx(blocks.Input, Object.assign({
128
136
  size: "small",
129
137
  width: "full",
130
138
  minLength: MIN_TEXT_LENGTH,
@@ -142,79 +150,93 @@ const MaterialSurveyEditContent = () => {
142
150
  /**
143
151
  * Render input for survey description.
144
152
  */
145
- const renderQuestionDescriptionInput = () => {
146
- return React.createElement(blocks.FormInputVerticalLayout, {
147
- label: React.createElement(blocks.Label, {
148
- size: "small"
149
- }, intl$1.formatMessage({
150
- id: 'content.description.title'
151
- })),
152
- input: React.createElement(reactHookForm.Controller, {
153
+ var renderQuestionDescriptionInput = function renderQuestionDescriptionInput() {
154
+ return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
155
+ label: jsxRuntime.jsx(blocks.Label, {
156
+ size: "small",
157
+ children: intl$1.formatMessage({
158
+ id: 'content.description.title'
159
+ })
160
+ }),
161
+ input: jsxRuntime.jsx(reactHookForm.Controller, {
153
162
  control: control,
154
163
  name: "questionInfoList.0.questionDescription",
155
- render: ({
156
- field
157
- }) => React.createElement(index.MarkdownEditor, Object.assign({
158
- placeholder: intl$1.formatMessage({
159
- id: 'content.description.placeholder'
160
- }),
161
- onFileUploadRequest: onFileUploadRequest
162
- }, field))
164
+ render: function render(_ref2) {
165
+ var field = _ref2.field;
166
+ return jsxRuntime.jsx(index.MarkdownEditor, Object.assign({
167
+ placeholder: intl$1.formatMessage({
168
+ id: 'content.description.placeholder'
169
+ }),
170
+ onFileUploadRequest: onFileUploadRequest
171
+ }, field));
172
+ }
163
173
  })
164
174
  });
165
175
  };
166
176
  /**
167
177
  * Render input of option type, option info and answer info.
168
178
  */
169
- const renderOptionInput = () => {
170
- return React.createElement(blocks.FormInputVerticalLayout, {
171
- label: React.createElement(blocks.Label, {
179
+ var renderOptionInput = function renderOptionInput() {
180
+ return jsxRuntime.jsx(blocks.FormInputVerticalLayout, {
181
+ label: jsxRuntime.jsx(blocks.Label, {
172
182
  size: "small",
173
- required: true
174
- }, intl$1.formatMessage({
175
- id: 'content.option.title'
176
- })),
177
- input: React.createElement(React.Fragment, null, React.createElement(reactHookForm.Controller, {
178
- control: control,
179
- name: "questionInfoList.0.optionType",
180
- render: ({
181
- field
182
- }) => React.createElement(blocks.Tooltip, {
183
- title: disabled ? intl$1.formatMessage({
184
- id: 'content.option.tooltip.disabled'
185
- }) : undefined,
186
- placement: "top-end"
187
- }, React.createElement(StyledSurveyOptionTypeSelectWrap, null, React.createElement(blocks.Select, Object.assign({
188
- size: "small",
189
- width: "small",
190
- readOnly: disabled
191
- }, field, {
192
- onChange: v => field.onChange(Number(v))
193
- }), React.createElement("option", {
194
- value: types.enums.SurveyOptionType.SelectOne,
195
- children: intl$1.formatMessage({
196
- id: 'content.option.select.items.selectOne'
197
- })
198
- }), React.createElement("option", {
199
- value: types.enums.SurveyOptionType.SelectMultiple,
200
- children: intl$1.formatMessage({
201
- id: 'content.option.select.items.selectMultiple'
202
- })
203
- }), React.createElement("option", {
204
- value: types.enums.SurveyOptionType.Text,
205
- children: intl$1.formatMessage({
206
- id: 'content.option.select.items.text'
207
- })
208
- }))))
209
- }), React.createElement(blocks.Vspace, {
210
- height: 0.5
211
- }), React.createElement(Option, null))
183
+ required: true,
184
+ children: intl$1.formatMessage({
185
+ id: 'content.option.title'
186
+ })
187
+ }),
188
+ input: jsxRuntime.jsxs(jsxRuntime.Fragment, {
189
+ children: [jsxRuntime.jsx(reactHookForm.Controller, {
190
+ control: control,
191
+ name: "questionInfoList.0.optionType",
192
+ render: function render(_ref3) {
193
+ var field = _ref3.field;
194
+ return jsxRuntime.jsx(blocks.Tooltip, {
195
+ title: disabled ? intl$1.formatMessage({
196
+ id: 'content.option.tooltip.disabled'
197
+ }) : undefined,
198
+ placement: "top-end",
199
+ children: jsxRuntime.jsx(StyledSurveyOptionTypeSelectWrap, {
200
+ children: jsxRuntime.jsxs(blocks.Select, Object.assign({
201
+ size: "small",
202
+ width: "small",
203
+ readOnly: disabled
204
+ }, field, {
205
+ onChange: function onChange(v) {
206
+ return field.onChange(Number(v));
207
+ },
208
+ children: [jsxRuntime.jsx("option", {
209
+ value: types.enums.SurveyOptionType.SelectOne,
210
+ children: intl$1.formatMessage({
211
+ id: 'content.option.select.items.selectOne'
212
+ })
213
+ }), jsxRuntime.jsx("option", {
214
+ value: types.enums.SurveyOptionType.SelectMultiple,
215
+ children: intl$1.formatMessage({
216
+ id: 'content.option.select.items.selectMultiple'
217
+ })
218
+ }), jsxRuntime.jsx("option", {
219
+ value: types.enums.SurveyOptionType.Text,
220
+ children: intl$1.formatMessage({
221
+ id: 'content.option.select.items.text'
222
+ })
223
+ })]
224
+ }))
225
+ })
226
+ });
227
+ }
228
+ }), jsxRuntime.jsx(blocks.Vspace, {
229
+ height: 0.5
230
+ }), jsxRuntime.jsx(Option, {})]
231
+ })
212
232
  });
213
233
  };
214
234
  //
215
235
  //
216
236
  //
217
- return React.createElement(React.Fragment, null, renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput());
237
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
238
+ children: [renderQuestionTitleInput(), renderQuestionDescriptionInput(), renderOptionInput()]
239
+ });
218
240
  };
219
241
 
220
242
  exports.default = MaterialSurveyEditContent;
@@ -2,7 +2,7 @@
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 reactHookForm = require('react-hook-form');
7
7
  var blocks = require('@elice/blocks');
8
8
  var icons = require('@elice/icons');
@@ -11,35 +11,36 @@ var styled = require('styled-components');
11
11
  var randomId = require('./utils/randomId.js');
12
12
  var context = require('./context.js');
13
13
 
14
- const MIN_OPTION_INFO_COUNT = 2;
15
- const MAX_OPTION_INFO_COUNT = 20;
16
- const StyledWrap = styled.div.withConfig({
14
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
15
+
16
+ var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
17
+
18
+ var MIN_OPTION_INFO_COUNT = 2;
19
+ var MAX_OPTION_INFO_COUNT = 20;
20
+ var StyledWrap = styled__default.default.div.withConfig({
17
21
  componentId: "sc-1eiyk6z-0"
18
22
  })([""]);
19
- const StyledInputGroup = styled.div.withConfig({
23
+ var StyledInputGroup = styled__default.default.div.withConfig({
20
24
  componentId: "sc-1eiyk6z-1"
21
25
  })(["width:100%;.eb-input{margin-bottom:0.5rem;&:last-of-type{margin-bottom:0;}}"]);
22
- const OptionSelectOne = () => {
23
- const intl$1 = intl.useRawEliceIntl();
24
- const {
25
- disabled
26
- } = context.useMaterialSurveyEditContext();
27
- const {
28
- control
29
- } = reactHookForm.useFormContext();
30
- const {
31
- fields: optionInfoFields,
32
- append: appendOptionInfoFieldItem,
33
- remove: removeOptionInfoFieldItem
34
- } = reactHookForm.useFieldArray({
35
- name: 'questionInfoList.0.optionInfo',
36
- keyName: 'id',
37
- shouldUnregister: true
38
- });
26
+ var OptionSelectOne = function OptionSelectOne() {
27
+ var intl$1 = intl.useRawEliceIntl();
28
+ var _useMaterialSurveyEdi = context.useMaterialSurveyEditContext(),
29
+ disabled = _useMaterialSurveyEdi.disabled;
30
+ var _useFormContext = reactHookForm.useFormContext(),
31
+ control = _useFormContext.control;
32
+ var _useFieldArray = reactHookForm.useFieldArray({
33
+ name: 'questionInfoList.0.optionInfo',
34
+ keyName: 'id',
35
+ shouldUnregister: true
36
+ }),
37
+ optionInfoFields = _useFieldArray.fields,
38
+ appendOptionInfoFieldItem = _useFieldArray.append,
39
+ removeOptionInfoFieldItem = _useFieldArray.remove;
39
40
  /**
40
41
  * Append option info.
41
42
  */
42
- const appendOptionInfo = () => {
43
+ var appendOptionInfo = function appendOptionInfo() {
43
44
  appendOptionInfoFieldItem({
44
45
  id: randomId.createRandomId(),
45
46
  value: ''
@@ -48,76 +49,88 @@ const OptionSelectOne = () => {
48
49
  /**
49
50
  * Remove item from option info at index.
50
51
  */
51
- const removeOptionInfo = index => {
52
+ var removeOptionInfo = function removeOptionInfo(index) {
52
53
  removeOptionInfoFieldItem(index);
53
54
  };
54
55
  //
55
56
  //
56
57
  //
57
- return React.createElement(StyledWrap, null, React.createElement(StyledInputGroup, null, optionInfoFields.map(({
58
- id
59
- }, index) => React.createElement(reactHookForm.Controller, {
60
- key: id,
61
- control: control,
62
- name: `questionInfoList.0.optionInfo.${index}.value`,
63
- rules: {
64
- required: {
65
- value: true,
66
- message: intl$1.formatMessage({
67
- id: 'option.common.select.errorMessage.required'
68
- })
69
- }
70
- },
71
- render: ({
72
- field,
73
- fieldState
74
- }) => {
75
- var _a;
76
- return React.createElement(blocks.Input, Object.assign({
77
- size: "small",
78
- width: "full",
79
- placeholder: intl$1.formatMessage({
80
- id: 'option.common.select.placeholder'
81
- }),
82
- suffix: React.createElement(blocks.Tooltip, {
83
- title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl$1.formatMessage({
84
- id: 'option.common.select.tooltip.minOptionInfoItem'
85
- }) : undefined,
86
- placement: "top-start"
87
- }, React.createElement("span", null, React.createElement(blocks.IconButton, {
88
- icon: icons.eilMathsignMultiplyBasic,
89
- role: "grey9",
90
- size: "tiny",
91
- border: false,
58
+ return jsxRuntime.jsxs(StyledWrap, {
59
+ children: [jsxRuntime.jsx(StyledInputGroup, {
60
+ children: optionInfoFields.map(function (_ref, index) {
61
+ var id = _ref.id;
62
+ return jsxRuntime.jsx(reactHookForm.Controller, {
63
+ control: control,
64
+ name: "questionInfoList.0.optionInfo.".concat(index, ".value"),
65
+ rules: {
66
+ required: {
67
+ value: true,
68
+ message: intl$1.formatMessage({
69
+ id: 'option.common.select.errorMessage.required'
70
+ })
71
+ }
72
+ },
73
+ render: function render(_ref2) {
74
+ var field = _ref2.field,
75
+ fieldState = _ref2.fieldState;
76
+ var _a;
77
+ return jsxRuntime.jsx(blocks.Input, Object.assign({
78
+ size: "small",
79
+ width: "full",
80
+ placeholder: intl$1.formatMessage({
81
+ id: 'option.common.select.placeholder'
82
+ }),
83
+ suffix: jsxRuntime.jsx(blocks.Tooltip, {
84
+ title: optionInfoFields.length <= MIN_OPTION_INFO_COUNT ? intl$1.formatMessage({
85
+ id: 'option.common.select.tooltip.minOptionInfoItem'
86
+ }) : undefined,
87
+ placement: "top-start",
88
+ children: jsxRuntime.jsx("span", {
89
+ children: jsxRuntime.jsx(blocks.IconButton, {
90
+ icon: icons.eilMathsignMultiplyBasic,
91
+ role: "grey9",
92
+ size: "tiny",
93
+ border: false,
94
+ transparent: true,
95
+ disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
96
+ onClick: function onClick() {
97
+ return removeOptionInfo(index);
98
+ }
99
+ })
100
+ })
101
+ }),
102
+ readOnly: disabled,
103
+ invalid: fieldState.invalid,
104
+ invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message
105
+ }, field));
106
+ }
107
+ }, id);
108
+ })
109
+ }), jsxRuntime.jsx(blocks.Vspace, {
110
+ height: 0.5
111
+ }), jsxRuntime.jsx(blocks.Tooltip, {
112
+ title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl$1.formatMessage({
113
+ id: 'option.common.select.tooltip.maxOptionInfoItem'
114
+ }) : undefined,
115
+ placement: "bottom",
116
+ children: jsxRuntime.jsx("span", {
117
+ children: jsxRuntime.jsx(blocks.Button, {
118
+ block: true,
119
+ size: "micro",
120
+ borderDashed: true,
92
121
  transparent: true,
93
- disabled: optionInfoFields.length <= MIN_OPTION_INFO_COUNT || disabled,
94
- onClick: () => removeOptionInfo(index)
95
- }))),
96
- readOnly: disabled,
97
- invalid: fieldState.invalid,
98
- invalidText: (_a = fieldState.error) === null || _a === void 0 ? void 0 : _a.message
99
- }, field));
100
- }
101
- }))), React.createElement(blocks.Vspace, {
102
- height: 0.5
103
- }), React.createElement(blocks.Tooltip, {
104
- title: optionInfoFields.length >= MAX_OPTION_INFO_COUNT ? intl$1.formatMessage({
105
- id: 'option.common.select.tooltip.maxOptionInfoItem'
106
- }) : undefined,
107
- placement: "bottom"
108
- }, React.createElement("span", null, React.createElement(blocks.Button, {
109
- block: true,
110
- size: "micro",
111
- borderDashed: true,
112
- transparent: true,
113
- icon: React.createElement(blocks.Icon, {
114
- icon: icons.eilMathsignAddCircle
115
- }),
116
- disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
117
- onClick: appendOptionInfo
118
- }, intl$1.formatMessage({
119
- id: 'option.common.select.addButton'
120
- })))));
122
+ icon: jsxRuntime.jsx(blocks.Icon, {
123
+ icon: icons.eilMathsignAddCircle
124
+ }),
125
+ disabled: optionInfoFields.length >= MAX_OPTION_INFO_COUNT || disabled,
126
+ onClick: appendOptionInfo,
127
+ children: intl$1.formatMessage({
128
+ id: 'option.common.select.addButton'
129
+ })
130
+ })
131
+ })
132
+ })]
133
+ });
121
134
  };
122
135
 
123
136
  exports.default = OptionSelectOne;
@@ -4,8 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
 
7
- const MaterialSurveyEditContext = React.createContext(null);
8
- const useMaterialSurveyEditContext = () => React.useContext(MaterialSurveyEditContext);
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
10
+
11
+ var MaterialSurveyEditContext = React__default.default.createContext(null);
12
+ var useMaterialSurveyEditContext = function useMaterialSurveyEditContext() {
13
+ return React__default.default.useContext(MaterialSurveyEditContext);
14
+ };
9
15
 
10
16
  exports.default = MaterialSurveyEditContext;
11
17
  exports.useMaterialSurveyEditContext = useMaterialSurveyEditContext;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var MaterialSurveyEdit = require('./MaterialSurveyEdit.js');
4
+
5
+
6
+
7
+ exports.MaterialSurveyEdit = MaterialSurveyEdit.default;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var en = require('./en.json.js');
4
+ var ko = require('./ko.json.js');
5
+ var th = require('./th.json.js');
6
+ var ja = require('./ja.json.js');
7
+
8
+
9
+
10
+ exports.messageEn = en.default;
11
+ exports.messageKo = ko.default;
12
+ exports.messageTh = th.default;
13
+ exports.messageJa = ja.default;
@@ -7,14 +7,18 @@ var randomId = require('./randomId.js');
7
7
  */
8
8
  function manipulateValue(v) {
9
9
  return Object.assign(Object.assign({}, v), {
10
- questionInfoList: v.questionInfoList.map(questionInfo => Object.assign(Object.assign({}, questionInfo), {
11
- // convert string array to object array
12
- // - ref: https://github.com/react-hook-form/react-hook-form/issues/7622#issuecomment-1018893318
13
- optionInfo: Array.isArray(questionInfo.optionInfo) ? questionInfo.optionInfo.map(option => ({
14
- id: randomId.createRandomId(),
15
- value: option
16
- })) : []
17
- }))
10
+ questionInfoList: v.questionInfoList.map(function (questionInfo) {
11
+ return Object.assign(Object.assign({}, questionInfo), {
12
+ // convert string array to object array
13
+ // - ref: https://github.com/react-hook-form/react-hook-form/issues/7622#issuecomment-1018893318
14
+ optionInfo: Array.isArray(questionInfo.optionInfo) ? questionInfo.optionInfo.map(function (option) {
15
+ return {
16
+ id: randomId.createRandomId(),
17
+ value: option
18
+ };
19
+ }) : []
20
+ });
21
+ })
18
22
  });
19
23
  }
20
24
  /**
@@ -22,10 +26,12 @@ function manipulateValue(v) {
22
26
  */
23
27
  function restoreValue(v) {
24
28
  return Object.assign(Object.assign({}, v), {
25
- questionInfoList: v.questionInfoList.map(questionInfo => {
29
+ questionInfoList: v.questionInfoList.map(function (questionInfo) {
26
30
  var _a;
27
- const newQuestionInfo = Object.assign(Object.assign({}, questionInfo), {
28
- optionInfo: ((_a = questionInfo.optionInfo) === null || _a === void 0 ? void 0 : _a.length) ? questionInfo.optionInfo.map(option => option.value) : null
31
+ var newQuestionInfo = Object.assign(Object.assign({}, questionInfo), {
32
+ optionInfo: ((_a = questionInfo.optionInfo) === null || _a === void 0 ? void 0 : _a.length) ? questionInfo.optionInfo.map(function (option) {
33
+ return option.value;
34
+ }) : null
29
35
  });
30
36
  if (!newQuestionInfo.optionInfo) {
31
37
  delete newQuestionInfo.optionInfo;
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var markdown = require('@elice/markdown');
6
6
  var styled = require('styled-components');
7
7
 
8
- const StyledMarkdown = styled(markdown.Markdown).withConfig({
8
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
9
+
10
+ var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
11
+
12
+ var StyledMarkdown = styled__default.default(markdown.Markdown).withConfig({
9
13
  componentId: "sc-h8kc9g-0"
10
14
  })(["p{margin:0 !important;}"]);
11
15