@instructure/quiz-core 20.2.2-rc.1 → 20.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [20.3.0](https://gerrit.instructure.com/quizzes-ui/compare/v20.2.1...v20.3.0) (2024-01-24)
7
+
8
+ **Note:** Version bump only for package @instructure/quiz-core
9
+
10
+
11
+
12
+
13
+
6
14
  ## [20.2.1](https://gerrit.instructure.com/quizzes-ui/compare/v20.2.0...v20.2.1) (2024-01-22)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/quiz-core
@@ -104,15 +104,13 @@ export var MatchingTypeTable = (_dec = themeable(theme, styles), _dec(_class = (
104
104
  count = answer.count;
105
105
  var answerNumberCellId = "answer-number-cell-".concat(questionKey, "-").concat(answerKey, "-").concat(itemId);
106
106
  var containerClassNames = classNames((_classNames = {}, _defineProperty(_classNames, styles.correctRowBorder, answer.correct), _defineProperty(_classNames, styles.correctRowBorderRadius, answer.correct), _classNames));
107
- var correctAnswerText = t('Correct answer');
108
- var screenReaderContent = correct ? "".concat(correctAnswerText, ": ").concat(count) : count;
109
107
  return /*#__PURE__*/React.createElement(Table.Cell, {
110
108
  id: answerNumberCellId,
111
109
  key: answerNumberCellId,
112
110
  themeOverride: {
113
111
  padding: '0 0 0 0'
114
112
  }
115
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/React.createElement("div", {
113
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, correct ? "".concat(t('Correct answer'), ": ").concat(count) : count), /*#__PURE__*/React.createElement("div", {
116
114
  className: containerClassNames
117
115
  }, /*#__PURE__*/React.createElement(Flex, {
118
116
  direction: "row",
@@ -26,11 +26,11 @@ export var OrderingType = /*#__PURE__*/function (_Component) {
26
26
 
27
27
  _this = _super.call.apply(_super, [this].concat(args));
28
28
 
29
- _this.updateAnswerBody = function (answerSummary) {
30
- var translateBody = function translateBody(index) {
31
- return "".concat(t('Order'), " ").concat(index);
32
- };
29
+ _this.translateBody = function (index) {
30
+ return "".concat(t('Order'), " ").concat(index);
31
+ };
33
32
 
33
+ _this.updateAnswerBody = function (answerSummary) {
34
34
  var answerSummaryCopy = _objectSpread({}, answerSummary);
35
35
 
36
36
  Object.keys(answerSummaryCopy.questions).forEach(function (questionKey) {
@@ -39,7 +39,7 @@ export var OrderingType = /*#__PURE__*/function (_Component) {
39
39
  answerSummaryCopy.questions[questionKey].answers[answerKey] = _objectSpread(_objectSpread({}, detail), {}, {
40
40
  // Body cannot be used because because re-render of the component add Order
41
41
  // as many time we have to re-render. Only re-assignment works.
42
- body: translateBody(Number(answerKey) + 1)
42
+ body: _this.translateBody(Number(answerKey) + 1)
43
43
  });
44
44
  });
45
45
  });
@@ -143,13 +143,16 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
143
143
  return !!no_answer;
144
144
  };
145
145
 
146
+ _this.getCorrectLabel = function () {
147
+ return _this.partialCorrectExist() ? t('Fully correct') : t('Correct');
148
+ };
149
+
146
150
  _this.renderCorrect = function () {
147
151
  var aggregate = _this.props.answerSummary.aggregate;
148
152
  var correct = aggregate.correct;
149
153
  var correctCount = correct.count || 0;
150
154
  var correctPercentage = correct.percentage || 0;
151
- var correctLabel = _this.partialCorrectExist() ? t('Fully correct') : t('Correct');
152
- return _this.renderRow(correctKey, _ref, correctLabel, correctCount, correctPercentage);
155
+ return _this.renderRow(correctKey, _ref, _this.getCorrectLabel(), correctCount, correctPercentage);
153
156
  };
154
157
 
155
158
  _this.renderPartialCorrect = function () {
@@ -157,8 +160,7 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
157
160
  var partial_correct = aggregate.partial_correct;
158
161
  var partialCorrectCount = partial_correct.count || 0;
159
162
  var partialCorrectPercentage = partial_correct.percentage || 0;
160
- var partialCorrectLabel = t('Partially correct');
161
- return _this.renderRow(partialCorrectKey, _ref2, partialCorrectLabel, partialCorrectCount, partialCorrectPercentage);
163
+ return _this.renderRow(partialCorrectKey, _ref2, t('Partially correct'), partialCorrectCount, partialCorrectPercentage);
162
164
  };
163
165
 
164
166
  _this.renderIncorrect = function () {
@@ -166,16 +168,14 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
166
168
  var incorrect = aggregate.incorrect;
167
169
  var incorrectCount = incorrect.count || 0;
168
170
  var incorrectPercentage = incorrect.percentage || 0;
169
- var incorrectLabel = t('Incorrect');
170
- return _this.renderRow(incorrectKey, _ref3, incorrectLabel, incorrectCount, incorrectPercentage);
171
+ return _this.renderRow(incorrectKey, _ref3, t('Incorrect'), incorrectCount, incorrectPercentage);
171
172
  };
172
173
 
173
174
  _this.renderNoAnswer = function () {
174
175
  var no_answer = _this.props.answerSummary.no_answer;
175
176
  var noAnswerCount = no_answer.count || 0;
176
177
  var noAnswerPercentage = no_answer.percentage || 0;
177
- var noAnswerLabel = t('No response');
178
- return _this.renderRow(noAnswerKey, _ref4, noAnswerLabel, noAnswerCount, noAnswerPercentage);
178
+ return _this.renderRow(noAnswerKey, _ref4, t('No response'), noAnswerCount, noAnswerPercentage);
179
179
  };
180
180
 
181
181
  _this.getColorProfile = function () {
@@ -131,15 +131,13 @@ var MatchingTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styl
131
131
  count = answer.count;
132
132
  var answerNumberCellId = "answer-number-cell-".concat(questionKey, "-").concat(answerKey, "-").concat(itemId);
133
133
  var containerClassNames = (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, styles.correctRowBorder, answer.correct), (0, _defineProperty2.default)(_classNames, styles.correctRowBorderRadius, answer.correct), _classNames));
134
- var correctAnswerText = (0, _formatMessage.default)('Correct answer');
135
- var screenReaderContent = correct ? "".concat(correctAnswerText, ": ").concat(count) : count;
136
134
  return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
137
135
  id: answerNumberCellId,
138
136
  key: answerNumberCellId,
139
137
  themeOverride: {
140
138
  padding: '0 0 0 0'
141
139
  }
142
- }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/_react.default.createElement("div", {
140
+ }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, correct ? "".concat((0, _formatMessage.default)('Correct answer'), ": ").concat(count) : count), /*#__PURE__*/_react.default.createElement("div", {
143
141
  className: containerClassNames
144
142
  }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
145
143
  direction: "row",
@@ -49,11 +49,11 @@ var OrderingType = /*#__PURE__*/function (_Component) {
49
49
 
50
50
  _this = _super.call.apply(_super, [this].concat(args));
51
51
 
52
- _this.updateAnswerBody = function (answerSummary) {
53
- var translateBody = function translateBody(index) {
54
- return "".concat((0, _formatMessage.default)('Order'), " ").concat(index);
55
- };
52
+ _this.translateBody = function (index) {
53
+ return "".concat((0, _formatMessage.default)('Order'), " ").concat(index);
54
+ };
56
55
 
56
+ _this.updateAnswerBody = function (answerSummary) {
57
57
  var answerSummaryCopy = (0, _objectSpread2.default)({}, answerSummary);
58
58
  Object.keys(answerSummaryCopy.questions).forEach(function (questionKey) {
59
59
  Object.keys(answerSummaryCopy.questions[questionKey].answers).forEach(function (answerKey) {
@@ -61,7 +61,7 @@ var OrderingType = /*#__PURE__*/function (_Component) {
61
61
  answerSummaryCopy.questions[questionKey].answers[answerKey] = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, detail), {}, {
62
62
  // Body cannot be used because because re-render of the component add Order
63
63
  // as many time we have to re-render. Only re-assignment works.
64
- body: translateBody(Number(answerKey) + 1)
64
+ body: _this.translateBody(Number(answerKey) + 1)
65
65
  });
66
66
  });
67
67
  });
@@ -170,13 +170,16 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
170
170
  return !!no_answer;
171
171
  };
172
172
 
173
+ _this.getCorrectLabel = function () {
174
+ return _this.partialCorrectExist() ? (0, _formatMessage.default)('Fully correct') : (0, _formatMessage.default)('Correct');
175
+ };
176
+
173
177
  _this.renderCorrect = function () {
174
178
  var aggregate = _this.props.answerSummary.aggregate;
175
179
  var correct = aggregate.correct;
176
180
  var correctCount = correct.count || 0;
177
181
  var correctPercentage = correct.percentage || 0;
178
- var correctLabel = _this.partialCorrectExist() ? (0, _formatMessage.default)('Fully correct') : (0, _formatMessage.default)('Correct');
179
- return _this.renderRow(correctKey, _ref, correctLabel, correctCount, correctPercentage);
182
+ return _this.renderRow(correctKey, _ref, _this.getCorrectLabel(), correctCount, correctPercentage);
180
183
  };
181
184
 
182
185
  _this.renderPartialCorrect = function () {
@@ -184,8 +187,7 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
184
187
  var partial_correct = aggregate.partial_correct;
185
188
  var partialCorrectCount = partial_correct.count || 0;
186
189
  var partialCorrectPercentage = partial_correct.percentage || 0;
187
- var partialCorrectLabel = (0, _formatMessage.default)('Partially correct');
188
- return _this.renderRow(partialCorrectKey, _ref2, partialCorrectLabel, partialCorrectCount, partialCorrectPercentage);
190
+ return _this.renderRow(partialCorrectKey, _ref2, (0, _formatMessage.default)('Partially correct'), partialCorrectCount, partialCorrectPercentage);
189
191
  };
190
192
 
191
193
  _this.renderIncorrect = function () {
@@ -193,16 +195,14 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
193
195
  var incorrect = aggregate.incorrect;
194
196
  var incorrectCount = incorrect.count || 0;
195
197
  var incorrectPercentage = incorrect.percentage || 0;
196
- var incorrectLabel = (0, _formatMessage.default)('Incorrect');
197
- return _this.renderRow(incorrectKey, _ref3, incorrectLabel, incorrectCount, incorrectPercentage);
198
+ return _this.renderRow(incorrectKey, _ref3, (0, _formatMessage.default)('Incorrect'), incorrectCount, incorrectPercentage);
198
199
  };
199
200
 
200
201
  _this.renderNoAnswer = function () {
201
202
  var no_answer = _this.props.answerSummary.no_answer;
202
203
  var noAnswerCount = no_answer.count || 0;
203
204
  var noAnswerPercentage = no_answer.percentage || 0;
204
- var noAnswerLabel = (0, _formatMessage.default)('No response');
205
- return _this.renderRow(noAnswerKey, _ref4, noAnswerLabel, noAnswerCount, noAnswerPercentage);
205
+ return _this.renderRow(noAnswerKey, _ref4, (0, _formatMessage.default)('No response'), noAnswerCount, noAnswerPercentage);
206
206
  };
207
207
 
208
208
  _this.getColorProfile = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.2.2-rc.1+312b3d698",
3
+ "version": "20.3.0",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -44,11 +44,11 @@
44
44
  "@instructure/emotion": "^8.51.0",
45
45
  "@instructure/grading-utils": "^1.0.0",
46
46
  "@instructure/outcomes-ui": "^3.0.0",
47
- "@instructure/quiz-common": "20.2.2-rc.1+312b3d698",
48
- "@instructure/quiz-i18n": "20.2.2-rc.1+312b3d698",
49
- "@instructure/quiz-interactions": "20.2.2-rc.1+312b3d698",
50
- "@instructure/quiz-number-input": "20.2.2-rc.1+312b3d698",
51
- "@instructure/quiz-rce": "20.2.2-rc.1+312b3d698",
47
+ "@instructure/quiz-common": "^20.3.0",
48
+ "@instructure/quiz-i18n": "^20.3.0",
49
+ "@instructure/quiz-interactions": "^20.3.0",
50
+ "@instructure/quiz-number-input": "^20.3.0",
51
+ "@instructure/quiz-rce": "^20.3.0",
52
52
  "@instructure/ui-a11y-content": "^8.51.0",
53
53
  "@instructure/ui-alerts": "^8.51.0",
54
54
  "@instructure/ui-avatar": "^8.51.0",
@@ -110,7 +110,7 @@
110
110
  "file-saver": "~2.0.5",
111
111
  "humps": "^2.0.0",
112
112
  "immutable": "^3.8.1",
113
- "instructure-validations": "20.2.2-rc.1+312b3d698",
113
+ "instructure-validations": "^20.3.0",
114
114
  "ipaddr.js": "^1.5.4",
115
115
  "isomorphic-fetch": "^2.2.0",
116
116
  "isuuid": "^0.1.0",
@@ -142,7 +142,7 @@
142
142
  "uuid": "^3.2.1"
143
143
  },
144
144
  "devDependencies": {
145
- "@instructure/quiz-scripts": "20.2.1",
145
+ "@instructure/quiz-scripts": "^20.3.0",
146
146
  "@instructure/ui-axe-check": "^8.51.0",
147
147
  "@instructure/ui-babel-preset": "^7.22.1",
148
148
  "@instructure/ui-karma-config": "^7.22.1",
@@ -162,7 +162,7 @@
162
162
  "intl": "^1.2.4",
163
163
  "jquery": "^2.2.3",
164
164
  "most-subject": "^5.3.0",
165
- "quiz-presets": "20.2.2-rc.1+312b3d698",
165
+ "quiz-presets": "^20.3.0",
166
166
  "react": "^16.8.6",
167
167
  "react-addons-test-utils": "^15.6.2",
168
168
  "react-dom": "^16.8.6",
@@ -178,5 +178,5 @@
178
178
  "publishConfig": {
179
179
  "access": "public"
180
180
  },
181
- "gitHead": "312b3d698c5d79ad5ce00acdaf4961e849fd1fed"
181
+ "gitHead": "21bdcc2f14296373ba225782aa54d8f7c7627db0"
182
182
  }