@elice/material-survey 1.240718.0-trasncript.0 → 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.
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +399 -0
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-survey/MaterialSurvey.js +82 -57
- package/cjs/components/material-survey/MaterialSurveyInfo.js +69 -59
- package/cjs/components/material-survey/MaterialSurveySelectMultiple.js +131 -90
- package/cjs/components/material-survey/MaterialSurveySelectOne.js +125 -86
- package/cjs/components/material-survey/MaterialSurveyShimmer.js +47 -40
- package/cjs/components/material-survey/MaterialSurveyText.js +114 -75
- package/cjs/components/material-survey/SurveyResultBadge.js +17 -10
- package/cjs/components/material-survey/SurveySubmitStatusText.js +21 -16
- package/cjs/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/cjs/components/material-survey/context/MaterialSurveyContext.js +115 -74
- package/cjs/components/material-survey/index.js +9 -0
- package/cjs/components/material-survey/locales/index.js +13 -0
- package/cjs/components/material-survey-edit/MaterialSurveyEdit.js +49 -36
- package/cjs/components/material-survey-edit/MaterialSurveyEditContent.js +113 -91
- package/cjs/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +100 -87
- package/cjs/components/material-survey-edit/context.js +8 -2
- package/cjs/components/material-survey-edit/index.js +7 -0
- package/cjs/components/material-survey-edit/locales/index.js +13 -0
- package/cjs/components/material-survey-edit/utils/editValue.js +17 -11
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/SurveyContentBox.js +85 -74
- package/cjs/components/shared/index.js +13 -0
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +13 -7
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +24 -17
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +66 -89
- package/cjs/components/shared/question-radio/QuestionRadio.js +13 -7
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +24 -17
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -80
- package/es/_virtual/_rollupPluginBabelHelpers.js +386 -0
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-survey/MaterialSurvey.js +77 -57
- package/es/components/material-survey/MaterialSurveyInfo.js +65 -59
- package/es/components/material-survey/MaterialSurveySelectMultiple.js +127 -90
- package/es/components/material-survey/MaterialSurveySelectOne.js +121 -86
- package/es/components/material-survey/MaterialSurveyShimmer.js +43 -40
- package/es/components/material-survey/MaterialSurveyText.js +109 -75
- package/es/components/material-survey/SurveyResultBadge.js +13 -10
- package/es/components/material-survey/SurveySubmitStatusText.js +17 -16
- package/es/components/material-survey/context/MaterialSurveyContext.d.ts +1 -1
- package/es/components/material-survey/context/MaterialSurveyContext.js +112 -75
- package/es/components/material-survey/index.js +2 -0
- package/es/components/material-survey/locales/index.js +4 -0
- package/es/components/material-survey-edit/MaterialSurveyEdit.js +45 -36
- package/es/components/material-survey-edit/MaterialSurveyEditContent.js +107 -90
- package/es/components/material-survey-edit/MaterialSurveyEditOptionSelect.js +96 -87
- package/es/components/material-survey-edit/context.js +4 -2
- package/es/components/material-survey-edit/index.js +1 -0
- package/es/components/material-survey-edit/locales/index.js +4 -0
- package/es/components/material-survey-edit/utils/editValue.js +17 -11
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/SurveyContentBox.js +81 -74
- package/es/components/shared/index.js +4 -0
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +9 -7
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +20 -17
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +61 -89
- package/es/components/shared/question-radio/QuestionRadio.js +9 -7
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +20 -17
- package/es/components/shared/question-radio/QuestionRadioOption.js +54 -80
- package/package.json +9 -12
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { base } from '@elice/design-tokens';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
5
|
import { useQuestionCheckboxContext } from './QuestionCheckboxContext.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
var StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
7
8
|
componentId: "sc-em5vxx-0"
|
|
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
|
-
|
|
11
|
-
}) => {
|
|
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;
|
|
12
12
|
if (checked) {
|
|
13
13
|
return base.color.primary1;
|
|
14
14
|
}
|
|
@@ -20,20 +20,21 @@ const StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
|
20
20
|
default:
|
|
21
21
|
return base.color.navy5;
|
|
22
22
|
}
|
|
23
|
-
}, ({
|
|
24
|
-
disabled
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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({
|
|
29
31
|
componentId: "sc-em5vxx-1"
|
|
30
32
|
})([""]);
|
|
31
|
-
|
|
33
|
+
var StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
32
34
|
componentId: "sc-em5vxx-2"
|
|
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
|
-
|
|
36
|
-
}) => {
|
|
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;
|
|
37
38
|
if (checked) {
|
|
38
39
|
return base.color.primary6;
|
|
39
40
|
}
|
|
@@ -45,10 +46,9 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
45
46
|
default:
|
|
46
47
|
return 'transparent';
|
|
47
48
|
}
|
|
48
|
-
}, ({
|
|
49
|
-
checked,
|
|
50
|
-
|
|
51
|
-
}) => {
|
|
49
|
+
}, function (_ref5) {
|
|
50
|
+
var checked = _ref5.checked,
|
|
51
|
+
status = _ref5.status;
|
|
52
52
|
if (checked) {
|
|
53
53
|
return base.color.primary6;
|
|
54
54
|
}
|
|
@@ -58,29 +58,16 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
58
58
|
case 'wrong':
|
|
59
59
|
return base.color.red9;
|
|
60
60
|
default:
|
|
61
|
-
return
|
|
61
|
+
return "1px solid ".concat(base.color.gray3);
|
|
62
62
|
}
|
|
63
|
-
}, ({
|
|
64
|
-
status,
|
|
65
|
-
|
|
66
|
-
}) => {
|
|
63
|
+
}, function (_ref6) {
|
|
64
|
+
var status = _ref6.status,
|
|
65
|
+
checked = _ref6.checked;
|
|
67
66
|
if (checked) {
|
|
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
|
-
`;
|
|
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 ");
|
|
81
68
|
}
|
|
82
69
|
if (status) {
|
|
83
|
-
|
|
70
|
+
var bgColor;
|
|
84
71
|
switch (status) {
|
|
85
72
|
case 'correct':
|
|
86
73
|
bgColor = base.color.green9;
|
|
@@ -92,7 +79,7 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
92
79
|
bgColor = 'transparent';
|
|
93
80
|
break;
|
|
94
81
|
}
|
|
95
|
-
|
|
82
|
+
var borderColor;
|
|
96
83
|
switch (status) {
|
|
97
84
|
case 'correct':
|
|
98
85
|
borderColor = base.color.green1;
|
|
@@ -104,28 +91,14 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
104
91
|
borderColor = base.color.navy5;
|
|
105
92
|
break;
|
|
106
93
|
}
|
|
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
|
-
`;
|
|
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 ");
|
|
121
95
|
}
|
|
122
96
|
});
|
|
123
|
-
|
|
97
|
+
var StyledLabel = styled.label.withConfig({
|
|
124
98
|
componentId: "sc-em5vxx-3"
|
|
125
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";color:", ";& p{color:", ";}"], base.size.body3, ({
|
|
126
|
-
checked,
|
|
127
|
-
|
|
128
|
-
}) => {
|
|
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;
|
|
129
102
|
if (checked) {
|
|
130
103
|
return base.color.primary6;
|
|
131
104
|
}
|
|
@@ -137,10 +110,9 @@ const StyledLabel = styled.label.withConfig({
|
|
|
137
110
|
default:
|
|
138
111
|
return base.color.navy0;
|
|
139
112
|
}
|
|
140
|
-
}, ({
|
|
141
|
-
checked,
|
|
142
|
-
|
|
143
|
-
}) => {
|
|
113
|
+
}, function (_ref8) {
|
|
114
|
+
var checked = _ref8.checked,
|
|
115
|
+
status = _ref8.status;
|
|
144
116
|
if (checked) {
|
|
145
117
|
return base.color.primary6;
|
|
146
118
|
}
|
|
@@ -153,41 +125,41 @@ const StyledLabel = styled.label.withConfig({
|
|
|
153
125
|
return base.color.navy0;
|
|
154
126
|
}
|
|
155
127
|
});
|
|
156
|
-
|
|
157
|
-
value,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const checked = selectedOptions.includes(value);
|
|
168
|
-
return React.createElement(StyledQuestionCheckboxOption, {
|
|
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, {
|
|
169
139
|
isAnswer: isAnswer,
|
|
170
140
|
disabled: disabled,
|
|
171
141
|
checked: checked,
|
|
172
|
-
onClick: e
|
|
142
|
+
onClick: function onClick(e) {
|
|
173
143
|
e.preventDefault();
|
|
174
144
|
if (disabled) {
|
|
175
145
|
return;
|
|
176
146
|
}
|
|
177
147
|
onSelect(value);
|
|
178
148
|
},
|
|
179
|
-
status: status
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
+
});
|
|
191
163
|
});
|
|
192
164
|
|
|
193
165
|
export { QuestionCheckboxOption as default };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { QuestionRadioContextProvider } from './QuestionRadioContext.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
var StyledQuestionRadio = styled.div.withConfig({
|
|
7
7
|
componentId: "sc-4da40f-0"
|
|
8
8
|
})(["display:flex;flex-direction:column;"]);
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
children
|
|
12
|
-
} = _a,
|
|
9
|
+
var QuestionRadio = function QuestionRadio(_a) {
|
|
10
|
+
var children = _a.children,
|
|
13
11
|
props = __rest(_a, ["children"]);
|
|
14
|
-
return
|
|
12
|
+
return jsx(QuestionRadioContextProvider, Object.assign({}, props, {
|
|
13
|
+
children: jsx(StyledQuestionRadio, {
|
|
14
|
+
children: children
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
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):
|
|
7
|
+
declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): JSX.Element;
|
|
8
8
|
declare function useQuestionRadioContext(): Value;
|
|
9
9
|
export { QuestionRadioContextProvider, useQuestionRadioContext };
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
var QuestionRadioContext = React.createContext(undefined);
|
|
4
5
|
QuestionRadioContext.displayName = 'QuestionRadioContext';
|
|
5
|
-
function QuestionRadioContextProvider({
|
|
6
|
-
selectedValue,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) {
|
|
6
|
+
function QuestionRadioContextProvider(_ref) {
|
|
7
|
+
var selectedValue = _ref.selectedValue,
|
|
8
|
+
onSelect = _ref.onSelect,
|
|
9
|
+
disabled = _ref.disabled,
|
|
10
|
+
children = _ref.children;
|
|
11
11
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
});
|
|
21
24
|
}
|
|
22
25
|
function useQuestionRadioContext() {
|
|
23
|
-
|
|
26
|
+
var context = React.useContext(QuestionRadioContext);
|
|
24
27
|
if (context === undefined) {
|
|
25
28
|
throw new Error('useQuestionRadioContext must be used within a QuestionRadioContextProvider');
|
|
26
29
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { base } from '@elice/design-tokens';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
5
|
import { useQuestionRadioContext } from './QuestionRadioContext.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
var StyledQuestionRadioOption = styled.div.withConfig({
|
|
7
8
|
componentId: "sc-zgbv8k-0"
|
|
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
|
-
|
|
11
|
-
}) => {
|
|
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;
|
|
12
12
|
if (checked) {
|
|
13
13
|
return base.color.primary1;
|
|
14
14
|
}
|
|
@@ -20,17 +20,18 @@ const StyledQuestionRadioOption = styled.div.withConfig({
|
|
|
20
20
|
default:
|
|
21
21
|
return base.color.navy5;
|
|
22
22
|
}
|
|
23
|
-
}, ({
|
|
24
|
-
disabled
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 StyledQuestionRadioInput = styled.input.withConfig({
|
|
29
31
|
componentId: "sc-zgbv8k-1"
|
|
30
|
-
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1.25rem;height:1.25rem;margin-right:0.875rem;border:2px solid ", ";", ""], ({
|
|
31
|
-
checked,
|
|
32
|
-
|
|
33
|
-
}) => {
|
|
32
|
+
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;border-radius:50%;width:1.25rem;height:1.25rem;margin-right:0.875rem;border:2px solid ", ";", ""], function (_ref4) {
|
|
33
|
+
var checked = _ref4.checked,
|
|
34
|
+
status = _ref4.status;
|
|
34
35
|
if (checked) {
|
|
35
36
|
return base.color.primary6;
|
|
36
37
|
}
|
|
@@ -42,27 +43,14 @@ const StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
42
43
|
default:
|
|
43
44
|
return base.color.gray3;
|
|
44
45
|
}
|
|
45
|
-
}, ({
|
|
46
|
-
status,
|
|
47
|
-
|
|
48
|
-
}) => {
|
|
46
|
+
}, function (_ref5) {
|
|
47
|
+
var status = _ref5.status,
|
|
48
|
+
checked = _ref5.checked;
|
|
49
49
|
if (checked) {
|
|
50
|
-
return
|
|
51
|
-
&:after {
|
|
52
|
-
content: '';
|
|
53
|
-
position: absolute;
|
|
54
|
-
top: 50%;
|
|
55
|
-
left: 50%;
|
|
56
|
-
transform: translate(-50%, -50%);
|
|
57
|
-
width: 70%;
|
|
58
|
-
height: 70%;
|
|
59
|
-
border-radius: 50%;
|
|
60
|
-
background-color: ${base.color.primary6};
|
|
61
|
-
}
|
|
62
|
-
`;
|
|
50
|
+
return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 70%;\n height: 70%;\n border-radius: 50%;\n background-color: ".concat(base.color.primary6, ";\n }\n ");
|
|
63
51
|
}
|
|
64
52
|
if (status) {
|
|
65
|
-
|
|
53
|
+
var bgColor;
|
|
66
54
|
switch (status) {
|
|
67
55
|
case 'correct':
|
|
68
56
|
bgColor = base.color.green9;
|
|
@@ -74,27 +62,14 @@ const StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
74
62
|
bgColor = base.color.gray3;
|
|
75
63
|
break;
|
|
76
64
|
}
|
|
77
|
-
return
|
|
78
|
-
&:after {
|
|
79
|
-
content: '';
|
|
80
|
-
position: absolute;
|
|
81
|
-
top: 50%;
|
|
82
|
-
left: 50%;
|
|
83
|
-
transform: translate(-50%, -50%);
|
|
84
|
-
width: 70%;
|
|
85
|
-
height: 70%;
|
|
86
|
-
border-radius: 50%;
|
|
87
|
-
background-color: ${bgColor};
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
65
|
+
return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 70%;\n height: 70%;\n border-radius: 50%;\n background-color: ".concat(bgColor, ";\n }\n ");
|
|
90
66
|
}
|
|
91
67
|
});
|
|
92
|
-
|
|
68
|
+
var StyledLabel = styled.label.withConfig({
|
|
93
69
|
componentId: "sc-zgbv8k-2"
|
|
94
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";color:", ";& p{color:", ";}"], base.size.body3, ({
|
|
95
|
-
checked,
|
|
96
|
-
|
|
97
|
-
}) => {
|
|
70
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";color:", ";& p{color:", ";}"], base.size.body3, function (_ref6) {
|
|
71
|
+
var checked = _ref6.checked,
|
|
72
|
+
status = _ref6.status;
|
|
98
73
|
if (checked) {
|
|
99
74
|
return base.color.primary6;
|
|
100
75
|
}
|
|
@@ -106,10 +81,9 @@ const StyledLabel = styled.label.withConfig({
|
|
|
106
81
|
default:
|
|
107
82
|
return base.color.navy0;
|
|
108
83
|
}
|
|
109
|
-
}, ({
|
|
110
|
-
checked,
|
|
111
|
-
|
|
112
|
-
}) => {
|
|
84
|
+
}, function (_ref7) {
|
|
85
|
+
var checked = _ref7.checked,
|
|
86
|
+
status = _ref7.status;
|
|
113
87
|
if (checked) {
|
|
114
88
|
return base.color.primary6;
|
|
115
89
|
}
|
|
@@ -122,40 +96,40 @@ const StyledLabel = styled.label.withConfig({
|
|
|
122
96
|
return base.color.navy0;
|
|
123
97
|
}
|
|
124
98
|
});
|
|
125
|
-
|
|
126
|
-
value,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} = useQuestionRadioContext();
|
|
136
|
-
return React.createElement(StyledQuestionRadioOption, {
|
|
99
|
+
var QuestionRadioOption = React.memo(function (_ref8) {
|
|
100
|
+
var value = _ref8.value,
|
|
101
|
+
status = _ref8.status,
|
|
102
|
+
isAnswer = _ref8.isAnswer,
|
|
103
|
+
children = _ref8.children;
|
|
104
|
+
var _useQuestionRadioCont = useQuestionRadioContext(),
|
|
105
|
+
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
106
|
+
disabled = _useQuestionRadioCont.disabled,
|
|
107
|
+
onSelect = _useQuestionRadioCont.onSelect;
|
|
108
|
+
return jsxs(StyledQuestionRadioOption, {
|
|
137
109
|
isAnswer: isAnswer,
|
|
138
110
|
disabled: disabled,
|
|
139
111
|
checked: selectedValue === value,
|
|
140
|
-
onClick: e
|
|
112
|
+
onClick: function onClick(e) {
|
|
141
113
|
e.preventDefault();
|
|
142
114
|
if (disabled) {
|
|
143
115
|
return;
|
|
144
116
|
}
|
|
145
117
|
onSelect(value);
|
|
146
118
|
},
|
|
147
|
-
status: status
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
119
|
+
status: status,
|
|
120
|
+
children: [jsx(StyledQuestionRadioInput, {
|
|
121
|
+
id: value,
|
|
122
|
+
type: "radio",
|
|
123
|
+
readOnly: true,
|
|
124
|
+
checked: selectedValue === value,
|
|
125
|
+
status: status
|
|
126
|
+
}), jsx(StyledLabel, {
|
|
127
|
+
htmlFor: value,
|
|
128
|
+
checked: selectedValue === value,
|
|
129
|
+
status: status,
|
|
130
|
+
children: children
|
|
131
|
+
})]
|
|
132
|
+
});
|
|
159
133
|
});
|
|
160
134
|
|
|
161
135
|
export { QuestionRadioOption as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-survey",
|
|
3
|
-
"version": "1.240718.0-trasncript.
|
|
3
|
+
"version": "1.240718.0-trasncript.2",
|
|
4
4
|
"description": "User view and editing components of Elice material survey",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "run-s watch",
|
|
19
19
|
"prebuild": "run-s clean",
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
22
|
-
"build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
|
|
23
|
-
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
|
|
20
|
+
"build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs",
|
|
21
|
+
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -f cjs -w",
|
|
24
22
|
"lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
|
|
25
23
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
26
24
|
},
|
|
@@ -47,15 +45,15 @@
|
|
|
47
45
|
},
|
|
48
46
|
"devDependencies": {
|
|
49
47
|
"@elice/api-client": "^1.240619.0",
|
|
50
|
-
"@elice/blocks": "^1.
|
|
48
|
+
"@elice/blocks": "^1.240529.0",
|
|
51
49
|
"@elice/design-tokens": "^1.220803.0",
|
|
52
50
|
"@elice/icons": "^1.230814.0",
|
|
53
51
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
54
52
|
"@elice/intl": "0.240425.0-rc.2",
|
|
55
|
-
"@elice/markdown": "^1.
|
|
56
|
-
"@elice/material-shared-types": "1.240718.0-trasncript.
|
|
57
|
-
"@elice/material-shared-utils": "1.240718.0-trasncript.
|
|
58
|
-
"@elice/types": "
|
|
53
|
+
"@elice/markdown": "^1.240124.0",
|
|
54
|
+
"@elice/material-shared-types": "1.240718.0-trasncript.2",
|
|
55
|
+
"@elice/material-shared-utils": "1.240718.0-trasncript.2",
|
|
56
|
+
"@elice/types": "1.240709.0",
|
|
59
57
|
"@elice/wysiwyg": "1.240716.1",
|
|
60
58
|
"@types/classnames": "^2.3.1",
|
|
61
59
|
"@types/react": "~17.0.9",
|
|
@@ -64,6 +62,5 @@
|
|
|
64
62
|
"react": "^17.0.2",
|
|
65
63
|
"react-use": "^17.2.4",
|
|
66
64
|
"styled-components": "^5.3.0"
|
|
67
|
-
}
|
|
68
|
-
"gitHead": "832dc77a5e38ff02e0bfec8905a3a9706b9b9593"
|
|
65
|
+
}
|
|
69
66
|
}
|