@instructure/quiz-core 21.0.1-rc.2 → 21.0.1-rc.5

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.
@@ -2,12 +2,16 @@ import { bindActionCreators } from 'redux';
2
2
  import { connect } from "../../../../react-redux.js";
3
3
  import * as modificationActions from "../../../../actions/modifications.js";
4
4
  import { featureOn } from "../../../../../common/util/featureCheck.js";
5
+ import { getActiveQuizId, getQuizById } from "../../../../../common/selectors/quizzes.js";
5
6
  import StimulusEditInfo from "./presenter.js";
6
7
  function mapStateToProps(state, props) {
8
+ var quizId = getActiveQuizId(state);
9
+ var quiz = getQuizById(state, quizId);
7
10
  return {
8
11
  workingStimulus: props.stimulus.getWorkingInstance(),
9
12
  errorsShowing: state.getIn(['errorsShowing', props.guid], props.errorsShowing || false),
10
- stimulusOrientationEnabled: featureOn('customizable_stimulus_orientation')
13
+ stimulusOrientationEnabled: featureOn('customizable_stimulus_orientation'),
14
+ shuffleQuestionsEnabled: quiz.shuffleQuestions
11
15
  };
12
16
  }
13
17
  function mapDispatchToProps(dispatch) {
@@ -18,6 +18,7 @@ import { SimpleSelect, TextInput, TOP, withStyleOverrides, FormFieldGroup, FormF
18
18
  import t from '@instructure/quiz-i18n/es/format-message';
19
19
  import generateStyle from "./styles.js";
20
20
  import generateComponentTheme from "./theme.js";
21
+ import { Alert } from '@instructure/ui-alerts';
21
22
  var _ref3 = jsx(IconUpdownLine, {
22
23
  rotate: "90"
23
24
  });
@@ -96,6 +97,16 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
96
97
  value: "top"
97
98
  }, t('Questions below'))));
98
99
  }
100
+ }, {
101
+ key: "renderPassageAlert",
102
+ value: function renderPassageAlert(stimulus) {
103
+ if (!stimulus.passage || !this.props.shuffleQuestionsEnabled) {
104
+ return null;
105
+ }
106
+ return jsx(Alert, {
107
+ variant: "warning"
108
+ }, t('The passage sections may not appear in their original order due to the shuffle setting.'));
109
+ }
99
110
  }, {
100
111
  key: "renderInstructions",
101
112
  value: function renderInstructions(stimulus) {
@@ -146,7 +157,7 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
146
157
  }, jsx(Heading, {
147
158
  level: "h3",
148
159
  as: "h2"
149
- }, this.headerText(stimulus)), jsx("div", {
160
+ }, this.headerText(stimulus)), this.renderPassageAlert(stimulus), jsx("div", {
150
161
  css: this.props.styles.section
151
162
  }, jsx(TextInput, {
152
163
  messages: this.inputErrors('title'),
@@ -184,9 +195,11 @@ export var StimulusEditInfo = (_dec = withStyleOverrides(generateStyle, generate
184
195
  modifyStimulus: PropTypes.func.isRequired,
185
196
  setTitleRef: PropTypes.func,
186
197
  stimulusOrientationEnabled: PropTypes.bool.isRequired,
187
- styles: PropTypes.object
198
+ styles: PropTypes.object,
199
+ shuffleQuestionsEnabled: PropTypes.bool
188
200
  }, _StimulusEditInfo.defaultProps = {
189
201
  isBankedContent: false,
202
+ shuffleQuestionsEnabled: false,
190
203
  setTitleRef: function setTitleRef() {}
191
204
  }, _StimulusEditInfo)) || _class);
192
205
  export default StimulusEditInfo;
@@ -11,13 +11,13 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
11
11
  import { IconBankLine } from '@instructure/ui-icons';
12
12
  import { jsx } from '@instructure/emotion';
13
13
  import { Text } from '@instructure/ui-text';
14
+ import { Flex, withStyleOverrides } from '@instructure/quiz-common';
14
15
  import StimulusShowInfo from "../StimulusShowInfo/index.js";
15
16
  import ActionButtons from "../../../../../building/components/resources/ActionButtons/index.js";
16
17
  import t from '@instructure/quiz-i18n/es/format-message';
17
18
  import generateStyle from "./styles.js";
18
19
  import generateComponentTheme from "./theme.js";
19
20
  import Overlay from "../../../shared/overlay/index.js";
20
- import { Flex, withStyleOverrides } from '@instructure/quiz-common';
21
21
  var _ref = jsx(IconBankLine, null);
22
22
  export var StimulusShow = (_dec = withStyleOverrides(generateStyle, generateComponentTheme), _dec(_class = (_StimulusShow = /*#__PURE__*/function (_Component) {
23
23
  _inherits(StimulusShow, _Component);
package/es/index.js CHANGED
@@ -146,7 +146,7 @@ import * as takingActionCreators from "./common/actions/taking.js";
146
146
  export { takingActionCreators };
147
147
 
148
148
  // Selectors
149
- export { getQuizById, getActiveQuizId, getQuizEntryById, isActiveQuizWorkingInstanceOneQuestionAtATime, getActiveQuiz } from "./common/selectors/quizzes.js";
149
+ export { getQuizById, getActiveQuizId, getQuizEntryById, getQuizEntriesByQuizId, isActiveQuizWorkingInstanceOneQuestionAtATime, getActiveQuiz } from "./common/selectors/quizzes.js";
150
150
  export { getItemById } from "./common/selectors/items.js";
151
151
  export { fileUploading } from "./common/selectors/calls.js";
152
152
  export { isTimeUp, getTimerData, getResponseDataByPosition } from "./common/selectors/taking.js";
@@ -10,12 +10,16 @@ var _redux = require("redux");
10
10
  var _reactRedux = require("../../../../react-redux.js");
11
11
  var modificationActions = _interopRequireWildcard(require("../../../../actions/modifications.js"));
12
12
  var _featureCheck = require("../../../../../common/util/featureCheck.js");
13
+ var _quizzes = require("../../../../../common/selectors/quizzes.js");
13
14
  var _presenter = _interopRequireDefault(require("./presenter.js"));
14
15
  function mapStateToProps(state, props) {
16
+ var quizId = (0, _quizzes.getActiveQuizId)(state);
17
+ var quiz = (0, _quizzes.getQuizById)(state, quizId);
15
18
  return {
16
19
  workingStimulus: props.stimulus.getWorkingInstance(),
17
20
  errorsShowing: state.getIn(['errorsShowing', props.guid], props.errorsShowing || false),
18
- stimulusOrientationEnabled: (0, _featureCheck.featureOn)('customizable_stimulus_orientation')
21
+ stimulusOrientationEnabled: (0, _featureCheck.featureOn)('customizable_stimulus_orientation'),
22
+ shuffleQuestionsEnabled: quiz.shuffleQuestions
19
23
  };
20
24
  }
21
25
  function mapDispatchToProps(dispatch) {
@@ -23,6 +23,7 @@ var _quizCommon = require("@instructure/quiz-common");
23
23
  var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
24
24
  var _styles = _interopRequireDefault(require("./styles.js"));
25
25
  var _theme = _interopRequireDefault(require("./theme.js"));
26
+ var _uiAlerts = require("@instructure/ui-alerts");
26
27
  var _dec, _class, _StimulusEditInfo;
27
28
  /** @jsx jsx */
28
29
  var _ref3 = (0, _emotion.jsx)(_uiIcons.IconUpdownLine, {
@@ -103,6 +104,16 @@ var StimulusEditInfo = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.defau
103
104
  value: "top"
104
105
  }, (0, _formatMessage.default)('Questions below'))));
105
106
  }
107
+ }, {
108
+ key: "renderPassageAlert",
109
+ value: function renderPassageAlert(stimulus) {
110
+ if (!stimulus.passage || !this.props.shuffleQuestionsEnabled) {
111
+ return null;
112
+ }
113
+ return (0, _emotion.jsx)(_uiAlerts.Alert, {
114
+ variant: "warning"
115
+ }, (0, _formatMessage.default)('The passage sections may not appear in their original order due to the shuffle setting.'));
116
+ }
106
117
  }, {
107
118
  key: "renderInstructions",
108
119
  value: function renderInstructions(stimulus) {
@@ -153,7 +164,7 @@ var StimulusEditInfo = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.defau
153
164
  }, (0, _emotion.jsx)(_uiHeading.Heading, {
154
165
  level: "h3",
155
166
  as: "h2"
156
- }, this.headerText(stimulus)), (0, _emotion.jsx)("div", {
167
+ }, this.headerText(stimulus)), this.renderPassageAlert(stimulus), (0, _emotion.jsx)("div", {
157
168
  css: this.props.styles.section
158
169
  }, (0, _emotion.jsx)(_quizCommon.TextInput, {
159
170
  messages: this.inputErrors('title'),
@@ -191,9 +202,11 @@ var StimulusEditInfo = (_dec = (0, _quizCommon.withStyleOverrides)(_styles.defau
191
202
  modifyStimulus: _propTypes.default.func.isRequired,
192
203
  setTitleRef: _propTypes.default.func,
193
204
  stimulusOrientationEnabled: _propTypes.default.bool.isRequired,
194
- styles: _propTypes.default.object
205
+ styles: _propTypes.default.object,
206
+ shuffleQuestionsEnabled: _propTypes.default.bool
195
207
  }, _StimulusEditInfo.defaultProps = {
196
208
  isBankedContent: false,
209
+ shuffleQuestionsEnabled: false,
197
210
  setTitleRef: function setTitleRef() {}
198
211
  }, _StimulusEditInfo)) || _class);
199
212
  exports.StimulusEditInfo = StimulusEditInfo;
@@ -15,13 +15,13 @@ var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-p
15
15
  var _uiIcons = require("@instructure/ui-icons");
16
16
  var _emotion = require("@instructure/emotion");
17
17
  var _uiText = require("@instructure/ui-text");
18
+ var _quizCommon = require("@instructure/quiz-common");
18
19
  var _index = _interopRequireDefault(require("../StimulusShowInfo/index.js"));
19
20
  var _index2 = _interopRequireDefault(require("../../../../../building/components/resources/ActionButtons/index.js"));
20
21
  var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
21
22
  var _styles = _interopRequireDefault(require("./styles.js"));
22
23
  var _theme = _interopRequireDefault(require("./theme.js"));
23
24
  var _index3 = _interopRequireDefault(require("../../../shared/overlay/index.js"));
24
- var _quizCommon = require("@instructure/quiz-common");
25
25
  var _dec, _class, _StimulusShow;
26
26
  /** @jsx jsx */
27
27
  /* eslint "jsx-a11y/click-events-have-key-events": "warn" */
package/lib/index.js CHANGED
@@ -203,6 +203,7 @@ var _exportNames = {
203
203
  getQuizById: true,
204
204
  getActiveQuizId: true,
205
205
  getQuizEntryById: true,
206
+ getQuizEntriesByQuizId: true,
206
207
  isActiveQuizWorkingInstanceOneQuestionAtATime: true,
207
208
  getActiveQuiz: true,
208
209
  getItemById: true,
@@ -1383,6 +1384,12 @@ Object.defineProperty(exports, "getQuizEntryById", {
1383
1384
  return _quizzes3.getQuizEntryById;
1384
1385
  }
1385
1386
  });
1387
+ Object.defineProperty(exports, "getQuizEntriesByQuizId", {
1388
+ enumerable: true,
1389
+ get: function get() {
1390
+ return _quizzes3.getQuizEntriesByQuizId;
1391
+ }
1392
+ });
1386
1393
  Object.defineProperty(exports, "isActiveQuizWorkingInstanceOneQuestionAtATime", {
1387
1394
  enumerable: true,
1388
1395
  get: function get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "21.0.1-rc.2+ea7f5f447",
3
+ "version": "21.0.1-rc.5+d404b6c7f",
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.2+ea7f5f447",
50
- "@instructure/quiz-i18n": "21.0.1-rc.2+ea7f5f447",
51
- "@instructure/quiz-interactions": "21.0.1-rc.2+ea7f5f447",
52
- "@instructure/quiz-number-input": "21.0.1-rc.2+ea7f5f447",
53
- "@instructure/quiz-rce": "21.0.1-rc.2+ea7f5f447",
49
+ "@instructure/quiz-common": "21.0.1-rc.5+d404b6c7f",
50
+ "@instructure/quiz-i18n": "21.0.1-rc.5+d404b6c7f",
51
+ "@instructure/quiz-interactions": "21.0.1-rc.5+d404b6c7f",
52
+ "@instructure/quiz-number-input": "21.0.1-rc.5+d404b6c7f",
53
+ "@instructure/quiz-rce": "21.0.1-rc.5+d404b6c7f",
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.2+ea7f5f447",
112
+ "instructure-validations": "21.0.1-rc.5+d404b6c7f",
113
113
  "ipaddr.js": "^1.5.4",
114
114
  "isomorphic-fetch": "^2.2.0",
115
115
  "isuuid": "^0.1.0",
@@ -159,7 +159,7 @@
159
159
  "jquery": "^2.2.3",
160
160
  "karma-junit-reporter": "^2.0.1",
161
161
  "most-subject": "^5.3.0",
162
- "quiz-presets": "21.0.1-rc.2+ea7f5f447",
162
+ "quiz-presets": "21.0.1-rc.5+d404b6c7f",
163
163
  "react": "^16.8.6",
164
164
  "react-addons-test-utils": "^15.6.2",
165
165
  "react-dom": "^16.8.6",
@@ -175,5 +175,5 @@
175
175
  "publishConfig": {
176
176
  "access": "public"
177
177
  },
178
- "gitHead": "ea7f5f447468891ba1903586059ba55f52bdf9c9"
178
+ "gitHead": "d404b6c7fd8bb68c358df62a1bdd990fc386c2ac"
179
179
  }