@instructure/quiz-core 21.0.1-rc.23 → 21.0.1-rc.27

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.
@@ -89,6 +89,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
89
89
  }, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
90
90
  });
91
91
  var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
92
+ var screenReaderText = this.props.isPassage ? t('Collapse passage questions') : t('Collapse stimulus questions');
92
93
  return jsx(Transition, {
93
94
  "in": isShowingItems || this.shouldDisplayAllItems(),
94
95
  type: transitionType
@@ -100,7 +101,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
100
101
  withBackground: false,
101
102
  withBorder: false,
102
103
  renderIcon: IconArrowOpenUpLine,
103
- screenReaderLabel: t('Collapse stimulus questions')
104
+ screenReaderLabel: screenReaderText
104
105
  })), jsx("div", null, itemComponents)));
105
106
  }
106
107
  }, {
@@ -111,6 +112,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
111
112
  itemCollection = _this$props2.itemCollection,
112
113
  isShowingItems = _this$props2.isShowingItems;
113
114
  var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
115
+ var screenReaderText = this.props.isPassage ? t('Expand passage questions') : t('Expand stimulus questions');
114
116
  return jsx(Transition, {
115
117
  "in": !isShowingItems,
116
118
  type: transitionType
@@ -124,7 +126,7 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
124
126
  withBackground: false,
125
127
  withBorder: false,
126
128
  renderIcon: IconArrowOpenDownLine,
127
- screenReaderLabel: t('Expand stimulus questions')
129
+ screenReaderLabel: screenReaderText
128
130
  })));
129
131
  }
130
132
  }, {
@@ -155,7 +157,8 @@ export var Collection = (_dec = withStyleOverrides(generateStyle, generateCompon
155
157
  // set in connect
156
158
  setSidebarStimulusIsShowing: PropTypes.func.isRequired,
157
159
  styles: PropTypes.object,
158
- makeStyles: PropTypes.func
160
+ makeStyles: PropTypes.func,
161
+ isPassage: PropTypes.bool
159
162
  }), _defineProperty(_Collection, "defaultProps", {
160
163
  isShowingItems: false
161
164
  }), _Collection)) || _class);
@@ -35,6 +35,8 @@ import t from '@instructure/quiz-i18n/es/format-message';
35
35
  import { Flex, END_EDITING_TRIGGER_CLASSNAME, withStyleOverrides } from '@instructure/quiz-common';
36
36
  import { Tooltip } from '@instructure/ui-tooltip';
37
37
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
38
+ import { View } from '@instructure/ui-view';
39
+ import { Text } from '@instructure/ui-text';
38
40
  export var DISPLAY_AS_SUMMARY_LIMIT = 5;
39
41
  export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_SidebarStimulus = /*#__PURE__*/function (_Component) {
40
42
  function SidebarStimulus() {
@@ -64,18 +66,26 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
64
66
  value: function componentDidUpdate() {
65
67
  this.props.makeStyles();
66
68
  }
69
+ }, {
70
+ key: "stimulusIsPassage",
71
+ value: function stimulusIsPassage() {
72
+ var _this$props$stimulus;
73
+ return (_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.isPassage;
74
+ }
67
75
  }, {
68
76
  key: "renderCollection",
69
77
  value: function renderCollection() {
70
- if (this.props.isDragging) {
71
- return;
72
- }
78
+ var _this$props$stimulus2;
73
79
  var _this$props = this.props,
74
80
  displayPosition = _this$props.displayPosition,
75
81
  isOver = _this$props.isOver,
76
82
  isShowingItems = _this$props.isShowingItems,
77
83
  renderSidebarItem = _this$props.renderSidebarItem,
78
- sidebarOpen = _this$props.sidebarOpen;
84
+ sidebarOpen = _this$props.sidebarOpen,
85
+ isDragging = _this$props.isDragging;
86
+ if (this.stimulusIsPassage() || isDragging) {
87
+ return null;
88
+ }
79
89
  return jsx(Collection, {
80
90
  firstPosition: displayPosition,
81
91
  isOver: isOver,
@@ -83,22 +93,30 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
83
93
  itemCollection: this.props.childEntries,
84
94
  renderSidebarItem: renderSidebarItem,
85
95
  sidebarOpen: sidebarOpen,
86
- stimulusId: this.props.stimulus.id
96
+ stimulusId: this.props.stimulus.id,
97
+ isPassage: (_this$props$stimulus2 = this.props.stimulus) === null || _this$props$stimulus2 === void 0 ? void 0 : _this$props$stimulus2.isPassage
87
98
  });
88
99
  }
89
100
  }, {
90
101
  key: "renderButton",
91
102
  value: function renderButton() {
92
- var displayPosition = this.props.displayPosition;
93
- var textForNavigation = t('Navigate to stimulus at position {displayPosition}', {
103
+ var _this$props2 = this.props,
104
+ displayPosition = _this$props2.displayPosition,
105
+ sidebarOpen = _this$props2.sidebarOpen;
106
+ var itemName = this.stimulusIsPassage() ? 'passage' : 'stimulus';
107
+ var textForNavigation = t('Navigate to {itemName} at position {displayPosition}', {
108
+ itemName: itemName,
94
109
  displayPosition: displayPosition
95
110
  });
111
+ var content = sidebarOpen ? '' : textForNavigation;
112
+ var tip = jsx(Text, {
113
+ "aria-hidden": !sidebarOpen,
114
+ "aria-label": content
115
+ }, content);
96
116
  return jsx(Tooltip, {
97
- renderTip: this.props.sidebarOpen ? '' : jsx("span", {
98
- "aria-hidden": "true"
99
- }, textForNavigation),
117
+ renderTip: tip,
100
118
  placement: "start",
101
- on: this.props.sidebarOpen ? [] : ['hover', 'focus']
119
+ on: sidebarOpen ? [] : ['hover', 'focus']
102
120
  }, jsx(Link, {
103
121
  href: "#",
104
122
  margin: "small",
@@ -110,33 +128,82 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
110
128
  className: END_EDITING_TRIGGER_CLASSNAME
111
129
  }, jsx(ScreenReaderContent, null, textForNavigation)));
112
130
  }
131
+ }, {
132
+ key: "infoHeaderLabel",
133
+ value: function infoHeaderLabel() {
134
+ return this.stimulusIsPassage() ? t('Passage') : t('Stimulus');
135
+ }
136
+ }, {
137
+ key: "renderSummary",
138
+ value: function renderSummary() {
139
+ var _this$props3 = this.props,
140
+ displayPosition = _this$props3.displayPosition,
141
+ isDragging = _this$props3.isDragging,
142
+ isShowingItems = _this$props3.isShowingItems,
143
+ sidebarOpen = _this$props3.sidebarOpen,
144
+ stimulus = _this$props3.stimulus;
145
+ if (this.stimulusIsPassage()) {
146
+ return null;
147
+ }
148
+ return jsx(Summary, {
149
+ startPosition: displayPosition,
150
+ isDragging: isDragging,
151
+ isShowingItems: isShowingItems,
152
+ stimulusId: stimulus.id,
153
+ sidebarOpen: sidebarOpen,
154
+ numberOfItems: this.props.childEntries.size
155
+ });
156
+ }
157
+ }, {
158
+ key: "stimulusHoverCss",
159
+ value: function stimulusHoverCss() {
160
+ return {
161
+ // TODO: figure out how to get rid of the last of these styles.
162
+ ':hover': this.props.styles.onHover
163
+ };
164
+ }
113
165
  }, {
114
166
  key: "renderClosed",
115
167
  value: function renderClosed() {
116
- return jsx("div", {
117
- css: this.props.styles.sidebarItem
118
- }, jsx("div", {
119
- css: this.props.styles.sidebarItemClosedButton
168
+ return jsx(View, {
169
+ borderWidth: "0 0 small 0",
170
+ borderColor: "primary",
171
+ as: "div"
172
+ }, jsx(View, {
173
+ textAlign: "center",
174
+ padding: "xx-small 0",
175
+ borderWidth: "none large none none",
176
+ borderColor: "transparent",
177
+ css: this.stimulusHoverCss(),
178
+ as: "div"
120
179
  }, this.renderButton()), this.renderCollection());
121
180
  }
122
181
  }, {
123
182
  key: "renderOpen",
124
183
  value: function renderOpen() {
125
- var _this$props2 = this.props,
126
- children = _this$props2.children,
127
- displayPosition = _this$props2.displayPosition,
128
- isDragging = _this$props2.isDragging,
129
- isShowingItems = _this$props2.isShowingItems,
130
- sidebarOpen = _this$props2.sidebarOpen,
131
- stimulus = _this$props2.stimulus;
132
- return jsx("div", {
133
- css: this.props.styles.sidebarItem
134
- }, jsx("div", {
135
- css: this.props.styles.stimulusHeader
136
- }, jsx("div", {
137
- css: this.props.styles.infoHeader
138
- }, t('Stimulus')), jsx("div", {
139
- css: this.props.styles.stimulusBody
184
+ var _this$props4 = this.props,
185
+ stimulus = _this$props4.stimulus,
186
+ children = _this$props4.children;
187
+ return jsx(View, {
188
+ borderWidth: "0 0 small 0",
189
+ borderColor: "primary",
190
+ as: "div"
191
+ }, jsx(View, {
192
+ padding: "small 0",
193
+ borderWidth: "none large none none",
194
+ borderColor: "transparent",
195
+ css: this.stimulusHoverCss(),
196
+ as: "div"
197
+ }, jsx(View, {
198
+ margin: "auto auto x-small x-small",
199
+ padding: "auto auto auto x-small",
200
+ as: "div"
201
+ }, jsx(Text, {
202
+ size: "x-small",
203
+ color: "secondary"
204
+ }, this.infoHeaderLabel())), jsx(View, {
205
+ margin: "auto auto auto small",
206
+ as: "div"
140
207
  }, jsx(Flex, {
141
208
  justifyItems: "space-between"
142
209
  }, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
@@ -146,14 +213,7 @@ export var SidebarStimulus = (_dec = withStyleOverrides(generateStyle, generateC
146
213
  tabIndex: "-1"
147
214
  }, jsx(Title, {
148
215
  title: stimulus.title
149
- })), jsx(Flex.Item, null, children)), jsx(Summary, {
150
- startPosition: displayPosition,
151
- isDragging: isDragging,
152
- isShowingItems: isShowingItems,
153
- sidebarOpen: sidebarOpen,
154
- stimulusId: stimulus.id,
155
- numberOfItems: this.props.childEntries.size
156
- }))), this.renderCollection());
216
+ })), jsx(Flex.Item, null, children)), this.renderSummary())), this.renderCollection());
157
217
  }
158
218
  }, {
159
219
  key: "render",
@@ -1,31 +1,7 @@
1
1
  var generateStyle = function generateStyle(componentTheme) {
2
2
  return {
3
- sidebarItem: {
4
- borderBottom: "".concat(componentTheme.sidebarItemBorderWidth, " solid ").concat(componentTheme.sidebarItemBorderColor)
5
- },
6
- sidebarItemClosedButton: {
7
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
8
- padding: componentTheme.sidebarClosedButtonPadding,
9
- textAlign: 'center',
10
- '&:hover': {
11
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
12
- }
13
- },
14
- stimulusHeader: {
15
- padding: "".concat(componentTheme.sidebarHeaderPadding, " 0"),
16
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
17
- '&:hover:': {
18
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
19
- }
20
- },
21
- stimulusBody: {
22
- marginLeft: '5%'
23
- },
24
- infoHeader: {
25
- fontSize: componentTheme.sidebarIsOpenInfoHeaderFontSize,
26
- color: componentTheme.sidebarIsOpenInfoHeaderColor,
27
- marginBottom: componentTheme.sidebarIsOpenInfoHeaderMargin,
28
- paddingLeft: componentTheme.sidebarIsOpenInfoHeaderPadding
3
+ onHover: {
4
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
29
5
  }
30
6
  };
31
7
  };
@@ -5,16 +5,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
5
5
  typography = _ref.typography;
6
6
  return {
7
7
  borderColor: colors.contrasts.white1010,
8
- hoverBorderColor: colors.contrasts.blue4570,
9
- hoverBorderWidth: borders.widthLarge,
10
- sidebarClosedButtonPadding: "".concat(spacing.xxSmall, " 0"),
11
- sidebarHeaderPadding: spacing.small,
12
- sidebarItemBorderWidth: borders.widthSmall,
13
- sidebarItemBorderColor: colors.contrasts.grey1214,
14
- sidebarIsOpenInfoHeaderFontSize: typography.fontSizeXSmall,
15
- sidebarIsOpenInfoHeaderPadding: spacing.xSmall,
16
- sidebarIsOpenInfoHeaderMargin: spacing.xSmall,
17
- sidebarIsOpenInfoHeaderColor: colors.contrasts.grey4570
8
+ hoverBorderColor: colors.contrasts.blue4570
18
9
  };
19
10
  };
20
11
  export default generateComponentTheme;
@@ -91,9 +91,9 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
91
91
  return typeof this.pointsPossible === 'number';
92
92
  }
93
93
  }, {
94
- key: "position",
95
- value: function position() {
96
- return this.props.sessionItem.position;
94
+ key: "questionNumber",
95
+ value: function questionNumber() {
96
+ return this.props.sessionItem.questionNumber;
97
97
  }
98
98
  }, {
99
99
  key: "unscorable",
@@ -179,38 +179,38 @@ export var SessionItemResult = (_dec = withStyleOverrides(generateStyle, generat
179
179
  value: function renderHeader() {
180
180
  return jsx("div", {
181
181
  css: this.props.styles.sessionItemResultHeader
182
- }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
182
+ }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
183
183
  }
184
184
  }, {
185
- key: "renderResultPosition",
186
- value: function renderResultPosition() {
187
- var position = this.position();
188
- var positionText;
185
+ key: "renderResultQuestionNumber",
186
+ value: function renderResultQuestionNumber() {
187
+ var questionNumber = this.questionNumber();
188
+ var questionNumberText;
189
189
  if (this.regraded() && this.unscorable()) {
190
- positionText = t('Results for question {position, number}. There was a problem grading this question. This question has been regraded.', {
191
- position: position
190
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
191
+ questionNumber: questionNumber
192
192
  });
193
193
  } else if (this.regraded()) {
194
- positionText = t('Results for question {position, number}. This question has been regraded.', {
195
- position: position
194
+ questionNumberText = t('Results for question {questionNumber, number}. This question has been regraded.', {
195
+ questionNumber: questionNumber
196
196
  });
197
197
  } else if (this.unscorable() && this.props.editGraderFeedback) {
198
- positionText = t('Results for question {position, number}. There was a problem grading this question.', {
199
- position: position
198
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question.', {
199
+ questionNumber: questionNumber
200
200
  });
201
201
  } else if (this.unscorable()) {
202
- positionText = t('Results for question {position, number}. There was a problem grading this question. Please inform your instructor.', {
203
- position: position
202
+ questionNumberText = t('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
203
+ questionNumber: questionNumber
204
204
  });
205
205
  } else {
206
- positionText = t('Results for question {position, number}.', {
207
- position: position
206
+ questionNumberText = t('Results for question {questionNumber, number}.', {
207
+ questionNumber: questionNumber
208
208
  });
209
209
  }
210
210
  return jsx(PositionBox, {
211
- position: position,
211
+ position: questionNumber,
212
212
  headingLevel: "h3",
213
- headingText: positionText
213
+ headingText: questionNumberText
214
214
  });
215
215
  }
216
216
  }, {
@@ -145,73 +145,74 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
145
145
  });
146
146
  _defineProperty(_this2, "onSubmit", /*#__PURE__*/function () {
147
147
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
148
- var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
148
+ var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
149
149
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
150
150
  while (1) switch (_context2.prev = _context2.next) {
151
151
  case 0:
152
152
  _this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
153
153
  if (workingStimulus.isValid()) {
154
- _context2.next = 8;
154
+ _context2.next = 9;
155
155
  break;
156
156
  }
157
- _context2.next = 4;
157
+ message = _this2.isPassage() ? t('Passage not saved due to validation errors with the data.') : t('Stimulus not saved due to validation errors with the data.');
158
+ _context2.next = 5;
158
159
  return _this2.props.showError(_this2.props.guid);
159
- case 4:
160
- _this2.props.screenreaderNotification(t('Simulus not saved due to validation errors with the data.'));
160
+ case 5:
161
+ _this2.props.screenreaderNotification(message);
161
162
  _this2.props.clearNextQuizEntry();
162
163
  _this2.focusFirstErrorField();
163
164
  return _context2.abrupt("return");
164
- case 8:
165
+ case 9:
165
166
  _this2.setState({
166
167
  canSubmit: false
167
168
  });
168
169
  _this2.props.hideError(_this2.props.guid);
169
- _context2.prev = 10;
170
+ _context2.prev = 11;
170
171
  if (!stimulus.isTemporary()) {
171
- _context2.next = 17;
172
+ _context2.next = 18;
172
173
  break;
173
174
  }
174
- _context2.next = 14;
175
+ _context2.next = 15;
175
176
  return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
176
- case 14:
177
+ case 15:
177
178
  _this2.props.clearTemporaryStimulus(quizId);
178
- _context2.next = 28;
179
+ _context2.next = 29;
179
180
  break;
180
- case 17:
181
+ case 18:
181
182
  if (!_this2.props.shouldClone) {
182
- _context2.next = 26;
183
+ _context2.next = 27;
183
184
  break;
184
185
  }
185
- _context2.next = 20;
186
+ _context2.next = 21;
186
187
  return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
187
- case 20:
188
+ case 21:
188
189
  stimulusData = _context2.sent;
189
- _context2.next = 23;
190
+ _context2.next = 24;
190
191
  return _this2.handleStimulusCreated(stimulusData);
191
- case 23:
192
+ case 24:
192
193
  _this2.props.clearTemporaryStimulus(quizId);
193
- _context2.next = 28;
194
+ _context2.next = 29;
194
195
  break;
195
- case 26:
196
- _context2.next = 28;
196
+ case 27:
197
+ _context2.next = 29;
197
198
  return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
198
- case 28:
199
- _context2.next = 34;
199
+ case 29:
200
+ _context2.next = 35;
200
201
  break;
201
- case 30:
202
- _context2.prev = 30;
203
- _context2.t0 = _context2["catch"](10);
202
+ case 31:
203
+ _context2.prev = 31;
204
+ _context2.t0 = _context2["catch"](11);
204
205
  _this2.setState({
205
206
  canSubmit: true
206
207
  });
207
208
  throw _context2.t0;
208
- case 34:
209
- _this2.afterSubmit();
210
209
  case 35:
210
+ _this2.afterSubmit();
211
+ case 36:
211
212
  case "end":
212
213
  return _context2.stop();
213
214
  }
214
- }, _callee2, null, [[10, 30]]);
215
+ }, _callee2, null, [[11, 31]]);
215
216
  }));
216
217
  return function (_x2) {
217
218
  return _ref2.apply(this, arguments);
@@ -315,10 +316,11 @@ export var StimulusEdit = (_dec = withStyleOverrides(generateStyle, generateComp
315
316
  }, {
316
317
  key: "afterSubmit",
317
318
  value: function afterSubmit() {
319
+ var message = this.isPassage() ? t('Changes to passage saved.') : t('Changes to stimulus saved.');
318
320
  this.props.switchOffEditing();
319
321
  this.clearModifications();
320
322
  this.props.setUi(SHOULD_CLONE_ITEM, false);
321
- this.props.screenreaderNotification(t('Changes to stimulus saved.'));
323
+ this.props.screenreaderNotification(message);
322
324
  if (this.props.nextQuizEntry) {
323
325
  this.createNextQuizEntry();
324
326
  }
@@ -164,9 +164,10 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
164
164
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
165
165
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
166
166
  var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
167
+ var message = stimulus.passage ? t('Edit Passage') : t('Edit Stimulus');
167
168
  return jsx(FormFieldGroup, {
168
169
  messages: this.inputErrors('onSelf'),
169
- description: jsx(ScreenReaderContent, null, t('Edit Stimulus'))
170
+ description: jsx(ScreenReaderContent, null, message)
170
171
  }, jsx(Heading, {
171
172
  level: "h3",
172
173
  as: "h2"
@@ -366,51 +366,63 @@ export var QuizEntry = (_dec = withStateCache(function () {
366
366
  // their own possible string so that translators can better translate the meaning
367
367
  var type;
368
368
  if (this.hasStimulus || this.isBank) {
369
+ if (this.isPassage) {
370
+ type = t('Passage');
371
+ var opts = {
372
+ type: type,
373
+ start: displayPosition - 1
374
+ };
375
+ return {
376
+ Remove: t('Remove {type} located after position {start, number}.', opts),
377
+ Edit: t('Edit {type} located after position {start, number}.', opts),
378
+ Move: t('Move {type} located after position {start, number}.', opts)
379
+ }[verb];
380
+ }
369
381
  type = this.hasStimulus ? t('Stimulus') : t('Bank');
370
382
  if (this.numItems > 1) {
371
- var opts = {
383
+ var _opts = {
372
384
  type: type,
373
385
  start: displayPosition,
374
386
  end: displayPosition + this.numItems - 1
375
387
  };
376
388
  return {
377
- Remove: t('Remove {type} containing questions {start, number} through {end, number}.', opts),
378
- Edit: t('Edit {type} containing questions {start, number} through {end, number}.', opts),
379
- Move: t('Move {type} containing questions {start, number} through {end, number}.', opts)
389
+ Remove: t('Remove {type} containing questions {start, number} through {end, number}.', _opts),
390
+ Edit: t('Edit {type} containing questions {start, number} through {end, number}.', _opts),
391
+ Move: t('Move {type} containing questions {start, number} through {end, number}.', _opts)
380
392
  }[verb];
381
393
  } else if (this.numItems === 1) {
382
- var _opts = {
394
+ var _opts2 = {
383
395
  type: type,
384
396
  start: displayPosition
385
397
  };
386
398
  return {
387
- Remove: t('Remove {type} containing question {start, number}.', _opts),
388
- Edit: t('Edit {type} containing question {start, number}.', _opts),
389
- Move: t('Move {type} containing question {start, number}.', _opts)
399
+ Remove: t('Remove {type} containing question {start, number}.', _opts2),
400
+ Edit: t('Edit {type} containing question {start, number}.', _opts2),
401
+ Move: t('Move {type} containing question {start, number}.', _opts2)
390
402
  }[verb];
391
403
  } else {
392
- var _opts2 = {
404
+ var _opts3 = {
393
405
  type: type,
394
406
  start: displayPosition - 1
395
407
  };
396
408
  return {
397
- Remove: t('Remove empty {type} located after position {start, number}.', _opts2),
398
- Edit: t('Edit empty {type} located after position {start, number}.', _opts2),
399
- Move: t('Move empty {type} located after position {start, number}.', _opts2)
409
+ Remove: t('Remove empty {type} located after position {start, number}.', _opts3),
410
+ Edit: t('Edit empty {type} located after position {start, number}.', _opts3),
411
+ Move: t('Move empty {type} located after position {start, number}.', _opts3)
400
412
  }[verb];
401
413
  }
402
414
  } else {
403
415
  type = t('Question');
404
- var _opts3 = {
416
+ var _opts4 = {
405
417
  verb: verb,
406
418
  type: type,
407
419
  position: displayPosition
408
420
  };
409
421
  return {
410
- Remove: t('Remove {type} at position {position, number}.', _opts3),
411
- Edit: t('Edit {type} at position {position, number}.', _opts3),
412
- Move: t('Move {type} at position {position, number}.', _opts3),
413
- Copy: t('Copy {type} at position {position, number}.', _opts3)
422
+ Remove: t('Remove {type} at position {position, number}.', _opts4),
423
+ Edit: t('Edit {type} at position {position, number}.', _opts4),
424
+ Move: t('Move {type} at position {position, number}.', _opts4),
425
+ Copy: t('Copy {type} at position {position, number}.', _opts4)
414
426
  }[verb];
415
427
  }
416
428
  }
@@ -85,6 +85,11 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
85
85
  get: function get() {
86
86
  return this.type === 'Stimulus';
87
87
  }
88
+ }, {
89
+ key: "isPassage",
90
+ get: function get() {
91
+ return this.isStimulus && this.stimulusRecord.isPassage;
92
+ }
88
93
  }, {
89
94
  key: "stimulusRecord",
90
95
  get: function get() {
@@ -123,6 +128,7 @@ export var SessionItem = /*#__PURE__*/function (_ReduxRecord) {
123
128
  item: {},
124
129
  pointsPossible: null,
125
130
  position: null,
131
+ questionNumber: null,
126
132
  quizEntryId: null,
127
133
  quizSessionId: null,
128
134
  scoringData: {},
@@ -211,7 +211,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
211
211
  var itemUserResponse = __getResponseForSessionItem(si, responses);
212
212
  return item.hasResponse(itemUserResponse);
213
213
  }).map(function (si) {
214
- return si.get('position');
214
+ return si.get('questionNumber');
215
215
  }).toSet().toJS();
216
216
  };
217
217
  export function showSubmitConfirmModal(quizSessionId) {
@@ -96,6 +96,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
96
96
  }, _this3.props.renderSidebarItem(item, displayPosition, sidebarOpen));
97
97
  });
98
98
  var transitionType = isShowingItems ? 'slide-down' : 'slide-up';
99
+ var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Collapse passage questions') : (0, _formatMessage["default"])('Collapse stimulus questions');
99
100
  return (0, _emotion.jsx)(_uiMotion.Transition, {
100
101
  "in": isShowingItems || this.shouldDisplayAllItems(),
101
102
  type: transitionType
@@ -107,7 +108,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
107
108
  withBackground: false,
108
109
  withBorder: false,
109
110
  renderIcon: _uiIcons.IconArrowOpenUpLine,
110
- screenReaderLabel: (0, _formatMessage["default"])('Collapse stimulus questions')
111
+ screenReaderLabel: screenReaderText
111
112
  })), (0, _emotion.jsx)("div", null, itemComponents)));
112
113
  }
113
114
  }, {
@@ -118,6 +119,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
118
119
  itemCollection = _this$props2.itemCollection,
119
120
  isShowingItems = _this$props2.isShowingItems;
120
121
  var transitionType = !isShowingItems ? 'slide-up' : 'slide-down';
122
+ var screenReaderText = this.props.isPassage ? (0, _formatMessage["default"])('Expand passage questions') : (0, _formatMessage["default"])('Expand stimulus questions');
121
123
  return (0, _emotion.jsx)(_uiMotion.Transition, {
122
124
  "in": !isShowingItems,
123
125
  type: transitionType
@@ -131,7 +133,7 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
131
133
  withBackground: false,
132
134
  withBorder: false,
133
135
  renderIcon: _uiIcons.IconArrowOpenDownLine,
134
- screenReaderLabel: (0, _formatMessage["default"])('Expand stimulus questions')
136
+ screenReaderLabel: screenReaderText
135
137
  })));
136
138
  }
137
139
  }, {
@@ -162,7 +164,8 @@ var Collection = exports.Collection = (_dec = (0, _quizCommon.withStyleOverrides
162
164
  // set in connect
163
165
  setSidebarStimulusIsShowing: _propTypes["default"].func.isRequired,
164
166
  styles: _propTypes["default"].object,
165
- makeStyles: _propTypes["default"].func
167
+ makeStyles: _propTypes["default"].func,
168
+ isPassage: _propTypes["default"].bool
166
169
  }), (0, _defineProperty2["default"])(_Collection, "defaultProps", {
167
170
  isShowingItems: false
168
171
  }), _Collection)) || _class);
@@ -26,6 +26,8 @@ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/f
26
26
  var _quizCommon = require("@instructure/quiz-common");
27
27
  var _uiTooltip = require("@instructure/ui-tooltip");
28
28
  var _uiA11yContent = require("@instructure/ui-a11y-content");
29
+ var _uiView = require("@instructure/ui-view");
30
+ var _uiText = require("@instructure/ui-text");
29
31
  var _dec, _class, _SidebarStimulus;
30
32
  /** @jsx jsx */
31
33
  function _callSuper(_this, derived, args) {
@@ -71,18 +73,26 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
71
73
  value: function componentDidUpdate() {
72
74
  this.props.makeStyles();
73
75
  }
76
+ }, {
77
+ key: "stimulusIsPassage",
78
+ value: function stimulusIsPassage() {
79
+ var _this$props$stimulus;
80
+ return (_this$props$stimulus = this.props.stimulus) === null || _this$props$stimulus === void 0 ? void 0 : _this$props$stimulus.isPassage;
81
+ }
74
82
  }, {
75
83
  key: "renderCollection",
76
84
  value: function renderCollection() {
77
- if (this.props.isDragging) {
78
- return;
79
- }
85
+ var _this$props$stimulus2;
80
86
  var _this$props = this.props,
81
87
  displayPosition = _this$props.displayPosition,
82
88
  isOver = _this$props.isOver,
83
89
  isShowingItems = _this$props.isShowingItems,
84
90
  renderSidebarItem = _this$props.renderSidebarItem,
85
- sidebarOpen = _this$props.sidebarOpen;
91
+ sidebarOpen = _this$props.sidebarOpen,
92
+ isDragging = _this$props.isDragging;
93
+ if (this.stimulusIsPassage() || isDragging) {
94
+ return null;
95
+ }
86
96
  return (0, _emotion.jsx)(_Collection["default"], {
87
97
  firstPosition: displayPosition,
88
98
  isOver: isOver,
@@ -90,22 +100,30 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
90
100
  itemCollection: this.props.childEntries,
91
101
  renderSidebarItem: renderSidebarItem,
92
102
  sidebarOpen: sidebarOpen,
93
- stimulusId: this.props.stimulus.id
103
+ stimulusId: this.props.stimulus.id,
104
+ isPassage: (_this$props$stimulus2 = this.props.stimulus) === null || _this$props$stimulus2 === void 0 ? void 0 : _this$props$stimulus2.isPassage
94
105
  });
95
106
  }
96
107
  }, {
97
108
  key: "renderButton",
98
109
  value: function renderButton() {
99
- var displayPosition = this.props.displayPosition;
100
- var textForNavigation = (0, _formatMessage["default"])('Navigate to stimulus at position {displayPosition}', {
110
+ var _this$props2 = this.props,
111
+ displayPosition = _this$props2.displayPosition,
112
+ sidebarOpen = _this$props2.sidebarOpen;
113
+ var itemName = this.stimulusIsPassage() ? 'passage' : 'stimulus';
114
+ var textForNavigation = (0, _formatMessage["default"])('Navigate to {itemName} at position {displayPosition}', {
115
+ itemName: itemName,
101
116
  displayPosition: displayPosition
102
117
  });
118
+ var content = sidebarOpen ? '' : textForNavigation;
119
+ var tip = (0, _emotion.jsx)(_uiText.Text, {
120
+ "aria-hidden": !sidebarOpen,
121
+ "aria-label": content
122
+ }, content);
103
123
  return (0, _emotion.jsx)(_uiTooltip.Tooltip, {
104
- renderTip: this.props.sidebarOpen ? '' : (0, _emotion.jsx)("span", {
105
- "aria-hidden": "true"
106
- }, textForNavigation),
124
+ renderTip: tip,
107
125
  placement: "start",
108
- on: this.props.sidebarOpen ? [] : ['hover', 'focus']
126
+ on: sidebarOpen ? [] : ['hover', 'focus']
109
127
  }, (0, _emotion.jsx)(_uiLink.Link, {
110
128
  href: "#",
111
129
  margin: "small",
@@ -117,33 +135,82 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
117
135
  className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME
118
136
  }, (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, textForNavigation)));
119
137
  }
138
+ }, {
139
+ key: "infoHeaderLabel",
140
+ value: function infoHeaderLabel() {
141
+ return this.stimulusIsPassage() ? (0, _formatMessage["default"])('Passage') : (0, _formatMessage["default"])('Stimulus');
142
+ }
143
+ }, {
144
+ key: "renderSummary",
145
+ value: function renderSummary() {
146
+ var _this$props3 = this.props,
147
+ displayPosition = _this$props3.displayPosition,
148
+ isDragging = _this$props3.isDragging,
149
+ isShowingItems = _this$props3.isShowingItems,
150
+ sidebarOpen = _this$props3.sidebarOpen,
151
+ stimulus = _this$props3.stimulus;
152
+ if (this.stimulusIsPassage()) {
153
+ return null;
154
+ }
155
+ return (0, _emotion.jsx)(_Summary["default"], {
156
+ startPosition: displayPosition,
157
+ isDragging: isDragging,
158
+ isShowingItems: isShowingItems,
159
+ stimulusId: stimulus.id,
160
+ sidebarOpen: sidebarOpen,
161
+ numberOfItems: this.props.childEntries.size
162
+ });
163
+ }
164
+ }, {
165
+ key: "stimulusHoverCss",
166
+ value: function stimulusHoverCss() {
167
+ return {
168
+ // TODO: figure out how to get rid of the last of these styles.
169
+ ':hover': this.props.styles.onHover
170
+ };
171
+ }
120
172
  }, {
121
173
  key: "renderClosed",
122
174
  value: function renderClosed() {
123
- return (0, _emotion.jsx)("div", {
124
- css: this.props.styles.sidebarItem
125
- }, (0, _emotion.jsx)("div", {
126
- css: this.props.styles.sidebarItemClosedButton
175
+ return (0, _emotion.jsx)(_uiView.View, {
176
+ borderWidth: "0 0 small 0",
177
+ borderColor: "primary",
178
+ as: "div"
179
+ }, (0, _emotion.jsx)(_uiView.View, {
180
+ textAlign: "center",
181
+ padding: "xx-small 0",
182
+ borderWidth: "none large none none",
183
+ borderColor: "transparent",
184
+ css: this.stimulusHoverCss(),
185
+ as: "div"
127
186
  }, this.renderButton()), this.renderCollection());
128
187
  }
129
188
  }, {
130
189
  key: "renderOpen",
131
190
  value: function renderOpen() {
132
- var _this$props2 = this.props,
133
- children = _this$props2.children,
134
- displayPosition = _this$props2.displayPosition,
135
- isDragging = _this$props2.isDragging,
136
- isShowingItems = _this$props2.isShowingItems,
137
- sidebarOpen = _this$props2.sidebarOpen,
138
- stimulus = _this$props2.stimulus;
139
- return (0, _emotion.jsx)("div", {
140
- css: this.props.styles.sidebarItem
141
- }, (0, _emotion.jsx)("div", {
142
- css: this.props.styles.stimulusHeader
143
- }, (0, _emotion.jsx)("div", {
144
- css: this.props.styles.infoHeader
145
- }, (0, _formatMessage["default"])('Stimulus')), (0, _emotion.jsx)("div", {
146
- css: this.props.styles.stimulusBody
191
+ var _this$props4 = this.props,
192
+ stimulus = _this$props4.stimulus,
193
+ children = _this$props4.children;
194
+ return (0, _emotion.jsx)(_uiView.View, {
195
+ borderWidth: "0 0 small 0",
196
+ borderColor: "primary",
197
+ as: "div"
198
+ }, (0, _emotion.jsx)(_uiView.View, {
199
+ padding: "small 0",
200
+ borderWidth: "none large none none",
201
+ borderColor: "transparent",
202
+ css: this.stimulusHoverCss(),
203
+ as: "div"
204
+ }, (0, _emotion.jsx)(_uiView.View, {
205
+ margin: "auto auto x-small x-small",
206
+ padding: "auto auto auto x-small",
207
+ as: "div"
208
+ }, (0, _emotion.jsx)(_uiText.Text, {
209
+ size: "x-small",
210
+ color: "secondary"
211
+ }, this.infoHeaderLabel())), (0, _emotion.jsx)(_uiView.View, {
212
+ margin: "auto auto auto small",
213
+ as: "div"
147
214
  }, (0, _emotion.jsx)(_quizCommon.Flex, {
148
215
  justifyItems: "space-between"
149
216
  }, (0, _emotion.jsx)(_quizCommon.Flex.Item, null, this.renderButton()), (0, _emotion.jsx)(_quizCommon.Flex.Item, {
@@ -153,14 +220,7 @@ var SidebarStimulus = exports.SidebarStimulus = (_dec = (0, _quizCommon.withStyl
153
220
  tabIndex: "-1"
154
221
  }, (0, _emotion.jsx)(_Title["default"], {
155
222
  title: stimulus.title
156
- })), (0, _emotion.jsx)(_quizCommon.Flex.Item, null, children)), (0, _emotion.jsx)(_Summary["default"], {
157
- startPosition: displayPosition,
158
- isDragging: isDragging,
159
- isShowingItems: isShowingItems,
160
- sidebarOpen: sidebarOpen,
161
- stimulusId: stimulus.id,
162
- numberOfItems: this.props.childEntries.size
163
- }))), this.renderCollection());
223
+ })), (0, _emotion.jsx)(_quizCommon.Flex.Item, null, children)), this.renderSummary())), this.renderCollection());
164
224
  }
165
225
  }, {
166
226
  key: "render",
@@ -6,32 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var generateStyle = function generateStyle(componentTheme) {
8
8
  return {
9
- sidebarItem: {
10
- borderBottom: "".concat(componentTheme.sidebarItemBorderWidth, " solid ").concat(componentTheme.sidebarItemBorderColor)
11
- },
12
- sidebarItemClosedButton: {
13
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
14
- padding: componentTheme.sidebarClosedButtonPadding,
15
- textAlign: 'center',
16
- '&:hover': {
17
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
18
- }
19
- },
20
- stimulusHeader: {
21
- padding: "".concat(componentTheme.sidebarHeaderPadding, " 0"),
22
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
23
- '&:hover:': {
24
- borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
25
- }
26
- },
27
- stimulusBody: {
28
- marginLeft: '5%'
29
- },
30
- infoHeader: {
31
- fontSize: componentTheme.sidebarIsOpenInfoHeaderFontSize,
32
- color: componentTheme.sidebarIsOpenInfoHeaderColor,
33
- marginBottom: componentTheme.sidebarIsOpenInfoHeaderMargin,
34
- paddingLeft: componentTheme.sidebarIsOpenInfoHeaderPadding
9
+ onHover: {
10
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
35
11
  }
36
12
  };
37
13
  };
@@ -11,16 +11,7 @@ var generateComponentTheme = function generateComponentTheme(_ref) {
11
11
  typography = _ref.typography;
12
12
  return {
13
13
  borderColor: colors.contrasts.white1010,
14
- hoverBorderColor: colors.contrasts.blue4570,
15
- hoverBorderWidth: borders.widthLarge,
16
- sidebarClosedButtonPadding: "".concat(spacing.xxSmall, " 0"),
17
- sidebarHeaderPadding: spacing.small,
18
- sidebarItemBorderWidth: borders.widthSmall,
19
- sidebarItemBorderColor: colors.contrasts.grey1214,
20
- sidebarIsOpenInfoHeaderFontSize: typography.fontSizeXSmall,
21
- sidebarIsOpenInfoHeaderPadding: spacing.xSmall,
22
- sidebarIsOpenInfoHeaderMargin: spacing.xSmall,
23
- sidebarIsOpenInfoHeaderColor: colors.contrasts.grey4570
14
+ hoverBorderColor: colors.contrasts.blue4570
24
15
  };
25
16
  };
26
17
  var _default = exports["default"] = generateComponentTheme;
@@ -98,9 +98,9 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
98
98
  return typeof this.pointsPossible === 'number';
99
99
  }
100
100
  }, {
101
- key: "position",
102
- value: function position() {
103
- return this.props.sessionItem.position;
101
+ key: "questionNumber",
102
+ value: function questionNumber() {
103
+ return this.props.sessionItem.questionNumber;
104
104
  }
105
105
  }, {
106
106
  key: "unscorable",
@@ -186,38 +186,38 @@ var SessionItemResult = exports.SessionItemResult = (_dec = (0, _quizCommon.with
186
186
  value: function renderHeader() {
187
187
  return (0, _emotion.jsx)("div", {
188
188
  css: this.props.styles.sessionItemResultHeader
189
- }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
189
+ }, this.renderResultQuestionNumber(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
190
190
  }
191
191
  }, {
192
- key: "renderResultPosition",
193
- value: function renderResultPosition() {
194
- var position = this.position();
195
- var positionText;
192
+ key: "renderResultQuestionNumber",
193
+ value: function renderResultQuestionNumber() {
194
+ var questionNumber = this.questionNumber();
195
+ var questionNumberText;
196
196
  if (this.regraded() && this.unscorable()) {
197
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. This question has been regraded.', {
198
- position: position
197
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. This question has been regraded.', {
198
+ questionNumber: questionNumber
199
199
  });
200
200
  } else if (this.regraded()) {
201
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. This question has been regraded.', {
202
- position: position
201
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. This question has been regraded.', {
202
+ questionNumber: questionNumber
203
203
  });
204
204
  } else if (this.unscorable() && this.props.editGraderFeedback) {
205
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question.', {
206
- position: position
205
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question.', {
206
+ questionNumber: questionNumber
207
207
  });
208
208
  } else if (this.unscorable()) {
209
- positionText = (0, _formatMessage["default"])('Results for question {position, number}. There was a problem grading this question. Please inform your instructor.', {
210
- position: position
209
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}. There was a problem grading this question. Please inform your instructor.', {
210
+ questionNumber: questionNumber
211
211
  });
212
212
  } else {
213
- positionText = (0, _formatMessage["default"])('Results for question {position, number}.', {
214
- position: position
213
+ questionNumberText = (0, _formatMessage["default"])('Results for question {questionNumber, number}.', {
214
+ questionNumber: questionNumber
215
215
  });
216
216
  }
217
217
  return (0, _emotion.jsx)(_PositionBox["default"], {
218
- position: position,
218
+ position: questionNumber,
219
219
  headingLevel: "h3",
220
- headingText: positionText
220
+ headingText: questionNumberText
221
221
  });
222
222
  }
223
223
  }, {
@@ -152,73 +152,74 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
152
152
  });
153
153
  (0, _defineProperty2["default"])(_this2, "onSubmit", /*#__PURE__*/function () {
154
154
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
155
- var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, stimulusData;
155
+ var _this2$props2, stimulus, workingStimulus, quizId, quizEntry, message, stimulusData;
156
156
  return _regenerator["default"].wrap(function _callee2$(_context2) {
157
157
  while (1) switch (_context2.prev = _context2.next) {
158
158
  case 0:
159
159
  _this2$props2 = _this2.props, stimulus = _this2$props2.stimulus, workingStimulus = _this2$props2.workingStimulus, quizId = _this2$props2.quizId, quizEntry = _this2$props2.quizEntry;
160
160
  if (workingStimulus.isValid()) {
161
- _context2.next = 8;
161
+ _context2.next = 9;
162
162
  break;
163
163
  }
164
- _context2.next = 4;
164
+ message = _this2.isPassage() ? (0, _formatMessage["default"])('Passage not saved due to validation errors with the data.') : (0, _formatMessage["default"])('Stimulus not saved due to validation errors with the data.');
165
+ _context2.next = 5;
165
166
  return _this2.props.showError(_this2.props.guid);
166
- case 4:
167
- _this2.props.screenreaderNotification((0, _formatMessage["default"])('Simulus not saved due to validation errors with the data.'));
167
+ case 5:
168
+ _this2.props.screenreaderNotification(message);
168
169
  _this2.props.clearNextQuizEntry();
169
170
  _this2.focusFirstErrorField();
170
171
  return _context2.abrupt("return");
171
- case 8:
172
+ case 9:
172
173
  _this2.setState({
173
174
  canSubmit: false
174
175
  });
175
176
  _this2.props.hideError(_this2.props.guid);
176
- _context2.prev = 10;
177
+ _context2.prev = 11;
177
178
  if (!stimulus.isTemporary()) {
178
- _context2.next = 17;
179
+ _context2.next = 18;
179
180
  break;
180
181
  }
181
- _context2.next = 14;
182
+ _context2.next = 15;
182
183
  return _this2.props.createStimulusAndQuizEntry(quizId, workingStimulus.toJS(), quizEntry);
183
- case 14:
184
+ case 15:
184
185
  _this2.props.clearTemporaryStimulus(quizId);
185
- _context2.next = 28;
186
+ _context2.next = 29;
186
187
  break;
187
- case 17:
188
+ case 18:
188
189
  if (!_this2.props.shouldClone) {
189
- _context2.next = 26;
190
+ _context2.next = 27;
190
191
  break;
191
192
  }
192
- _context2.next = 20;
193
+ _context2.next = 21;
193
194
  return _this2.props.createStimulus(workingStimulus, _this2.props.quizId, 'quiz', workingStimulus.id);
194
- case 20:
195
+ case 21:
195
196
  stimulusData = _context2.sent;
196
- _context2.next = 23;
197
+ _context2.next = 24;
197
198
  return _this2.handleStimulusCreated(stimulusData);
198
- case 23:
199
+ case 24:
199
200
  _this2.props.clearTemporaryStimulus(quizId);
200
- _context2.next = 28;
201
+ _context2.next = 29;
201
202
  break;
202
- case 26:
203
- _context2.next = 28;
203
+ case 27:
204
+ _context2.next = 29;
204
205
  return _this2.props.updateStimulus(workingStimulus.toJS(), quizId);
205
- case 28:
206
- _context2.next = 34;
206
+ case 29:
207
+ _context2.next = 35;
207
208
  break;
208
- case 30:
209
- _context2.prev = 30;
210
- _context2.t0 = _context2["catch"](10);
209
+ case 31:
210
+ _context2.prev = 31;
211
+ _context2.t0 = _context2["catch"](11);
211
212
  _this2.setState({
212
213
  canSubmit: true
213
214
  });
214
215
  throw _context2.t0;
215
- case 34:
216
- _this2.afterSubmit();
217
216
  case 35:
217
+ _this2.afterSubmit();
218
+ case 36:
218
219
  case "end":
219
220
  return _context2.stop();
220
221
  }
221
- }, _callee2, null, [[10, 30]]);
222
+ }, _callee2, null, [[11, 31]]);
222
223
  }));
223
224
  return function (_x2) {
224
225
  return _ref2.apply(this, arguments);
@@ -322,10 +323,11 @@ var StimulusEdit = exports.StimulusEdit = (_dec = (0, _quizCommon.withStyleOverr
322
323
  }, {
323
324
  key: "afterSubmit",
324
325
  value: function afterSubmit() {
326
+ var message = this.isPassage() ? (0, _formatMessage["default"])('Changes to passage saved.') : (0, _formatMessage["default"])('Changes to stimulus saved.');
325
327
  this.props.switchOffEditing();
326
328
  this.clearModifications();
327
329
  this.props.setUi(_quizCommon.SHOULD_CLONE_ITEM, false);
328
- this.props.screenreaderNotification((0, _formatMessage["default"])('Changes to stimulus saved.'));
330
+ this.props.screenreaderNotification(message);
329
331
  if (this.props.nextQuizEntry) {
330
332
  this.createNextQuizEntry();
331
333
  }
@@ -171,9 +171,10 @@ var StimulusEditInfo = exports.StimulusEditInfo = (_dec = (0, _quizCommon.withSt
171
171
  var textAreaId = "stimulusBodyEdit_".concat(stimulus.id, "_").concat(this.props.isBankedContent);
172
172
  var stimulusBodyId = "stimulusBodyEdit_".concat(stimulus.id, "_body");
173
173
  var automationPrefix = stimulus.passage ? 'passage' : 'stimulus';
174
+ var message = stimulus.passage ? (0, _formatMessage["default"])('Edit Passage') : (0, _formatMessage["default"])('Edit Stimulus');
174
175
  return (0, _emotion.jsx)(_quizCommon.FormFieldGroup, {
175
176
  messages: this.inputErrors('onSelf'),
176
- description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage["default"])('Edit Stimulus'))
177
+ description: (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, message)
177
178
  }, (0, _emotion.jsx)(_uiHeading.Heading, {
178
179
  level: "h3",
179
180
  as: "h2"
@@ -375,51 +375,63 @@ var QuizEntry = exports.QuizEntry = (_dec = (0, _withStateCache["default"])(func
375
375
  // their own possible string so that translators can better translate the meaning
376
376
  var type;
377
377
  if (this.hasStimulus || this.isBank) {
378
+ if (this.isPassage) {
379
+ type = (0, _formatMessage["default"])('Passage');
380
+ var opts = {
381
+ type: type,
382
+ start: displayPosition - 1
383
+ };
384
+ return {
385
+ Remove: (0, _formatMessage["default"])('Remove {type} located after position {start, number}.', opts),
386
+ Edit: (0, _formatMessage["default"])('Edit {type} located after position {start, number}.', opts),
387
+ Move: (0, _formatMessage["default"])('Move {type} located after position {start, number}.', opts)
388
+ }[verb];
389
+ }
378
390
  type = this.hasStimulus ? (0, _formatMessage["default"])('Stimulus') : (0, _formatMessage["default"])('Bank');
379
391
  if (this.numItems > 1) {
380
- var opts = {
392
+ var _opts = {
381
393
  type: type,
382
394
  start: displayPosition,
383
395
  end: displayPosition + this.numItems - 1
384
396
  };
385
397
  return {
386
- Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', opts),
387
- Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', opts),
388
- Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', opts)
398
+ Remove: (0, _formatMessage["default"])('Remove {type} containing questions {start, number} through {end, number}.', _opts),
399
+ Edit: (0, _formatMessage["default"])('Edit {type} containing questions {start, number} through {end, number}.', _opts),
400
+ Move: (0, _formatMessage["default"])('Move {type} containing questions {start, number} through {end, number}.', _opts)
389
401
  }[verb];
390
402
  } else if (this.numItems === 1) {
391
- var _opts = {
403
+ var _opts2 = {
392
404
  type: type,
393
405
  start: displayPosition
394
406
  };
395
407
  return {
396
- Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts),
397
- Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts),
398
- Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts)
408
+ Remove: (0, _formatMessage["default"])('Remove {type} containing question {start, number}.', _opts2),
409
+ Edit: (0, _formatMessage["default"])('Edit {type} containing question {start, number}.', _opts2),
410
+ Move: (0, _formatMessage["default"])('Move {type} containing question {start, number}.', _opts2)
399
411
  }[verb];
400
412
  } else {
401
- var _opts2 = {
413
+ var _opts3 = {
402
414
  type: type,
403
415
  start: displayPosition - 1
404
416
  };
405
417
  return {
406
- Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts2),
407
- Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts2),
408
- Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts2)
418
+ Remove: (0, _formatMessage["default"])('Remove empty {type} located after position {start, number}.', _opts3),
419
+ Edit: (0, _formatMessage["default"])('Edit empty {type} located after position {start, number}.', _opts3),
420
+ Move: (0, _formatMessage["default"])('Move empty {type} located after position {start, number}.', _opts3)
409
421
  }[verb];
410
422
  }
411
423
  } else {
412
424
  type = (0, _formatMessage["default"])('Question');
413
- var _opts3 = {
425
+ var _opts4 = {
414
426
  verb: verb,
415
427
  type: type,
416
428
  position: displayPosition
417
429
  };
418
430
  return {
419
- Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts3),
420
- Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts3),
421
- Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts3),
422
- Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts3)
431
+ Remove: (0, _formatMessage["default"])('Remove {type} at position {position, number}.', _opts4),
432
+ Edit: (0, _formatMessage["default"])('Edit {type} at position {position, number}.', _opts4),
433
+ Move: (0, _formatMessage["default"])('Move {type} at position {position, number}.', _opts4),
434
+ Copy: (0, _formatMessage["default"])('Copy {type} at position {position, number}.', _opts4)
423
435
  }[verb];
424
436
  }
425
437
  }
@@ -92,6 +92,11 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
92
92
  get: function get() {
93
93
  return this.type === 'Stimulus';
94
94
  }
95
+ }, {
96
+ key: "isPassage",
97
+ get: function get() {
98
+ return this.isStimulus && this.stimulusRecord.isPassage;
99
+ }
95
100
  }, {
96
101
  key: "stimulusRecord",
97
102
  get: function get() {
@@ -130,6 +135,7 @@ var SessionItem = exports.SessionItem = /*#__PURE__*/function (_ReduxRecord) {
130
135
  item: {},
131
136
  pointsPossible: null,
132
137
  position: null,
138
+ questionNumber: null,
133
139
  quizEntryId: null,
134
140
  quizSessionId: null,
135
141
  scoringData: {},
@@ -234,7 +234,7 @@ var __remainingQuestionPositions = function __remainingQuestionPositions(session
234
234
  var itemUserResponse = __getResponseForSessionItem(si, responses);
235
235
  return item.hasResponse(itemUserResponse);
236
236
  }).map(function (si) {
237
- return si.get('position');
237
+ return si.get('questionNumber');
238
238
  }).toSet().toJS();
239
239
  };
240
240
  function showSubmitConfirmModal(quizSessionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "21.0.1-rc.23+ba016039f",
3
+ "version": "21.0.1-rc.27+2e775b6c8",
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": "10.14.0",
47
47
  "@instructure/grading-utils": "^1.0.0",
48
48
  "@instructure/outcomes-ui": "3.2.3",
49
- "@instructure/quiz-common": "21.0.1-rc.23+ba016039f",
50
- "@instructure/quiz-i18n": "21.0.1-rc.23+ba016039f",
51
- "@instructure/quiz-interactions": "21.0.1-rc.23+ba016039f",
52
- "@instructure/quiz-number-input": "21.0.1-rc.23+ba016039f",
53
- "@instructure/quiz-rce": "21.0.1-rc.23+ba016039f",
49
+ "@instructure/quiz-common": "21.0.1-rc.27+2e775b6c8",
50
+ "@instructure/quiz-i18n": "21.0.1-rc.27+2e775b6c8",
51
+ "@instructure/quiz-interactions": "21.0.1-rc.27+2e775b6c8",
52
+ "@instructure/quiz-number-input": "21.0.1-rc.27+2e775b6c8",
53
+ "@instructure/quiz-rce": "21.0.1-rc.27+2e775b6c8",
54
54
  "@instructure/ui-a11y-content": "10.14.0",
55
55
  "@instructure/ui-alerts": "10.14.0",
56
56
  "@instructure/ui-avatar": "10.14.0",
@@ -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.23+ba016039f",
112
+ "instructure-validations": "21.0.1-rc.27+2e775b6c8",
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.23+ba016039f",
161
+ "quiz-presets": "21.0.1-rc.27+2e775b6c8",
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": "ba016039fc4b110fe972fb73aa16f5d17159c7c8"
177
+ "gitHead": "2e775b6c8301807d61316c23c7ad71256d239485"
178
178
  }