@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,4 +1,6 @@
|
|
|
1
|
+
import { asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
1
2
|
import { __rest } from 'tslib';
|
|
3
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
4
|
import React, { useEffect } from 'react';
|
|
3
5
|
import { useIntersection } from 'react-use';
|
|
4
6
|
import { Button, Flex, Text, Box } from '@elice/blocks';
|
|
@@ -11,206 +13,231 @@ import { MATERIAL_QUIZ_ANSWER_ID, MATERIAL_QUIZ_PASSIVE_ID } from '../../constan
|
|
|
11
13
|
import { useMaterialQuizState } from '../material-quiz/context/MaterialQuizContext.js';
|
|
12
14
|
import { mergeRefs } from './utils/mergeRefs.js';
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
var easeInOutCubic = function easeInOutCubic(t) {
|
|
15
17
|
return t < 0.5 ? 4 * Math.pow(t, 3) : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
16
18
|
};
|
|
17
|
-
|
|
19
|
+
var StyledQuestionBox = styled.div.withConfig({
|
|
18
20
|
componentId: "sc-6qfyxj-0"
|
|
19
|
-
})(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"], ({
|
|
20
|
-
vertical
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
vertical
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
min-height: 100
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
})(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"], function (_ref) {
|
|
22
|
+
var vertical = _ref.vertical;
|
|
23
|
+
return vertical ? 'auto' : 'hidden';
|
|
24
|
+
}, function (_ref2) {
|
|
25
|
+
var vertical = _ref2.vertical;
|
|
26
|
+
return vertical ? '0' : '8px';
|
|
27
|
+
}, base.color.navy8, function (_ref3) {
|
|
28
|
+
var vertical = _ref3.vertical;
|
|
29
|
+
return vertical ? 'height: 100%' : "\n max-height: 100%;\n min-height: 100%;\n ";
|
|
30
|
+
});
|
|
31
|
+
var StyledQuestionBoxHeader = styled.div.withConfig({
|
|
30
32
|
componentId: "sc-6qfyxj-1"
|
|
31
|
-
})(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], base.color.navy8, ({
|
|
32
|
-
vertical
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
position: sticky;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
z-index: 1;
|
|
40
|
-
` : '');
|
|
41
|
-
const StyledQuestionBoxBody = styled.div.withConfig({
|
|
33
|
+
})(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], base.color.navy8, function (_ref4) {
|
|
34
|
+
var vertical = _ref4.vertical;
|
|
35
|
+
return !vertical ? '1.5rem' : '1.5rem 1rem 1rem';
|
|
36
|
+
}, function (_ref5) {
|
|
37
|
+
var vertical = _ref5.vertical;
|
|
38
|
+
return vertical ? "\n position: sticky;\n top: -1px;\n left: 0;\n z-index: 1;\n " : '';
|
|
39
|
+
});
|
|
40
|
+
var StyledQuestionBoxBody = styled.div.withConfig({
|
|
42
41
|
componentId: "sc-6qfyxj-2"
|
|
43
|
-
})(["background-color:", ";flex:auto;", ";"], base.color.navy8, ({
|
|
44
|
-
hasFooter,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
})(["background-color:", ";flex:auto;", ";"], base.color.navy8, function (_ref6) {
|
|
43
|
+
var hasFooter = _ref6.hasFooter,
|
|
44
|
+
vertical = _ref6.vertical;
|
|
45
|
+
return hasFooter && !vertical ? 'height: 100%; padding: 0 1.5rem 1.5rem; overflow-y: auto;' : 'padding: 0.25rem 1.5rem 1.5rem';
|
|
46
|
+
});
|
|
47
|
+
var StyledAnchorBox = styled.div.withConfig({
|
|
48
48
|
componentId: "sc-6qfyxj-3"
|
|
49
49
|
})(["position:sticky;bottom:0;left:0;display:flex;justify-content:center;background-color:", ";border-top:1px solid ", ";"], base.color.navy8, base.color.gray7);
|
|
50
|
-
|
|
50
|
+
var StyledQuestionBoxFooter = styled.div.withConfig({
|
|
51
51
|
componentId: "sc-6qfyxj-4"
|
|
52
|
-
})(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], base.color.navy8, ({
|
|
53
|
-
vertical
|
|
54
|
-
|
|
55
|
-
return vertical ? `
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
align-items: flex-start;
|
|
58
|
-
` : `
|
|
59
|
-
border-top: 1px solid ${base.color.gray7};
|
|
60
|
-
justify-content: end;
|
|
61
|
-
gap: 0.75rem;
|
|
62
|
-
`;
|
|
52
|
+
})(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], base.color.navy8, function (_ref7) {
|
|
53
|
+
var vertical = _ref7.vertical;
|
|
54
|
+
return vertical ? "\n flex-direction: column;\n align-items: flex-start;\n " : "\n border-top: 1px solid ".concat(base.color.gray7, ";\n justify-content: end; \n gap: 0.75rem;\n ");
|
|
63
55
|
});
|
|
64
|
-
|
|
56
|
+
var StyledQuestionBoxFooterActions = styled.div.withConfig({
|
|
65
57
|
componentId: "sc-6qfyxj-5"
|
|
66
|
-
})(["display:flex;gap:0.75rem;", ";"], ({
|
|
67
|
-
vertical
|
|
68
|
-
}) => {
|
|
58
|
+
})(["display:flex;gap:0.75rem;", ";"], function (_ref8) {
|
|
59
|
+
var vertical = _ref8.vertical;
|
|
69
60
|
return vertical ? 'width: 100%' : '';
|
|
70
61
|
});
|
|
71
|
-
|
|
62
|
+
var StyledPrimaryButton = styled(Button).withConfig({
|
|
72
63
|
componentId: "sc-6qfyxj-6"
|
|
73
64
|
})(["background-color:", ";border-color:", ";"], base.color.primary6, base.color.primary6);
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} = _a,
|
|
65
|
+
var QuestionBox = function QuestionBox(_a) {
|
|
66
|
+
var children = _a.children,
|
|
67
|
+
_a$footerActions = _a.footerActions,
|
|
68
|
+
footerActions = _a$footerActions === void 0 ? [] : _a$footerActions,
|
|
69
|
+
title = _a.title,
|
|
70
|
+
titlePrefix = _a.titlePrefix,
|
|
71
|
+
submitResult = _a.submitResult;
|
|
72
|
+
_a.submitStatus;
|
|
73
|
+
var onNext = _a.onNext,
|
|
74
|
+
isNextActive = _a.isNextActive,
|
|
75
|
+
bodyContainerRef = _a.bodyContainerRef,
|
|
86
76
|
props = __rest(_a, ["children", "footerActions", "title", "titlePrefix", "submitResult", "submitStatus", "onNext", "isNextActive", "bodyContainerRef"]);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
vertical,
|
|
91
|
-
isLongPassage
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const intersection = useIntersection(intersectionRef, {
|
|
77
|
+
var theme = useTheme();
|
|
78
|
+
var intl = useRawEliceIntl();
|
|
79
|
+
var _useMaterialQuizState = useMaterialQuizState(),
|
|
80
|
+
vertical = _useMaterialQuizState.vertical,
|
|
81
|
+
isLongPassage = _useMaterialQuizState.isLongPassage;
|
|
82
|
+
var intersectionRef = React.useRef(null);
|
|
83
|
+
var headerRef = React.useRef(null);
|
|
84
|
+
var bodyRef = React.useRef(null);
|
|
85
|
+
var currentBodyRef = mergeRefs(bodyContainerRef, bodyRef);
|
|
86
|
+
var hasFooter = footerActions.length > 0;
|
|
87
|
+
var visibleAnchorSection = vertical && isLongPassage;
|
|
88
|
+
var intersection = useIntersection(intersectionRef, {
|
|
100
89
|
root: null,
|
|
101
90
|
rootMargin: '0px',
|
|
102
91
|
threshold: 0.1
|
|
103
92
|
});
|
|
104
|
-
|
|
105
|
-
useEffect(()
|
|
106
|
-
|
|
93
|
+
var isViewingAnswerContainer = Boolean(intersection === null || intersection === void 0 ? void 0 : intersection.isIntersecting);
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
var answerContainer = document.getElementById(MATERIAL_QUIZ_ANSWER_ID);
|
|
107
96
|
// only enable for vertical mode
|
|
108
97
|
if (answerContainer && vertical) intersectionRef.current = answerContainer;
|
|
109
98
|
}, [intersectionRef, vertical]);
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
99
|
+
var scrollToElement = /*#__PURE__*/function () {
|
|
100
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(elementId) {
|
|
101
|
+
var _a, _b, target;
|
|
102
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
103
|
+
while (1) switch (_context.prev = _context.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
target = document.getElementById(elementId);
|
|
106
|
+
if (!(target && bodyRef.current)) {
|
|
107
|
+
_context.next = 4;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
_context.next = 4;
|
|
111
|
+
return animateScrollTo(target.offsetTop, {
|
|
112
|
+
elementToScroll: bodyRef.current,
|
|
113
|
+
verticalOffset: -((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0),
|
|
114
|
+
easing: easeInOutCubic,
|
|
115
|
+
minDuration: 50,
|
|
116
|
+
speed: 200
|
|
117
|
+
});
|
|
118
|
+
case 4:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
return function scrollToElement(_x) {
|
|
125
|
+
return _ref9.apply(this, arguments);
|
|
126
|
+
};
|
|
127
|
+
}();
|
|
128
|
+
var header = title ? jsxs(StyledQuestionBoxHeader, {
|
|
124
129
|
vertical: vertical,
|
|
125
|
-
ref: headerRef
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
ref: headerRef,
|
|
131
|
+
children: [jsxs(Flex, {
|
|
132
|
+
children: [titlePrefix ? jsx(Text, {
|
|
133
|
+
bold: true,
|
|
134
|
+
size: "large",
|
|
135
|
+
customStyles: {
|
|
136
|
+
color: base.color.primary3,
|
|
137
|
+
marginRight: '0.5rem'
|
|
138
|
+
},
|
|
139
|
+
children: titlePrefix
|
|
140
|
+
}) : null, jsx(Text, {
|
|
141
|
+
bold: true,
|
|
142
|
+
role: "navy0",
|
|
143
|
+
size: "large",
|
|
144
|
+
wordBreak: "break-word",
|
|
145
|
+
children: title
|
|
146
|
+
})]
|
|
147
|
+
}), submitResult ? jsx(Box, {
|
|
148
|
+
children: submitResult
|
|
149
|
+
}) : null]
|
|
150
|
+
}) : null;
|
|
151
|
+
var body = jsx(StyledQuestionBoxBody, {
|
|
140
152
|
ref: !vertical ? currentBodyRef : undefined,
|
|
141
153
|
hasFooter: hasFooter,
|
|
142
|
-
vertical: vertical
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
154
|
+
vertical: vertical,
|
|
155
|
+
children: children
|
|
156
|
+
});
|
|
157
|
+
var footer = jsx(StyledQuestionBoxFooter, {
|
|
158
|
+
vertical: vertical,
|
|
159
|
+
children: jsxs(StyledQuestionBoxFooterActions, {
|
|
160
|
+
vertical: vertical,
|
|
161
|
+
children: [footerActions.map(function (action, index) {
|
|
162
|
+
var Component = action.role === 'lightpurple' ? StyledPrimaryButton : Button;
|
|
163
|
+
return jsx(Component, Object.assign({
|
|
164
|
+
isFluid: vertical,
|
|
165
|
+
size: "small"
|
|
166
|
+
}, action, {
|
|
167
|
+
children: action.children
|
|
168
|
+
}), index);
|
|
169
|
+
}), isNextActive ? jsx(StyledPrimaryButton, {
|
|
170
|
+
isFluid: vertical,
|
|
171
|
+
size: "small",
|
|
172
|
+
border: false,
|
|
173
|
+
tabIndex: 0,
|
|
174
|
+
transparent: false,
|
|
175
|
+
onClick: onNext,
|
|
176
|
+
customStyles: {
|
|
177
|
+
backgroundColor: theme.palette.primary.main,
|
|
178
|
+
color: theme.palette.primary.contrastText
|
|
179
|
+
},
|
|
180
|
+
children: intl.formatMessage({
|
|
181
|
+
id: 'materialQuiz.next'
|
|
182
|
+
})
|
|
183
|
+
}) : null]
|
|
184
|
+
})
|
|
185
|
+
});
|
|
186
|
+
var _renderAnchorSection = function _renderAnchorSection() {
|
|
187
|
+
var getCustomStyles = function getCustomStyles(active) {
|
|
188
|
+
return {
|
|
189
|
+
borderBottom: '3px solid currentColor',
|
|
190
|
+
background: 'none',
|
|
191
|
+
borderColor: active ? 'currentColor' : 'transparent',
|
|
192
|
+
color: active ? theme.palette.primary.main : theme.palette.secondary.light
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
return visibleAnchorSection && jsxs(StyledAnchorBox, {
|
|
196
|
+
children: [jsx(Button, {
|
|
197
|
+
size: "small",
|
|
198
|
+
border: false,
|
|
199
|
+
hasBorderRadius: false,
|
|
200
|
+
tabIndex: 0,
|
|
201
|
+
transparent: true,
|
|
202
|
+
onClick: scrollToElement.bind(null, MATERIAL_QUIZ_PASSIVE_ID),
|
|
203
|
+
customStyles: getCustomStyles(!isViewingAnswerContainer),
|
|
204
|
+
children: intl.formatMessage({
|
|
205
|
+
id: 'materialQuiz.anchorLabel.question'
|
|
206
|
+
})
|
|
207
|
+
}), jsx(Button, {
|
|
208
|
+
size: "small",
|
|
209
|
+
border: false,
|
|
210
|
+
hasBorderRadius: false,
|
|
211
|
+
tabIndex: 0,
|
|
212
|
+
transparent: true,
|
|
213
|
+
onClick: scrollToElement.bind(null, MATERIAL_QUIZ_ANSWER_ID),
|
|
214
|
+
customStyles: getCustomStyles(isViewingAnswerContainer),
|
|
215
|
+
children: intl.formatMessage({
|
|
216
|
+
id: 'materialQuiz.anchorLabel.answer'
|
|
217
|
+
})
|
|
218
|
+
})]
|
|
175
219
|
});
|
|
176
|
-
return visibleAnchorSection && React.createElement(StyledAnchorBox, null, React.createElement(Button, {
|
|
177
|
-
size: "small",
|
|
178
|
-
border: false,
|
|
179
|
-
hasBorderRadius: false,
|
|
180
|
-
tabIndex: 0,
|
|
181
|
-
transparent: true,
|
|
182
|
-
onClick: scrollToElement.bind(null, MATERIAL_QUIZ_PASSIVE_ID),
|
|
183
|
-
customStyles: getCustomStyles(!isViewingAnswerContainer)
|
|
184
|
-
}, intl.formatMessage({
|
|
185
|
-
id: 'materialQuiz.anchorLabel.question'
|
|
186
|
-
})), React.createElement(Button, {
|
|
187
|
-
size: "small",
|
|
188
|
-
border: false,
|
|
189
|
-
hasBorderRadius: false,
|
|
190
|
-
tabIndex: 0,
|
|
191
|
-
transparent: true,
|
|
192
|
-
onClick: scrollToElement.bind(null, MATERIAL_QUIZ_ANSWER_ID),
|
|
193
|
-
customStyles: getCustomStyles(isViewingAnswerContainer)
|
|
194
|
-
}, intl.formatMessage({
|
|
195
|
-
id: 'materialQuiz.anchorLabel.answer'
|
|
196
|
-
})));
|
|
197
220
|
};
|
|
198
|
-
|
|
199
|
-
|
|
221
|
+
var renderContent = function renderContent() {
|
|
222
|
+
var content = jsxs(Fragment, {
|
|
223
|
+
children: [body, footerActions.length > 0 ? footer : null]
|
|
224
|
+
});
|
|
200
225
|
if (vertical) {
|
|
201
|
-
return
|
|
226
|
+
return jsx("div", {
|
|
202
227
|
ref: currentBodyRef,
|
|
203
228
|
style: {
|
|
204
229
|
height: '100%',
|
|
205
230
|
overflow: 'auto'
|
|
206
|
-
}
|
|
207
|
-
|
|
231
|
+
},
|
|
232
|
+
children: content
|
|
233
|
+
});
|
|
208
234
|
}
|
|
209
235
|
return content;
|
|
210
236
|
};
|
|
211
|
-
return
|
|
212
|
-
vertical: vertical
|
|
213
|
-
|
|
237
|
+
return jsxs(StyledQuestionBox, Object.assign({}, props, {
|
|
238
|
+
vertical: vertical,
|
|
239
|
+
children: [header, renderContent(), _renderAnchorSection()]
|
|
240
|
+
}));
|
|
214
241
|
};
|
|
215
242
|
|
|
216
243
|
export { StyledQuestionBox, QuestionBox as default };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import QuizDraggbleOption from './QuizDraggbleOption.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
id,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
4
|
+
var QuizDraggbleDroppedOption = function QuizDraggbleDroppedOption(_ref) {
|
|
5
|
+
var id = _ref.id,
|
|
6
|
+
content = _ref.content,
|
|
7
|
+
_ref$disabled = _ref.disabled,
|
|
8
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
9
|
+
role = _ref.role,
|
|
10
|
+
indexOrder = _ref.indexOrder,
|
|
11
|
+
isMarkdown = _ref.isMarkdown;
|
|
12
|
+
return jsx(QuizDraggbleOption, {
|
|
13
13
|
id: id,
|
|
14
|
-
key: id,
|
|
15
14
|
content: content,
|
|
16
15
|
className: "quiz-answer",
|
|
17
16
|
disabled: disabled,
|
|
@@ -19,7 +18,7 @@ const QuizDraggbleDroppedOption = ({
|
|
|
19
18
|
indexOrder: indexOrder,
|
|
20
19
|
clone: true,
|
|
21
20
|
isMarkdown: isMarkdown
|
|
22
|
-
});
|
|
21
|
+
}, id);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export { QuizDraggbleDroppedOption as default };
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Text } from '@elice/blocks';
|
|
3
3
|
import { base } from '@elice/design-tokens';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import EbDroppable from '../eb-sortable/EbDroppable.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var StyledQuizDraggbleDummyOption = styled(EbDroppable).withConfig({
|
|
8
8
|
componentId: "sc-1ayp8c1-0"
|
|
9
9
|
})(["display:flex;justify-content:space-between;align-items:center;border:1px dashed ", ";border-radius:8px;overflow:hidden;background-color:", ";padding:0.875rem 1rem;color:", ";font-size:0.875rem;&:not(:last-of-type){margin-bottom:1rem;}&.ui-droppable-hover{outline:1px dashed ", ";}"], base.color.navy4, base.color.navy5, base.color.navy0, base.color.navy0);
|
|
10
|
-
|
|
10
|
+
var StyledOrder = styled.div.withConfig({
|
|
11
11
|
componentId: "sc-1ayp8c1-1"
|
|
12
12
|
})(["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);
|
|
13
|
-
|
|
14
|
-
children,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
var QuizDraggbleDummyOption = function QuizDraggbleDummyOption(_ref) {
|
|
14
|
+
var children = _ref.children,
|
|
15
|
+
indexOrder = _ref.indexOrder,
|
|
16
|
+
onDrop = _ref.onDrop;
|
|
17
|
+
return jsxs(StyledQuizDraggbleDummyOption, {
|
|
18
|
+
onDrop: onDrop,
|
|
19
|
+
children: [jsx(Text, {
|
|
20
|
+
wordBreak: "break-all",
|
|
21
|
+
customStyles: {
|
|
22
|
+
color: base.color.navy0
|
|
23
|
+
},
|
|
24
|
+
children: children !== null && children !== void 0 ? children : 'drag here...'
|
|
25
|
+
}), jsx(StyledOrder, {
|
|
26
|
+
children: indexOrder
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
export { QuizDraggbleDummyOption as default };
|