@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Icon, Text } from '@elice/blocks';
|
|
3
3
|
import { base } from '@elice/design-tokens';
|
|
4
4
|
import { eilDraggableVertical } from '@elice/icons';
|
|
@@ -7,25 +7,23 @@ import EbDraggable from '../eb-sortable/EbDraggable.js';
|
|
|
7
7
|
import { useMaterialQuizState } from '../material-quiz/context/MaterialQuizContext.js';
|
|
8
8
|
import StyledMarkdown from './StyledMarkdown.js';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
var StyledQuizDraggbleOptionHandle = styled.div.withConfig({
|
|
11
11
|
componentId: "sc-19b0zkq-0"
|
|
12
12
|
})(["display:flex;align-items:center;justify-content:center;background-color:", ";width:1.5rem;flex:none;"], base.color.navy5);
|
|
13
|
-
|
|
13
|
+
var StyledQuizDraggbleOptionContent = styled.div.withConfig({
|
|
14
14
|
componentId: "sc-19b0zkq-1"
|
|
15
|
-
})(["display:flex;justify-content:space-between;min-width:0;align-items:center;flex:auto;padding:0.875rem 1rem;line-height:24px;border:", ";background-color:", ";"], ({
|
|
16
|
-
role
|
|
17
|
-
}) => {
|
|
15
|
+
})(["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) {
|
|
16
|
+
var role = _ref.role;
|
|
18
17
|
switch (role) {
|
|
19
18
|
case 'correct':
|
|
20
|
-
return
|
|
19
|
+
return "1px solid ".concat(base.color.primary6);
|
|
21
20
|
case 'wrong':
|
|
22
|
-
return
|
|
21
|
+
return "1px solid ".concat(base.color.red6);
|
|
23
22
|
default:
|
|
24
23
|
return '';
|
|
25
24
|
}
|
|
26
|
-
}, ({
|
|
27
|
-
role
|
|
28
|
-
}) => {
|
|
25
|
+
}, function (_ref2) {
|
|
26
|
+
var role = _ref2.role;
|
|
29
27
|
switch (role) {
|
|
30
28
|
case 'answer':
|
|
31
29
|
return base.color.primary6;
|
|
@@ -33,14 +31,13 @@ const StyledQuizDraggbleOptionContent = styled.div.withConfig({
|
|
|
33
31
|
return '';
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
|
-
|
|
34
|
+
var StyledOrder = styled.div.withConfig({
|
|
37
35
|
componentId: "sc-19b0zkq-2"
|
|
38
36
|
})(["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;"], base.color.navy0, base.color.navy4);
|
|
39
|
-
|
|
37
|
+
var StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
40
38
|
componentId: "sc-19b0zkq-3"
|
|
41
|
-
})(["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);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, ({
|
|
42
|
-
role
|
|
43
|
-
}) => {
|
|
39
|
+
})(["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);}"], base.color.navy4, base.color.navy5, StyledQuizDraggbleOptionHandle, function (_ref3) {
|
|
40
|
+
var role = _ref3.role;
|
|
44
41
|
switch (role) {
|
|
45
42
|
case 'answer':
|
|
46
43
|
return base.color.primary4;
|
|
@@ -52,9 +49,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
52
49
|
default:
|
|
53
50
|
return base.color.navy3;
|
|
54
51
|
}
|
|
55
|
-
}, ({
|
|
56
|
-
role
|
|
57
|
-
}) => {
|
|
52
|
+
}, function (_ref4) {
|
|
53
|
+
var role = _ref4.role;
|
|
58
54
|
switch (role) {
|
|
59
55
|
case 'answer':
|
|
60
56
|
return base.color.primary9;
|
|
@@ -66,9 +62,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
66
62
|
default:
|
|
67
63
|
return base.color.navy5;
|
|
68
64
|
}
|
|
69
|
-
}, StyledQuizDraggbleOptionContent, ({
|
|
70
|
-
role
|
|
71
|
-
}) => {
|
|
65
|
+
}, StyledQuizDraggbleOptionContent, function (_ref5) {
|
|
66
|
+
var role = _ref5.role;
|
|
72
67
|
switch (role) {
|
|
73
68
|
case 'answer':
|
|
74
69
|
return base.color.primary1;
|
|
@@ -80,9 +75,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
80
75
|
default:
|
|
81
76
|
return base.color.navy5;
|
|
82
77
|
}
|
|
83
|
-
}, ({
|
|
84
|
-
role
|
|
85
|
-
}) => {
|
|
78
|
+
}, function (_ref6) {
|
|
79
|
+
var role = _ref6.role;
|
|
86
80
|
switch (role) {
|
|
87
81
|
case 'answer':
|
|
88
82
|
return base.color.primary9;
|
|
@@ -94,9 +88,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
94
88
|
default:
|
|
95
89
|
return base.color.navy0;
|
|
96
90
|
}
|
|
97
|
-
}, StyledOrder, ({
|
|
98
|
-
role
|
|
99
|
-
}) => {
|
|
91
|
+
}, StyledOrder, function (_ref7) {
|
|
92
|
+
var role = _ref7.role;
|
|
100
93
|
switch (role) {
|
|
101
94
|
case 'answer':
|
|
102
95
|
return base.color.primary3;
|
|
@@ -108,9 +101,8 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
108
101
|
default:
|
|
109
102
|
return base.color.navy4;
|
|
110
103
|
}
|
|
111
|
-
}, ({
|
|
112
|
-
role
|
|
113
|
-
}) => {
|
|
104
|
+
}, function (_ref8) {
|
|
105
|
+
var role = _ref8.role;
|
|
114
106
|
switch (role) {
|
|
115
107
|
case 'answer':
|
|
116
108
|
return base.color.primary9;
|
|
@@ -123,39 +115,49 @@ const StyledQuizDraggbleOption = styled(EbDraggable).withConfig({
|
|
|
123
115
|
return base.color.navy0;
|
|
124
116
|
}
|
|
125
117
|
}, base.color.navy0, StyledQuizDraggbleOptionHandle, base.color.navy5, StyledQuizDraggbleOptionContent, base.color.navy4, base.color.navy4, StyledOrder, base.color.navy0, base.color.navy5, base.color.navy0);
|
|
126
|
-
|
|
127
|
-
id,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
118
|
+
var QuizDraggbleOption = function QuizDraggbleOption(_ref9) {
|
|
119
|
+
var id = _ref9.id,
|
|
120
|
+
className = _ref9.className,
|
|
121
|
+
content = _ref9.content,
|
|
122
|
+
_ref9$disabled = _ref9.disabled,
|
|
123
|
+
disabled = _ref9$disabled === void 0 ? false : _ref9$disabled,
|
|
124
|
+
_ref9$role = _ref9.role,
|
|
125
|
+
role = _ref9$role === void 0 ? 'default' : _ref9$role,
|
|
126
|
+
indexOrder = _ref9.indexOrder,
|
|
127
|
+
_ref9$clone = _ref9.clone,
|
|
128
|
+
clone = _ref9$clone === void 0 ? false : _ref9$clone,
|
|
129
|
+
_ref9$isMarkdown = _ref9.isMarkdown,
|
|
130
|
+
isMarkdown = _ref9$isMarkdown === void 0 ? false : _ref9$isMarkdown;
|
|
131
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
132
|
+
vertical = _useMaterialQuizState.vertical;
|
|
133
|
+
return jsxs(StyledQuizDraggbleOption, {
|
|
140
134
|
id: id,
|
|
141
135
|
className: className,
|
|
142
136
|
disabled: disabled,
|
|
143
137
|
role: role,
|
|
144
138
|
clone: clone,
|
|
145
|
-
vertical: vertical
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
139
|
+
vertical: vertical,
|
|
140
|
+
children: [jsx(StyledQuizDraggbleOptionHandle, {
|
|
141
|
+
children: jsx(Icon, {
|
|
142
|
+
size: "large",
|
|
143
|
+
icon: eilDraggableVertical
|
|
144
|
+
})
|
|
145
|
+
}), jsxs(StyledQuizDraggbleOptionContent, {
|
|
146
|
+
children: [isMarkdown ? jsx(StyledMarkdown, {
|
|
147
|
+
children: content,
|
|
148
|
+
dark: true,
|
|
149
|
+
paddingx: 0,
|
|
150
|
+
paddingy: 0
|
|
151
|
+
}) : jsx(Text, {
|
|
152
|
+
userSelect: "none",
|
|
153
|
+
wordBreak: "break-all",
|
|
154
|
+
role: role === 'answer' ? 'white' : 'default',
|
|
155
|
+
children: content
|
|
156
|
+
}), indexOrder ? jsx(StyledOrder, {
|
|
157
|
+
children: indexOrder
|
|
158
|
+
}) : null]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
159
161
|
};
|
|
160
162
|
|
|
161
163
|
export { QuizDraggbleOption as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Markdown } from '@elice/markdown';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
var StyledMarkdown = styled(Markdown).withConfig({
|
|
5
5
|
componentId: "sc-l6r531-0"
|
|
6
6
|
})(["p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
|
|
7
7
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as QuizDraggbleDroppedOption } from './QuizDraggbleDroppedOption.js';
|
|
2
|
+
export { default as QuizDraggbleDummyOption } from './QuizDraggbleDummyOption.js';
|
|
3
|
+
export { default as QuizDraggbleOption } from './QuizDraggbleOption.js';
|
|
4
|
+
export { default as QuestionRadio } from './question-radio/QuestionRadio.js';
|
|
5
|
+
export { default as QuestionRadioOption } from './question-radio/QuestionRadioOption.js';
|
|
6
|
+
export { default as QuestionCheckbox } from './question-checkbox/QuestionCheckbox.js';
|
|
7
|
+
export { default as QuestionCheckboxOption } from './question-checkbox/QuestionCheckboxOption.js';
|
|
@@ -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 { QuestionCheckboxContextProvider } from './QuestionCheckboxContext.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
var StyledQuestionCheckbox = styled.div.withConfig({
|
|
7
7
|
componentId: "sc-1jgy6x5-0"
|
|
8
8
|
})(["display:flex;flex-direction:column;"]);
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
children
|
|
12
|
-
} = _a,
|
|
9
|
+
var QuestionCheckbox = function QuestionCheckbox(_a) {
|
|
10
|
+
var children = _a.children,
|
|
13
11
|
props = __rest(_a, ["children"]);
|
|
14
|
-
return
|
|
12
|
+
return jsx(QuestionCheckboxContextProvider, Object.assign({}, props, {
|
|
13
|
+
children: jsx(StyledQuestionCheckbox, {
|
|
14
|
+
children: children
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
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):
|
|
7
|
+
declare function QuestionCheckboxContextProvider({ selectedOptions, onSelect, disabled, children, }: QuestionCheckboxProviderProps): JSX.Element;
|
|
8
8
|
declare function useQuestionCheckboxContext(): Value;
|
|
9
9
|
export { QuestionCheckboxContextProvider, useQuestionCheckboxContext };
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
var QuestionCheckboxContext = React.createContext(undefined);
|
|
4
5
|
QuestionCheckboxContext.displayName = 'QuestionCheckboxContext';
|
|
5
|
-
function QuestionCheckboxContextProvider({
|
|
6
|
-
selectedOptions,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}) {
|
|
6
|
+
function QuestionCheckboxContextProvider(_ref) {
|
|
7
|
+
var selectedOptions = _ref.selectedOptions,
|
|
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
|
+
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
|
+
});
|
|
21
24
|
}
|
|
22
25
|
function useQuestionCheckboxContext() {
|
|
23
|
-
|
|
26
|
+
var context = React.useContext(QuestionCheckboxContext);
|
|
24
27
|
if (context === undefined) {
|
|
25
28
|
throw new Error('useQuestionCheckboxContext must be used within a QuestionCheckboxContextProvider');
|
|
26
29
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
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 { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
5
6
|
import { useQuestionCheckboxContext } from './QuestionCheckboxContext.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
var StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
8
9
|
componentId: "sc-1erloup-0"
|
|
9
|
-
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], ({
|
|
10
|
-
checked,
|
|
11
|
-
|
|
12
|
-
}) => {
|
|
10
|
+
})(["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) {
|
|
11
|
+
var checked = _ref.checked,
|
|
12
|
+
status = _ref.status;
|
|
13
13
|
switch (status) {
|
|
14
14
|
case 'correct':
|
|
15
15
|
return base.color.green1;
|
|
@@ -18,20 +18,21 @@ const StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
|
18
18
|
default:
|
|
19
19
|
return checked ? base.color.primary1 : base.color.navy6;
|
|
20
20
|
}
|
|
21
|
-
}, ({
|
|
22
|
-
disabled
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
}, function (_ref2) {
|
|
22
|
+
var disabled = _ref2.disabled;
|
|
23
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
24
|
+
}, function (_ref3) {
|
|
25
|
+
var isAnswer = _ref3.isAnswer;
|
|
26
|
+
return isAnswer ? "border: 3px solid ".concat(base.color.green5) : '';
|
|
27
|
+
});
|
|
28
|
+
var StyledCustomCheckboxButton = styled.span.withConfig({
|
|
27
29
|
componentId: "sc-1erloup-1"
|
|
28
30
|
})([""]);
|
|
29
|
-
|
|
31
|
+
var StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
30
32
|
componentId: "sc-1erloup-2"
|
|
31
|
-
})(["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:", ";", ""], ({
|
|
32
|
-
checked,
|
|
33
|
-
|
|
34
|
-
}) => {
|
|
33
|
+
})(["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) {
|
|
34
|
+
var checked = _ref4.checked,
|
|
35
|
+
status = _ref4.status;
|
|
35
36
|
switch (status) {
|
|
36
37
|
case 'correct':
|
|
37
38
|
return base.color.green9;
|
|
@@ -40,23 +41,21 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
40
41
|
default:
|
|
41
42
|
return checked ? base.color.primary6 : 'transparent';
|
|
42
43
|
}
|
|
43
|
-
}, ({
|
|
44
|
-
checked,
|
|
45
|
-
|
|
46
|
-
}) => {
|
|
44
|
+
}, function (_ref5) {
|
|
45
|
+
var checked = _ref5.checked,
|
|
46
|
+
status = _ref5.status;
|
|
47
47
|
switch (status) {
|
|
48
48
|
case 'correct':
|
|
49
49
|
return base.color.green9;
|
|
50
50
|
case 'wrong':
|
|
51
51
|
return base.color.red9;
|
|
52
52
|
default:
|
|
53
|
-
return checked ? base.color.primary6 :
|
|
53
|
+
return checked ? base.color.primary6 : "1px solid ".concat(base.color.gray3);
|
|
54
54
|
}
|
|
55
|
-
}, ({
|
|
56
|
-
status,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let bgColor;
|
|
55
|
+
}, function (_ref6) {
|
|
56
|
+
var status = _ref6.status,
|
|
57
|
+
checked = _ref6.checked;
|
|
58
|
+
var bgColor;
|
|
60
59
|
switch (status) {
|
|
61
60
|
case 'correct':
|
|
62
61
|
bgColor = base.color.green9;
|
|
@@ -68,7 +67,7 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
68
67
|
bgColor = 'transparent';
|
|
69
68
|
break;
|
|
70
69
|
}
|
|
71
|
-
|
|
70
|
+
var borderColor;
|
|
72
71
|
switch (status) {
|
|
73
72
|
case 'correct':
|
|
74
73
|
borderColor = base.color.green1;
|
|
@@ -80,59 +79,46 @@ const StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
80
79
|
borderColor = checked ? base.color.primary1 : status ? base.color.navy5 : 'transparent';
|
|
81
80
|
break;
|
|
82
81
|
}
|
|
83
|
-
return
|
|
84
|
-
&:after {
|
|
85
|
-
content: '';
|
|
86
|
-
position: absolute;
|
|
87
|
-
top: 50%;
|
|
88
|
-
left: 50%;
|
|
89
|
-
width: 3px;
|
|
90
|
-
height: 7px;
|
|
91
|
-
border: solid ${borderColor};
|
|
92
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
93
|
-
border-width: 0 2px 2px 0;
|
|
94
|
-
background-color: ${bgColor};
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
82
|
+
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 ");
|
|
97
83
|
});
|
|
98
|
-
|
|
84
|
+
var StyledLabel = styled.label.withConfig({
|
|
99
85
|
componentId: "sc-1erloup-3"
|
|
100
86
|
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
101
|
-
|
|
102
|
-
value,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const checked = selectedOptions.includes(value);
|
|
113
|
-
return React.createElement(StyledQuestionCheckboxOption, {
|
|
87
|
+
var QuestionCheckboxOption = React.memo(function (_ref7) {
|
|
88
|
+
var value = _ref7.value,
|
|
89
|
+
status = _ref7.status,
|
|
90
|
+
isAnswer = _ref7.isAnswer,
|
|
91
|
+
children = _ref7.children;
|
|
92
|
+
var _useQuestionCheckboxC = useQuestionCheckboxContext(),
|
|
93
|
+
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
94
|
+
disabled = _useQuestionCheckboxC.disabled,
|
|
95
|
+
onSelect = _useQuestionCheckboxC.onSelect;
|
|
96
|
+
var checked = selectedOptions.includes(value);
|
|
97
|
+
return jsxs(StyledQuestionCheckboxOption, {
|
|
114
98
|
isAnswer: isAnswer,
|
|
115
99
|
disabled: disabled,
|
|
116
100
|
checked: checked,
|
|
117
|
-
onClick: e
|
|
101
|
+
onClick: function onClick(e) {
|
|
118
102
|
e.preventDefault();
|
|
119
103
|
if (disabled) {
|
|
120
104
|
return;
|
|
121
105
|
}
|
|
122
106
|
onSelect(value);
|
|
123
107
|
},
|
|
124
|
-
status: status
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
108
|
+
status: status,
|
|
109
|
+
children: [jsx(StyledCustomCheckboxButton, {}), jsx(StyledQuestionCheckboxInput, {
|
|
110
|
+
id: value,
|
|
111
|
+
readOnly: true,
|
|
112
|
+
type: "checkbox",
|
|
113
|
+
checked: checked,
|
|
114
|
+
status: status
|
|
115
|
+
}), jsx(StyledLabel, {
|
|
116
|
+
htmlFor: value,
|
|
117
|
+
checked: checked,
|
|
118
|
+
status: status,
|
|
119
|
+
children: children
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
136
122
|
});
|
|
137
123
|
|
|
138
124
|
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-s7wqiy-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
|
}
|