@elice/material-survey 1.240718.0-trasncript.2 → 1.240718.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/components/markdown-editor/index.d.ts +2 -1
  2. package/cjs/components/markdown-editor/index.js +10 -19
  3. package/cjs/components/material-survey/MaterialSurvey.js +57 -82
  4. package/cjs/components/material-survey/MaterialSurveyInfo.js +59 -69
  5. package/cjs/components/material-survey/MaterialSurveySelectMultiple.js +90 -131
  6. package/cjs/components/material-survey/MaterialSurveySelectOne.js +86 -125
  7. package/cjs/components/material-survey/MaterialSurveyShimmer.js +40 -47
  8. package/cjs/components/material-survey/MaterialSurveyText.js +75 -114
  9. package/cjs/components/material-survey/SurveyResultBadge.js +10 -17
  10. package/cjs/components/material-survey/SurveySubmitStatusText.js +16 -21
  11. package/cjs/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
  12. package/cjs/components/material-survey/context/MaterialSurveyContext.js +74 -115
  13. package/cjs/components/material-survey-edit/MaterialSurveyEdit.js +36 -49
  14. package/cjs/components/material-survey-edit/MaterialSurveyEditContent.js +91 -113
  15. package/cjs/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +87 -100
  16. package/cjs/components/material-survey-edit/context.js +2 -8
  17. package/cjs/components/material-survey-edit/utils/editValue.js +11 -17
  18. package/cjs/components/shared/StyledMarkdown.js +1 -5
  19. package/cjs/components/shared/SurveyContentBox.js +74 -85
  20. package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
  21. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  22. package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
  23. package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +89 -66
  24. package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
  25. package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  26. package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
  27. package/cjs/components/shared/question-radio/QuestionRadioOption.js +80 -59
  28. package/es/components/markdown-editor/index.d.ts +2 -1
  29. package/es/components/markdown-editor/index.js +10 -15
  30. package/es/components/material-survey/MaterialSurvey.js +57 -77
  31. package/es/components/material-survey/MaterialSurveyInfo.js +59 -65
  32. package/es/components/material-survey/MaterialSurveySelectMultiple.js +90 -127
  33. package/es/components/material-survey/MaterialSurveySelectOne.js +86 -121
  34. package/es/components/material-survey/MaterialSurveyShimmer.js +40 -43
  35. package/es/components/material-survey/MaterialSurveyText.js +75 -109
  36. package/es/components/material-survey/SurveyResultBadge.js +10 -13
  37. package/es/components/material-survey/SurveySubmitStatusText.js +16 -17
  38. package/es/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
  39. package/es/components/material-survey/context/MaterialSurveyContext.js +75 -112
  40. package/es/components/material-survey-edit/MaterialSurveyEdit.js +36 -45
  41. package/es/components/material-survey-edit/MaterialSurveyEditContent.js +90 -107
  42. package/es/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +87 -96
  43. package/es/components/material-survey-edit/context.js +2 -4
  44. package/es/components/material-survey-edit/utils/editValue.js +11 -17
  45. package/es/components/shared/StyledMarkdown.js +1 -1
  46. package/es/components/shared/SurveyContentBox.js +74 -81
  47. package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
  48. package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
  49. package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
  50. package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +89 -61
  51. package/es/components/shared/question-radio/QuestionRadio.js +7 -9
  52. package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
  53. package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
  54. package/es/components/shared/question-radio/QuestionRadioOption.js +80 -54
  55. package/package.json +12 -9
  56. package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -399
  57. package/cjs/components/material-survey/index.js +0 -9
  58. package/cjs/components/material-survey/locales/index.js +0 -13
  59. package/cjs/components/material-survey-edit/index.js +0 -7
  60. package/cjs/components/material-survey-edit/locales/index.js +0 -13
  61. package/cjs/components/shared/index.js +0 -13
  62. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -386
  63. package/es/components/material-survey/index.js +0 -2
  64. package/es/components/material-survey/locales/index.js +0 -4
  65. package/es/components/material-survey-edit/index.js +0 -1
  66. package/es/components/material-survey-edit/locales/index.js +0 -4
  67. package/es/components/shared/index.js +0 -4
@@ -7,18 +7,14 @@ 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(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
- })
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
+ }))
22
18
  });
23
19
  }
24
20
  /**
@@ -26,12 +22,10 @@ function manipulateValue(v) {
26
22
  */
27
23
  function restoreValue(v) {
28
24
  return Object.assign(Object.assign({}, v), {
29
- questionInfoList: v.questionInfoList.map(function (questionInfo) {
25
+ questionInfoList: v.questionInfoList.map(questionInfo => {
30
26
  var _a;
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
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
35
29
  });
36
30
  if (!newQuestionInfo.optionInfo) {
37
31
  delete newQuestionInfo.optionInfo;
@@ -5,11 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var markdown = require('@elice/markdown');
6
6
  var styled = require('styled-components');
7
7
 
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({
8
+ const StyledMarkdown = styled(markdown.Markdown).withConfig({
13
9
  componentId: "sc-h8kc9g-0"
14
10
  })(["p{margin:0 !important;}"]);
15
11
 
@@ -3,109 +3,98 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
7
  var blocks = require('@elice/blocks');
8
8
  var designTokens = require('@elice/design-tokens');
9
9
  var intl = require('@elice/intl');
10
10
  var styled = require('styled-components');
11
11
  var MaterialSurveyContext = require('../material-survey/context/MaterialSurveyContext.js');
12
12
 
13
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
-
15
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
16
-
17
- var StyledQuestionBox = styled__default.default.div.withConfig({
13
+ const StyledQuestionBox = styled.div.withConfig({
18
14
  componentId: "sc-h8ztvr-0"
19
- })(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;max-height:", ";min-height:", ";"], function (_ref) {
20
- var vertical = _ref.vertical;
21
- return vertical ? '0' : '8px';
22
- }, function (_ref2) {
23
- var hasFooter = _ref2.hasFooter;
24
- return hasFooter ? '100%' : '';
25
- }, function (_ref3) {
26
- var hasFooter = _ref3.hasFooter;
27
- return hasFooter ? '' : '100%';
28
- });
29
- var StyledQuestionBoxHeader = styled__default.default.div.withConfig({
15
+ })(["display:flex;flex-direction:column;border-radius:", ";overflow:hidden;width:100%;max-height:", ";min-height:", ";"], ({
16
+ vertical
17
+ }) => vertical ? '0' : '8px', ({
18
+ hasFooter
19
+ }) => hasFooter ? '100%' : '', ({
20
+ hasFooter
21
+ }) => hasFooter ? '' : '100%');
22
+ const StyledQuestionBoxHeader = styled.div.withConfig({
30
23
  componentId: "sc-h8ztvr-1"
31
24
  })(["display:flex;justify-content:space-between;background-color:", ";padding:1rem 1.5rem;flex:none;height:3.5rem;"], designTokens.base.color.navy6);
32
- var StyledQuestionBoxBody = styled__default.default.div.withConfig({
25
+ const StyledQuestionBoxBody = styled.div.withConfig({
33
26
  componentId: "sc-h8ztvr-2"
34
- })(["padding:1.5rem;background-color:", ";flex:auto;", "})"], designTokens.base.color.navy7, function (_ref4) {
35
- var hasFooter = _ref4.hasFooter;
36
- return hasFooter ? 'height: 100%; overflow-y: auto;' : '';
37
- });
38
- var StyledQuestionBoxFooter = styled__default.default.div.withConfig({
27
+ })(["padding:1.5rem;background-color:", ";flex:auto;", "})"], designTokens.base.color.navy7, ({
28
+ hasFooter
29
+ }) => hasFooter ? 'height: 100%; overflow-y: auto;' : '');
30
+ const StyledQuestionBoxFooter = styled.div.withConfig({
39
31
  componentId: "sc-h8ztvr-3"
40
- })(["flex:none;display:flex;justify-content:space-between;align-items:center;padding:0.75rem 1.5rem;background-color:", ";", ""], designTokens.base.color.navy8, function (_ref5) {
41
- var vertical = _ref5.vertical;
42
- return vertical ? "\n flex-direction: column;\n align-items: flex-start;\n " : '';
32
+ })(["flex:none;display:flex;justify-content:space-between;align-items:center;padding:0.75rem 1.5rem;background-color:", ";", ""], designTokens.base.color.navy8, ({
33
+ vertical
34
+ }) => {
35
+ return vertical ? `
36
+ flex-direction: column;
37
+ align-items: flex-start;
38
+ ` : '';
43
39
  });
44
- var StyledQuestionBoxFooterActions = styled__default.default.div.withConfig({
40
+ const StyledQuestionBoxFooterActions = styled.div.withConfig({
45
41
  componentId: "sc-h8ztvr-4"
46
42
  })(["display:flex;> *:not(:last-child){margin-right:0.75rem;}"]);
47
- var StyledQuestionBoxFooterStatus = styled__default.default.div.withConfig({
43
+ const StyledQuestionBoxFooterStatus = styled.div.withConfig({
48
44
  componentId: "sc-h8ztvr-5"
49
- })(["margin-left:0.75rem;", ""], function (_ref6) {
50
- var vertical = _ref6.vertical;
51
- return vertical ? "\n margin-left: 0;\n margin-top: 0.75rem;\n " : '';
45
+ })(["margin-left:0.75rem;", ""], ({
46
+ vertical
47
+ }) => {
48
+ return vertical ? `
49
+ margin-left: 0;
50
+ margin-top: 0.75rem;
51
+ ` : '';
52
52
  });
53
- var SurveyContentBox = function SurveyContentBox(_a) {
54
- var children = _a.children,
55
- _a$footerActions = _a.footerActions,
56
- footerActions = _a$footerActions === void 0 ? [] : _a$footerActions,
57
- title = _a.title,
58
- submitResult = _a.submitResult,
59
- submitStatus = _a.submitStatus,
60
- onNext = _a.onNext,
53
+ const SurveyContentBox = _a => {
54
+ var {
55
+ children,
56
+ footerActions = [],
57
+ title,
58
+ submitResult,
59
+ submitStatus,
60
+ onNext
61
+ } = _a,
61
62
  props = tslib.__rest(_a, ["children", "footerActions", "title", "submitResult", "submitStatus", "onNext"]);
62
- var intl$1 = intl.useRawEliceIntl();
63
- var _useMaterialSurveySta = MaterialSurveyContext.useMaterialSurveyState(),
64
- vertical = _useMaterialSurveySta.vertical;
65
- var hasFooter = footerActions.length > 0;
66
- var header = jsxRuntime.jsxs(StyledQuestionBoxHeader, {
67
- children: [jsxRuntime.jsx(blocks.Text, {
68
- bold: true,
69
- customStyles: {
70
- color: designTokens.base.color.navy0
71
- },
72
- children: title
73
- }), submitResult ? submitResult : null]
74
- });
75
- var body = jsxRuntime.jsx(StyledQuestionBoxBody, {
76
- hasFooter: hasFooter,
77
- children: children
78
- });
79
- var footer = jsxRuntime.jsxs(StyledQuestionBoxFooter, {
80
- vertical: vertical,
81
- children: [jsxRuntime.jsxs(StyledQuestionBoxFooterActions, {
82
- children: [footerActions.map(function (action, index) {
83
- return jsxRuntime.jsx(blocks.Button, Object.assign({
84
- size: "small"
85
- }, action, {
86
- children: action.children
87
- }), index);
88
- }), typeof onNext === 'function' ? jsxRuntime.jsx(blocks.Button, {
89
- size: "small",
90
- border: true,
91
- tabIndex: 0,
92
- transparent: false,
93
- role: "lightpurple",
94
- onClick: onNext,
95
- children: intl$1.formatMessage({
96
- id: 'materialSurvey.next'
97
- })
98
- }) : null]
99
- }), jsxRuntime.jsx(StyledQuestionBoxFooterStatus, {
100
- vertical: vertical,
101
- children: submitStatus
102
- })]
103
- });
104
- return jsxRuntime.jsxs(StyledQuestionBox, Object.assign({}, props, {
63
+ const intl$1 = intl.useRawEliceIntl();
64
+ const {
65
+ vertical
66
+ } = MaterialSurveyContext.useMaterialSurveyState();
67
+ const hasFooter = footerActions.length > 0;
68
+ const header = React.createElement(StyledQuestionBoxHeader, null, React.createElement(blocks.Text, {
69
+ bold: true,
70
+ customStyles: {
71
+ color: designTokens.base.color.navy0
72
+ }
73
+ }, title), submitResult ? submitResult : null);
74
+ const body = React.createElement(StyledQuestionBoxBody, {
75
+ hasFooter: hasFooter
76
+ }, children);
77
+ const footer = React.createElement(StyledQuestionBoxFooter, {
78
+ vertical: vertical
79
+ }, React.createElement(StyledQuestionBoxFooterActions, null, footerActions.map((action, index) => React.createElement(blocks.Button, Object.assign({
80
+ key: index,
81
+ size: "small"
82
+ }, action), action.children)), typeof onNext === 'function' ? React.createElement(blocks.Button, {
83
+ size: "small",
84
+ border: true,
85
+ tabIndex: 0,
86
+ transparent: false,
87
+ role: "lightpurple",
88
+ onClick: onNext
89
+ }, intl$1.formatMessage({
90
+ id: 'materialSurvey.next'
91
+ })) : null), React.createElement(StyledQuestionBoxFooterStatus, {
92
+ vertical: vertical
93
+ }, submitStatus));
94
+ return React.createElement(StyledQuestionBox, Object.assign({}, props, {
105
95
  vertical: vertical,
106
- hasFooter: hasFooter,
107
- children: [header, body, footerActions.length > 0 ? footer : null]
108
- }));
96
+ hasFooter: hasFooter
97
+ }), header, body, footerActions.length > 0 ? footer : null);
109
98
  };
110
99
 
111
100
  exports.StyledQuestionBox = StyledQuestionBox;
@@ -3,25 +3,19 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
7
  var styled = require('styled-components');
8
8
  var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
9
9
 
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
-
12
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
13
-
14
- var StyledQuestionCheckbox = styled__default.default.div.withConfig({
10
+ const StyledQuestionCheckbox = styled.div.withConfig({
15
11
  componentId: "sc-1ovh9lp-0"
16
12
  })(["display:flex;flex-direction:column;"]);
17
- var QuestionCheckbox = function QuestionCheckbox(_a) {
18
- var children = _a.children,
13
+ const QuestionCheckbox = _a => {
14
+ var {
15
+ children
16
+ } = _a,
19
17
  props = tslib.__rest(_a, ["children"]);
20
- return jsxRuntime.jsx(QuestionCheckboxContext.QuestionCheckboxContextProvider, Object.assign({}, props, {
21
- children: jsxRuntime.jsx(StyledQuestionCheckbox, {
22
- children: children
23
- })
24
- }));
18
+ return React.createElement(QuestionCheckboxContext.QuestionCheckboxContextProvider, Object.assign({}, props), React.createElement(StyledQuestionCheckbox, null, children));
25
19
  };
26
20
 
27
21
  exports.default = QuestionCheckbox;
@@ -4,6 +4,6 @@ type Value = Pick<QuestionCheckboxProps, 'selectedOptions' | 'disabled' | 'onSel
4
4
  interface QuestionCheckboxProviderProps extends QuestionCheckboxProps {
5
5
  children: React.ReactNode;
6
6
  }
7
- declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): JSX.Element;
7
+ declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): React.JSX.Element;
8
8
  declare function useQuestionCheckboxContext(): Value;
9
9
  export { QuestionCheckboxContextProvider, useQuestionCheckboxContext };
@@ -1,35 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('react/jsx-runtime');
4
3
  var React = require('react');
5
4
 
6
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
-
8
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
9
-
10
- var QuestionCheckboxContext = React__default.default.createContext(undefined);
5
+ const QuestionCheckboxContext = React.createContext(undefined);
11
6
  QuestionCheckboxContext.displayName = 'QuestionCheckboxContext';
12
- function QuestionCheckboxContextProvider(_ref) {
13
- var selectedOptions = _ref.selectedOptions,
14
- onSelect = _ref.onSelect,
15
- disabled = _ref.disabled,
16
- children = _ref.children;
7
+ function QuestionCheckboxContextProvider({
8
+ selectedOptions,
9
+ onSelect,
10
+ disabled,
11
+ children
12
+ }) {
17
13
  // eslint-disable-next-line react-hooks/exhaustive-deps
18
- var onSelectValue = React__default.default.useCallback(onSelect, []);
19
- var value = React__default.default.useMemo(function () {
20
- return {
21
- selectedOptions: selectedOptions,
22
- disabled: disabled,
23
- onSelect: onSelectValue
24
- };
25
- }, [selectedOptions, disabled, onSelectValue]);
26
- return jsxRuntime.jsx(QuestionCheckboxContext.Provider, {
27
- value: value,
28
- children: children
29
- });
14
+ const onSelectValue = React.useCallback(onSelect, []);
15
+ const value = React.useMemo(() => ({
16
+ selectedOptions,
17
+ disabled,
18
+ onSelect: onSelectValue
19
+ }), [selectedOptions, disabled, onSelectValue]);
20
+ return React.createElement(QuestionCheckboxContext.Provider, {
21
+ value: value
22
+ }, children);
30
23
  }
31
24
  function useQuestionCheckboxContext() {
32
- var context = React__default.default.useContext(QuestionCheckboxContext);
25
+ const context = React.useContext(QuestionCheckboxContext);
33
26
  if (context === undefined) {
34
27
  throw new Error('useQuestionCheckboxContext must be used within a QuestionCheckboxContextProvider');
35
28
  }
@@ -2,22 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var jsxRuntime = require('react/jsx-runtime');
6
5
  var React = require('react');
7
6
  var designTokens = require('@elice/design-tokens');
8
7
  var styled = require('styled-components');
9
8
  var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
10
9
 
11
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
-
13
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
15
-
16
- var StyledQuestionCheckboxOption = styled__default.default.div.withConfig({
10
+ const StyledQuestionCheckboxOption = styled.div.withConfig({
17
11
  componentId: "sc-em5vxx-0"
18
- })(["display:flex;align-items:center;padding:1.125rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
19
- var checked = _ref.checked,
20
- status = _ref.status;
12
+ })(["display:flex;align-items:center;padding:1.125rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
13
+ checked,
14
+ status
15
+ }) => {
21
16
  if (checked) {
22
17
  return designTokens.base.color.primary1;
23
18
  }
@@ -29,21 +24,20 @@ var StyledQuestionCheckboxOption = styled__default.default.div.withConfig({
29
24
  default:
30
25
  return designTokens.base.color.navy5;
31
26
  }
32
- }, function (_ref2) {
33
- var disabled = _ref2.disabled;
34
- return disabled ? 'not-allowed' : 'pointer';
35
- }, function (_ref3) {
36
- var isAnswer = _ref3.isAnswer;
37
- return isAnswer ? "border: 3px solid ".concat(designTokens.base.color.green5) : '';
38
- });
39
- var StyledCustomCheckboxButton = styled__default.default.span.withConfig({
27
+ }, ({
28
+ disabled
29
+ }) => disabled ? 'not-allowed' : 'pointer', ({
30
+ isAnswer
31
+ }) => isAnswer ? `border: 3px solid ${designTokens.base.color.green5}` : '');
32
+ const StyledCustomCheckboxButton = styled.span.withConfig({
40
33
  componentId: "sc-em5vxx-1"
41
34
  })([""]);
42
- var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
35
+ const StyledQuestionCheckboxInput = styled.input.withConfig({
43
36
  componentId: "sc-em5vxx-2"
44
- })(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;width:1.25rem;height:1.25rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], function (_ref4) {
45
- var checked = _ref4.checked,
46
- status = _ref4.status;
37
+ })(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;width:1.25rem;height:1.25rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], ({
38
+ checked,
39
+ status
40
+ }) => {
47
41
  if (checked) {
48
42
  return designTokens.base.color.primary6;
49
43
  }
@@ -55,9 +49,10 @@ var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
55
49
  default:
56
50
  return 'transparent';
57
51
  }
58
- }, function (_ref5) {
59
- var checked = _ref5.checked,
60
- status = _ref5.status;
52
+ }, ({
53
+ checked,
54
+ status
55
+ }) => {
61
56
  if (checked) {
62
57
  return designTokens.base.color.primary6;
63
58
  }
@@ -67,16 +62,29 @@ var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
67
62
  case 'wrong':
68
63
  return designTokens.base.color.red9;
69
64
  default:
70
- return "1px solid ".concat(designTokens.base.color.gray3);
65
+ return `1px solid ${designTokens.base.color.gray3}`;
71
66
  }
72
- }, function (_ref6) {
73
- var status = _ref6.status,
74
- checked = _ref6.checked;
67
+ }, ({
68
+ status,
69
+ checked
70
+ }) => {
75
71
  if (checked) {
76
- return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 5px;\n height: 10px;\n border: solid ".concat(designTokens.base.color.primary1, ";\n transform: translate(-50%, -50%) rotate(45deg);\n border-width: 0 3px 3px 0;\n }\n ");
72
+ return `
73
+ &:after {
74
+ content: '';
75
+ position: absolute;
76
+ top: 50%;
77
+ left: 50%;
78
+ width: 5px;
79
+ height: 10px;
80
+ border: solid ${designTokens.base.color.primary1};
81
+ transform: translate(-50%, -50%) rotate(45deg);
82
+ border-width: 0 3px 3px 0;
83
+ }
84
+ `;
77
85
  }
78
86
  if (status) {
79
- var bgColor;
87
+ let bgColor;
80
88
  switch (status) {
81
89
  case 'correct':
82
90
  bgColor = designTokens.base.color.green9;
@@ -88,7 +96,7 @@ var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
88
96
  bgColor = 'transparent';
89
97
  break;
90
98
  }
91
- var borderColor;
99
+ let borderColor;
92
100
  switch (status) {
93
101
  case 'correct':
94
102
  borderColor = designTokens.base.color.green1;
@@ -100,14 +108,28 @@ var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
100
108
  borderColor = designTokens.base.color.navy5;
101
109
  break;
102
110
  }
103
- return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 5px;\n height: 10px;\n border: solid ".concat(borderColor, ";\n transform: translate(-50%, -50%) rotate(45deg);\n border-width: 0 3px 3px 0;\n background-color: ").concat(bgColor, ";\n }\n ");
111
+ return `
112
+ &:after {
113
+ content: '';
114
+ position: absolute;
115
+ top: 50%;
116
+ left: 50%;
117
+ width: 5px;
118
+ height: 10px;
119
+ border: solid ${borderColor};
120
+ transform: translate(-50%, -50%) rotate(45deg);
121
+ border-width: 0 3px 3px 0;
122
+ background-color: ${bgColor};
123
+ }
124
+ `;
104
125
  }
105
126
  });
106
- var StyledLabel = styled__default.default.label.withConfig({
127
+ const StyledLabel = styled.label.withConfig({
107
128
  componentId: "sc-em5vxx-3"
108
- })(["word-break:break-all;margin-right:0.875rem;font-size:", ";color:", ";& p{color:", ";}"], designTokens.base.size.body3, function (_ref7) {
109
- var checked = _ref7.checked,
110
- status = _ref7.status;
129
+ })(["word-break:break-all;margin-right:0.875rem;font-size:", ";color:", ";& p{color:", ";}"], designTokens.base.size.body3, ({
130
+ checked,
131
+ status
132
+ }) => {
111
133
  if (checked) {
112
134
  return designTokens.base.color.primary6;
113
135
  }
@@ -119,9 +141,10 @@ var StyledLabel = styled__default.default.label.withConfig({
119
141
  default:
120
142
  return designTokens.base.color.navy0;
121
143
  }
122
- }, function (_ref8) {
123
- var checked = _ref8.checked,
124
- status = _ref8.status;
144
+ }, ({
145
+ checked,
146
+ status
147
+ }) => {
125
148
  if (checked) {
126
149
  return designTokens.base.color.primary6;
127
150
  }
@@ -134,41 +157,41 @@ var StyledLabel = styled__default.default.label.withConfig({
134
157
  return designTokens.base.color.navy0;
135
158
  }
136
159
  });
137
- var QuestionCheckboxOption = React__default.default.memo(function (_ref9) {
138
- var value = _ref9.value,
139
- status = _ref9.status,
140
- isAnswer = _ref9.isAnswer,
141
- children = _ref9.children;
142
- var _useQuestionCheckboxC = QuestionCheckboxContext.useQuestionCheckboxContext(),
143
- selectedOptions = _useQuestionCheckboxC.selectedOptions,
144
- disabled = _useQuestionCheckboxC.disabled,
145
- onSelect = _useQuestionCheckboxC.onSelect;
146
- var checked = selectedOptions.includes(value);
147
- return jsxRuntime.jsxs(StyledQuestionCheckboxOption, {
160
+ const QuestionCheckboxOption = React.memo(({
161
+ value,
162
+ status,
163
+ isAnswer,
164
+ children
165
+ }) => {
166
+ const {
167
+ selectedOptions,
168
+ disabled,
169
+ onSelect
170
+ } = QuestionCheckboxContext.useQuestionCheckboxContext();
171
+ const checked = selectedOptions.includes(value);
172
+ return React.createElement(StyledQuestionCheckboxOption, {
148
173
  isAnswer: isAnswer,
149
174
  disabled: disabled,
150
175
  checked: checked,
151
- onClick: function onClick(e) {
176
+ onClick: e => {
152
177
  e.preventDefault();
153
178
  if (disabled) {
154
179
  return;
155
180
  }
156
181
  onSelect(value);
157
182
  },
158
- status: status,
159
- children: [jsxRuntime.jsx(StyledCustomCheckboxButton, {}), jsxRuntime.jsx(StyledQuestionCheckboxInput, {
160
- id: value,
161
- readOnly: true,
162
- type: "checkbox",
163
- checked: checked,
164
- status: status
165
- }), jsxRuntime.jsx(StyledLabel, {
166
- htmlFor: value,
167
- checked: checked,
168
- status: status,
169
- children: children
170
- })]
171
- });
183
+ status: status
184
+ }, React.createElement(StyledCustomCheckboxButton, null), React.createElement(StyledQuestionCheckboxInput, {
185
+ id: value,
186
+ readOnly: true,
187
+ type: "checkbox",
188
+ checked: checked,
189
+ status: status
190
+ }), React.createElement(StyledLabel, {
191
+ htmlFor: value,
192
+ checked: checked,
193
+ status: status
194
+ }, children));
172
195
  });
173
196
 
174
197
  exports.default = QuestionCheckboxOption;
@@ -3,25 +3,19 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
7
  var styled = require('styled-components');
8
8
  var QuestionRadioContext = require('./QuestionRadioContext.js');
9
9
 
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
-
12
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
13
-
14
- var StyledQuestionRadio = styled__default.default.div.withConfig({
10
+ const StyledQuestionRadio = styled.div.withConfig({
15
11
  componentId: "sc-4da40f-0"
16
12
  })(["display:flex;flex-direction:column;"]);
17
- var QuestionRadio = function QuestionRadio(_a) {
18
- var children = _a.children,
13
+ const QuestionRadio = _a => {
14
+ var {
15
+ children
16
+ } = _a,
19
17
  props = tslib.__rest(_a, ["children"]);
20
- return jsxRuntime.jsx(QuestionRadioContext.QuestionRadioContextProvider, Object.assign({}, props, {
21
- children: jsxRuntime.jsx(StyledQuestionRadio, {
22
- children: children
23
- })
24
- }));
18
+ return React.createElement(QuestionRadioContext.QuestionRadioContextProvider, Object.assign({}, props), React.createElement(StyledQuestionRadio, null, children));
25
19
  };
26
20
 
27
21
  exports.default = QuestionRadio;
@@ -4,6 +4,6 @@ type Value = Pick<QuestionRadioProps, 'selectedValue' | 'disabled' | 'onSelect'>
4
4
  interface QuestionRadioProviderProps extends QuestionRadioProps {
5
5
  children: React.ReactNode;
6
6
  }
7
- declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): JSX.Element;
7
+ declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): React.JSX.Element;
8
8
  declare function useQuestionRadioContext(): Value;
9
9
  export { QuestionRadioContextProvider, useQuestionRadioContext };