@elice/material-quiz 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 +423 -0
- package/cjs/components/eb-sortable/EbDraggable.js +42 -33
- package/cjs/components/eb-sortable/EbDroppable.js +27 -20
- package/cjs/components/markdown-editor/index.d.ts +1 -2
- package/cjs/components/markdown-editor/index.js +19 -10
- package/cjs/components/material-quiz/MaterialQuiz.js +114 -83
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +36 -29
- package/cjs/components/material-quiz/MaterialQuizInfo.js +151 -149
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +175 -127
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +360 -286
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +172 -126
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +46 -39
- package/cjs/components/material-quiz/MaterialQuizText.js +163 -115
- package/cjs/components/material-quiz/QuizResultBadge.js +32 -22
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +21 -16
- package/cjs/components/material-quiz/constants/color.js +5 -5
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +156 -93
- package/cjs/components/material-quiz/index.js +9 -0
- package/cjs/components/material-quiz/locales/index.js +13 -0
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +259 -161
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +134 -100
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +130 -101
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +64 -52
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +5 -1
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +47 -36
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +280 -232
- package/cjs/components/material-quiz-edit/context.js +8 -2
- package/cjs/components/material-quiz-edit/index.js +7 -0
- package/cjs/components/material-quiz-edit/locales/index.js +13 -0
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +70 -46
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +174 -148
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +175 -149
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +164 -144
- package/cjs/components/material-quiz-edit/options/OptionText.js +90 -82
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +156 -112
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +288 -196
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +88 -75
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +108 -92
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/cjs/components/material-quiz-edit/utils/editValue.js +21 -12
- package/cjs/components/shared/QuestionBox.js +198 -165
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/cjs/components/shared/QuizDraggbleDummyOption.js +23 -16
- package/cjs/components/shared/QuizDraggbleOption.js +65 -59
- package/cjs/components/shared/StyledMarkdown.js +5 -1
- package/cjs/components/shared/index.js +19 -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 +59 -68
- 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 +52 -59
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/cjs/components/shared/utils/mergeRefs.js +15 -6
- package/cjs/constant/element.js +3 -3
- package/cjs/constant/index.js +9 -0
- package/cjs/helpers/index.js +8 -10
- package/cjs/hooks/index.js +7 -0
- package/cjs/hooks/useCaculatePassage.js +21 -20
- package/es/_virtual/_rollupPluginBabelHelpers.js +408 -0
- package/es/components/eb-sortable/EbDraggable.js +37 -33
- package/es/components/eb-sortable/EbDroppable.js +22 -20
- package/es/components/markdown-editor/index.d.ts +1 -2
- package/es/components/markdown-editor/index.js +15 -10
- package/es/components/material-quiz/MaterialQuiz.js +109 -83
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +32 -29
- package/es/components/material-quiz/MaterialQuizInfo.js +148 -150
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +171 -127
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +356 -287
- package/es/components/material-quiz/MaterialQuizSelectOne.js +168 -126
- package/es/components/material-quiz/MaterialQuizShimmer.js +42 -39
- package/es/components/material-quiz/MaterialQuizText.js +158 -115
- package/es/components/material-quiz/QuizResultBadge.js +27 -22
- package/es/components/material-quiz/QuizSubmitStatusText.js +17 -16
- package/es/components/material-quiz/constants/color.js +5 -5
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/es/components/material-quiz/context/MaterialQuizContext.js +153 -94
- package/es/components/material-quiz/index.js +2 -0
- package/es/components/material-quiz/locales/index.js +4 -0
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +253 -161
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +129 -100
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +125 -101
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +60 -52
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +43 -36
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +272 -229
- package/es/components/material-quiz-edit/context.js +4 -2
- package/es/components/material-quiz-edit/index.js +1 -0
- package/es/components/material-quiz-edit/locales/index.js +4 -0
- package/es/components/material-quiz-edit/options/OptionEditor.js +64 -46
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +170 -148
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +171 -149
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +159 -144
- package/es/components/material-quiz-edit/options/OptionText.js +86 -82
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +9 -8
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +151 -112
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +283 -197
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +83 -75
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +103 -92
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +5 -1
- package/es/components/material-quiz-edit/utils/editValue.js +17 -12
- package/es/components/shared/QuestionBox.js +192 -165
- package/es/components/shared/QuizDraggbleDroppedOption.js +11 -12
- package/es/components/shared/QuizDraggbleDummyOption.js +19 -16
- package/es/components/shared/QuizDraggbleOption.js +61 -59
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/index.js +7 -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 +54 -68
- 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 +47 -59
- package/es/components/shared/utils/getQuestionStatusStyle.js +7 -9
- package/es/components/shared/utils/mergeRefs.js +15 -6
- package/es/constant/element.js +3 -3
- package/es/constant/index.js +1 -0
- package/es/helpers/index.js +8 -10
- package/es/hooks/index.js +1 -0
- package/es/hooks/useCaculatePassage.js +21 -20
- package/package.json +12 -15
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var designTokens = require('@elice/design-tokens');
|
|
8
8
|
var icons = require('@elice/icons');
|
|
@@ -11,25 +11,27 @@ var EbDraggable = require('../eb-sortable/EbDraggable.js');
|
|
|
11
11
|
var MaterialQuizContext = require('../material-quiz/context/MaterialQuizContext.js');
|
|
12
12
|
var StyledMarkdown = require('./StyledMarkdown.js');
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
15
|
+
|
|
16
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
17
|
+
|
|
18
|
+
var StyledQuizDraggbleOptionHandle = styled__default.default.div.withConfig({
|
|
15
19
|
componentId: "sc-19b0zkq-0"
|
|
16
20
|
})(["display:flex;align-items:center;justify-content:center;background-color:", ";width:1.5rem;flex:none;"], designTokens.base.color.navy5);
|
|
17
|
-
|
|
21
|
+
var StyledQuizDraggbleOptionContent = styled__default.default.div.withConfig({
|
|
18
22
|
componentId: "sc-19b0zkq-1"
|
|
19
|
-
})(["display:flex;justify-content:space-between;min-width:0;align-items:center;flex:auto;padding:0.875rem 1rem;line-height:24px;border:", ";background-color:", ";"], ({
|
|
20
|
-
role
|
|
21
|
-
}) => {
|
|
23
|
+
})(["display:flex;justify-content:space-between;min-width:0;align-items:center;flex:auto;padding:0.875rem 1rem;line-height:24px;border:", ";background-color:", ";"], function (_ref) {
|
|
24
|
+
var role = _ref.role;
|
|
22
25
|
switch (role) {
|
|
23
26
|
case 'correct':
|
|
24
|
-
return
|
|
27
|
+
return "1px solid ".concat(designTokens.base.color.primary6);
|
|
25
28
|
case 'wrong':
|
|
26
|
-
return
|
|
29
|
+
return "1px solid ".concat(designTokens.base.color.red6);
|
|
27
30
|
default:
|
|
28
31
|
return '';
|
|
29
32
|
}
|
|
30
|
-
}, ({
|
|
31
|
-
role
|
|
32
|
-
}) => {
|
|
33
|
+
}, function (_ref2) {
|
|
34
|
+
var role = _ref2.role;
|
|
33
35
|
switch (role) {
|
|
34
36
|
case 'answer':
|
|
35
37
|
return designTokens.base.color.primary6;
|
|
@@ -37,14 +39,13 @@ const StyledQuizDraggbleOptionContent = styled.div.withConfig({
|
|
|
37
39
|
return '';
|
|
38
40
|
}
|
|
39
41
|
});
|
|
40
|
-
|
|
42
|
+
var StyledOrder = styled__default.default.div.withConfig({
|
|
41
43
|
componentId: "sc-19b0zkq-2"
|
|
42
44
|
})(["width:1.5rem;height:1.5rem;display:flex;border-radius:4px;align-items:center;justify-content:center;color:", ";background-color:", ";flex:none;margin-left:0.5rem;"], designTokens.base.color.navy0, designTokens.base.color.navy4);
|
|
43
|
-
|
|
45
|
+
var StyledQuizDraggbleOption = styled__default.default(EbDraggable.default).withConfig({
|
|
44
46
|
componentId: "sc-19b0zkq-3"
|
|
45
|
-
})(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, StyledQuizDraggbleOptionHandle, ({
|
|
46
|
-
role
|
|
47
|
-
}) => {
|
|
47
|
+
})(["display:flex;border-radius:8px;border:1px solid ", ";background-color:", ";overflow:hidden;z-index:980 !important;&:not(:last-of-type){margin-bottom:1rem;}", "{background-color:", ";color:", ";}", "{background-color:", ";& *{color:", ";}}", "{background-color:", ";color:", ";}&.ui-draggable-dragging{z-index:1000 !important;color:", " !important;border:none !important;", "{background-color:", ";}", "{background-color:", ";border:1px solid ", " !important;}", "{color:", ";background-color:", ";}& *{color:", " !important;}}&.ui-draggable-dragging.quiz-answer{width:calc(100% - 1rem * 2);}"], designTokens.base.color.navy4, designTokens.base.color.navy5, StyledQuizDraggbleOptionHandle, function (_ref3) {
|
|
48
|
+
var role = _ref3.role;
|
|
48
49
|
switch (role) {
|
|
49
50
|
case 'answer':
|
|
50
51
|
return designTokens.base.color.primary4;
|
|
@@ -56,9 +57,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
56
57
|
default:
|
|
57
58
|
return designTokens.base.color.navy3;
|
|
58
59
|
}
|
|
59
|
-
}, ({
|
|
60
|
-
role
|
|
61
|
-
}) => {
|
|
60
|
+
}, function (_ref4) {
|
|
61
|
+
var role = _ref4.role;
|
|
62
62
|
switch (role) {
|
|
63
63
|
case 'answer':
|
|
64
64
|
return designTokens.base.color.primary9;
|
|
@@ -70,9 +70,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
70
70
|
default:
|
|
71
71
|
return designTokens.base.color.navy5;
|
|
72
72
|
}
|
|
73
|
-
}, StyledQuizDraggbleOptionContent, ({
|
|
74
|
-
role
|
|
75
|
-
}) => {
|
|
73
|
+
}, StyledQuizDraggbleOptionContent, function (_ref5) {
|
|
74
|
+
var role = _ref5.role;
|
|
76
75
|
switch (role) {
|
|
77
76
|
case 'answer':
|
|
78
77
|
return designTokens.base.color.primary1;
|
|
@@ -84,9 +83,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
84
83
|
default:
|
|
85
84
|
return designTokens.base.color.navy5;
|
|
86
85
|
}
|
|
87
|
-
}, ({
|
|
88
|
-
role
|
|
89
|
-
}) => {
|
|
86
|
+
}, function (_ref6) {
|
|
87
|
+
var role = _ref6.role;
|
|
90
88
|
switch (role) {
|
|
91
89
|
case 'answer':
|
|
92
90
|
return designTokens.base.color.primary9;
|
|
@@ -98,9 +96,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
98
96
|
default:
|
|
99
97
|
return designTokens.base.color.navy0;
|
|
100
98
|
}
|
|
101
|
-
}, StyledOrder, ({
|
|
102
|
-
role
|
|
103
|
-
}) => {
|
|
99
|
+
}, StyledOrder, function (_ref7) {
|
|
100
|
+
var role = _ref7.role;
|
|
104
101
|
switch (role) {
|
|
105
102
|
case 'answer':
|
|
106
103
|
return designTokens.base.color.primary3;
|
|
@@ -112,9 +109,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
112
109
|
default:
|
|
113
110
|
return designTokens.base.color.navy4;
|
|
114
111
|
}
|
|
115
|
-
}, ({
|
|
116
|
-
role
|
|
117
|
-
}) => {
|
|
112
|
+
}, function (_ref8) {
|
|
113
|
+
var role = _ref8.role;
|
|
118
114
|
switch (role) {
|
|
119
115
|
case 'answer':
|
|
120
116
|
return designTokens.base.color.primary9;
|
|
@@ -127,39 +123,49 @@ const StyledQuizDraggbleOption = styled(EbDraggable.default).withConfig({
|
|
|
127
123
|
return designTokens.base.color.navy0;
|
|
128
124
|
}
|
|
129
125
|
}, designTokens.base.color.navy0, StyledQuizDraggbleOptionHandle, designTokens.base.color.navy5, StyledQuizDraggbleOptionContent, designTokens.base.color.navy4, designTokens.base.color.navy4, StyledOrder, designTokens.base.color.navy0, designTokens.base.color.navy5, designTokens.base.color.navy0);
|
|
130
|
-
|
|
131
|
-
id,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
126
|
+
var QuizDraggbleOption = function QuizDraggbleOption(_ref9) {
|
|
127
|
+
var id = _ref9.id,
|
|
128
|
+
className = _ref9.className,
|
|
129
|
+
content = _ref9.content,
|
|
130
|
+
_ref9$disabled = _ref9.disabled,
|
|
131
|
+
disabled = _ref9$disabled === void 0 ? false : _ref9$disabled,
|
|
132
|
+
_ref9$role = _ref9.role,
|
|
133
|
+
role = _ref9$role === void 0 ? 'default' : _ref9$role,
|
|
134
|
+
indexOrder = _ref9.indexOrder,
|
|
135
|
+
_ref9$clone = _ref9.clone,
|
|
136
|
+
clone = _ref9$clone === void 0 ? false : _ref9$clone,
|
|
137
|
+
_ref9$isMarkdown = _ref9.isMarkdown,
|
|
138
|
+
isMarkdown = _ref9$isMarkdown === void 0 ? false : _ref9$isMarkdown;
|
|
139
|
+
var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
|
|
140
|
+
vertical = _useMaterialQuizState.vertical;
|
|
141
|
+
return jsxRuntime.jsxs(StyledQuizDraggbleOption, {
|
|
144
142
|
id: id,
|
|
145
143
|
className: className,
|
|
146
144
|
disabled: disabled,
|
|
147
145
|
role: role,
|
|
148
146
|
clone: clone,
|
|
149
|
-
vertical: vertical
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
147
|
+
vertical: vertical,
|
|
148
|
+
children: [jsxRuntime.jsx(StyledQuizDraggbleOptionHandle, {
|
|
149
|
+
children: jsxRuntime.jsx(blocks.Icon, {
|
|
150
|
+
size: "large",
|
|
151
|
+
icon: icons.eilDraggableVertical
|
|
152
|
+
})
|
|
153
|
+
}), jsxRuntime.jsxs(StyledQuizDraggbleOptionContent, {
|
|
154
|
+
children: [isMarkdown ? jsxRuntime.jsx(StyledMarkdown.default, {
|
|
155
|
+
children: content,
|
|
156
|
+
dark: true,
|
|
157
|
+
paddingx: 0,
|
|
158
|
+
paddingy: 0
|
|
159
|
+
}) : jsxRuntime.jsx(blocks.Text, {
|
|
160
|
+
userSelect: "none",
|
|
161
|
+
wordBreak: "break-all",
|
|
162
|
+
role: role === 'answer' ? 'white' : 'default',
|
|
163
|
+
children: content
|
|
164
|
+
}), indexOrder ? jsxRuntime.jsx(StyledOrder, {
|
|
165
|
+
children: indexOrder
|
|
166
|
+
}) : null]
|
|
167
|
+
})]
|
|
168
|
+
});
|
|
163
169
|
};
|
|
164
170
|
|
|
165
171
|
exports.default = QuizDraggbleOption;
|
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var markdown = require('@elice/markdown');
|
|
6
6
|
var styled = require('styled-components');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
11
|
+
|
|
12
|
+
var StyledMarkdown = styled__default.default(markdown.Markdown).withConfig({
|
|
9
13
|
componentId: "sc-l6r531-0"
|
|
10
14
|
})(["p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
|
|
11
15
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var QuizDraggbleDroppedOption = require('./QuizDraggbleDroppedOption.js');
|
|
4
|
+
var QuizDraggbleDummyOption = require('./QuizDraggbleDummyOption.js');
|
|
5
|
+
var QuizDraggbleOption = require('./QuizDraggbleOption.js');
|
|
6
|
+
var QuestionRadio = require('./question-radio/QuestionRadio.js');
|
|
7
|
+
var QuestionRadioOption = require('./question-radio/QuestionRadioOption.js');
|
|
8
|
+
var QuestionCheckbox = require('./question-checkbox/QuestionCheckbox.js');
|
|
9
|
+
var QuestionCheckboxOption = require('./question-checkbox/QuestionCheckboxOption.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.QuizDraggbleDroppedOption = QuizDraggbleDroppedOption.default;
|
|
14
|
+
exports.QuizDraggbleDummyOption = QuizDraggbleDummyOption.default;
|
|
15
|
+
exports.QuizDraggbleOption = QuizDraggbleOption.default;
|
|
16
|
+
exports.QuestionRadio = QuestionRadio.default;
|
|
17
|
+
exports.QuestionRadioOption = QuestionRadioOption.default;
|
|
18
|
+
exports.QuestionCheckbox = QuestionCheckbox.default;
|
|
19
|
+
exports.QuestionCheckboxOption = QuestionCheckboxOption.default;
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
8
|
var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
|
|
9
9
|
|
|
10
|
-
|
|
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({
|
|
11
15
|
componentId: "sc-1jgy6x5-0"
|
|
12
16
|
})(["display:flex;flex-direction:column;"]);
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
children
|
|
16
|
-
} = _a,
|
|
17
|
+
var QuestionCheckbox = function QuestionCheckbox(_a) {
|
|
18
|
+
var children = _a.children,
|
|
17
19
|
props = tslib.__rest(_a, ["children"]);
|
|
18
|
-
return
|
|
20
|
+
return jsxRuntime.jsx(QuestionCheckboxContext.QuestionCheckboxContextProvider, Object.assign({}, props, {
|
|
21
|
+
children: jsxRuntime.jsx(StyledQuestionCheckbox, {
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
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):
|
|
7
|
+
declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): JSX.Element;
|
|
8
8
|
declare function useQuestionCheckboxContext(): Value;
|
|
9
9
|
export { QuestionCheckboxContextProvider, useQuestionCheckboxContext };
|
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
|
|
5
|
-
|
|
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);
|
|
6
11
|
QuestionCheckboxContext.displayName = 'QuestionCheckboxContext';
|
|
7
|
-
function QuestionCheckboxContextProvider({
|
|
8
|
-
selectedOptions,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) {
|
|
12
|
+
function QuestionCheckboxContextProvider(_ref) {
|
|
13
|
+
var selectedOptions = _ref.selectedOptions,
|
|
14
|
+
onSelect = _ref.onSelect,
|
|
15
|
+
disabled = _ref.disabled,
|
|
16
|
+
children = _ref.children;
|
|
13
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
});
|
|
23
30
|
}
|
|
24
31
|
function useQuestionCheckboxContext() {
|
|
25
|
-
|
|
32
|
+
var context = React__default.default.useContext(QuestionCheckboxContext);
|
|
26
33
|
if (context === undefined) {
|
|
27
34
|
throw new Error('useQuestionCheckboxContext must be used within a QuestionCheckboxContextProvider');
|
|
28
35
|
}
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var designTokens = require('@elice/design-tokens');
|
|
7
8
|
var styled = require('styled-components');
|
|
8
9
|
var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
|
|
9
10
|
var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
16
|
+
|
|
17
|
+
var StyledQuestionCheckboxOption = styled__default.default.div.withConfig({
|
|
12
18
|
componentId: "sc-1erloup-0"
|
|
13
|
-
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
|
|
14
|
-
checked,
|
|
15
|
-
|
|
16
|
-
}) => {
|
|
19
|
+
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
20
|
+
var checked = _ref.checked,
|
|
21
|
+
status = _ref.status;
|
|
17
22
|
switch (status) {
|
|
18
23
|
case 'correct':
|
|
19
24
|
return designTokens.base.color.green1;
|
|
@@ -22,20 +27,21 @@ const StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
|
22
27
|
default:
|
|
23
28
|
return checked ? designTokens.base.color.primary1 : designTokens.base.color.navy6;
|
|
24
29
|
}
|
|
25
|
-
}, ({
|
|
26
|
-
disabled
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
}, function (_ref2) {
|
|
31
|
+
var disabled = _ref2.disabled;
|
|
32
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
33
|
+
}, function (_ref3) {
|
|
34
|
+
var isAnswer = _ref3.isAnswer;
|
|
35
|
+
return isAnswer ? "border: 3px solid ".concat(designTokens.base.color.green5) : '';
|
|
36
|
+
});
|
|
37
|
+
var StyledCustomCheckboxButton = styled__default.default.span.withConfig({
|
|
31
38
|
componentId: "sc-1erloup-1"
|
|
32
39
|
})([""]);
|
|
33
|
-
|
|
40
|
+
var StyledQuestionCheckboxInput = styled__default.default.input.withConfig({
|
|
34
41
|
componentId: "sc-1erloup-2"
|
|
35
|
-
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;width:1rem;height:1rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], ({
|
|
36
|
-
checked,
|
|
37
|
-
|
|
38
|
-
}) => {
|
|
42
|
+
})(["flex:none;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;width:1rem;height:1rem;margin-right:0.875rem;background-color:", ";border:", ";", ""], function (_ref4) {
|
|
43
|
+
var checked = _ref4.checked,
|
|
44
|
+
status = _ref4.status;
|
|
39
45
|
switch (status) {
|
|
40
46
|
case 'correct':
|
|
41
47
|
return designTokens.base.color.green9;
|
|
@@ -44,23 +50,21 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
44
50
|
default:
|
|
45
51
|
return checked ? designTokens.base.color.primary6 : 'transparent';
|
|
46
52
|
}
|
|
47
|
-
}, ({
|
|
48
|
-
checked,
|
|
49
|
-
|
|
50
|
-
}) => {
|
|
53
|
+
}, function (_ref5) {
|
|
54
|
+
var checked = _ref5.checked,
|
|
55
|
+
status = _ref5.status;
|
|
51
56
|
switch (status) {
|
|
52
57
|
case 'correct':
|
|
53
58
|
return designTokens.base.color.green9;
|
|
54
59
|
case 'wrong':
|
|
55
60
|
return designTokens.base.color.red9;
|
|
56
61
|
default:
|
|
57
|
-
return checked ? designTokens.base.color.primary6 :
|
|
62
|
+
return checked ? designTokens.base.color.primary6 : "1px solid ".concat(designTokens.base.color.gray3);
|
|
58
63
|
}
|
|
59
|
-
}, ({
|
|
60
|
-
status,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
let bgColor;
|
|
64
|
+
}, function (_ref6) {
|
|
65
|
+
var status = _ref6.status,
|
|
66
|
+
checked = _ref6.checked;
|
|
67
|
+
var bgColor;
|
|
64
68
|
switch (status) {
|
|
65
69
|
case 'correct':
|
|
66
70
|
bgColor = designTokens.base.color.green9;
|
|
@@ -72,7 +76,7 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
72
76
|
bgColor = 'transparent';
|
|
73
77
|
break;
|
|
74
78
|
}
|
|
75
|
-
|
|
79
|
+
var borderColor;
|
|
76
80
|
switch (status) {
|
|
77
81
|
case 'correct':
|
|
78
82
|
borderColor = designTokens.base.color.green1;
|
|
@@ -84,59 +88,46 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
84
88
|
borderColor = checked ? designTokens.base.color.primary1 : status ? designTokens.base.color.navy5 : 'transparent';
|
|
85
89
|
break;
|
|
86
90
|
}
|
|
87
|
-
return
|
|
88
|
-
&:after {
|
|
89
|
-
content: '';
|
|
90
|
-
position: absolute;
|
|
91
|
-
top: 50%;
|
|
92
|
-
left: 50%;
|
|
93
|
-
width: 3px;
|
|
94
|
-
height: 7px;
|
|
95
|
-
border: solid ${borderColor};
|
|
96
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
97
|
-
border-width: 0 2px 2px 0;
|
|
98
|
-
background-color: ${bgColor};
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
91
|
+
return "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 3px;\n height: 7px;\n border: solid ".concat(borderColor, ";\n transform: translate(-50%, -50%) rotate(45deg);\n border-width: 0 2px 2px 0;\n background-color: ").concat(bgColor, ";\n }\n ");
|
|
101
92
|
});
|
|
102
|
-
|
|
93
|
+
var StyledLabel = styled__default.default.label.withConfig({
|
|
103
94
|
componentId: "sc-1erloup-3"
|
|
104
95
|
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
|
|
105
|
-
|
|
106
|
-
value,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const checked = selectedOptions.includes(value);
|
|
117
|
-
return React.createElement(StyledQuestionCheckboxOption, {
|
|
96
|
+
var QuestionCheckboxOption = React__default.default.memo(function (_ref7) {
|
|
97
|
+
var value = _ref7.value,
|
|
98
|
+
status = _ref7.status,
|
|
99
|
+
isAnswer = _ref7.isAnswer,
|
|
100
|
+
children = _ref7.children;
|
|
101
|
+
var _useQuestionCheckboxC = QuestionCheckboxContext.useQuestionCheckboxContext(),
|
|
102
|
+
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
103
|
+
disabled = _useQuestionCheckboxC.disabled,
|
|
104
|
+
onSelect = _useQuestionCheckboxC.onSelect;
|
|
105
|
+
var checked = selectedOptions.includes(value);
|
|
106
|
+
return jsxRuntime.jsxs(StyledQuestionCheckboxOption, {
|
|
118
107
|
isAnswer: isAnswer,
|
|
119
108
|
disabled: disabled,
|
|
120
109
|
checked: checked,
|
|
121
|
-
onClick: e
|
|
110
|
+
onClick: function onClick(e) {
|
|
122
111
|
e.preventDefault();
|
|
123
112
|
if (disabled) {
|
|
124
113
|
return;
|
|
125
114
|
}
|
|
126
115
|
onSelect(value);
|
|
127
116
|
},
|
|
128
|
-
status: status
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
117
|
+
status: status,
|
|
118
|
+
children: [jsxRuntime.jsx(StyledCustomCheckboxButton, {}), jsxRuntime.jsx(StyledQuestionCheckboxInput, {
|
|
119
|
+
id: value,
|
|
120
|
+
readOnly: true,
|
|
121
|
+
type: "checkbox",
|
|
122
|
+
checked: checked,
|
|
123
|
+
status: status
|
|
124
|
+
}), jsxRuntime.jsx(StyledLabel, {
|
|
125
|
+
htmlFor: value,
|
|
126
|
+
checked: checked,
|
|
127
|
+
status: status,
|
|
128
|
+
children: children
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
140
131
|
});
|
|
141
132
|
|
|
142
133
|
exports.default = QuestionCheckboxOption;
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
8
|
var QuestionRadioContext = require('./QuestionRadioContext.js');
|
|
9
9
|
|
|
10
|
-
|
|
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({
|
|
11
15
|
componentId: "sc-s7wqiy-0"
|
|
12
16
|
})(["display:flex;flex-direction:column;"]);
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
children
|
|
16
|
-
} = _a,
|
|
17
|
+
var QuestionRadio = function QuestionRadio(_a) {
|
|
18
|
+
var children = _a.children,
|
|
17
19
|
props = tslib.__rest(_a, ["children"]);
|
|
18
|
-
return
|
|
20
|
+
return jsxRuntime.jsx(QuestionRadioContext.QuestionRadioContextProvider, Object.assign({}, props, {
|
|
21
|
+
children: jsxRuntime.jsx(StyledQuestionRadio, {
|
|
22
|
+
children: children
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
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):
|
|
7
|
+
declare function QuestionRadioContextProvider({ selectedValue, onSelect, disabled, children, }: QuestionRadioProviderProps): JSX.Element;
|
|
8
8
|
declare function useQuestionRadioContext(): Value;
|
|
9
9
|
export { QuestionRadioContextProvider, useQuestionRadioContext };
|
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
|
|
5
|
-
|
|
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 QuestionRadioContext = React__default.default.createContext(undefined);
|
|
6
11
|
QuestionRadioContext.displayName = 'QuestionRadioContext';
|
|
7
|
-
function QuestionRadioContextProvider({
|
|
8
|
-
selectedValue,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) {
|
|
12
|
+
function QuestionRadioContextProvider(_ref) {
|
|
13
|
+
var selectedValue = _ref.selectedValue,
|
|
14
|
+
onSelect = _ref.onSelect,
|
|
15
|
+
disabled = _ref.disabled,
|
|
16
|
+
children = _ref.children;
|
|
13
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
return jsxRuntime.jsx(QuestionRadioContext.Provider, {
|
|
27
|
+
value: value,
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
23
30
|
}
|
|
24
31
|
function useQuestionRadioContext() {
|
|
25
|
-
|
|
32
|
+
var context = React__default.default.useContext(QuestionRadioContext);
|
|
26
33
|
if (context === undefined) {
|
|
27
34
|
throw new Error('useQuestionRadioContext must be used within a QuestionRadioContextProvider');
|
|
28
35
|
}
|