@elice/material-survey 1.230328.0 → 1.230418.0

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