@instructure/quiz-core 19.0.1-rc.1 → 19.0.1-rc.3

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.
Files changed (15) hide show
  1. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +75 -34
  2. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +1 -0
  3. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +4 -0
  4. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/presenter.js +6 -5
  5. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/theme.js +6 -0
  6. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
  7. package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
  8. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +76 -34
  9. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +1 -0
  10. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +4 -0
  11. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/presenter.js +7 -5
  12. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AfsPartsContainer/theme.js +13 -0
  13. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
  14. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
  15. package/package.json +9 -9
@@ -1,9 +1,10 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
6
 
6
- var _dec, _class, _class2, _temp;
7
+ var _rowStyleMap, _dec, _class, _class2, _temp;
7
8
 
8
9
  import React, { Component } from 'react';
9
10
  import t from '@instructure/quiz-i18n/es/format-message';
@@ -13,18 +14,19 @@ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
13
14
  import PropTypes from 'prop-types';
14
15
  import { choiceTypeAnswerSummaryPropType } from "../../../propTypes.js";
15
16
  var styles = {
16
- componentId: 'TErmM',
17
+ componentId: 'elvBp',
17
18
  template: function template(theme) {
18
- return "\n\n.TErmM_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.TErmM_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.TErmM_SVtU table tbody tr th{font-weight:400;height:1px;width:33.33%}\n\n.TErmM_SVtU table tbody tr td{height:1px;width:33.33%}\n\n.TErmM_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.TErmM_EKAb{background-color:").concat(theme.colorGreen || 'inherit', ";border-radius:4px 0 0 4px}\n\n.TErmM_EKAb svg{fill:#fff}\n\n.TErmM_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.TErmM_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.TErmM_tnta{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid;border-width:2px 0}\n\n.TErmM_fvqY{border-radius:0 4px 4px 0;border-width:2px 2px 2px 0}");
19
+ return "\n\n.elvBp_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.elvBp_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.elvBp_SVtU table{border-collapse:separate;border-spacing:0 1px}\n\n.elvBp_eviJ table thead tr td,.elvBp_eviJ table thead tr th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_SVtU table tbody tr th{font-weight:400;width:33.33%}\n\n.elvBp_SVtU table tbody tr td{width:33.33%}\n\n.elvBp_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.elvBp_EKAb{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.elvBp_EKAb svg{fill:#fff}\n\n.elvBp_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.elvBp_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.elvBp_eEOp td,.elvBp_eEOp th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_UAZE td{border-width:2px 0 2px 0}\n\n.elvBp_UAZE td,.elvBp_UAZE th:first-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid}\n\n.elvBp_UAZE th:first-child{border-radius:4px 0 0 4px;border-width:2px 0 2px 2px}\n\n.elvBp_UAZE td:last-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}");
19
20
  },
20
- 'tableWrapper': 'TErmM_rMrG',
21
- 'tableContainer': 'TErmM_SVtU',
22
- 'iconWrapper': 'TErmM_cvRx',
23
- 'iconCorrect': 'TErmM_EKAb',
24
- 'textContainer': 'TErmM_cCmC',
25
- 'firstTextContainer': 'TErmM_dJVn',
26
- 'correctRowBorder': 'TErmM_tnta',
27
- 'correctRowBorderRadius': 'TErmM_fvqY'
21
+ 'tableWrapper': 'elvBp_rMrG',
22
+ 'tableContainer': 'elvBp_SVtU',
23
+ 'headerGrayBottomBorder': 'elvBp_eviJ',
24
+ 'iconWrapper': 'elvBp_cvRx',
25
+ 'iconCorrect': 'elvBp_EKAb',
26
+ 'textContainer': 'elvBp_cCmC',
27
+ 'firstTextContainer': 'elvBp_dJVn',
28
+ 'incorrectRow': 'elvBp_eEOp',
29
+ 'correctRow': 'elvBp_UAZE'
28
30
  };
29
31
  import theme from "./theme.js";
30
32
  import classNames from 'classnames';
@@ -32,6 +34,9 @@ import { IconCheckSolid, IconXSolid } from '@instructure/ui-icons';
32
34
  import { extractTextFromHtml } from '@instructure/quiz-interactions';
33
35
  import { Flex } from '@instructure/ui-flex';
34
36
  import { Text } from '@instructure/ui-text';
37
+ var correctAttribute = 'correct';
38
+ var incorrectAttribute = 'incorrect';
39
+ var rowStyleMap = (_rowStyleMap = {}, _defineProperty(_rowStyleMap, correctAttribute, styles.correctRow), _defineProperty(_rowStyleMap, incorrectAttribute, styles.incorrectRow), _rowStyleMap);
35
40
 
36
41
  var _ref = /*#__PURE__*/React.createElement(IconCheckSolid, null);
37
42
 
@@ -60,24 +65,15 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
60
65
  }, correct ? _ref : _ref2);
61
66
  };
62
67
 
63
- _this.renderFirstCell = function (correct, content) {
64
- var className = classNames(styles.firstTextContainer, _defineProperty({}, styles.correctRowBorder, correct));
68
+ _this.renderFirstCell = function (content) {
69
+ var className = classNames(styles.firstTextContainer);
65
70
  return /*#__PURE__*/React.createElement("div", {
66
71
  className: className
67
72
  }, content);
68
73
  };
69
74
 
70
- _this.renderMiddleCell = function (correct, content) {
71
- var className = classNames(styles.textContainer, _defineProperty({}, styles.correctRowBorder, correct));
72
- return /*#__PURE__*/React.createElement("div", {
73
- className: className
74
- }, content);
75
- };
76
-
77
- _this.renderLastCell = function (correct, content) {
78
- var _classNames4;
79
-
80
- var className = classNames(styles.textContainer, (_classNames4 = {}, _defineProperty(_classNames4, styles.correctRowBorder, correct), _defineProperty(_classNames4, styles.correctRowBorderRadius, correct), _classNames4));
75
+ _this.renderCell = function (content) {
76
+ var className = classNames(styles.textContainer);
81
77
  return /*#__PURE__*/React.createElement("div", {
82
78
  className: className
83
79
  }, content);
@@ -93,6 +89,23 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
93
89
  return _this.answerLabel(correct);
94
90
  };
95
91
 
92
+ _this.nextChoiceIsCorrect = function (choices, choiceIndex) {
93
+ var _choices$choiceIndex;
94
+
95
+ return (_choices$choiceIndex = choices[choiceIndex]) === null || _choices$choiceIndex === void 0 ? void 0 : _choices$choiceIndex.correct;
96
+ };
97
+
98
+ _this.getDataIconAttribute = function (correct, choiceIndex) {
99
+ var answerSummary = _this.props.answerSummary;
100
+ var choices = answerSummary.choices;
101
+
102
+ if (_this.nextChoiceIsCorrect(choices, choiceIndex + 1) && !correct) {
103
+ return '';
104
+ }
105
+
106
+ return correct ? correctAttribute : incorrectAttribute;
107
+ };
108
+
96
109
  _this.renderRow = function (choice, choiceIndex) {
97
110
  var correct = choice.correct,
98
111
  body = choice.body;
@@ -103,7 +116,7 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
103
116
  return /*#__PURE__*/React.createElement(Table.Row, {
104
117
  key: choiceIndex
105
118
  }, /*#__PURE__*/React.createElement(Table.RowHeader, {
106
- theme: {
119
+ themeOverride: {
107
120
  padding: '0'
108
121
  }
109
122
  }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/React.createElement(Flex, {
@@ -114,20 +127,46 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
114
127
  textAlign: "center",
115
128
  align: "stretch"
116
129
  }, /*#__PURE__*/React.createElement("div", {
130
+ "data-icon": _this.getDataIconAttribute(correct, choiceIndex),
117
131
  className: classNames(styles.iconWrapper)
118
132
  }, _this.renderIcon(correct))), /*#__PURE__*/React.createElement(Flex.Item, {
119
133
  shouldShrink: true,
120
134
  shouldGrow: true
121
- }, /*#__PURE__*/React.createElement(Text, null, _this.renderFirstCell(correct, extractedBody))))), /*#__PURE__*/React.createElement(Table.Cell, {
122
- theme: {
135
+ }, /*#__PURE__*/React.createElement(Text, null, _this.renderFirstCell(extractedBody))))), /*#__PURE__*/React.createElement(Table.Cell, {
136
+ themeOverride: {
123
137
  padding: '0'
124
138
  }
125
- }, _this.renderMiddleCell(correct, choice.count)), /*#__PURE__*/React.createElement(Table.Cell, {
126
- theme: {
139
+ }, _this.renderCell(choice.count)), /*#__PURE__*/React.createElement(Table.Cell, {
140
+ themeOverride: {
127
141
  padding: '0'
128
142
  },
129
143
  textAlign: "center"
130
- }, _this.renderLastCell(correct, "".concat(choice.percentage, "%"))));
144
+ }, _this.renderCell("".concat(choice.percentage, "%"))));
145
+ };
146
+
147
+ _this.componentDidMount = function () {
148
+ if (_this.tableRef) {
149
+ var _iterator = _createForOfIteratorHelper(_this.tableRef.rows),
150
+ _step;
151
+
152
+ try {
153
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
154
+ var _row$querySelector, _row$querySelector$da;
155
+
156
+ var row = _step.value;
157
+ var icon = (_row$querySelector = row.querySelector('tr th:first-child [data-icon]')) === null || _row$querySelector === void 0 ? void 0 : (_row$querySelector$da = _row$querySelector.dataset) === null || _row$querySelector$da === void 0 ? void 0 : _row$querySelector$da.icon;
158
+ row.classList.add(rowStyleMap[icon]);
159
+ }
160
+ } catch (err) {
161
+ _iterator.e(err);
162
+ } finally {
163
+ _iterator.f();
164
+ }
165
+ }
166
+ };
167
+
168
+ _this.setTableRef = function (el) {
169
+ return _this.tableRef = el;
131
170
  };
132
171
 
133
172
  _this.render = function () {
@@ -138,14 +177,16 @@ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_t
138
177
  var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
139
178
  var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
140
179
  var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
180
+ var containerClasses = classNames(styles.tableContainer, _defineProperty({}, styles.headerGrayBottomBorder, !_this.nextChoiceIsCorrect(choices, 0)));
141
181
  return /*#__PURE__*/React.createElement("div", {
142
- className: classNames(styles.tableContainer)
182
+ className: containerClasses
143
183
  }, /*#__PURE__*/React.createElement(Table, {
144
- caption: t('Answer Frequency Summary')
184
+ caption: t('Answer Frequency Summary'),
185
+ elementRef: _this.setTableRef
145
186
  }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.ColHeader, {
146
187
  id: answerHeaderId,
147
188
  height: "47px",
148
- theme: {
189
+ themeOverride: {
149
190
  padding: '0 0 0 57px'
150
191
  }
151
192
  }, t('Answer')), /*#__PURE__*/React.createElement(Table.ColHeader, {
@@ -3,6 +3,7 @@ export default function generator(_ref) {
3
3
  return {
4
4
  tableBottomPadding: spacing.medium,
5
5
  colorGreen: '#0b874b',
6
+ colorGray: '#C7CDD1',
6
7
  cellPadding: '0.75rem 0.75rem'
7
8
  };
8
9
  }
@@ -49,6 +49,10 @@ export var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
49
49
  if (afsFlags.trueFalseEnabled) {
50
50
  _this.afsTableComponentMap.set('true-false', ChoiceType);
51
51
  }
52
+
53
+ if (afsFlags.choiceEnabled) {
54
+ _this.afsTableComponentMap.set('choice', ChoiceType);
55
+ }
52
56
  };
53
57
 
54
58
  _this.render = function () {
@@ -9,15 +9,16 @@ import React, { Component } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import { themeable } from '@instructure/ui-themeable';
11
11
  var styles = {
12
- componentId: 'dApXZ',
12
+ componentId: 'DjkQc',
13
13
  template: function template(theme) {
14
- return "\n\n.dApXZ_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.dApXZ_ellB{margin-top:13px}";
14
+ return "\n\n.DjkQc_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.DjkQc_ellB{margin-top:".concat(theme.marginOfTables || 'inherit', "}");
15
15
  },
16
- 'tableContainer': 'dApXZ_SVtU',
17
- 'aggregateContainer': 'dApXZ_ellB'
16
+ 'tableContainer': 'DjkQc_SVtU',
17
+ 'aggregateContainer': 'DjkQc_ellB'
18
18
  };
19
19
  import classNames from 'classnames';
20
- export var AfsPartsContainer = (_dec = themeable({}, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
20
+ import theme from "./theme.js";
21
+ export var AfsPartsContainer = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
21
22
  _inherits(AfsPartsContainer, _Component);
22
23
 
23
24
  var _super = _createSuper(AfsPartsContainer);
@@ -0,0 +1,6 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing;
3
+ return {
4
+ marginOfTables: spacing.medium
5
+ };
6
+ }
@@ -12,7 +12,8 @@ function mapStateToProps(_state) {
12
12
  orderingEnabled: featureOn('ia_ordering_afs'),
13
13
  hotSpotEnabled: featureOn('ia_hot_spot_afs'),
14
14
  categorizationEnabled: featureOn('ia_categorization_afs'),
15
- trueFalseEnabled: featureOn('ia_true_false_afs')
15
+ trueFalseEnabled: featureOn('ia_true_false_afs'),
16
+ choiceEnabled: featureOn('ia_choice_afs')
16
17
  }
17
18
  };
18
19
  }
@@ -88,5 +88,6 @@ export var afsFlags = PropTypes.shape({
88
88
  hotSpotEnabled: PropTypes.bool.isRequired,
89
89
  orderingEnabled: PropTypes.bool.isRequired,
90
90
  categorizationEnabled: PropTypes.bool.isRequired,
91
- trueFalseEnabled: PropTypes.bool.isRequired
91
+ trueFalseEnabled: PropTypes.bool.isRequired,
92
+ choiceEnabled: PropTypes.bool.isRequired
92
93
  });
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.ChoiceTypeTable = void 0;
11
11
 
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
13
13
 
14
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
15
 
@@ -17,6 +17,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
17
17
 
18
18
  var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
19
19
 
20
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
+
20
22
  var _react = _interopRequireWildcard(require("react"));
21
23
 
22
24
  var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
@@ -43,22 +45,26 @@ var _uiFlex = require("@instructure/ui-flex");
43
45
 
44
46
  var _uiText = require("@instructure/ui-text");
45
47
 
46
- var _dec, _class, _class2, _temp;
48
+ var _rowStyleMap, _dec, _class, _class2, _temp;
47
49
 
48
50
  var styles = {
49
- componentId: 'TErmM',
51
+ componentId: 'elvBp',
50
52
  template: function template(theme) {
51
- return "\n\n.TErmM_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.TErmM_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.TErmM_SVtU table tbody tr th{font-weight:400;height:1px;width:33.33%}\n\n.TErmM_SVtU table tbody tr td{height:1px;width:33.33%}\n\n.TErmM_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.TErmM_EKAb{background-color:").concat(theme.colorGreen || 'inherit', ";border-radius:4px 0 0 4px}\n\n.TErmM_EKAb svg{fill:#fff}\n\n.TErmM_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.TErmM_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.TErmM_tnta{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid;border-width:2px 0}\n\n.TErmM_fvqY{border-radius:0 4px 4px 0;border-width:2px 2px 2px 0}");
53
+ return "\n\n.elvBp_rMrG{display:flex;flex-basis:100%;flex-direction:column;padding-bottom:".concat(theme.tableBottomPadding || 'inherit', "}\n\n.elvBp_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.elvBp_SVtU table{border-collapse:separate;border-spacing:0 1px}\n\n.elvBp_eviJ table thead tr td,.elvBp_eviJ table thead tr th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_SVtU table tbody tr th{font-weight:400;width:33.33%}\n\n.elvBp_SVtU table tbody tr td{width:33.33%}\n\n.elvBp_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.elvBp_EKAb{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.elvBp_EKAb svg{fill:#fff}\n\n.elvBp_cCmC{align-items:center;display:flex;height:calc(100% - 4px);justify-content:center}\n\n.elvBp_dJVn{padding:").concat(theme.cellPadding || 'inherit', "}\n\n.elvBp_eEOp td,.elvBp_eEOp th{border-bottom:solid 0.0625rem ").concat(theme.colorGray || 'inherit', "}\n\n.elvBp_UAZE td{border-width:2px 0 2px 0}\n\n.elvBp_UAZE td,.elvBp_UAZE th:first-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-style:solid}\n\n.elvBp_UAZE th:first-child{border-radius:4px 0 0 4px;border-width:2px 0 2px 2px}\n\n.elvBp_UAZE td:last-child{border-color:").concat(theme.colorGreen || 'inherit', ";border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}");
52
54
  },
53
- 'tableWrapper': 'TErmM_rMrG',
54
- 'tableContainer': 'TErmM_SVtU',
55
- 'iconWrapper': 'TErmM_cvRx',
56
- 'iconCorrect': 'TErmM_EKAb',
57
- 'textContainer': 'TErmM_cCmC',
58
- 'firstTextContainer': 'TErmM_dJVn',
59
- 'correctRowBorder': 'TErmM_tnta',
60
- 'correctRowBorderRadius': 'TErmM_fvqY'
55
+ 'tableWrapper': 'elvBp_rMrG',
56
+ 'tableContainer': 'elvBp_SVtU',
57
+ 'headerGrayBottomBorder': 'elvBp_eviJ',
58
+ 'iconWrapper': 'elvBp_cvRx',
59
+ 'iconCorrect': 'elvBp_EKAb',
60
+ 'textContainer': 'elvBp_cCmC',
61
+ 'firstTextContainer': 'elvBp_dJVn',
62
+ 'incorrectRow': 'elvBp_eEOp',
63
+ 'correctRow': 'elvBp_UAZE'
61
64
  };
65
+ var correctAttribute = 'correct';
66
+ var incorrectAttribute = 'incorrect';
67
+ var rowStyleMap = (_rowStyleMap = {}, (0, _defineProperty2.default)(_rowStyleMap, correctAttribute, styles.correctRow), (0, _defineProperty2.default)(_rowStyleMap, incorrectAttribute, styles.incorrectRow), _rowStyleMap);
62
68
 
63
69
  var _ref = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null);
64
70
 
@@ -87,24 +93,15 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
87
93
  }, correct ? _ref : _ref2);
88
94
  };
89
95
 
90
- _this.renderFirstCell = function (correct, content) {
91
- var className = (0, _classnames.default)(styles.firstTextContainer, (0, _defineProperty2.default)({}, styles.correctRowBorder, correct));
96
+ _this.renderFirstCell = function (content) {
97
+ var className = (0, _classnames.default)(styles.firstTextContainer);
92
98
  return /*#__PURE__*/_react.default.createElement("div", {
93
99
  className: className
94
100
  }, content);
95
101
  };
96
102
 
97
- _this.renderMiddleCell = function (correct, content) {
98
- var className = (0, _classnames.default)(styles.textContainer, (0, _defineProperty2.default)({}, styles.correctRowBorder, correct));
99
- return /*#__PURE__*/_react.default.createElement("div", {
100
- className: className
101
- }, content);
102
- };
103
-
104
- _this.renderLastCell = function (correct, content) {
105
- var _classNames4;
106
-
107
- var className = (0, _classnames.default)(styles.textContainer, (_classNames4 = {}, (0, _defineProperty2.default)(_classNames4, styles.correctRowBorder, correct), (0, _defineProperty2.default)(_classNames4, styles.correctRowBorderRadius, correct), _classNames4));
103
+ _this.renderCell = function (content) {
104
+ var className = (0, _classnames.default)(styles.textContainer);
108
105
  return /*#__PURE__*/_react.default.createElement("div", {
109
106
  className: className
110
107
  }, content);
@@ -120,6 +117,23 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
120
117
  return _this.answerLabel(correct);
121
118
  };
122
119
 
120
+ _this.nextChoiceIsCorrect = function (choices, choiceIndex) {
121
+ var _choices$choiceIndex;
122
+
123
+ return (_choices$choiceIndex = choices[choiceIndex]) === null || _choices$choiceIndex === void 0 ? void 0 : _choices$choiceIndex.correct;
124
+ };
125
+
126
+ _this.getDataIconAttribute = function (correct, choiceIndex) {
127
+ var answerSummary = _this.props.answerSummary;
128
+ var choices = answerSummary.choices;
129
+
130
+ if (_this.nextChoiceIsCorrect(choices, choiceIndex + 1) && !correct) {
131
+ return '';
132
+ }
133
+
134
+ return correct ? correctAttribute : incorrectAttribute;
135
+ };
136
+
123
137
  _this.renderRow = function (choice, choiceIndex) {
124
138
  var correct = choice.correct,
125
139
  body = choice.body;
@@ -130,7 +144,7 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
130
144
  return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, {
131
145
  key: choiceIndex
132
146
  }, /*#__PURE__*/_react.default.createElement(_uiTable.Table.RowHeader, {
133
- theme: {
147
+ themeOverride: {
134
148
  padding: '0'
135
149
  }
136
150
  }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
@@ -141,20 +155,46 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
141
155
  textAlign: "center",
142
156
  align: "stretch"
143
157
  }, /*#__PURE__*/_react.default.createElement("div", {
158
+ "data-icon": _this.getDataIconAttribute(correct, choiceIndex),
144
159
  className: (0, _classnames.default)(styles.iconWrapper)
145
160
  }, _this.renderIcon(correct))), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
146
161
  shouldShrink: true,
147
162
  shouldGrow: true
148
- }, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, _this.renderFirstCell(correct, extractedBody))))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
149
- theme: {
163
+ }, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, _this.renderFirstCell(extractedBody))))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
164
+ themeOverride: {
150
165
  padding: '0'
151
166
  }
152
- }, _this.renderMiddleCell(correct, choice.count)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
153
- theme: {
167
+ }, _this.renderCell(choice.count)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
168
+ themeOverride: {
154
169
  padding: '0'
155
170
  },
156
171
  textAlign: "center"
157
- }, _this.renderLastCell(correct, "".concat(choice.percentage, "%"))));
172
+ }, _this.renderCell("".concat(choice.percentage, "%"))));
173
+ };
174
+
175
+ _this.componentDidMount = function () {
176
+ if (_this.tableRef) {
177
+ var _iterator = (0, _createForOfIteratorHelper2.default)(_this.tableRef.rows),
178
+ _step;
179
+
180
+ try {
181
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
182
+ var _row$querySelector, _row$querySelector$da;
183
+
184
+ var row = _step.value;
185
+ var icon = (_row$querySelector = row.querySelector('tr th:first-child [data-icon]')) === null || _row$querySelector === void 0 ? void 0 : (_row$querySelector$da = _row$querySelector.dataset) === null || _row$querySelector$da === void 0 ? void 0 : _row$querySelector$da.icon;
186
+ row.classList.add(rowStyleMap[icon]);
187
+ }
188
+ } catch (err) {
189
+ _iterator.e(err);
190
+ } finally {
191
+ _iterator.f();
192
+ }
193
+ }
194
+ };
195
+
196
+ _this.setTableRef = function (el) {
197
+ return _this.tableRef = el;
158
198
  };
159
199
 
160
200
  _this.render = function () {
@@ -165,14 +205,16 @@ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles
165
205
  var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
166
206
  var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
167
207
  var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
208
+ var containerClasses = (0, _classnames.default)(styles.tableContainer, (0, _defineProperty2.default)({}, styles.headerGrayBottomBorder, !_this.nextChoiceIsCorrect(choices, 0)));
168
209
  return /*#__PURE__*/_react.default.createElement("div", {
169
- className: (0, _classnames.default)(styles.tableContainer)
210
+ className: containerClasses
170
211
  }, /*#__PURE__*/_react.default.createElement(_uiTable.Table, {
171
- caption: (0, _formatMessage.default)('Answer Frequency Summary')
212
+ caption: (0, _formatMessage.default)('Answer Frequency Summary'),
213
+ elementRef: _this.setTableRef
172
214
  }, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Head, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
173
215
  id: answerHeaderId,
174
216
  height: "47px",
175
- theme: {
217
+ themeOverride: {
176
218
  padding: '0 0 0 57px'
177
219
  }
178
220
  }, (0, _formatMessage.default)('Answer')), /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
@@ -10,6 +10,7 @@ function generator(_ref) {
10
10
  return {
11
11
  tableBottomPadding: spacing.medium,
12
12
  colorGreen: '#0b874b',
13
+ colorGray: '#C7CDD1',
13
14
  cellPadding: '0.75rem 0.75rem'
14
15
  };
15
16
  }
@@ -70,6 +70,10 @@ var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
70
70
  if (afsFlags.trueFalseEnabled) {
71
71
  _this.afsTableComponentMap.set('true-false', _index2.default);
72
72
  }
73
+
74
+ if (afsFlags.choiceEnabled) {
75
+ _this.afsTableComponentMap.set('choice', _index2.default);
76
+ }
73
77
  };
74
78
 
75
79
  _this.render = function () {
@@ -25,17 +25,19 @@ var _uiThemeable = require("@instructure/ui-themeable");
25
25
 
26
26
  var _classnames = _interopRequireDefault(require("classnames"));
27
27
 
28
+ var _theme = _interopRequireDefault(require("./theme.js"));
29
+
28
30
  var _dec, _class, _class2, _temp;
29
31
 
30
32
  var styles = {
31
- componentId: 'dApXZ',
33
+ componentId: 'DjkQc',
32
34
  template: function template(theme) {
33
- return "\n\n.dApXZ_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.dApXZ_ellB{margin-top:13px}";
35
+ return "\n\n.DjkQc_SVtU{max-width:100%;width:calc(25% + 350px)}\n\n.DjkQc_ellB{margin-top:".concat(theme.marginOfTables || 'inherit', "}");
34
36
  },
35
- 'tableContainer': 'dApXZ_SVtU',
36
- 'aggregateContainer': 'dApXZ_ellB'
37
+ 'tableContainer': 'DjkQc_SVtU',
38
+ 'aggregateContainer': 'DjkQc_ellB'
37
39
  };
38
- var AfsPartsContainer = (_dec = (0, _uiThemeable.themeable)({}, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
40
+ var AfsPartsContainer = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
39
41
  (0, _inherits2.default)(AfsPartsContainer, _Component);
40
42
 
41
43
  var _super = (0, _createSuper2.default)(AfsPartsContainer);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = generator;
7
+
8
+ function generator(_ref) {
9
+ var spacing = _ref.spacing;
10
+ return {
11
+ marginOfTables: spacing.medium
12
+ };
13
+ }
@@ -21,7 +21,8 @@ function mapStateToProps(_state) {
21
21
  orderingEnabled: (0, _featureCheck.featureOn)('ia_ordering_afs'),
22
22
  hotSpotEnabled: (0, _featureCheck.featureOn)('ia_hot_spot_afs'),
23
23
  categorizationEnabled: (0, _featureCheck.featureOn)('ia_categorization_afs'),
24
- trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs')
24
+ trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs'),
25
+ choiceEnabled: (0, _featureCheck.featureOn)('ia_choice_afs')
25
26
  }
26
27
  };
27
28
  }
@@ -121,7 +121,8 @@ var afsFlags = _propTypes.default.shape({
121
121
  hotSpotEnabled: _propTypes.default.bool.isRequired,
122
122
  orderingEnabled: _propTypes.default.bool.isRequired,
123
123
  categorizationEnabled: _propTypes.default.bool.isRequired,
124
- trueFalseEnabled: _propTypes.default.bool.isRequired
124
+ trueFalseEnabled: _propTypes.default.bool.isRequired,
125
+ choiceEnabled: _propTypes.default.bool.isRequired
125
126
  });
126
127
 
127
128
  exports.afsFlags = afsFlags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "19.0.1-rc.1+3fe6f47b6",
3
+ "version": "19.0.1-rc.3+ccf710abb",
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.48.3",
45
45
  "@instructure/grading-utils": "^1.0.0",
46
46
  "@instructure/outcomes-ui": "^2.1.9",
47
- "@instructure/quiz-common": "19.0.1-rc.1+3fe6f47b6",
48
- "@instructure/quiz-i18n": "19.0.1-rc.1+3fe6f47b6",
49
- "@instructure/quiz-interactions": "19.0.1-rc.1+3fe6f47b6",
50
- "@instructure/quiz-number-input": "19.0.1-rc.1+3fe6f47b6",
51
- "@instructure/quiz-rce": "19.0.1-rc.1+3fe6f47b6",
47
+ "@instructure/quiz-common": "19.0.1-rc.3+ccf710abb",
48
+ "@instructure/quiz-i18n": "19.0.1-rc.3+ccf710abb",
49
+ "@instructure/quiz-interactions": "19.0.1-rc.3+ccf710abb",
50
+ "@instructure/quiz-number-input": "19.0.1-rc.3+ccf710abb",
51
+ "@instructure/quiz-rce": "19.0.1-rc.3+ccf710abb",
52
52
  "@instructure/ui-a11y-content": "^8.48.3",
53
53
  "@instructure/ui-alerts": "^8.48.3",
54
54
  "@instructure/ui-avatar": "^8.48.3",
@@ -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": "19.0.1-rc.1+3fe6f47b6",
113
+ "instructure-validations": "19.0.1-rc.3+ccf710abb",
114
114
  "ipaddr.js": "^1.5.4",
115
115
  "isomorphic-fetch": "^2.2.0",
116
116
  "isuuid": "^0.1.0",
@@ -161,7 +161,7 @@
161
161
  "intl": "^1.2.4",
162
162
  "jquery": "^2.2.3",
163
163
  "most-subject": "^5.3.0",
164
- "quiz-presets": "19.0.1-rc.1+3fe6f47b6",
164
+ "quiz-presets": "19.0.1-rc.3+ccf710abb",
165
165
  "react": "^16.8.6",
166
166
  "react-addons-test-utils": "^15.6.2",
167
167
  "react-dom": "^16.8.6",
@@ -177,5 +177,5 @@
177
177
  "publishConfig": {
178
178
  "access": "public"
179
179
  },
180
- "gitHead": "3fe6f47b67edf23b4154addc8df80af2060f85bd"
180
+ "gitHead": "ccf710abbb15a38788222e936bbdfbf710087793"
181
181
  }