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