@instructure/quiz-core 21.0.1-rc.14 → 21.0.1-rc.17
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/components/resources/DeleteStimulusModal/presenter.js +35 -13
- package/es/building/components/resources/quizEntry/QuizEntryEdit/Header/index.js +45 -27
- package/es/common/components/resources/sessionItemResult/ResultStimulus/index.js +1 -1
- package/es/common/components/resources/sessionItemResult/ResultStimulus/styles.js +2 -4
- package/es/common/components/resources/sessionItemResult/ResultStimulus/theme.js +1 -1
- package/es/common/records/Stimulus.js +5 -0
- package/lib/building/components/resources/DeleteStimulusModal/presenter.js +37 -13
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/Header/index.js +45 -27
- package/lib/common/components/resources/sessionItemResult/ResultStimulus/index.js +1 -1
- package/lib/common/components/resources/sessionItemResult/ResultStimulus/styles.js +2 -4
- package/lib/common/components/resources/sessionItemResult/ResultStimulus/theme.js +1 -1
- package/lib/common/records/Stimulus.js +5 -0
- package/package.json +9 -9
|
@@ -9,7 +9,7 @@ var _dec, _class, _DeleteStimulusModal;
|
|
|
9
9
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
/** @jsx jsx */
|
|
12
|
-
import { Component } from 'react';
|
|
12
|
+
import React, { Component } from 'react';
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
15
15
|
import partial from 'lodash/partial';
|
|
@@ -26,19 +26,31 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, DELETE_STIMULUS_MODAL_SELEC
|
|
|
26
26
|
import generateStyle from './styles';
|
|
27
27
|
import generateComponentTheme from './theme';
|
|
28
28
|
export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_DeleteStimulusModal = /*#__PURE__*/function (_Component) {
|
|
29
|
-
function DeleteStimulusModal() {
|
|
29
|
+
function DeleteStimulusModal(props) {
|
|
30
30
|
var _this;
|
|
31
31
|
_classCallCheck(this, DeleteStimulusModal);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
_this = _callSuper(this, DeleteStimulusModal, [props]);
|
|
33
|
+
/**
|
|
34
|
+
* @type {React.RefObject<RadioInput> | null}
|
|
35
|
+
*/
|
|
36
|
+
_defineProperty(_this, "radioInputRef", null);
|
|
36
37
|
_defineProperty(_this, "handleSubmit", function (e) {
|
|
37
|
-
_this.closeAction();
|
|
38
38
|
var _this$props = _this.props,
|
|
39
39
|
quizId = _this$props.quizId,
|
|
40
40
|
stimulusEntry = _this$props.stimulusEntry,
|
|
41
41
|
childEntries = _this$props.childEntries;
|
|
42
|
+
if (!_this.props.deletionMode && childEntries.size > 0) {
|
|
43
|
+
var _this$radioInputRef;
|
|
44
|
+
(_this$radioInputRef = _this.radioInputRef) === null || _this$radioInputRef === void 0 || (_this$radioInputRef = _this$radioInputRef.current) === null || _this$radioInputRef === void 0 || _this$radioInputRef.focus();
|
|
45
|
+
_this.setState({
|
|
46
|
+
validationError: [{
|
|
47
|
+
text: t('Please choose a deletion mode.'),
|
|
48
|
+
type: 'newError'
|
|
49
|
+
}]
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
_this.closeAction();
|
|
42
54
|
if (_this.props.deletionMode === 'chooseWhich') {
|
|
43
55
|
_this.removeStimulus(_this.props.selectedChildren.toArray());
|
|
44
56
|
} else if (_this.props.deletionMode === 'deleteAll') {
|
|
@@ -51,8 +63,17 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
51
63
|
_this.props.closeModal();
|
|
52
64
|
_this.props.setUi(DELETE_STIMULUS_MODAL_DELETION_MODE, null);
|
|
53
65
|
_this.props.setUi(DELETE_STIMULUS_MODAL_SELECTED_CHILDREN, Set.of());
|
|
66
|
+
_this.clearValidationError();
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(_this, "clearValidationError", function () {
|
|
69
|
+
if (_this.state.validationError) {
|
|
70
|
+
_this.setState({
|
|
71
|
+
validationError: null
|
|
72
|
+
});
|
|
73
|
+
}
|
|
54
74
|
});
|
|
55
75
|
_defineProperty(_this, "setDeletionMode", function (event, value) {
|
|
76
|
+
_this.clearValidationError();
|
|
56
77
|
_this.props.setUi(DELETE_STIMULUS_MODAL_DELETION_MODE, value);
|
|
57
78
|
});
|
|
58
79
|
_defineProperty(_this, "toggleChildSelected", function (childEntry) {
|
|
@@ -96,6 +117,10 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
96
117
|
css: _this.props.styles.checkboxesWrapper
|
|
97
118
|
}, jsx(PresentationContent, null, jsx("hr", null)), checkboxes, jsx(PresentationContent, null, jsx("hr", null)));
|
|
98
119
|
});
|
|
120
|
+
_this.state = {
|
|
121
|
+
validationError: null
|
|
122
|
+
};
|
|
123
|
+
_this.radioInputRef = React.createRef();
|
|
99
124
|
return _this;
|
|
100
125
|
}
|
|
101
126
|
_inherits(DeleteStimulusModal, _Component);
|
|
@@ -156,12 +181,7 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
156
181
|
}, {
|
|
157
182
|
key: "doneButton",
|
|
158
183
|
value: function doneButton() {
|
|
159
|
-
var _this$props3 = this.props,
|
|
160
|
-
deletionMode = _this$props3.deletionMode,
|
|
161
|
-
childEntries = _this$props3.childEntries;
|
|
162
|
-
var disabled = !deletionMode && childEntries.size > 0;
|
|
163
184
|
return jsx(Button, {
|
|
164
|
-
disabled: disabled,
|
|
165
185
|
color: "primary",
|
|
166
186
|
onClick: this.handleSubmit,
|
|
167
187
|
margin: XSMALL_SIDE_MARGIN,
|
|
@@ -189,8 +209,10 @@ export var DeleteStimulusModal = (_dec = withStyleOverrides(generateStyle, gener
|
|
|
189
209
|
name: "deletionMode",
|
|
190
210
|
defaultValue: this.props.deletionMode,
|
|
191
211
|
onChange: this.setDeletionMode,
|
|
192
|
-
description: jsx(ScreenReaderContent, null, t('Stimulus Removal Mode'))
|
|
212
|
+
description: jsx(ScreenReaderContent, null, t('Stimulus Removal Mode')),
|
|
213
|
+
messages: this.state.validationError
|
|
193
214
|
}, jsx(RadioInput, {
|
|
215
|
+
ref: this.radioInputRef,
|
|
194
216
|
key: "deleteAll",
|
|
195
217
|
value: "deleteAll",
|
|
196
218
|
label: jsx("div", {
|
|
@@ -160,6 +160,16 @@ var QuizEntryHeader = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
160
160
|
cancelText: t('Keep Question')
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "isActiveBank",
|
|
165
|
+
get: function get() {
|
|
166
|
+
return this.props.quizEntry.isBank && this.props.newActiveBank;
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "isBankEntry",
|
|
170
|
+
get: function get() {
|
|
171
|
+
return this.props.quizEntry.isBank || this.props.quizEntry.isBankEntry;
|
|
172
|
+
}
|
|
163
173
|
}, {
|
|
164
174
|
key: "getVOText",
|
|
165
175
|
value: function getVOText(verb, displayPosition) {
|
|
@@ -174,27 +184,19 @@ var QuizEntryHeader = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
174
184
|
});
|
|
175
185
|
}
|
|
176
186
|
}, {
|
|
177
|
-
key: "
|
|
178
|
-
value: function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
187
|
+
key: "renderItemName",
|
|
188
|
+
value: function renderItemName() {
|
|
189
|
+
return jsx(Text, {
|
|
190
|
+
size: "small",
|
|
191
|
+
weight: "normal",
|
|
192
|
+
"data-automation": "sdk-quiz-entry-interaction-type"
|
|
193
|
+
}, this.props.name);
|
|
182
194
|
}
|
|
183
195
|
}, {
|
|
184
|
-
key: "
|
|
185
|
-
value: function
|
|
186
|
-
var isBank = this.props.quizEntry.isBank && this.props.newActiveBank;
|
|
187
|
-
var dataAutomation = 'sdk-quiz-entry-interaction-type';
|
|
188
|
-
if (!isBank) {
|
|
189
|
-
return jsx(Text, {
|
|
190
|
-
size: "small",
|
|
191
|
-
weight: "normal",
|
|
192
|
-
"data-automation": dataAutomation
|
|
193
|
-
}, this.props.name);
|
|
194
|
-
}
|
|
196
|
+
key: "renderBankNameButton",
|
|
197
|
+
value: function renderBankNameButton() {
|
|
195
198
|
return jsx(CondensedButton, {
|
|
196
199
|
size: "small",
|
|
197
|
-
margin: "0 0 0 x-small",
|
|
198
200
|
onClick: this.handleBankClick,
|
|
199
201
|
"data-automation": "sdk-quiz-entry-interaction-type"
|
|
200
202
|
}, this.props.name);
|
|
@@ -220,14 +222,14 @@ var QuizEntryHeader = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
220
222
|
renderLabel: jsx(Flex, {
|
|
221
223
|
direction: "column",
|
|
222
224
|
gap: "small"
|
|
223
|
-
}, jsx(Flex.Item, {
|
|
225
|
+
}, !this.isBankEntry && jsx(Flex.Item, {
|
|
224
226
|
"aria-hidden": true
|
|
225
|
-
}, this.
|
|
227
|
+
}, this.renderItemName()), jsx(Flex.Item, {
|
|
226
228
|
"aria-hidden": true
|
|
227
229
|
}, t('Question Title')), jsx(ScreenReaderContent, null, titleLabelText)),
|
|
228
230
|
type: "text",
|
|
229
231
|
onChange: this.handleTitleChange,
|
|
230
|
-
|
|
232
|
+
defaultValue: workingEntry.title || '',
|
|
231
233
|
interaction: disabled ? 'disabled' : 'enabled',
|
|
232
234
|
"data-automation": "sdk-question-title-textinput"
|
|
233
235
|
});
|
|
@@ -242,15 +244,27 @@ var QuizEntryHeader = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
242
244
|
return jsx(Flex, {
|
|
243
245
|
className: "leftHeader",
|
|
244
246
|
direction: "row",
|
|
245
|
-
|
|
247
|
+
alignItems: "center",
|
|
246
248
|
"data-automation": "sdk-quiz-entry-left-header"
|
|
247
249
|
}, jsx(PositionBox, {
|
|
248
250
|
position: position,
|
|
249
251
|
headingText: positionText,
|
|
250
252
|
"data-automation": "sdk-quiz-entry-positionbox"
|
|
251
|
-
}),
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
}), jsx(Flex.Item, {
|
|
254
|
+
shouldShrink: this.isActiveBank,
|
|
255
|
+
shouldGrow: !this.isActiveBank
|
|
256
|
+
}, jsx(Flex, {
|
|
257
|
+
direction: "row",
|
|
258
|
+
gap: this.isActiveBank ? 'x-small' : 'medium',
|
|
259
|
+
themeOverride: {
|
|
260
|
+
gapMedium: '1.25rem'
|
|
261
|
+
},
|
|
262
|
+
alignItems: "center"
|
|
263
|
+
}, this.isBankEntry && jsx(Flex.Item, null, jsx(IconBankLine, null)), this.isActiveBank ? jsx(Flex.Item, {
|
|
264
|
+
shouldShrink: true
|
|
265
|
+
}, this.renderBankNameButton()) : jsx(Flex.Item, {
|
|
266
|
+
shouldGrow: true
|
|
267
|
+
}, this.renderTitleHolder()))));
|
|
254
268
|
}
|
|
255
269
|
}, {
|
|
256
270
|
key: "render",
|
|
@@ -278,11 +292,15 @@ var QuizEntryHeader = (_dec = withStyleOverrides(generateStyle, generateComponen
|
|
|
278
292
|
}), jsx(Flex, {
|
|
279
293
|
className: "header",
|
|
280
294
|
direction: "row",
|
|
281
|
-
|
|
295
|
+
alignItems: this.isActiveBank ? 'center' : 'end',
|
|
296
|
+
gap: "small",
|
|
297
|
+
justifyItems: "space-between"
|
|
282
298
|
}, jsx(Flex.Item, {
|
|
283
|
-
shouldShrink:
|
|
299
|
+
shouldShrink: this.isActiveBank,
|
|
284
300
|
shouldGrow: true
|
|
285
|
-
}, this.renderLeftHeader()), jsx(Flex.Item,
|
|
301
|
+
}, this.renderLeftHeader()), jsx(Flex.Item, {
|
|
302
|
+
padding: this.isActiveBank ? '0' : '0 0 xx-small'
|
|
303
|
+
}, jsx(ActionButtons, actionButtonProps))));
|
|
286
304
|
}
|
|
287
305
|
}]);
|
|
288
306
|
}(Component), _defineProperty(_QuizEntryHeader, "displayName", 'QuizEntryHeader'), _defineProperty(_QuizEntryHeader, "componentId", "Quizzes".concat(_QuizEntryHeader.displayName)), _defineProperty(_QuizEntryHeader, "propTypes", {
|
|
@@ -76,7 +76,7 @@ export var ResultStimulus = (_dec = withStyleOverrides(generateStyle, generateCo
|
|
|
76
76
|
css: this.props.styles.stimulusGroup
|
|
77
77
|
}, jsx("div", {
|
|
78
78
|
css: this.props.styles.stimulusInfo
|
|
79
|
-
}, this.renderStimulusInfo()), jsx("div", {
|
|
79
|
+
}, this.renderStimulusInfo()), this.props.stimulus.isPassage === false && jsx("div", {
|
|
80
80
|
css: this.props.styles.items
|
|
81
81
|
}, this.renderStimulusItems()))));
|
|
82
82
|
}
|
|
@@ -16,7 +16,7 @@ var generateStyle = function generateStyle(componentTheme, props) {
|
|
|
16
16
|
};
|
|
17
17
|
return {
|
|
18
18
|
root: {
|
|
19
|
-
|
|
19
|
+
borderTop: "".concat(componentTheme.rootBorderWidth, " solid ").concat(componentTheme.rootBorderColor),
|
|
20
20
|
overflow: 'hidden'
|
|
21
21
|
},
|
|
22
22
|
instructions: _defineProperty({
|
|
@@ -31,9 +31,7 @@ var generateStyle = function generateStyle(componentTheme, props) {
|
|
|
31
31
|
},
|
|
32
32
|
info: _defineProperty({
|
|
33
33
|
padding: "".concat(componentTheme.infoPaddingTopBottom, " ").concat(componentTheme.infoPaddingLeftRight),
|
|
34
|
-
|
|
35
|
-
height: '100%',
|
|
36
|
-
overflow: 'scroll'
|
|
34
|
+
height: '100%'
|
|
37
35
|
}, mq, {
|
|
38
36
|
padding: componentTheme.phoneInfoPadding
|
|
39
37
|
}),
|
|
@@ -6,7 +6,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
6
6
|
breakpoints = _ref.breakpoints;
|
|
7
7
|
return {
|
|
8
8
|
rootBorderWidth: borders.widthSmall,
|
|
9
|
-
rootBorderColor: colors.
|
|
9
|
+
rootBorderColor: colors.tiara,
|
|
10
10
|
instructionsPaddingTopBottom: spacing.medium,
|
|
11
11
|
instructionsPaddingLeftRight: spacing.large,
|
|
12
12
|
instructionsBorderWidth: borders.widthSmall,
|
|
@@ -12,7 +12,7 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _react = require("react");
|
|
15
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));
|
|
18
18
|
var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
@@ -30,22 +30,36 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
30
30
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
31
31
|
var _dec, _class, _DeleteStimulusModal;
|
|
32
32
|
/** @jsx jsx */
|
|
33
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
33
35
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
34
36
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
35
37
|
var DeleteStimulusModal = exports.DeleteStimulusModal = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["default"], _theme["default"]), _dec(_class = (_DeleteStimulusModal = /*#__PURE__*/function (_Component) {
|
|
36
|
-
function DeleteStimulusModal() {
|
|
38
|
+
function DeleteStimulusModal(props) {
|
|
37
39
|
var _this;
|
|
38
40
|
(0, _classCallCheck2["default"])(this, DeleteStimulusModal);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
_this = _callSuper(this, DeleteStimulusModal, [props]);
|
|
42
|
+
/**
|
|
43
|
+
* @type {React.RefObject<RadioInput> | null}
|
|
44
|
+
*/
|
|
45
|
+
(0, _defineProperty2["default"])(_this, "radioInputRef", null);
|
|
43
46
|
(0, _defineProperty2["default"])(_this, "handleSubmit", function (e) {
|
|
44
|
-
_this.closeAction();
|
|
45
47
|
var _this$props = _this.props,
|
|
46
48
|
quizId = _this$props.quizId,
|
|
47
49
|
stimulusEntry = _this$props.stimulusEntry,
|
|
48
50
|
childEntries = _this$props.childEntries;
|
|
51
|
+
if (!_this.props.deletionMode && childEntries.size > 0) {
|
|
52
|
+
var _this$radioInputRef;
|
|
53
|
+
(_this$radioInputRef = _this.radioInputRef) === null || _this$radioInputRef === void 0 || (_this$radioInputRef = _this$radioInputRef.current) === null || _this$radioInputRef === void 0 || _this$radioInputRef.focus();
|
|
54
|
+
_this.setState({
|
|
55
|
+
validationError: [{
|
|
56
|
+
text: (0, _formatMessage["default"])('Please choose a deletion mode.'),
|
|
57
|
+
type: 'newError'
|
|
58
|
+
}]
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
_this.closeAction();
|
|
49
63
|
if (_this.props.deletionMode === 'chooseWhich') {
|
|
50
64
|
_this.removeStimulus(_this.props.selectedChildren.toArray());
|
|
51
65
|
} else if (_this.props.deletionMode === 'deleteAll') {
|
|
@@ -58,8 +72,17 @@ var DeleteStimulusModal = exports.DeleteStimulusModal = (_dec = (0, _quizCommon.
|
|
|
58
72
|
_this.props.closeModal();
|
|
59
73
|
_this.props.setUi(_quizCommon.DELETE_STIMULUS_MODAL_DELETION_MODE, null);
|
|
60
74
|
_this.props.setUi(_quizCommon.DELETE_STIMULUS_MODAL_SELECTED_CHILDREN, _immutable.Set.of());
|
|
75
|
+
_this.clearValidationError();
|
|
76
|
+
});
|
|
77
|
+
(0, _defineProperty2["default"])(_this, "clearValidationError", function () {
|
|
78
|
+
if (_this.state.validationError) {
|
|
79
|
+
_this.setState({
|
|
80
|
+
validationError: null
|
|
81
|
+
});
|
|
82
|
+
}
|
|
61
83
|
});
|
|
62
84
|
(0, _defineProperty2["default"])(_this, "setDeletionMode", function (event, value) {
|
|
85
|
+
_this.clearValidationError();
|
|
63
86
|
_this.props.setUi(_quizCommon.DELETE_STIMULUS_MODAL_DELETION_MODE, value);
|
|
64
87
|
});
|
|
65
88
|
(0, _defineProperty2["default"])(_this, "toggleChildSelected", function (childEntry) {
|
|
@@ -103,6 +126,10 @@ var DeleteStimulusModal = exports.DeleteStimulusModal = (_dec = (0, _quizCommon.
|
|
|
103
126
|
css: _this.props.styles.checkboxesWrapper
|
|
104
127
|
}, (0, _emotion.jsx)(_uiA11yContent.PresentationContent, null, (0, _emotion.jsx)("hr", null)), checkboxes, (0, _emotion.jsx)(_uiA11yContent.PresentationContent, null, (0, _emotion.jsx)("hr", null)));
|
|
105
128
|
});
|
|
129
|
+
_this.state = {
|
|
130
|
+
validationError: null
|
|
131
|
+
};
|
|
132
|
+
_this.radioInputRef = _react["default"].createRef();
|
|
106
133
|
return _this;
|
|
107
134
|
}
|
|
108
135
|
(0, _inherits2["default"])(DeleteStimulusModal, _Component);
|
|
@@ -163,12 +190,7 @@ var DeleteStimulusModal = exports.DeleteStimulusModal = (_dec = (0, _quizCommon.
|
|
|
163
190
|
}, {
|
|
164
191
|
key: "doneButton",
|
|
165
192
|
value: function doneButton() {
|
|
166
|
-
var _this$props3 = this.props,
|
|
167
|
-
deletionMode = _this$props3.deletionMode,
|
|
168
|
-
childEntries = _this$props3.childEntries;
|
|
169
|
-
var disabled = !deletionMode && childEntries.size > 0;
|
|
170
193
|
return (0, _emotion.jsx)(_uiButtons.Button, {
|
|
171
|
-
disabled: disabled,
|
|
172
194
|
color: "primary",
|
|
173
195
|
onClick: this.handleSubmit,
|
|
174
196
|
margin: _quizCommon.XSMALL_SIDE_MARGIN,
|
|
@@ -196,8 +218,10 @@ var DeleteStimulusModal = exports.DeleteStimulusModal = (_dec = (0, _quizCommon.
|
|
|
196
218
|
name: "deletionMode",
|
|
197
219
|
defaultValue: this.props.deletionMode,
|
|
198
220
|
onChange: this.setDeletionMode,
|
|
199
|
-
description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Stimulus Removal Mode'))
|
|
221
|
+
description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Stimulus Removal Mode')),
|
|
222
|
+
messages: this.state.validationError
|
|
200
223
|
}, (0, _emotion.jsx)(_uiRadioInput.RadioInput, {
|
|
224
|
+
ref: this.radioInputRef,
|
|
201
225
|
key: "deleteAll",
|
|
202
226
|
value: "deleteAll",
|
|
203
227
|
label: (0, _emotion.jsx)("div", {
|
|
@@ -167,6 +167,16 @@ var QuizEntryHeader = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["defau
|
|
|
167
167
|
cancelText: (0, _formatMessage["default"])('Keep Question')
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "isActiveBank",
|
|
172
|
+
get: function get() {
|
|
173
|
+
return this.props.quizEntry.isBank && this.props.newActiveBank;
|
|
174
|
+
}
|
|
175
|
+
}, {
|
|
176
|
+
key: "isBankEntry",
|
|
177
|
+
get: function get() {
|
|
178
|
+
return this.props.quizEntry.isBank || this.props.quizEntry.isBankEntry;
|
|
179
|
+
}
|
|
170
180
|
}, {
|
|
171
181
|
key: "getVOText",
|
|
172
182
|
value: function getVOText(verb, displayPosition) {
|
|
@@ -181,27 +191,19 @@ var QuizEntryHeader = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["defau
|
|
|
181
191
|
});
|
|
182
192
|
}
|
|
183
193
|
}, {
|
|
184
|
-
key: "
|
|
185
|
-
value: function
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
194
|
+
key: "renderItemName",
|
|
195
|
+
value: function renderItemName() {
|
|
196
|
+
return (0, _emotion.jsx)(_uiText.Text, {
|
|
197
|
+
size: "small",
|
|
198
|
+
weight: "normal",
|
|
199
|
+
"data-automation": "sdk-quiz-entry-interaction-type"
|
|
200
|
+
}, this.props.name);
|
|
189
201
|
}
|
|
190
202
|
}, {
|
|
191
|
-
key: "
|
|
192
|
-
value: function
|
|
193
|
-
var isBank = this.props.quizEntry.isBank && this.props.newActiveBank;
|
|
194
|
-
var dataAutomation = 'sdk-quiz-entry-interaction-type';
|
|
195
|
-
if (!isBank) {
|
|
196
|
-
return (0, _emotion.jsx)(_uiText.Text, {
|
|
197
|
-
size: "small",
|
|
198
|
-
weight: "normal",
|
|
199
|
-
"data-automation": dataAutomation
|
|
200
|
-
}, this.props.name);
|
|
201
|
-
}
|
|
203
|
+
key: "renderBankNameButton",
|
|
204
|
+
value: function renderBankNameButton() {
|
|
202
205
|
return (0, _emotion.jsx)(_uiButtons.CondensedButton, {
|
|
203
206
|
size: "small",
|
|
204
|
-
margin: "0 0 0 x-small",
|
|
205
207
|
onClick: this.handleBankClick,
|
|
206
208
|
"data-automation": "sdk-quiz-entry-interaction-type"
|
|
207
209
|
}, this.props.name);
|
|
@@ -227,14 +229,14 @@ var QuizEntryHeader = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["defau
|
|
|
227
229
|
renderLabel: (0, _emotion.jsx)(_quizCommon.Flex, {
|
|
228
230
|
direction: "column",
|
|
229
231
|
gap: "small"
|
|
230
|
-
}, (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
232
|
+
}, !this.isBankEntry && (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
231
233
|
"aria-hidden": true
|
|
232
|
-
}, this.
|
|
234
|
+
}, this.renderItemName()), (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
233
235
|
"aria-hidden": true
|
|
234
236
|
}, (0, _formatMessage["default"])('Question Title')), (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, titleLabelText)),
|
|
235
237
|
type: "text",
|
|
236
238
|
onChange: this.handleTitleChange,
|
|
237
|
-
|
|
239
|
+
defaultValue: workingEntry.title || '',
|
|
238
240
|
interaction: disabled ? 'disabled' : 'enabled',
|
|
239
241
|
"data-automation": "sdk-question-title-textinput"
|
|
240
242
|
});
|
|
@@ -249,15 +251,27 @@ var QuizEntryHeader = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["defau
|
|
|
249
251
|
return (0, _emotion.jsx)(_quizCommon.Flex, {
|
|
250
252
|
className: "leftHeader",
|
|
251
253
|
direction: "row",
|
|
252
|
-
|
|
254
|
+
alignItems: "center",
|
|
253
255
|
"data-automation": "sdk-quiz-entry-left-header"
|
|
254
256
|
}, (0, _emotion.jsx)(_PositionBox["default"], {
|
|
255
257
|
position: position,
|
|
256
258
|
headingText: positionText,
|
|
257
259
|
"data-automation": "sdk-quiz-entry-positionbox"
|
|
258
|
-
}),
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
}), (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
261
|
+
shouldShrink: this.isActiveBank,
|
|
262
|
+
shouldGrow: !this.isActiveBank
|
|
263
|
+
}, (0, _emotion.jsx)(_quizCommon.Flex, {
|
|
264
|
+
direction: "row",
|
|
265
|
+
gap: this.isActiveBank ? 'x-small' : 'medium',
|
|
266
|
+
themeOverride: {
|
|
267
|
+
gapMedium: '1.25rem'
|
|
268
|
+
},
|
|
269
|
+
alignItems: "center"
|
|
270
|
+
}, this.isBankEntry && (0, _emotion.jsx)(_quizCommon.Flex.Item, null, (0, _emotion.jsx)(_uiIcons.IconBankLine, null)), this.isActiveBank ? (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
271
|
+
shouldShrink: true
|
|
272
|
+
}, this.renderBankNameButton()) : (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
273
|
+
shouldGrow: true
|
|
274
|
+
}, this.renderTitleHolder()))));
|
|
261
275
|
}
|
|
262
276
|
}, {
|
|
263
277
|
key: "render",
|
|
@@ -285,11 +299,15 @@ var QuizEntryHeader = (_dec = (0, _quizCommon.withStyleOverrides)(_styles["defau
|
|
|
285
299
|
}), (0, _emotion.jsx)(_quizCommon.Flex, {
|
|
286
300
|
className: "header",
|
|
287
301
|
direction: "row",
|
|
288
|
-
|
|
302
|
+
alignItems: this.isActiveBank ? 'center' : 'end',
|
|
303
|
+
gap: "small",
|
|
304
|
+
justifyItems: "space-between"
|
|
289
305
|
}, (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
290
|
-
shouldShrink:
|
|
306
|
+
shouldShrink: this.isActiveBank,
|
|
291
307
|
shouldGrow: true
|
|
292
|
-
}, this.renderLeftHeader()), (0, _emotion.jsx)(_quizCommon.Flex.Item,
|
|
308
|
+
}, this.renderLeftHeader()), (0, _emotion.jsx)(_quizCommon.Flex.Item, {
|
|
309
|
+
padding: this.isActiveBank ? '0' : '0 0 xx-small'
|
|
310
|
+
}, (0, _emotion.jsx)(_ActionButtons["default"], actionButtonProps))));
|
|
293
311
|
}
|
|
294
312
|
}]);
|
|
295
313
|
}(_react.Component), (0, _defineProperty2["default"])(_QuizEntryHeader, "displayName", 'QuizEntryHeader'), (0, _defineProperty2["default"])(_QuizEntryHeader, "componentId", "Quizzes".concat(_QuizEntryHeader.displayName)), (0, _defineProperty2["default"])(_QuizEntryHeader, "propTypes", {
|
|
@@ -83,7 +83,7 @@ var ResultStimulus = exports.ResultStimulus = (_dec = (0, _quizCommon.withStyleO
|
|
|
83
83
|
css: this.props.styles.stimulusGroup
|
|
84
84
|
}, (0, _emotion.jsx)("div", {
|
|
85
85
|
css: this.props.styles.stimulusInfo
|
|
86
|
-
}, this.renderStimulusInfo()), (0, _emotion.jsx)("div", {
|
|
86
|
+
}, this.renderStimulusInfo()), this.props.stimulus.isPassage === false && (0, _emotion.jsx)("div", {
|
|
87
87
|
css: this.props.styles.items
|
|
88
88
|
}, this.renderStimulusItems()))));
|
|
89
89
|
}
|
|
@@ -23,7 +23,7 @@ var generateStyle = function generateStyle(componentTheme, props) {
|
|
|
23
23
|
};
|
|
24
24
|
return {
|
|
25
25
|
root: {
|
|
26
|
-
|
|
26
|
+
borderTop: "".concat(componentTheme.rootBorderWidth, " solid ").concat(componentTheme.rootBorderColor),
|
|
27
27
|
overflow: 'hidden'
|
|
28
28
|
},
|
|
29
29
|
instructions: (0, _defineProperty2["default"])({
|
|
@@ -38,9 +38,7 @@ var generateStyle = function generateStyle(componentTheme, props) {
|
|
|
38
38
|
},
|
|
39
39
|
info: (0, _defineProperty2["default"])({
|
|
40
40
|
padding: "".concat(componentTheme.infoPaddingTopBottom, " ").concat(componentTheme.infoPaddingLeftRight),
|
|
41
|
-
|
|
42
|
-
height: '100%',
|
|
43
|
-
overflow: 'scroll'
|
|
41
|
+
height: '100%'
|
|
44
42
|
}, mq, {
|
|
45
43
|
padding: componentTheme.phoneInfoPadding
|
|
46
44
|
}),
|
|
@@ -12,7 +12,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
|
12
12
|
breakpoints = _ref.breakpoints;
|
|
13
13
|
return {
|
|
14
14
|
rootBorderWidth: borders.widthSmall,
|
|
15
|
-
rootBorderColor: colors.
|
|
15
|
+
rootBorderColor: colors.tiara,
|
|
16
16
|
instructionsPaddingTopBottom: spacing.medium,
|
|
17
17
|
instructionsPaddingLeftRight: spacing.large,
|
|
18
18
|
instructionsBorderWidth: borders.widthSmall,
|
|
@@ -29,6 +29,11 @@ var Stimulus = exports.Stimulus = /*#__PURE__*/function (_ReduxRecord) {
|
|
|
29
29
|
get: function get() {
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "isPassage",
|
|
34
|
+
get: function get() {
|
|
35
|
+
return this.passage;
|
|
36
|
+
}
|
|
32
37
|
}, {
|
|
33
38
|
key: "isLoaded",
|
|
34
39
|
value: function isLoaded() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "21.0.1-rc.
|
|
3
|
+
"version": "21.0.1-rc.17+438073fcc",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@instructure/emotion": "^9.11.1",
|
|
47
47
|
"@instructure/grading-utils": "^1.0.0",
|
|
48
48
|
"@instructure/outcomes-ui": "^3.2.2",
|
|
49
|
-
"@instructure/quiz-common": "21.0.1-rc.
|
|
50
|
-
"@instructure/quiz-i18n": "21.0.1-rc.
|
|
51
|
-
"@instructure/quiz-interactions": "21.0.1-rc.
|
|
52
|
-
"@instructure/quiz-number-input": "21.0.1-rc.
|
|
53
|
-
"@instructure/quiz-rce": "21.0.1-rc.
|
|
49
|
+
"@instructure/quiz-common": "21.0.1-rc.17+438073fcc",
|
|
50
|
+
"@instructure/quiz-i18n": "21.0.1-rc.17+438073fcc",
|
|
51
|
+
"@instructure/quiz-interactions": "21.0.1-rc.17+438073fcc",
|
|
52
|
+
"@instructure/quiz-number-input": "21.0.1-rc.17+438073fcc",
|
|
53
|
+
"@instructure/quiz-rce": "21.0.1-rc.17+438073fcc",
|
|
54
54
|
"@instructure/ui-a11y-content": "^9.11.1",
|
|
55
55
|
"@instructure/ui-alerts": "^9.11.1",
|
|
56
56
|
"@instructure/ui-avatar": "^9.11.1",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"file-saver": "~2.0.5",
|
|
110
110
|
"humps": "^2.0.0",
|
|
111
111
|
"immutable": "^3.8.1",
|
|
112
|
-
"instructure-validations": "21.0.1-rc.
|
|
112
|
+
"instructure-validations": "21.0.1-rc.17+438073fcc",
|
|
113
113
|
"ipaddr.js": "^1.5.4",
|
|
114
114
|
"isomorphic-fetch": "^2.2.0",
|
|
115
115
|
"isuuid": "^0.1.0",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"jquery": "^2.2.3",
|
|
159
159
|
"karma-junit-reporter": "^2.0.1",
|
|
160
160
|
"most-subject": "^5.3.0",
|
|
161
|
-
"quiz-presets": "21.0.1-rc.
|
|
161
|
+
"quiz-presets": "21.0.1-rc.17+438073fcc",
|
|
162
162
|
"react": "^16.8.6",
|
|
163
163
|
"react-addons-test-utils": "^15.6.2",
|
|
164
164
|
"react-dom": "^16.8.6",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"publishConfig": {
|
|
175
175
|
"access": "public"
|
|
176
176
|
},
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "438073fcc6b0f4a678ce5cf06aa1b8511cb351e4"
|
|
178
178
|
}
|