@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.1
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/components/eb-sortable/EbDraggable.js +33 -42
- package/cjs/components/eb-sortable/EbDroppable.js +20 -27
- package/cjs/components/markdown-editor/index.d.ts +2 -1
- package/cjs/components/markdown-editor/index.js +10 -19
- package/cjs/components/material-quiz/MaterialQuiz.js +83 -114
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -36
- package/cjs/components/material-quiz/MaterialQuizInfo.js +149 -151
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +127 -175
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +286 -360
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +126 -172
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +39 -46
- package/cjs/components/material-quiz/MaterialQuizText.js +115 -163
- package/cjs/components/material-quiz/QuizResultBadge.js +22 -32
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +16 -21
- 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 +93 -156
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -259
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -134
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -130
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -64
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +1 -5
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +36 -47
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +232 -280
- package/cjs/components/material-quiz-edit/context.js +2 -8
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +46 -70
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -174
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -175
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +144 -164
- package/cjs/components/material-quiz-edit/options/OptionText.js +82 -90
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -156
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +196 -288
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -88
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -108
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
- package/cjs/components/material-quiz-edit/utils/editValue.js +12 -21
- package/cjs/components/shared/QuestionBox.js +165 -198
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +12 -11
- package/cjs/components/shared/QuizDraggbleDummyOption.js +16 -23
- package/cjs/components/shared/QuizDraggbleOption.js +59 -65
- package/cjs/components/shared/StyledMarkdown.js +1 -5
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -59
- package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -52
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +9 -7
- package/cjs/components/shared/utils/mergeRefs.js +6 -15
- package/cjs/constant/element.js +3 -3
- package/cjs/helpers/index.js +10 -8
- package/cjs/hooks/useCaculatePassage.js +20 -21
- package/es/components/eb-sortable/EbDraggable.js +33 -37
- package/es/components/eb-sortable/EbDroppable.js +20 -22
- package/es/components/markdown-editor/index.d.ts +2 -1
- package/es/components/markdown-editor/index.js +10 -15
- package/es/components/material-quiz/MaterialQuiz.js +83 -109
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -32
- package/es/components/material-quiz/MaterialQuizInfo.js +150 -148
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +127 -171
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +287 -356
- package/es/components/material-quiz/MaterialQuizSelectOne.js +126 -168
- package/es/components/material-quiz/MaterialQuizShimmer.js +39 -42
- package/es/components/material-quiz/MaterialQuizText.js +115 -158
- package/es/components/material-quiz/QuizResultBadge.js +22 -27
- package/es/components/material-quiz/QuizSubmitStatusText.js +16 -17
- 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 +94 -153
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -253
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -129
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -125
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -60
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +36 -43
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +229 -272
- package/es/components/material-quiz-edit/context.js +2 -4
- package/es/components/material-quiz-edit/options/OptionEditor.js +46 -64
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -170
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -171
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +144 -159
- package/es/components/material-quiz-edit/options/OptionText.js +82 -86
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -151
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +197 -283
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -83
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -103
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
- package/es/components/material-quiz-edit/utils/editValue.js +12 -17
- package/es/components/shared/QuestionBox.js +165 -192
- package/es/components/shared/QuizDraggbleDroppedOption.js +12 -11
- package/es/components/shared/QuizDraggbleDummyOption.js +16 -19
- package/es/components/shared/QuizDraggbleOption.js +59 -61
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -54
- package/es/components/shared/question-radio/QuestionRadio.js +7 -9
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
- package/es/components/shared/question-radio/QuestionRadioOption.js +59 -47
- package/es/components/shared/utils/getQuestionStatusStyle.js +9 -7
- package/es/components/shared/utils/mergeRefs.js +6 -15
- package/es/constant/element.js +3 -3
- package/es/helpers/index.js +10 -8
- package/es/hooks/useCaculatePassage.js +20 -21
- package/package.json +15 -12
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -423
- package/cjs/components/material-quiz/index.js +0 -9
- package/cjs/components/material-quiz/locales/index.js +0 -13
- package/cjs/components/material-quiz-edit/index.js +0 -7
- package/cjs/components/material-quiz-edit/locales/index.js +0 -13
- package/cjs/components/shared/index.js +0 -19
- package/cjs/constant/index.js +0 -9
- package/cjs/hooks/index.js +0 -7
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -408
- package/es/components/material-quiz/index.js +0 -2
- package/es/components/material-quiz/locales/index.js +0 -4
- package/es/components/material-quiz-edit/index.js +0 -1
- package/es/components/material-quiz-edit/locales/index.js +0 -4
- package/es/components/shared/index.js +0 -7
- package/es/constant/index.js +0 -1
- package/es/hooks/index.js +0 -1
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
6
5
|
var tslib = require('tslib');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
6
|
var React = require('react');
|
|
9
7
|
var reactUse = require('react-use');
|
|
10
8
|
var blocks = require('@elice/blocks');
|
|
@@ -17,237 +15,206 @@ var element = require('../../constant/element.js');
|
|
|
17
15
|
var MaterialQuizContext = require('../material-quiz/context/MaterialQuizContext.js');
|
|
18
16
|
var mergeRefs = require('./utils/mergeRefs.js');
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
23
|
-
var animateScrollTo__default = /*#__PURE__*/_interopDefaultCompat(animateScrollTo);
|
|
24
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
25
|
-
|
|
26
|
-
var easeInOutCubic = function easeInOutCubic(t) {
|
|
18
|
+
const easeInOutCubic = t => {
|
|
27
19
|
return t < 0.5 ? 4 * Math.pow(t, 3) : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
28
20
|
};
|
|
29
|
-
|
|
21
|
+
const StyledQuestionBox = styled.div.withConfig({
|
|
30
22
|
componentId: "sc-6qfyxj-0"
|
|
31
|
-
})(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"],
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
})(["position:relative;display:flex;flex-direction:column;overflow:", ";border-radius:", ";width:100%;background-color:", ";", ";"], ({
|
|
24
|
+
vertical
|
|
25
|
+
}) => vertical ? 'auto' : 'hidden', ({
|
|
26
|
+
vertical
|
|
27
|
+
}) => vertical ? '0' : '8px', designTokens.base.color.navy8, ({
|
|
28
|
+
vertical
|
|
29
|
+
}) => vertical ? 'height: 100%' : `
|
|
30
|
+
max-height: 100%;
|
|
31
|
+
min-height: 100%;
|
|
32
|
+
`);
|
|
33
|
+
const StyledQuestionBoxHeader = styled.div.withConfig({
|
|
42
34
|
componentId: "sc-6qfyxj-1"
|
|
43
|
-
})(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], designTokens.base.color.navy8,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
})(["display:flex;justify-content:space-between;background-color:", ";padding:", ";flex:none;", ""], designTokens.base.color.navy8, ({
|
|
36
|
+
vertical
|
|
37
|
+
}) => !vertical ? '1.5rem' : '1.5rem 1rem 1rem', ({
|
|
38
|
+
vertical
|
|
39
|
+
}) => vertical ? `
|
|
40
|
+
position: sticky;
|
|
41
|
+
top: -1px;
|
|
42
|
+
left: 0;
|
|
43
|
+
z-index: 1;
|
|
44
|
+
` : '');
|
|
45
|
+
const StyledQuestionBoxBody = styled.div.withConfig({
|
|
51
46
|
componentId: "sc-6qfyxj-2"
|
|
52
|
-
})(["background-color:", ";flex:auto;", ";"], designTokens.base.color.navy8,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var StyledAnchorBox = styled__default.default.div.withConfig({
|
|
47
|
+
})(["background-color:", ";flex:auto;", ";"], designTokens.base.color.navy8, ({
|
|
48
|
+
hasFooter,
|
|
49
|
+
vertical
|
|
50
|
+
}) => hasFooter && !vertical ? 'height: 100%; padding: 0 1.5rem 1.5rem; overflow-y: auto;' : 'padding: 0.25rem 1.5rem 1.5rem');
|
|
51
|
+
const StyledAnchorBox = styled.div.withConfig({
|
|
58
52
|
componentId: "sc-6qfyxj-3"
|
|
59
53
|
})(["position:sticky;bottom:0;left:0;display:flex;justify-content:center;background-color:", ";border-top:1px solid ", ";"], designTokens.base.color.navy8, designTokens.base.color.gray7);
|
|
60
|
-
|
|
54
|
+
const StyledQuestionBoxFooter = styled.div.withConfig({
|
|
61
55
|
componentId: "sc-6qfyxj-4"
|
|
62
|
-
})(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], designTokens.base.color.navy8,
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
})(["flex:none;display:flex;align-items:center;padding:1rem;background-color:", ";", ""], designTokens.base.color.navy8, ({
|
|
57
|
+
vertical
|
|
58
|
+
}) => {
|
|
59
|
+
return vertical ? `
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
align-items: flex-start;
|
|
62
|
+
` : `
|
|
63
|
+
border-top: 1px solid ${designTokens.base.color.gray7};
|
|
64
|
+
justify-content: end;
|
|
65
|
+
gap: 0.75rem;
|
|
66
|
+
`;
|
|
65
67
|
});
|
|
66
|
-
|
|
68
|
+
const StyledQuestionBoxFooterActions = styled.div.withConfig({
|
|
67
69
|
componentId: "sc-6qfyxj-5"
|
|
68
|
-
})(["display:flex;gap:0.75rem;", ";"],
|
|
69
|
-
|
|
70
|
+
})(["display:flex;gap:0.75rem;", ";"], ({
|
|
71
|
+
vertical
|
|
72
|
+
}) => {
|
|
70
73
|
return vertical ? 'width: 100%' : '';
|
|
71
74
|
});
|
|
72
|
-
|
|
75
|
+
const StyledPrimaryButton = styled(blocks.Button).withConfig({
|
|
73
76
|
componentId: "sc-6qfyxj-6"
|
|
74
77
|
})(["background-color:", ";border-color:", ";"], designTokens.base.color.primary6, designTokens.base.color.primary6);
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
const QuestionBox = _a => {
|
|
79
|
+
var {
|
|
80
|
+
children,
|
|
81
|
+
footerActions = [],
|
|
82
|
+
title,
|
|
83
|
+
titlePrefix,
|
|
84
|
+
submitResult,
|
|
85
|
+
submitStatus,
|
|
86
|
+
onNext,
|
|
87
|
+
isNextActive,
|
|
88
|
+
bodyContainerRef
|
|
89
|
+
} = _a,
|
|
86
90
|
props = tslib.__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
|
-
|
|
91
|
+
const theme = material.useTheme();
|
|
92
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
93
|
+
const {
|
|
94
|
+
vertical,
|
|
95
|
+
isLongPassage
|
|
96
|
+
} = MaterialQuizContext.useMaterialQuizState();
|
|
97
|
+
const intersectionRef = React.useRef(null);
|
|
98
|
+
const headerRef = React.useRef(null);
|
|
99
|
+
const bodyRef = React.useRef(null);
|
|
100
|
+
const currentBodyRef = mergeRefs.mergeRefs(bodyContainerRef, bodyRef);
|
|
101
|
+
const hasFooter = footerActions.length > 0;
|
|
102
|
+
const visibleAnchorSection = vertical && isLongPassage;
|
|
103
|
+
const intersection = reactUse.useIntersection(intersectionRef, {
|
|
99
104
|
root: null,
|
|
100
105
|
rootMargin: '0px',
|
|
101
106
|
threshold: 0.1
|
|
102
107
|
});
|
|
103
|
-
|
|
104
|
-
React.useEffect(
|
|
105
|
-
|
|
108
|
+
const isViewingAnswerContainer = Boolean(intersection === null || intersection === void 0 ? void 0 : intersection.isIntersecting);
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
const answerContainer = document.getElementById(element.MATERIAL_QUIZ_ANSWER_ID);
|
|
106
111
|
// only enable for vertical mode
|
|
107
112
|
if (answerContainer && vertical) intersectionRef.current = answerContainer;
|
|
108
113
|
}, [intersectionRef, vertical]);
|
|
109
|
-
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
verticalOffset: -((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0),
|
|
124
|
-
easing: easeInOutCubic,
|
|
125
|
-
minDuration: 50,
|
|
126
|
-
speed: 200
|
|
127
|
-
});
|
|
128
|
-
case 4:
|
|
129
|
-
case "end":
|
|
130
|
-
return _context.stop();
|
|
131
|
-
}
|
|
132
|
-
}, _callee);
|
|
133
|
-
}));
|
|
134
|
-
return function scrollToElement(_x) {
|
|
135
|
-
return _ref9.apply(this, arguments);
|
|
136
|
-
};
|
|
137
|
-
}();
|
|
138
|
-
var header = title ? jsxRuntime.jsxs(StyledQuestionBoxHeader, {
|
|
114
|
+
const scrollToElement = async elementId => {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
const target = document.getElementById(elementId);
|
|
117
|
+
if (target && bodyRef.current) {
|
|
118
|
+
await animateScrollTo(target.offsetTop, {
|
|
119
|
+
elementToScroll: bodyRef.current,
|
|
120
|
+
verticalOffset: -((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0),
|
|
121
|
+
easing: easeInOutCubic,
|
|
122
|
+
minDuration: 50,
|
|
123
|
+
speed: 200
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const header = title ? React.createElement(StyledQuestionBoxHeader, {
|
|
139
128
|
vertical: vertical,
|
|
140
|
-
ref: headerRef
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
children: title
|
|
156
|
-
})]
|
|
157
|
-
}), submitResult ? jsxRuntime.jsx(blocks.Box, {
|
|
158
|
-
children: submitResult
|
|
159
|
-
}) : null]
|
|
160
|
-
}) : null;
|
|
161
|
-
var body = jsxRuntime.jsx(StyledQuestionBoxBody, {
|
|
129
|
+
ref: headerRef
|
|
130
|
+
}, React.createElement(blocks.Flex, null, titlePrefix ? React.createElement(blocks.Text, {
|
|
131
|
+
bold: true,
|
|
132
|
+
size: "large",
|
|
133
|
+
customStyles: {
|
|
134
|
+
color: designTokens.base.color.primary3,
|
|
135
|
+
marginRight: '0.5rem'
|
|
136
|
+
}
|
|
137
|
+
}, titlePrefix) : null, React.createElement(blocks.Text, {
|
|
138
|
+
bold: true,
|
|
139
|
+
role: "navy0",
|
|
140
|
+
size: "large",
|
|
141
|
+
wordBreak: "break-word"
|
|
142
|
+
}, title)), submitResult ? React.createElement(blocks.Box, null, submitResult) : null) : null;
|
|
143
|
+
const body = React.createElement(StyledQuestionBoxBody, {
|
|
162
144
|
ref: !vertical ? currentBodyRef : undefined,
|
|
163
145
|
hasFooter: hasFooter,
|
|
164
|
-
vertical: vertical
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
var getCustomStyles = function getCustomStyles(active) {
|
|
198
|
-
return {
|
|
199
|
-
borderBottom: '3px solid currentColor',
|
|
200
|
-
background: 'none',
|
|
201
|
-
borderColor: active ? 'currentColor' : 'transparent',
|
|
202
|
-
color: active ? theme.palette.primary.main : theme.palette.secondary.light
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
return visibleAnchorSection && jsxRuntime.jsxs(StyledAnchorBox, {
|
|
206
|
-
children: [jsxRuntime.jsx(blocks.Button, {
|
|
207
|
-
size: "small",
|
|
208
|
-
border: false,
|
|
209
|
-
hasBorderRadius: false,
|
|
210
|
-
tabIndex: 0,
|
|
211
|
-
transparent: true,
|
|
212
|
-
onClick: scrollToElement.bind(null, element.MATERIAL_QUIZ_PASSIVE_ID),
|
|
213
|
-
customStyles: getCustomStyles(!isViewingAnswerContainer),
|
|
214
|
-
children: intl$1.formatMessage({
|
|
215
|
-
id: 'materialQuiz.anchorLabel.question'
|
|
216
|
-
})
|
|
217
|
-
}), jsxRuntime.jsx(blocks.Button, {
|
|
218
|
-
size: "small",
|
|
219
|
-
border: false,
|
|
220
|
-
hasBorderRadius: false,
|
|
221
|
-
tabIndex: 0,
|
|
222
|
-
transparent: true,
|
|
223
|
-
onClick: scrollToElement.bind(null, element.MATERIAL_QUIZ_ANSWER_ID),
|
|
224
|
-
customStyles: getCustomStyles(isViewingAnswerContainer),
|
|
225
|
-
children: intl$1.formatMessage({
|
|
226
|
-
id: 'materialQuiz.anchorLabel.answer'
|
|
227
|
-
})
|
|
228
|
-
})]
|
|
146
|
+
vertical: vertical
|
|
147
|
+
}, children);
|
|
148
|
+
const footer = React.createElement(StyledQuestionBoxFooter, {
|
|
149
|
+
vertical: vertical
|
|
150
|
+
}, React.createElement(StyledQuestionBoxFooterActions, {
|
|
151
|
+
vertical: vertical
|
|
152
|
+
}, footerActions.map((action, index) => {
|
|
153
|
+
const Component = action.role === 'lightpurple' ? StyledPrimaryButton : blocks.Button;
|
|
154
|
+
return React.createElement(Component, Object.assign({
|
|
155
|
+
isFluid: vertical,
|
|
156
|
+
key: index,
|
|
157
|
+
size: "small"
|
|
158
|
+
}, action), action.children);
|
|
159
|
+
}), isNextActive ? React.createElement(StyledPrimaryButton, {
|
|
160
|
+
isFluid: vertical,
|
|
161
|
+
size: "small",
|
|
162
|
+
border: false,
|
|
163
|
+
tabIndex: 0,
|
|
164
|
+
transparent: false,
|
|
165
|
+
onClick: onNext,
|
|
166
|
+
customStyles: {
|
|
167
|
+
backgroundColor: theme.palette.primary.main,
|
|
168
|
+
color: theme.palette.primary.contrastText
|
|
169
|
+
}
|
|
170
|
+
}, intl$1.formatMessage({
|
|
171
|
+
id: 'materialQuiz.next'
|
|
172
|
+
})) : null));
|
|
173
|
+
const _renderAnchorSection = () => {
|
|
174
|
+
const getCustomStyles = active => ({
|
|
175
|
+
borderBottom: '3px solid currentColor',
|
|
176
|
+
background: 'none',
|
|
177
|
+
borderColor: active ? 'currentColor' : 'transparent',
|
|
178
|
+
color: active ? theme.palette.primary.main : theme.palette.secondary.light
|
|
229
179
|
});
|
|
180
|
+
return visibleAnchorSection && React.createElement(StyledAnchorBox, null, React.createElement(blocks.Button, {
|
|
181
|
+
size: "small",
|
|
182
|
+
border: false,
|
|
183
|
+
hasBorderRadius: false,
|
|
184
|
+
tabIndex: 0,
|
|
185
|
+
transparent: true,
|
|
186
|
+
onClick: scrollToElement.bind(null, element.MATERIAL_QUIZ_PASSIVE_ID),
|
|
187
|
+
customStyles: getCustomStyles(!isViewingAnswerContainer)
|
|
188
|
+
}, intl$1.formatMessage({
|
|
189
|
+
id: 'materialQuiz.anchorLabel.question'
|
|
190
|
+
})), React.createElement(blocks.Button, {
|
|
191
|
+
size: "small",
|
|
192
|
+
border: false,
|
|
193
|
+
hasBorderRadius: false,
|
|
194
|
+
tabIndex: 0,
|
|
195
|
+
transparent: true,
|
|
196
|
+
onClick: scrollToElement.bind(null, element.MATERIAL_QUIZ_ANSWER_ID),
|
|
197
|
+
customStyles: getCustomStyles(isViewingAnswerContainer)
|
|
198
|
+
}, intl$1.formatMessage({
|
|
199
|
+
id: 'materialQuiz.anchorLabel.answer'
|
|
200
|
+
})));
|
|
230
201
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
children: [body, footerActions.length > 0 ? footer : null]
|
|
234
|
-
});
|
|
202
|
+
const renderContent = () => {
|
|
203
|
+
const content = React.createElement(React.Fragment, null, body, footerActions.length > 0 ? footer : null);
|
|
235
204
|
if (vertical) {
|
|
236
|
-
return
|
|
205
|
+
return React.createElement("div", {
|
|
237
206
|
ref: currentBodyRef,
|
|
238
207
|
style: {
|
|
239
208
|
height: '100%',
|
|
240
209
|
overflow: 'auto'
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
});
|
|
210
|
+
}
|
|
211
|
+
}, content);
|
|
244
212
|
}
|
|
245
213
|
return content;
|
|
246
214
|
};
|
|
247
|
-
return
|
|
248
|
-
vertical: vertical
|
|
249
|
-
|
|
250
|
-
}));
|
|
215
|
+
return React.createElement(StyledQuestionBox, Object.assign({}, props, {
|
|
216
|
+
vertical: vertical
|
|
217
|
+
}), header, renderContent(), _renderAnchorSection());
|
|
251
218
|
};
|
|
252
219
|
|
|
253
220
|
exports.StyledQuestionBox = StyledQuestionBox;
|
|
@@ -2,19 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var QuizDraggbleOption = require('./QuizDraggbleOption.js');
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return
|
|
8
|
+
const QuizDraggbleDroppedOption = ({
|
|
9
|
+
id,
|
|
10
|
+
content,
|
|
11
|
+
disabled = false,
|
|
12
|
+
role,
|
|
13
|
+
indexOrder,
|
|
14
|
+
isMarkdown
|
|
15
|
+
}) => {
|
|
16
|
+
return React.createElement(QuizDraggbleOption.default, {
|
|
17
17
|
id: id,
|
|
18
|
+
key: id,
|
|
18
19
|
content: content,
|
|
19
20
|
className: "quiz-answer",
|
|
20
21
|
disabled: disabled,
|
|
@@ -22,7 +23,7 @@ var QuizDraggbleDroppedOption = function QuizDraggbleDroppedOption(_ref) {
|
|
|
22
23
|
indexOrder: indexOrder,
|
|
23
24
|
clone: true,
|
|
24
25
|
isMarkdown: isMarkdown
|
|
25
|
-
}
|
|
26
|
+
});
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
exports.default = QuizDraggbleDroppedOption;
|
|
@@ -2,38 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var blocks = require('@elice/blocks');
|
|
7
7
|
var designTokens = require('@elice/design-tokens');
|
|
8
8
|
var styled = require('styled-components');
|
|
9
9
|
var EbDroppable = require('../eb-sortable/EbDroppable.js');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
-
|
|
15
|
-
var StyledQuizDraggbleDummyOption = styled__default.default(EbDroppable.default).withConfig({
|
|
11
|
+
const StyledQuizDraggbleDummyOption = styled(EbDroppable.default).withConfig({
|
|
16
12
|
componentId: "sc-1ayp8c1-0"
|
|
17
13
|
})(["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 ", ";}"], designTokens.base.color.navy4, designTokens.base.color.navy5, designTokens.base.color.navy0, designTokens.base.color.navy0);
|
|
18
|
-
|
|
14
|
+
const StyledOrder = styled.div.withConfig({
|
|
19
15
|
componentId: "sc-1ayp8c1-1"
|
|
20
16
|
})(["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);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: indexOrder
|
|
35
|
-
})]
|
|
36
|
-
});
|
|
17
|
+
const QuizDraggbleDummyOption = ({
|
|
18
|
+
children,
|
|
19
|
+
indexOrder,
|
|
20
|
+
onDrop
|
|
21
|
+
}) => {
|
|
22
|
+
return React.createElement(StyledQuizDraggbleDummyOption, {
|
|
23
|
+
onDrop: onDrop
|
|
24
|
+
}, React.createElement(blocks.Text, {
|
|
25
|
+
wordBreak: "break-all",
|
|
26
|
+
customStyles: {
|
|
27
|
+
color: designTokens.base.color.navy0
|
|
28
|
+
}
|
|
29
|
+
}, children !== null && children !== void 0 ? children : 'drag here...'), React.createElement(StyledOrder, null, indexOrder));
|
|
37
30
|
};
|
|
38
31
|
|
|
39
32
|
exports.default = QuizDraggbleDummyOption;
|