@instructure/quiz-core 22.16.1 → 22.17.0
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/es/building/api/quizEntries.js +25 -5
- package/es/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/es/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/es/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/es/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/es/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/es/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/es/common/actions/modal.js +2 -1
- package/es/common/components/ConfirmationModal/index.js +1 -1
- package/es/common/components/ConfirmationModal/presenter.js +49 -169
- package/es/common/components/SDKApp/index.js +22 -23
- package/es/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/es/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/es/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/es/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{lib/common/components/resources/quizSessionResult/Header → es/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/es/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/es/common/components/resources/item/ItemEdit/index.js +5 -3
- package/es/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/es/common/components/resources/item/ItemShow/index.js +2 -1
- package/es/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/es/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/es/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/es/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/es/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/es/common/middleware/appSyncMiddleware.js +19 -0
- package/es/common/records/Quiz.js +8 -1
- package/es/common/records/QuizEntry.js +8 -1
- package/es/common/records/SessionItem.js +2 -1
- package/es/common/records/SessionItemResult.js +24 -0
- package/es/common/util/interactionTypePropsHelper.js +4 -2
- package/es/common/util/isMissing.js +4 -0
- package/es/configureStore.js +3 -1
- package/es/index.js +4 -2
- package/es/moderating/components/resources/ModerateTable/presenter.js +14 -9
- package/es/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/es/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/es/reduxStore.js +4 -0
- package/es/taking/api/taking.js +45 -10
- package/lib/building/api/quizEntries.js +25 -5
- package/lib/building/components/layout/header/BuildingButtons/index.js +1 -0
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +4 -0
- package/lib/building/components/resources/ItemFeedbackModal/index.js +4 -1
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +44 -41
- package/lib/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
- package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +6 -2
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/index.js +5 -1
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Footer/presenter.js +39 -3
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/index.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +1 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/components/LeftHeader.js +151 -0
- package/lib/building/components/resources/quizEntry/QuizEntryShow/index.js +5 -2
- package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +27 -102
- package/lib/building/components/resources/quizEntry/QuizEntryShow/styles.js +0 -12
- package/lib/common/actions/modal.js +2 -1
- package/lib/common/components/ConfirmationModal/index.js +1 -1
- package/lib/common/components/ConfirmationModal/presenter.js +49 -169
- package/lib/common/components/SDKApp/index.js +22 -23
- package/lib/common/components/layout/sidebar/Sidebar/components/TotalPointsPossible.js +37 -0
- package/lib/common/components/layout/sidebar/Sidebar/index.js +29 -57
- package/lib/common/components/layout/sidebar/SidebarItem/index.js +5 -1
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +40 -11
- package/lib/common/components/layout/sidebar/SidebarItem/styles.js +4 -1
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +26 -1
- package/{es/common/components/resources/quizSessionResult/Header → lib/common/components/resources/QuizSessionResult/QuizSessionResultHeader}/index.js +15 -23
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/LetterGrade.js +36 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/PointsDisplay.js +70 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/components/Progress.js +57 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/ScoreDisplay/index.js +49 -0
- package/lib/common/components/resources/QuizSessionResult/QuizSessionResultInfo/index.js +118 -0
- package/lib/common/components/resources/item/ItemEdit/index.js +5 -3
- package/lib/common/components/resources/item/ItemEdit/presenter.js +3 -2
- package/lib/common/components/resources/item/ItemShow/index.js +2 -1
- package/lib/common/components/resources/quiz/AddContent/Body/index.js +4 -2
- package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +25 -6
- package/lib/common/components/resources/quiz/AddContent/Body/styles.js +7 -0
- package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +1 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/components/SessionItemResultHeader.js +122 -0
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/index.js +6 -2
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +80 -168
- package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +0 -8
- package/lib/common/components/resources/stimulus/Stimulus/index.js +4 -1
- package/lib/common/components/resources/stimulus/Stimulus/presenter.js +2 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +3 -1
- package/lib/common/middleware/appSyncMiddleware.js +19 -0
- package/lib/common/records/Quiz.js +8 -1
- package/lib/common/records/QuizEntry.js +8 -1
- package/lib/common/records/SessionItem.js +2 -1
- package/lib/common/records/SessionItemResult.js +24 -0
- package/lib/common/util/interactionTypePropsHelper.js +4 -2
- package/lib/common/util/isMissing.js +4 -0
- package/lib/configureStore.js +3 -1
- package/lib/index.js +4 -2
- package/lib/moderating/components/resources/ModerateTable/presenter.js +14 -9
- package/lib/moderating/components/resources/ModerateTableRow/presenter.js +68 -24
- package/lib/moderating/components/resources/ModerateTableRow/styles.js +0 -4
- package/lib/reduxStore.js +4 -0
- package/lib/taking/api/taking.js +45 -10
- package/package.json +10 -10
- package/es/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/es/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/es/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/es/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/es/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/styles.js +0 -13
- package/lib/building/components/resources/ItemFeedbackModal/theme.js +0 -7
- package/lib/common/components/resources/quizSessionResult/Info/index.js +0 -410
- package/lib/common/components/resources/quizSessionResult/Info/styles.js +0 -58
- package/lib/common/components/resources/quizSessionResult/Info/theme.js +0 -13
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/es/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/styles.js +0 -0
- /package/lib/common/components/resources/{quizSessionResult/Header → QuizSessionResult/QuizSessionResultHeader}/theme.js +0 -0
|
@@ -231,10 +231,28 @@ export var SidebarStimulus = /*#__PURE__*/ function(Component) {
|
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
},
|
|
234
|
+
{
|
|
235
|
+
key: "renderStimulusItems",
|
|
236
|
+
value: function renderStimulusItems() {
|
|
237
|
+
var _this_props = this.props, childEntries = _this_props.childEntries, displayPosition = _this_props.displayPosition, renderSidebarItem = _this_props.renderSidebarItem;
|
|
238
|
+
var nextDisplayPosition = displayPosition;
|
|
239
|
+
return childEntries.toArray().map(function(item, i) {
|
|
240
|
+
var itemDisplayPosition = nextDisplayPosition;
|
|
241
|
+
nextDisplayPosition += item.displayPositionSlots;
|
|
242
|
+
return /*#__PURE__*/ jsx(View, {
|
|
243
|
+
key: item.id,
|
|
244
|
+
padding: "0 0 0 small",
|
|
245
|
+
borderWidth: "0 0 small 0",
|
|
246
|
+
borderColor: "primary",
|
|
247
|
+
as: "div"
|
|
248
|
+
}, renderSidebarItem(item, itemDisplayPosition, false));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
},
|
|
234
252
|
{
|
|
235
253
|
key: "renderClosed",
|
|
236
254
|
value: function renderClosed() {
|
|
237
|
-
|
|
255
|
+
var stimulusContainer = /*#__PURE__*/ jsx(View, {
|
|
238
256
|
borderWidth: "0 0 small 0",
|
|
239
257
|
borderColor: "primary",
|
|
240
258
|
as: "div"
|
|
@@ -246,6 +264,13 @@ export var SidebarStimulus = /*#__PURE__*/ function(Component) {
|
|
|
246
264
|
css: this.stimulusHoverCss(),
|
|
247
265
|
as: "div"
|
|
248
266
|
}, this.renderButton()), this.renderCollection());
|
|
267
|
+
// For passages or when dragging, just return the stimulus container
|
|
268
|
+
if (this.stimulusIsPassage() || this.props.isDragging) {
|
|
269
|
+
return stimulusContainer;
|
|
270
|
+
}
|
|
271
|
+
// For non-passage stimuli in closed sidebar, return stimulus + child items separately
|
|
272
|
+
var childItems = this.renderStimulusItems();
|
|
273
|
+
return /*#__PURE__*/ jsx("div", null, stimulusContainer, childItems);
|
|
249
274
|
}
|
|
250
275
|
},
|
|
251
276
|
{
|
|
@@ -84,12 +84,6 @@ function _is_native_reflect_construct() {
|
|
|
84
84
|
return !!result;
|
|
85
85
|
})();
|
|
86
86
|
}
|
|
87
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
88
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
90
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
91
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
92
|
-
}
|
|
93
87
|
import { Component } from 'react';
|
|
94
88
|
import PropTypes from 'prop-types';
|
|
95
89
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
@@ -100,13 +94,13 @@ import t from '@instructure/quiz-i18n/format-message';
|
|
|
100
94
|
import generateStyle from './styles';
|
|
101
95
|
import generateComponentTheme from './theme';
|
|
102
96
|
import { withStyleOverrides } from '@instructure/quiz-common';
|
|
103
|
-
export var
|
|
97
|
+
export var BaseQuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
104
98
|
"use strict";
|
|
105
|
-
_inherits(
|
|
106
|
-
function
|
|
107
|
-
_class_call_check(this,
|
|
99
|
+
_inherits(BaseQuizSessionResultHeader, Component);
|
|
100
|
+
function BaseQuizSessionResultHeader() {
|
|
101
|
+
_class_call_check(this, BaseQuizSessionResultHeader);
|
|
108
102
|
var _this;
|
|
109
|
-
_this = _call_super(this,
|
|
103
|
+
_this = _call_super(this, BaseQuizSessionResultHeader, arguments), _define_property(_this, "renderRegradeAlert", function() {
|
|
110
104
|
if (_this.props.regradedSessionItemResults && _this.props.regradedSessionItemResults.size > 0) {
|
|
111
105
|
var questions = _this.props.regradedSessionItemResults.map(function(rsi) {
|
|
112
106
|
return rsi.position;
|
|
@@ -121,7 +115,7 @@ export var QuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
|
121
115
|
});
|
|
122
116
|
return _this;
|
|
123
117
|
}
|
|
124
|
-
_create_class(
|
|
118
|
+
_create_class(BaseQuizSessionResultHeader, [
|
|
125
119
|
{
|
|
126
120
|
key: "studentName",
|
|
127
121
|
value: function studentName() {
|
|
@@ -143,27 +137,25 @@ export var QuizSessionResultHeader = /*#__PURE__*/ function(Component) {
|
|
|
143
137
|
}, t('Results'))), /*#__PURE__*/ jsx("div", {
|
|
144
138
|
css: this.props.styles.resultListDescription,
|
|
145
139
|
className: "fs-mask"
|
|
146
|
-
}, this.props.studentDescription || this.studentName()))), /*#__PURE__*/ jsx("div", {
|
|
140
|
+
}, this.props.studentDescription || this.studentName()))), !this.props.isSurvey && /*#__PURE__*/ jsx("div", {
|
|
147
141
|
css: this.props.styles.regradeAlert
|
|
148
142
|
}, this.renderRegradeAlert()));
|
|
149
143
|
}
|
|
150
144
|
}
|
|
151
145
|
]);
|
|
152
|
-
return
|
|
146
|
+
return BaseQuizSessionResultHeader;
|
|
153
147
|
}(Component);
|
|
154
|
-
_define_property(
|
|
155
|
-
_define_property(
|
|
156
|
-
_define_property(
|
|
148
|
+
_define_property(BaseQuizSessionResultHeader, "displayName", 'QuizSessionResultHeader');
|
|
149
|
+
_define_property(BaseQuizSessionResultHeader, "componentId", "Quizzes".concat(BaseQuizSessionResultHeader.displayName));
|
|
150
|
+
_define_property(BaseQuizSessionResultHeader, "propTypes", {
|
|
157
151
|
quizSession: ImmutablePropTypes.record.isRequired,
|
|
158
152
|
regradedSessionItemResults: ImmutablePropTypes.list,
|
|
159
153
|
studentDescription: PropTypes.node,
|
|
160
|
-
styles: PropTypes.object
|
|
154
|
+
styles: PropTypes.object,
|
|
155
|
+
isSurvey: PropTypes.bool.isRequired
|
|
161
156
|
});
|
|
162
|
-
_define_property(
|
|
157
|
+
_define_property(BaseQuizSessionResultHeader, "defaultProps", {
|
|
163
158
|
regradedSessionItemResults: null,
|
|
164
159
|
studentDescription: null
|
|
165
160
|
});
|
|
166
|
-
QuizSessionResultHeader =
|
|
167
|
-
withStyleOverrides(generateStyle, generateComponentTheme)
|
|
168
|
-
], QuizSessionResultHeader);
|
|
169
|
-
export default QuizSessionResultHeader;
|
|
161
|
+
export var QuizSessionResultHeader = withStyleOverrides(generateStyle, generateComponentTheme)(BaseQuizSessionResultHeader);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
4
|
+
import { View } from '@instructure/ui-view';
|
|
5
|
+
import { Text } from '@instructure/ui-text';
|
|
6
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
7
|
+
import { scoreToLetterGrade } from '@instructure/grading-utils';
|
|
8
|
+
export var LetterGrade = function(param) {
|
|
9
|
+
var percentage = param.percentage, gradingScheme = param.gradingScheme;
|
|
10
|
+
var letterGrade = scoreToLetterGrade(percentage * 100, gradingScheme);
|
|
11
|
+
var gradeText = t('Grade for this attempt');
|
|
12
|
+
var alt = t('Grade for this attempt: { grade }', {
|
|
13
|
+
grade: letterGrade
|
|
14
|
+
});
|
|
15
|
+
return /*#__PURE__*/ React.createElement(AccessibleContent, {
|
|
16
|
+
alt: alt
|
|
17
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
18
|
+
as: "div"
|
|
19
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
20
|
+
size: "xx-large",
|
|
21
|
+
weight: "bold",
|
|
22
|
+
color: "primary"
|
|
23
|
+
}, letterGrade)), /*#__PURE__*/ React.createElement(Text, {
|
|
24
|
+
color: "secondary"
|
|
25
|
+
}, gradeText));
|
|
26
|
+
};
|
|
27
|
+
LetterGrade.propTypes = {
|
|
28
|
+
percentage: PropTypes.oneOfType([
|
|
29
|
+
PropTypes.number,
|
|
30
|
+
PropTypes.string
|
|
31
|
+
]),
|
|
32
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
name: PropTypes.string,
|
|
34
|
+
value: PropTypes.number
|
|
35
|
+
}))
|
|
36
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
4
|
+
import { Text } from '@instructure/ui-text';
|
|
5
|
+
import { Flex } from '@instructure/quiz-common';
|
|
6
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
7
|
+
import { isMissing } from '../../../../../../util/isMissing';
|
|
8
|
+
var mainPointsText = function(points, pointsPossible) {
|
|
9
|
+
if (isMissing(points) && isMissing(pointsPossible)) {
|
|
10
|
+
return '--';
|
|
11
|
+
}
|
|
12
|
+
var valueToUse = !isMissing(points) ? points : pointsPossible;
|
|
13
|
+
return t.number(valueToUse);
|
|
14
|
+
};
|
|
15
|
+
var subPointsText = function(points, pointsPossible) {
|
|
16
|
+
if (!isMissing(points) && !isMissing(pointsPossible)) {
|
|
17
|
+
return t("Out of {\n points, plural,\n one {# point}\n other {# points}\n }", {
|
|
18
|
+
points: pointsPossible
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!isMissing(points)) {
|
|
22
|
+
return t("Earned {points, plural,\n one {point}\n other {points}\n }", {
|
|
23
|
+
points: points
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
// We use "Points Possible" when only points is present or when nothing is present
|
|
27
|
+
return t("{points, plural,\n one {Point}\n other {Points}\n } possible", {
|
|
28
|
+
points: pointsPossible
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var pointsText = function(points, pointsPossible) {
|
|
32
|
+
if (!isMissing(points) && !isMissing(pointsPossible)) {
|
|
33
|
+
return t("{points, number} out of {\n total, plural,\n one {# point}\n other {# points}\n }", {
|
|
34
|
+
points: points,
|
|
35
|
+
total: pointsPossible
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (!isMissing(points)) {
|
|
39
|
+
return t("Earned {points, plural,\n one {# point}\n other {# points}\n }", {
|
|
40
|
+
points: points
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// We use "Points Possible" when only points is present or when nothing is present
|
|
44
|
+
if (!isMissing(pointsPossible)) {
|
|
45
|
+
return t("{points, plural,\n one {# point}\n other {# points}\n } possible", {
|
|
46
|
+
points: pointsPossible
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return t('Unknown Score');
|
|
50
|
+
};
|
|
51
|
+
export var PointsDisplay = function(param) {
|
|
52
|
+
var points = param.points, pointsPossible = param.pointsPossible;
|
|
53
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
54
|
+
margin: "small",
|
|
55
|
+
padding: "0 0 0 small"
|
|
56
|
+
}, /*#__PURE__*/ React.createElement(AccessibleContent, {
|
|
57
|
+
alt: pointsText(points, pointsPossible)
|
|
58
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
59
|
+
as: "div",
|
|
60
|
+
color: "primary",
|
|
61
|
+
size: "xx-large",
|
|
62
|
+
weight: "bold"
|
|
63
|
+
}, mainPointsText(points, pointsPossible)), /*#__PURE__*/ React.createElement(Text, {
|
|
64
|
+
color: "secondary"
|
|
65
|
+
}, subPointsText(points, pointsPossible))));
|
|
66
|
+
};
|
|
67
|
+
PointsDisplay.propTypes = {
|
|
68
|
+
points: PropTypes.string,
|
|
69
|
+
pointsPossible: PropTypes.string
|
|
70
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Text } from '@instructure/ui-text';
|
|
4
|
+
import { Flex } from '@instructure/quiz-common';
|
|
5
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
6
|
+
import { ProgressCircle } from '@instructure/ui-progress';
|
|
7
|
+
import { formatPercentMax2FractionDigits } from '@instructure/quiz-i18n';
|
|
8
|
+
import { isMissing, UNKNOWN_PERCENTAGE_VALUE } from '../../../../../../util/isMissing';
|
|
9
|
+
var progressTextFormatter = function(param) {
|
|
10
|
+
var valueNow = param.valueNow;
|
|
11
|
+
var percentageUnknown = valueNow === UNKNOWN_PERCENTAGE_VALUE;
|
|
12
|
+
return percentageUnknown ? t('Unknown Score') : t('Your score was {percentage}.', {
|
|
13
|
+
percentage: formatPercentMax2FractionDigits(valueNow)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var progressDisplayFormatter = function(param) {
|
|
17
|
+
var valueNow = param.valueNow;
|
|
18
|
+
var valueToShow = valueNow === UNKNOWN_PERCENTAGE_VALUE ? t({
|
|
19
|
+
id: 'progress_display',
|
|
20
|
+
default: '?',
|
|
21
|
+
description: 'placeholder for an unknown percentage value'
|
|
22
|
+
}) : formatPercentMax2FractionDigits(valueNow);
|
|
23
|
+
return /*#__PURE__*/ React.createElement(Text, {
|
|
24
|
+
size: "large",
|
|
25
|
+
weight: "bold",
|
|
26
|
+
"data-automation": "sdk-quiz-score-percentage"
|
|
27
|
+
}, valueToShow);
|
|
28
|
+
};
|
|
29
|
+
export var Progress = function(param) {
|
|
30
|
+
var percentage = param.percentage, points = param.points, pointsPossible = param.pointsPossible;
|
|
31
|
+
if (isMissing(points) || isMissing(pointsPossible)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
height: "150px",
|
|
37
|
+
width: "150px",
|
|
38
|
+
margin: "small",
|
|
39
|
+
"data-automation": "sdk-info-score"
|
|
40
|
+
}, /*#__PURE__*/ React.createElement(ProgressCircle, {
|
|
41
|
+
shouldAnimateOnMount: true,
|
|
42
|
+
size: "large",
|
|
43
|
+
screenReaderLabel: t('Your Score'),
|
|
44
|
+
formatScreenReaderValue: progressTextFormatter,
|
|
45
|
+
renderValue: progressDisplayFormatter,
|
|
46
|
+
valueNow: percentage,
|
|
47
|
+
valueMax: 1
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
Progress.propTypes = {
|
|
51
|
+
percentage: PropTypes.oneOfType([
|
|
52
|
+
PropTypes.number,
|
|
53
|
+
PropTypes.string
|
|
54
|
+
]),
|
|
55
|
+
points: PropTypes.string,
|
|
56
|
+
pointsPossible: PropTypes.string
|
|
57
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import { Flex } from '@instructure/quiz-common';
|
|
5
|
+
import { Progress } from './components/Progress';
|
|
6
|
+
import { PointsDisplay } from './components/PointsDisplay';
|
|
7
|
+
import { LetterGrade } from './components/LetterGrade';
|
|
8
|
+
import { UNKNOWN_PERCENTAGE_VALUE } from '../../../../../util/isMissing';
|
|
9
|
+
export var ScoreDisplay = function(param) {
|
|
10
|
+
var isSurvey = param.isSurvey, restrictQuantitativeData = param.restrictQuantitativeData, quizSessionResult = param.quizSessionResult, gradingScheme = param.gradingScheme;
|
|
11
|
+
if (isSurvey) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var ratio = quizSessionResult.percentage;
|
|
15
|
+
var percentage = isNaN(ratio) ? UNKNOWN_PERCENTAGE_VALUE : ratio;
|
|
16
|
+
if (restrictQuantitativeData) {
|
|
17
|
+
return /*#__PURE__*/ React.createElement(LetterGrade, {
|
|
18
|
+
percentage: percentage,
|
|
19
|
+
gradingScheme: gradingScheme
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/ React.createElement(Flex, {
|
|
23
|
+
wrap: "wrap",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyItems: "start"
|
|
26
|
+
}, /*#__PURE__*/ React.createElement(Flex.Item, {
|
|
27
|
+
shouldGrow: true,
|
|
28
|
+
shouldShrink: true
|
|
29
|
+
}, /*#__PURE__*/ React.createElement(Progress, {
|
|
30
|
+
percentage: percentage,
|
|
31
|
+
points: quizSessionResult.score,
|
|
32
|
+
pointsPossible: quizSessionResult.pointsPossible
|
|
33
|
+
})), /*#__PURE__*/ React.createElement(Flex.Item, {
|
|
34
|
+
shouldGrow: true,
|
|
35
|
+
shouldShrink: true
|
|
36
|
+
}, /*#__PURE__*/ React.createElement(PointsDisplay, {
|
|
37
|
+
points: quizSessionResult.score,
|
|
38
|
+
pointsPossible: quizSessionResult.pointsPossible
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
41
|
+
ScoreDisplay.propTypes = {
|
|
42
|
+
isSurvey: PropTypes.bool.isRequired,
|
|
43
|
+
restrictQuantitativeData: PropTypes.bool,
|
|
44
|
+
quizSessionResult: ImmutablePropTypes.record,
|
|
45
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
46
|
+
name: PropTypes.string,
|
|
47
|
+
value: PropTypes.number
|
|
48
|
+
}))
|
|
49
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** @jsx jsx */ import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
4
|
+
import { AccessibleContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
5
|
+
import { Alert } from '@instructure/ui-alerts';
|
|
6
|
+
import { Text } from '@instructure/ui-text';
|
|
7
|
+
import { Heading } from '@instructure/ui-heading';
|
|
8
|
+
import { View } from '@instructure/ui-view';
|
|
9
|
+
import { jsx } from '@instructure/emotion';
|
|
10
|
+
import { Flex } from '@instructure/quiz-common';
|
|
11
|
+
import t from '@instructure/quiz-i18n/format-message';
|
|
12
|
+
import FormattedDuration from '../../../shared/FormattedDuration';
|
|
13
|
+
import { formatTime } from '../../../../util/formatTimespan';
|
|
14
|
+
import { ScoreDisplay } from './ScoreDisplay/index';
|
|
15
|
+
function GradingAlerts(param) {
|
|
16
|
+
var quizSessionResult = param.quizSessionResult, sessionItemResults = param.sessionItemResults;
|
|
17
|
+
var alerts = [];
|
|
18
|
+
if (quizSessionResult.isLoaded() && quizSessionResult.autogradingFailed()) {
|
|
19
|
+
var msg = t('There was a grading problem. Please inform your instructor.');
|
|
20
|
+
alerts.push(/*#__PURE__*/ jsx(Alert, {
|
|
21
|
+
key: "autograding_failed",
|
|
22
|
+
variant: "warning"
|
|
23
|
+
}, msg));
|
|
24
|
+
}
|
|
25
|
+
var ungradedCount = sessionItemResults.reduce(function(count, sessionItemResult) {
|
|
26
|
+
return sessionItemResult.getIn([
|
|
27
|
+
'scoredData',
|
|
28
|
+
'gradeStatus'
|
|
29
|
+
]) === 'waiting' ? count + 1 : count;
|
|
30
|
+
}, 0);
|
|
31
|
+
if (ungradedCount > 0 && quizSessionResult.isLoaded()) {
|
|
32
|
+
var ungradedText = t("{\n count, plural,\n one {# question requires grading}\n other {# questions require grading}\n }", {
|
|
33
|
+
count: ungradedCount
|
|
34
|
+
});
|
|
35
|
+
alerts.push(/*#__PURE__*/ jsx(Alert, {
|
|
36
|
+
key: "manual_grading",
|
|
37
|
+
variant: "info"
|
|
38
|
+
}, ungradedText));
|
|
39
|
+
}
|
|
40
|
+
if (alerts.length === 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/ jsx(Flex, {
|
|
44
|
+
direction: "row",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyItems: "center",
|
|
47
|
+
margin: "x-small 0 0 0"
|
|
48
|
+
}, /*#__PURE__*/ jsx(Flex.Item, {
|
|
49
|
+
"data-automation": "sdk-results-requires-grading",
|
|
50
|
+
shouldGrow: false,
|
|
51
|
+
shouldShrink: true,
|
|
52
|
+
size: "33rem"
|
|
53
|
+
}, alerts));
|
|
54
|
+
}
|
|
55
|
+
function ElapsedTime(param) {
|
|
56
|
+
var elapsedTime = param.elapsedTime;
|
|
57
|
+
var attemptText = t('Time for this attempt');
|
|
58
|
+
var alt = t('Time for this attempt: { time }', {
|
|
59
|
+
time: formatTime(elapsedTime)
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/ jsx(AccessibleContent, {
|
|
62
|
+
alt: alt
|
|
63
|
+
}, /*#__PURE__*/ jsx(View, {
|
|
64
|
+
as: "div"
|
|
65
|
+
}, /*#__PURE__*/ jsx(FormattedDuration, {
|
|
66
|
+
fontSize: "xx-large",
|
|
67
|
+
fontWeight: "bold",
|
|
68
|
+
seconds: elapsedTime
|
|
69
|
+
})), /*#__PURE__*/ jsx(Text, {
|
|
70
|
+
color: "secondary"
|
|
71
|
+
}, attemptText));
|
|
72
|
+
}
|
|
73
|
+
export function QuizSessionResultInfo(param) {
|
|
74
|
+
var _param_gradingScheme = param.gradingScheme, gradingScheme = _param_gradingScheme === void 0 ? [] : _param_gradingScheme, quizSession = param.quizSession, quizSessionResult = param.quizSessionResult, sessionItemResults = param.sessionItemResults, _param_restrictQuantitativeData = param.restrictQuantitativeData, restrictQuantitativeData = _param_restrictQuantitativeData === void 0 ? false : _param_restrictQuantitativeData, isSurvey = param.isSurvey;
|
|
75
|
+
return /*#__PURE__*/ jsx(View, null, /*#__PURE__*/ jsx(GradingAlerts, {
|
|
76
|
+
quizSessionResult: quizSessionResult,
|
|
77
|
+
sessionItemResults: sessionItemResults
|
|
78
|
+
}), /*#__PURE__*/ jsx(Flex, {
|
|
79
|
+
padding: "none",
|
|
80
|
+
margin: "none",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
justifyItems: "center"
|
|
83
|
+
}, /*#__PURE__*/ jsx(Flex, {
|
|
84
|
+
wrap: "wrap",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyItems: "center",
|
|
87
|
+
className: "fs-mask"
|
|
88
|
+
}, /*#__PURE__*/ jsx(ScreenReaderContent, null, /*#__PURE__*/ jsx(Heading, {
|
|
89
|
+
level: "h2"
|
|
90
|
+
}, t('Assessment Statistics'))), /*#__PURE__*/ jsx(Flex.Item, {
|
|
91
|
+
shouldGrow: true,
|
|
92
|
+
shouldShrink: true
|
|
93
|
+
}, /*#__PURE__*/ jsx(ScoreDisplay, {
|
|
94
|
+
isSurvey: isSurvey,
|
|
95
|
+
restrictQuantitativeData: restrictQuantitativeData,
|
|
96
|
+
gradingScheme: gradingScheme,
|
|
97
|
+
quizSessionResult: quizSessionResult
|
|
98
|
+
})), /*#__PURE__*/ jsx(Flex.Item, {
|
|
99
|
+
shouldGrow: true,
|
|
100
|
+
shouldShrink: true,
|
|
101
|
+
margin: "small",
|
|
102
|
+
padding: "0 0 0 small"
|
|
103
|
+
}, /*#__PURE__*/ jsx(ElapsedTime, {
|
|
104
|
+
elapsedTime: quizSession.elapsedTime
|
|
105
|
+
})))));
|
|
106
|
+
}
|
|
107
|
+
QuizSessionResultInfo.propTypes = {
|
|
108
|
+
gradingScheme: PropTypes.arrayOf(PropTypes.shape({
|
|
109
|
+
name: PropTypes.string,
|
|
110
|
+
value: PropTypes.number
|
|
111
|
+
})),
|
|
112
|
+
quizSession: ImmutablePropTypes.record.isRequired,
|
|
113
|
+
quizSessionResult: ImmutablePropTypes.record.isRequired,
|
|
114
|
+
restrictQuantitativeData: PropTypes.bool,
|
|
115
|
+
sessionItemResults: ImmutablePropTypes.list.isRequired,
|
|
116
|
+
styles: PropTypes.object,
|
|
117
|
+
isSurvey: PropTypes.bool.isRequired
|
|
118
|
+
};
|
|
@@ -13,7 +13,7 @@ import { addError, screenreaderNotification } from '../../../../actions/alerts';
|
|
|
13
13
|
import { updateItem } from '../../../../../building/api/items';
|
|
14
14
|
import { interactionFileUpload, setOneAtATimeType } from '../../../../../building/api/quizzes';
|
|
15
15
|
import { featureOn } from '../../../../util/featureCheck';
|
|
16
|
-
import {
|
|
16
|
+
import { getActiveQuiz, isActiveQuizWorkingInstanceOneQuestionAtATime } from '../../../../selectors/quizzes';
|
|
17
17
|
export function mapStateToProps(state, props) {
|
|
18
18
|
// Error Related:
|
|
19
19
|
var workingItem = props.entry.getWorkingInstance();
|
|
@@ -25,6 +25,7 @@ export function mapStateToProps(state, props) {
|
|
|
25
25
|
'outcomes',
|
|
26
26
|
'contextUuid'
|
|
27
27
|
]) : props.contextUuid;
|
|
28
|
+
var quiz = getActiveQuiz(state);
|
|
28
29
|
var _props_showCalculator;
|
|
29
30
|
return {
|
|
30
31
|
answerFeedbackEnabled: featureOn('answer_level_feedback'),
|
|
@@ -50,13 +51,14 @@ export function mapStateToProps(state, props) {
|
|
|
50
51
|
]),
|
|
51
52
|
partialDeepScoringEnabled: featureOn('partial_deep_scoring'),
|
|
52
53
|
partialScoringEnabled: featureOn('partial_scoring'),
|
|
53
|
-
quizId:
|
|
54
|
+
quizId: quiz.id,
|
|
54
55
|
scope: props.scope,
|
|
55
56
|
rootAccountUuid: state.getIn([
|
|
56
57
|
'outcomes',
|
|
57
58
|
'externalAccountUuid'
|
|
58
59
|
]),
|
|
59
|
-
showCalculatorOption: (_props_showCalculator = props.showCalculator) !== null && _props_showCalculator !== void 0 ? _props_showCalculator : true
|
|
60
|
+
showCalculatorOption: (_props_showCalculator = props.showCalculator) !== null && _props_showCalculator !== void 0 ? _props_showCalculator : true,
|
|
61
|
+
isSurvey: quiz.isSurvey()
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
function mapDispatchToProps(dispatch) {
|
|
@@ -185,7 +185,7 @@ export var ItemEdit = /*#__PURE__*/ function(Component) {
|
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
var options = [];
|
|
188
|
-
if (this.props.outcomesEndpoint) {
|
|
188
|
+
if (!this.props.isSurvey && this.props.outcomesEndpoint) {
|
|
189
189
|
options.push({
|
|
190
190
|
key: 'outcomes',
|
|
191
191
|
title: /*#__PURE__*/ React.createElement("span", null, t('Align to Outcomes'), /*#__PURE__*/ React.createElement(OutcomeCount, _object_spread_props(_object_spread({
|
|
@@ -295,7 +295,8 @@ _define_property(ItemEdit, "propTypes", {
|
|
|
295
295
|
separatorConfig: PropTypes.shape({
|
|
296
296
|
decimalSeparator: PropTypes.string,
|
|
297
297
|
thousandSeparator: PropTypes.string
|
|
298
|
-
})
|
|
298
|
+
}),
|
|
299
|
+
isSurvey: PropTypes.bool.isRequired
|
|
299
300
|
});
|
|
300
301
|
_define_property(ItemEdit, "defaultProps", {
|
|
301
302
|
additionalOptions: [],
|
|
@@ -160,7 +160,8 @@ _define_property(ItemShow, "propTypes", {
|
|
|
160
160
|
separatorConfig: PropTypes.shape({
|
|
161
161
|
decimalSeparator: PropTypes.string,
|
|
162
162
|
thousandSeparator: PropTypes.string
|
|
163
|
-
})
|
|
163
|
+
}),
|
|
164
|
+
isSurvey: PropTypes.bool.isRequired
|
|
164
165
|
});
|
|
165
166
|
_define_property(ItemShow, "defaultProps", {
|
|
166
167
|
switchOnEditing: null
|
|
@@ -4,12 +4,14 @@ import { set } from '../../../../../actions/ui';
|
|
|
4
4
|
import { screenreaderNotification } from '../../../../../actions/alerts';
|
|
5
5
|
import AddContentBody from './presenter';
|
|
6
6
|
import { getInteractionTypes } from '../../../../../selectors/interactionTypes';
|
|
7
|
-
import { isEditingQuizEntry, getQuizEntryWithErrorsShowing } from '../../../../../selectors/quizzes';
|
|
7
|
+
import { isEditingQuizEntry, getQuizEntryWithErrorsShowing, getActiveQuiz } from '../../../../../selectors/quizzes';
|
|
8
8
|
var mapStateToProps = function(state) {
|
|
9
|
+
var activeQuiz = getActiveQuiz(state);
|
|
9
10
|
return {
|
|
10
11
|
editingQuizEntry: isEditingQuizEntry(state),
|
|
11
12
|
interactionTypes: getInteractionTypes(state),
|
|
12
|
-
quizEntryWithErrorsShowing: getQuizEntryWithErrorsShowing(state)
|
|
13
|
+
quizEntryWithErrorsShowing: getQuizEntryWithErrorsShowing(state),
|
|
14
|
+
isSurvey: activeQuiz.isSurvey()
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
var mapDispatchToProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */ import { jsx } from '@instructure/emotion';
|
|
2
2
|
import { BUILD_TRAY_OPEN, BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID, withStyleOverrides } from '@instructure/quiz-common';
|
|
3
3
|
import t from '@instructure/quiz-i18n/format-message';
|
|
4
|
-
import { Button, IconButton } from '@instructure/ui-buttons';
|
|
4
|
+
import { Button, IconButton, CloseButton } from '@instructure/ui-buttons';
|
|
5
5
|
import { Grid } from '@instructure/ui-grid';
|
|
6
6
|
import { IconAiSolid, IconBankLine } from '@instructure/ui-icons';
|
|
7
7
|
import { Text } from '@instructure/ui-text';
|
|
@@ -14,7 +14,9 @@ import InteractionTypes from '../../../../shared/InteractionTypes';
|
|
|
14
14
|
import generateStyle from './styles';
|
|
15
15
|
import generateComponentTheme from './theme';
|
|
16
16
|
function UnstyledAddContentBody(param) {
|
|
17
|
-
var allowStimulusCreation = param.allowStimulusCreation, createItem = param.createItem, createStimulus = param.createStimulus, editingQuizEntry = param.editingQuizEntry, interactionTypes = param.interactionTypes, _param_onOpenBankTray = param.onOpenBankTray, onOpenBankTray = _param_onOpenBankTray === void 0 ? function() {} : _param_onOpenBankTray, _param_onAddItem = param.onAddItem, onAddItem = _param_onAddItem === void 0 ? function() {} : _param_onAddItem, parentEntryId = param.parentEntryId, position = param.position, quizEntryWithErrorsShowing = param.quizEntryWithErrorsShowing, quizId = param.quizId, screenreaderNotification = param.screenreaderNotification, setNextQuizEntry = param.setNextQuizEntry, setUi = param.setUi, _param_showHeaderText = param.showHeaderText, showHeaderText = _param_showHeaderText === void 0 ? true : _param_showHeaderText, stimulusId = param.stimulusId, styles = param.styles, _param_slotProps = param.slotProps, slotProps = _param_slotProps === void 0 ? {} : _param_slotProps, _param_containerType = param.containerType, containerType = _param_containerType === void 0 ? 'popover' : _param_containerType
|
|
17
|
+
var allowStimulusCreation = param.allowStimulusCreation, createItem = param.createItem, createStimulus = param.createStimulus, editingQuizEntry = param.editingQuizEntry, interactionTypes = param.interactionTypes, _param_isSurvey = param.isSurvey, isSurvey = _param_isSurvey === void 0 ? false : _param_isSurvey, _param_onOpenBankTray = param.onOpenBankTray, onOpenBankTray = _param_onOpenBankTray === void 0 ? function() {} : _param_onOpenBankTray, _param_onAddItem = param.onAddItem, onAddItem = _param_onAddItem === void 0 ? function() {} : _param_onAddItem, parentEntryId = param.parentEntryId, position = param.position, quizEntryWithErrorsShowing = param.quizEntryWithErrorsShowing, quizId = param.quizId, screenreaderNotification = param.screenreaderNotification, setNextQuizEntry = param.setNextQuizEntry, setUi = param.setUi, _param_showHeaderText = param.showHeaderText, showHeaderText = _param_showHeaderText === void 0 ? true : _param_showHeaderText, stimulusId = param.stimulusId, styles = param.styles, _param_slotProps = param.slotProps, slotProps = _param_slotProps === void 0 ? {} : _param_slotProps, _param_containerType = param.containerType, containerType = _param_containerType === void 0 ? 'popover' : _param_containerType, _param_renderCloseButton = param.// Close button is only shown when the popover is rendered standalone.
|
|
18
|
+
// Defaults to false to avoid showing two close buttons when inside a modal(especially on smaller screens).
|
|
19
|
+
renderCloseButton, renderCloseButton = _param_renderCloseButton === void 0 ? false : _param_renderCloseButton;
|
|
18
20
|
var openBankTray = useCallback(function() {
|
|
19
21
|
onOpenBankTray();
|
|
20
22
|
setUi(BUILD_TRAY_OPEN, true);
|
|
@@ -26,6 +28,11 @@ function UnstyledAddContentBody(param) {
|
|
|
26
28
|
position,
|
|
27
29
|
parentEntryId
|
|
28
30
|
]);
|
|
31
|
+
var handleClose = useCallback(function() {
|
|
32
|
+
onAddItem();
|
|
33
|
+
}, [
|
|
34
|
+
onAddItem
|
|
35
|
+
]);
|
|
29
36
|
var addStimulus = useCallback(function(isPassage) {
|
|
30
37
|
if (editingQuizEntry) {
|
|
31
38
|
setNextQuizEntry(null, quizId, position);
|
|
@@ -89,15 +96,25 @@ function UnstyledAddContentBody(param) {
|
|
|
89
96
|
var text = showHeaderText ? t('Insert Content') : '';
|
|
90
97
|
return /*#__PURE__*/ jsx("div", {
|
|
91
98
|
css: styles.popoverHeaderBox
|
|
92
|
-
}, /*#__PURE__*/ jsx(
|
|
99
|
+
}, renderCloseButton && /*#__PURE__*/ jsx(View, {
|
|
100
|
+
as: "span",
|
|
101
|
+
display: "inline-block",
|
|
102
|
+
css: styles.closeButton
|
|
103
|
+
}, /*#__PURE__*/ jsx(CloseButton, {
|
|
104
|
+
screenReaderLabel: t('Close Insert Content'),
|
|
105
|
+
onClick: handleClose
|
|
106
|
+
})), /*#__PURE__*/ jsx("div", {
|
|
93
107
|
css: styles.popoverHeader
|
|
94
108
|
}, /*#__PURE__*/ jsx(Grid, {
|
|
95
109
|
vAlign: "middle",
|
|
96
110
|
colSpacing: "none",
|
|
97
111
|
rowSpacing: "none"
|
|
98
|
-
}, /*#__PURE__*/ jsx(Grid.Row, null, /*#__PURE__*/ jsx(Grid.Col, null, /*#__PURE__*/ jsx(
|
|
112
|
+
}, /*#__PURE__*/ jsx(Grid.Row, null, /*#__PURE__*/ jsx(Grid.Col, null, /*#__PURE__*/ jsx(View, {
|
|
113
|
+
as: "div",
|
|
114
|
+
margin: "medium 0"
|
|
115
|
+
}, /*#__PURE__*/ jsx(Text, {
|
|
99
116
|
color: "primary"
|
|
100
|
-
}, text)), /*#__PURE__*/ jsx(Grid.Col, {
|
|
117
|
+
}, text))), !isSurvey && /*#__PURE__*/ jsx(Grid.Col, {
|
|
101
118
|
width: "auto"
|
|
102
119
|
}, renderBankButton())))), ((_slotProps_quizGenerationButton = slotProps.quizGenerationButton) === null || _slotProps_quizGenerationButton === void 0 ? void 0 : _slotProps_quizGenerationButton.visible) && /*#__PURE__*/ jsx(View, {
|
|
103
120
|
as: "div",
|
|
@@ -142,6 +159,7 @@ AddContentBody.propTypes = {
|
|
|
142
159
|
createStimulus: PropTypes.func.isRequired,
|
|
143
160
|
editingQuizEntry: PropTypes.bool,
|
|
144
161
|
interactionTypes: ImmutablePropTypes.list,
|
|
162
|
+
isSurvey: PropTypes.bool,
|
|
145
163
|
onOpenBankTray: PropTypes.func,
|
|
146
164
|
onAddItem: PropTypes.func,
|
|
147
165
|
parentEntryId: PropTypes.string,
|
|
@@ -156,6 +174,7 @@ AddContentBody.propTypes = {
|
|
|
156
174
|
styles: PropTypes.object,
|
|
157
175
|
slotProps: PropTypes.shape({
|
|
158
176
|
quizGenerationButton: quizGenerationButtonPropTypes
|
|
159
|
-
})
|
|
177
|
+
}),
|
|
178
|
+
renderCloseButton: PropTypes.bool
|
|
160
179
|
};
|
|
161
180
|
export default AddContentBody;
|
|
@@ -18,8 +18,15 @@ var generateStyle = function(componentTheme) {
|
|
|
18
18
|
var _obj;
|
|
19
19
|
return {
|
|
20
20
|
popoverHeaderBox: {
|
|
21
|
+
position: 'relative',
|
|
21
22
|
borderBottom: "solid ".concat(componentTheme.popoverHeaderBoxBorderWidth, " ").concat(componentTheme.popoverHeaderBoxBorderColor)
|
|
22
23
|
},
|
|
24
|
+
closeButton: {
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: '-0.8rem',
|
|
27
|
+
right: '-1.3rem',
|
|
28
|
+
zIndex: 1
|
|
29
|
+
},
|
|
23
30
|
popoverHeader: {
|
|
24
31
|
margin: '1rem',
|
|
25
32
|
marginBottom: '0.25rem'
|
|
@@ -120,6 +120,7 @@ function UnstyledAddContentPopover(param) {
|
|
|
120
120
|
shouldContainFocus: true,
|
|
121
121
|
renderTrigger: renderAddContentButton()
|
|
122
122
|
}, /*#__PURE__*/ jsx(AddContentBody, {
|
|
123
|
+
renderCloseButton: true,
|
|
123
124
|
allowStimulusCreation: allowStimulusCreation,
|
|
124
125
|
onOpenBankTray: switchOffEditing,
|
|
125
126
|
onAddItem: switchOffEditing,
|