@elice/material-quiz 1.240718.0-trasncript.1 → 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,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Flex, Button, Vspace, Text, Icon } from '@elice/blocks';
|
|
3
4
|
import { base } from '@elice/design-tokens';
|
|
@@ -9,141 +10,169 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
|
|
|
9
10
|
import QuizGroupContext from './context/context.js';
|
|
10
11
|
import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
var QUIZ_OPTIONS_CONTENT_WIDTH = 534;
|
|
14
|
+
var StyledQuizAnswerWrapper = styled.div.withConfig({
|
|
14
15
|
componentId: "sc-18trt81-0"
|
|
15
16
|
})(["display:flex;flex-direction:column;flex:0 0 calc((100% - ", "px) / 2);"], QUIZ_OPTIONS_CONTENT_WIDTH);
|
|
16
|
-
|
|
17
|
+
var StyledQuizAnswerDropzoneWrapper = styled.div.withConfig({
|
|
17
18
|
componentId: "sc-18trt81-1"
|
|
18
19
|
})(["padding:1rem;border-radius:0.5rem;background:", ";&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
|
|
19
|
-
|
|
20
|
+
var StyledQuizAnswerDropzone = styled(EbDroppable).withConfig({
|
|
20
21
|
componentId: "sc-18trt81-2"
|
|
21
|
-
})(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], ({
|
|
22
|
-
isGroupAnswer
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
})(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], function (_ref) {
|
|
23
|
+
var isGroupAnswer = _ref.isGroupAnswer;
|
|
24
|
+
return isGroupAnswer ? 'flex-start' : 'center';
|
|
25
|
+
}, function (_ref2) {
|
|
26
|
+
var isGroupAnswer = _ref2.isGroupAnswer;
|
|
27
|
+
return isGroupAnswer ? 'flex-start' : 'center';
|
|
28
|
+
}, base.color.gray1, base.color.gray3, base.color.navy4);
|
|
29
|
+
var StyledQuizOptions = styled.div.withConfig({
|
|
27
30
|
componentId: "sc-18trt81-3"
|
|
28
31
|
})(["display:flex;flex-direction:column;width:26.125rem;height:fit-content;padding:1rem;background-color:", ";border-radius:0.5rem;outline:1px dashed ", ";"], base.color.navy6, base.color.navy4);
|
|
29
|
-
|
|
32
|
+
var StyledQuizOptionsDropzone = styled(EbDroppable).withConfig({
|
|
30
33
|
componentId: "sc-18trt81-4"
|
|
31
34
|
})(["display:flex;flex-wrap:wrap;gap:1rem;min-height:10.25rem;border-radius:0.5rem;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], base.color.navy4, base.color.gray4);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
userId
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
handleAnswerReset
|
|
44
|
-
} = React.useContext(QuizGroupContext);
|
|
35
|
+
var MaterialQuizGroupDesktop = function MaterialQuizGroupDesktop() {
|
|
36
|
+
var intl = useRawEliceIntl();
|
|
37
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
38
|
+
userId = _useMaterialQuizState.userId;
|
|
39
|
+
var _React$useContext = React.useContext(QuizGroupContext),
|
|
40
|
+
groupList = _React$useContext.groupList,
|
|
41
|
+
currentAnswerList = _React$useContext.currentAnswerList,
|
|
42
|
+
currentOptionList = _React$useContext.currentOptionList,
|
|
43
|
+
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
44
|
+
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
45
|
+
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
45
46
|
/**
|
|
46
47
|
*
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
-
return
|
|
49
|
+
var renderQuizContentSortation = function renderQuizContentSortation() {
|
|
50
|
+
return jsx(Flex, {
|
|
50
51
|
align: "center",
|
|
51
|
-
margin: "0 1.25rem"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
margin: "0 1.25rem",
|
|
53
|
+
children: jsx(Icon, {
|
|
54
|
+
size: "large",
|
|
55
|
+
icon: eilSortItem,
|
|
56
|
+
rotate: 90,
|
|
57
|
+
color: "white"
|
|
58
|
+
})
|
|
59
|
+
});
|
|
58
60
|
};
|
|
59
61
|
/**
|
|
60
62
|
*
|
|
61
63
|
*/
|
|
62
|
-
|
|
64
|
+
var renderQuizGroupAnswer = function renderQuizGroupAnswer(title, dropzoneIndex) {
|
|
63
65
|
var _a, _b;
|
|
64
|
-
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
var isGroupAnswer = Boolean((_a = currentAnswerList[dropzoneIndex]) === null || _a === void 0 ? void 0 : _a.length);
|
|
67
|
+
return jsxs(StyledQuizAnswerDropzoneWrapper, {
|
|
68
|
+
children: [jsx(Text, {
|
|
69
|
+
size: "large",
|
|
70
|
+
bold: true,
|
|
71
|
+
children: title
|
|
72
|
+
}), jsx(Vspace, {
|
|
73
|
+
height: 1
|
|
74
|
+
}), jsx(StyledQuizAnswerDropzone, {
|
|
75
|
+
accept: ".quiz-answer",
|
|
76
|
+
disabled: !!userId,
|
|
77
|
+
isGroupAnswer: isGroupAnswer,
|
|
78
|
+
onDrop: function onDrop(event, ui) {
|
|
79
|
+
var targetId = Number(ui.draggable[0].id);
|
|
80
|
+
updateCurrentAnswer(targetId, dropzoneIndex);
|
|
81
|
+
},
|
|
82
|
+
children: isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map(function (answer, index) {
|
|
83
|
+
return jsx(MaterialQuizGroupOptionItem, {
|
|
84
|
+
option: answer
|
|
85
|
+
}, index);
|
|
86
|
+
}) : jsx(Text, {
|
|
87
|
+
role: "gray5",
|
|
88
|
+
bold: true,
|
|
89
|
+
children: intl.formatMessage({
|
|
90
|
+
id: 'materialQuiz.dropzone.desktop.answerEmpty'
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
87
95
|
};
|
|
88
96
|
/**
|
|
89
97
|
*
|
|
90
98
|
*/
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
var renderQuizContentLeft = function renderQuizContentLeft() {
|
|
100
|
+
return jsx(StyledQuizAnswerWrapper, {
|
|
101
|
+
children: groupList.filter(function (_, index) {
|
|
102
|
+
return !(index % 2);
|
|
103
|
+
}).map(function (group, index) {
|
|
104
|
+
return jsx(React.Fragment, {
|
|
105
|
+
children: renderQuizGroupAnswer(group, index * 2)
|
|
106
|
+
}, index);
|
|
107
|
+
})
|
|
108
|
+
});
|
|
95
109
|
};
|
|
96
110
|
/**
|
|
97
111
|
*
|
|
98
112
|
*/
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
var renderQuizContentRight = function renderQuizContentRight() {
|
|
114
|
+
return jsx(StyledQuizAnswerWrapper, {
|
|
115
|
+
children: groupList.filter(function (_, index) {
|
|
116
|
+
return index % 2;
|
|
117
|
+
}).map(function (group, index) {
|
|
118
|
+
return jsx(React.Fragment, {
|
|
119
|
+
children: renderQuizGroupAnswer(group, index * 2 + 1)
|
|
120
|
+
}, index);
|
|
121
|
+
})
|
|
122
|
+
});
|
|
103
123
|
};
|
|
104
124
|
/**
|
|
105
125
|
*
|
|
106
126
|
*/
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
height: "fit-content"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
127
|
+
var renderQuizContentOption = function renderQuizContentOption() {
|
|
128
|
+
return jsxs(Flex, {
|
|
129
|
+
height: "fit-content",
|
|
130
|
+
children: [renderQuizContentSortation(), jsxs(StyledQuizOptions, {
|
|
131
|
+
children: [jsx(Button, {
|
|
132
|
+
role: "white",
|
|
133
|
+
size: "small",
|
|
134
|
+
disabled: !!userId,
|
|
135
|
+
onClick: handleAnswerReset,
|
|
136
|
+
children: intl.formatMessage({
|
|
137
|
+
id: 'materialQuiz.dropzone.optionReset'
|
|
138
|
+
})
|
|
139
|
+
}), jsx(Vspace, {
|
|
140
|
+
height: 1
|
|
141
|
+
}), jsx(StyledQuizOptionsDropzone, {
|
|
142
|
+
accept: ".quiz-answer",
|
|
143
|
+
onDrop: function onDrop(event, ui) {
|
|
144
|
+
var targetId = Number(ui.draggable[0].id);
|
|
145
|
+
updateCurrentOption(targetId);
|
|
146
|
+
},
|
|
147
|
+
children: currentOptionList.length ? currentOptionList.map(function (option, index) {
|
|
148
|
+
return jsx(MaterialQuizGroupOptionItem, {
|
|
149
|
+
option: option
|
|
150
|
+
}, index);
|
|
151
|
+
}) : jsx(Flex, {
|
|
152
|
+
justify: "center",
|
|
153
|
+
align: "center",
|
|
154
|
+
width: "100%",
|
|
155
|
+
children: jsx(Text, {
|
|
156
|
+
role: "navy",
|
|
157
|
+
textAlign: "center",
|
|
158
|
+
bold: true,
|
|
159
|
+
children: intl.formatMessage({
|
|
160
|
+
id: 'materialQuiz.dropzone.optionEmpty'
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
}), renderQuizContentSortation()]
|
|
166
|
+
});
|
|
139
167
|
};
|
|
140
168
|
//
|
|
141
169
|
//
|
|
142
170
|
//
|
|
143
|
-
return
|
|
171
|
+
return jsxs(Flex, {
|
|
144
172
|
width: "100%",
|
|
145
|
-
height: "100%"
|
|
146
|
-
|
|
173
|
+
height: "100%",
|
|
174
|
+
children: [renderQuizContentLeft(), renderQuizContentOption(), renderQuizContentRight()]
|
|
175
|
+
});
|
|
147
176
|
};
|
|
148
177
|
|
|
149
178
|
export { MaterialQuizGroupDesktop as default };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { Button, Vspace, Text, BottomSheet } from '@elice/blocks';
|
|
3
5
|
import { base } from '@elice/design-tokens';
|
|
@@ -7,136 +9,158 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
|
|
|
7
9
|
import QuizGroupContext from './context/context.js';
|
|
8
10
|
import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
var StyledQuizGroupWrapper = styled.div.withConfig({
|
|
11
13
|
componentId: "sc-bftjpj-0"
|
|
12
14
|
})(["display:flex;flex-direction:column;overflow:hidden;width:100%;padding:1rem;background:", ";border-radius:0.5rem;&:hover{cursor:pointer;}&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
|
|
13
|
-
|
|
15
|
+
var StyledQuizOptionList = styled.div.withConfig({
|
|
14
16
|
componentId: "sc-bftjpj-1"
|
|
15
|
-
})(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"], ({
|
|
16
|
-
isCurrentOptionList
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
})(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"], function (_ref) {
|
|
18
|
+
var isCurrentOptionList = _ref.isCurrentOptionList;
|
|
19
|
+
return isCurrentOptionList ? 'flex-start' : 'center';
|
|
20
|
+
}, base.color.gray1, base.color.gray3);
|
|
21
|
+
var StyledQuizOptionItem = styled.div.withConfig({
|
|
19
22
|
componentId: "sc-bftjpj-2"
|
|
20
23
|
})(["&:hover{cursor:pointer;}"]);
|
|
21
|
-
|
|
24
|
+
var StyledBottomSheetWrapper = styled(StyledQuizOptionList).withConfig({
|
|
22
25
|
componentId: "sc-bftjpj-3"
|
|
23
|
-
})(["align-items:", ";padding:0.5rem;"], ({
|
|
24
|
-
vertical,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
})(["align-items:", ";padding:0.5rem;"], function (_ref2) {
|
|
27
|
+
var vertical = _ref2.vertical,
|
|
28
|
+
isCurrentOptionList = _ref2.isCurrentOptionList;
|
|
29
|
+
return vertical && isCurrentOptionList ? 'flex-start' : 'center';
|
|
30
|
+
});
|
|
31
|
+
var MaterialQuizGroupMobile = function MaterialQuizGroupMobile() {
|
|
32
|
+
var intl = useRawEliceIntl();
|
|
29
33
|
// context
|
|
30
|
-
|
|
31
|
-
materialQuiz,
|
|
32
|
-
userId,
|
|
33
|
-
vertical
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
35
|
+
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
36
|
+
userId = _useMaterialQuizState.userId,
|
|
37
|
+
vertical = _useMaterialQuizState.vertical;
|
|
38
|
+
var _React$useContext = React.useContext(QuizGroupContext),
|
|
39
|
+
currentOptionList = _React$useContext.currentOptionList,
|
|
40
|
+
currentAnswerList = _React$useContext.currentAnswerList,
|
|
41
|
+
updateCurrentAnswer = _React$useContext.updateCurrentAnswer,
|
|
42
|
+
updateCurrentOption = _React$useContext.updateCurrentOption,
|
|
43
|
+
handleAnswerReset = _React$useContext.handleAnswerReset;
|
|
44
|
+
var _React$useState = React.useState(null),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
dropzoneIndex = _React$useState2[0],
|
|
47
|
+
setDropzoneIndex = _React$useState2[1];
|
|
43
48
|
/**
|
|
44
49
|
*
|
|
45
50
|
*/
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
var renderResetButton = function renderResetButton() {
|
|
52
|
+
return jsxs(Fragment, {
|
|
53
|
+
children: [jsx(Button, {
|
|
54
|
+
role: "white",
|
|
55
|
+
size: "small",
|
|
56
|
+
disabled: !!userId,
|
|
57
|
+
onClick: handleAnswerReset,
|
|
58
|
+
block: true,
|
|
59
|
+
children: intl.formatMessage({
|
|
60
|
+
id: 'materialQuiz.dropzone.optionReset'
|
|
61
|
+
})
|
|
62
|
+
}), jsx(Vspace, {
|
|
63
|
+
height: 1
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
58
66
|
};
|
|
59
67
|
/**
|
|
60
68
|
*
|
|
61
69
|
*/
|
|
62
|
-
|
|
70
|
+
var renderGroupList = function renderGroupList() {
|
|
63
71
|
var _a;
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
return jsx(Fragment, {
|
|
73
|
+
children: (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map(function (group, index) {
|
|
74
|
+
var _a;
|
|
75
|
+
var isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index]) === null || _a === void 0 ? void 0 : _a.length);
|
|
76
|
+
return jsxs(StyledQuizGroupWrapper, {
|
|
77
|
+
onClick: function onClick() {
|
|
78
|
+
return setDropzoneIndex(index);
|
|
79
|
+
},
|
|
80
|
+
children: [jsx(Text, {
|
|
81
|
+
size: "small",
|
|
82
|
+
bold: true,
|
|
83
|
+
children: group
|
|
84
|
+
}), jsx(Vspace, {
|
|
85
|
+
height: 0.5
|
|
86
|
+
}), jsx(StyledQuizOptionList, {
|
|
87
|
+
isCurrentOptionList: isCurrentOptionList,
|
|
88
|
+
children: isCurrentOptionList ? currentAnswerList[index].map(function (answer) {
|
|
89
|
+
return jsx(MaterialQuizGroupOptionItem, {
|
|
90
|
+
option: answer,
|
|
91
|
+
onClose: function onClose() {
|
|
92
|
+
var targetId = answer.order;
|
|
93
|
+
updateCurrentOption(targetId);
|
|
94
|
+
}
|
|
95
|
+
}, answer.order);
|
|
96
|
+
}) : jsx(Text, {
|
|
97
|
+
role: "gray6",
|
|
98
|
+
size: "small",
|
|
99
|
+
textAlign: "center",
|
|
100
|
+
bold: true,
|
|
101
|
+
block: true,
|
|
102
|
+
children: intl.formatMessage({
|
|
103
|
+
id: 'materialQuiz.dropzone.mobile.answerEmpty'
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
}, index);
|
|
108
|
+
})
|
|
109
|
+
});
|
|
94
110
|
};
|
|
95
111
|
/**
|
|
96
112
|
*
|
|
97
113
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return
|
|
114
|
+
var renderOptionListBottomSheet = function renderOptionListBottomSheet() {
|
|
115
|
+
var isCurrentOptionList = Boolean(currentOptionList.length);
|
|
116
|
+
return jsx(BottomSheet, {
|
|
101
117
|
show: dropzoneIndex !== null,
|
|
102
118
|
title: intl.formatMessage({
|
|
103
119
|
id: 'materialQuiz.bottomSheet.title'
|
|
104
120
|
}),
|
|
105
121
|
contentsText: "",
|
|
106
122
|
disableSwipeGesture: true,
|
|
107
|
-
onClose: ()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
onClose: function onClose() {
|
|
124
|
+
return setDropzoneIndex(null);
|
|
125
|
+
},
|
|
126
|
+
children: jsx(StyledBottomSheetWrapper, {
|
|
127
|
+
vertical: vertical,
|
|
128
|
+
isCurrentOptionList: isCurrentOptionList,
|
|
129
|
+
children: isCurrentOptionList ? currentOptionList === null || currentOptionList === void 0 ? void 0 : currentOptionList.map(function (option, index) {
|
|
130
|
+
return jsx(StyledQuizOptionItem, {
|
|
131
|
+
onClick: function onClick() {
|
|
132
|
+
var targetId = option.order;
|
|
133
|
+
if (dropzoneIndex === null) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!!userId) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
updateCurrentAnswer(targetId, dropzoneIndex);
|
|
140
|
+
},
|
|
141
|
+
children: jsx(MaterialQuizGroupOptionItem, {
|
|
142
|
+
option: option
|
|
143
|
+
}, index)
|
|
144
|
+
}, index);
|
|
145
|
+
}) : jsx(Text, {
|
|
146
|
+
role: "gray6",
|
|
147
|
+
size: "small",
|
|
148
|
+
textAlign: "center",
|
|
149
|
+
bold: true,
|
|
150
|
+
block: true,
|
|
151
|
+
children: intl.formatMessage({
|
|
152
|
+
id: 'materialQuiz.bottomSheet.optionEmpty'
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
});
|
|
135
157
|
};
|
|
136
158
|
//
|
|
137
159
|
//
|
|
138
160
|
//
|
|
139
|
-
return
|
|
161
|
+
return jsxs(Fragment, {
|
|
162
|
+
children: [renderResetButton(), renderGroupList(), renderOptionListBottomSheet()]
|
|
163
|
+
});
|
|
140
164
|
};
|
|
141
165
|
|
|
142
166
|
export { MaterialQuizGroupMobile as default };
|