@instructure/quiz-core 19.0.0 → 19.0.1-rc.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.
Files changed (21) hide show
  1. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/index.js +1 -0
  2. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +169 -0
  3. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +8 -0
  4. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/index.js +1 -0
  5. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/presenter.js +51 -0
  6. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/MatchingType/MatchingTypeTable/presenter.js +8 -1
  7. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +5 -0
  8. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AggregationTable/presenter.js +41 -22
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
  11. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/index.js +13 -0
  12. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/presenter.js +197 -0
  13. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/ChoiceTypeTable/theme.js +15 -0
  14. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/index.js +13 -0
  15. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/ChoiceType/presenter.js +74 -0
  16. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/MatchingType/MatchingTypeTable/presenter.js +9 -1
  17. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/presenter.js +13 -7
  18. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnswerFrequencySummary/shared/AggregationTable/presenter.js +41 -22
  19. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -1
  20. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/propTypes.js +2 -1
  21. package/package.json +10 -10
@@ -0,0 +1 @@
1
+ export { ChoiceTypeTable as default } from "./presenter.js";
@@ -0,0 +1,169 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+
6
+ var _dec, _class, _class2, _temp;
7
+
8
+ import React, { Component } from 'react';
9
+ import t from '@instructure/quiz-i18n/es/format-message';
10
+ import { Table } from '@instructure/ui-table';
11
+ import { themeable } from '@instructure/ui-themeable';
12
+ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
13
+ import PropTypes from 'prop-types';
14
+ import { choiceTypeAnswerSummaryPropType } from "../../../propTypes.js";
15
+ var styles = {
16
+ componentId: 'TErmM',
17
+ 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
+ },
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'
28
+ };
29
+ import theme from "./theme.js";
30
+ import classNames from 'classnames';
31
+ import { IconCheckSolid, IconXSolid } from '@instructure/ui-icons';
32
+ import { extractTextFromHtml } from '@instructure/quiz-interactions';
33
+ import { Flex } from '@instructure/ui-flex';
34
+ import { Text } from '@instructure/ui-text';
35
+
36
+ var _ref = /*#__PURE__*/React.createElement(IconCheckSolid, null);
37
+
38
+ var _ref2 = /*#__PURE__*/React.createElement(IconXSolid, null);
39
+
40
+ export var ChoiceTypeTable = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
41
+ _inherits(ChoiceTypeTable, _Component);
42
+
43
+ var _super = _createSuper(ChoiceTypeTable);
44
+
45
+ function ChoiceTypeTable() {
46
+ var _this;
47
+
48
+ _classCallCheck(this, ChoiceTypeTable);
49
+
50
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+
54
+ _this = _super.call.apply(_super, [this].concat(args));
55
+
56
+ _this.renderIcon = function (correct) {
57
+ var className = classNames(styles.iconWrapper, _defineProperty({}, styles.iconCorrect, correct));
58
+ return /*#__PURE__*/React.createElement("div", {
59
+ className: className
60
+ }, correct ? _ref : _ref2);
61
+ };
62
+
63
+ _this.renderFirstCell = function (correct, content) {
64
+ var className = classNames(styles.firstTextContainer, _defineProperty({}, styles.correctRowBorder, correct));
65
+ return /*#__PURE__*/React.createElement("div", {
66
+ className: className
67
+ }, content);
68
+ };
69
+
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));
81
+ return /*#__PURE__*/React.createElement("div", {
82
+ className: className
83
+ }, content);
84
+ };
85
+
86
+ _this.answerLabel = function (correct) {
87
+ return correct ? t('Correct answer') : t('Incorrect answer');
88
+ };
89
+
90
+ _this.extractChoiceText = function (choiceBody, correct) {
91
+ var text = extractTextFromHtml(choiceBody);
92
+ if (text.trim().length > 0) return text;
93
+ return _this.answerLabel(correct);
94
+ };
95
+
96
+ _this.renderRow = function (choice, choiceIndex) {
97
+ var correct = choice.correct,
98
+ body = choice.body;
99
+
100
+ var extractedBody = _this.extractChoiceText(body, correct);
101
+
102
+ var screenReaderContent = "".concat(_this.answerLabel(correct), ": ").concat(extractedBody);
103
+ return /*#__PURE__*/React.createElement(Table.Row, {
104
+ key: choiceIndex
105
+ }, /*#__PURE__*/React.createElement(Table.RowHeader, {
106
+ theme: {
107
+ padding: '0'
108
+ }
109
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/React.createElement(Flex, {
110
+ direction: "row",
111
+ alignItems: "center"
112
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
113
+ width: "46px",
114
+ textAlign: "center",
115
+ align: "stretch"
116
+ }, /*#__PURE__*/React.createElement("div", {
117
+ className: classNames(styles.iconWrapper)
118
+ }, _this.renderIcon(correct))), /*#__PURE__*/React.createElement(Flex.Item, {
119
+ shouldShrink: true,
120
+ shouldGrow: true
121
+ }, /*#__PURE__*/React.createElement(Text, null, _this.renderFirstCell(correct, extractedBody))))), /*#__PURE__*/React.createElement(Table.Cell, {
122
+ theme: {
123
+ padding: '0'
124
+ }
125
+ }, _this.renderMiddleCell(correct, choice.count)), /*#__PURE__*/React.createElement(Table.Cell, {
126
+ theme: {
127
+ padding: '0'
128
+ },
129
+ textAlign: "center"
130
+ }, _this.renderLastCell(correct, "".concat(choice.percentage, "%"))));
131
+ };
132
+
133
+ _this.render = function () {
134
+ var _this$props = _this.props,
135
+ answerSummary = _this$props.answerSummary,
136
+ itemId = _this$props.itemId;
137
+ var choices = answerSummary.choices;
138
+ var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
139
+ var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
140
+ var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
141
+ return /*#__PURE__*/React.createElement("div", {
142
+ className: classNames(styles.tableContainer)
143
+ }, /*#__PURE__*/React.createElement(Table, {
144
+ caption: t('Answer Frequency Summary')
145
+ }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.ColHeader, {
146
+ id: answerHeaderId,
147
+ height: "47px",
148
+ theme: {
149
+ padding: '0 0 0 57px'
150
+ }
151
+ }, t('Answer')), /*#__PURE__*/React.createElement(Table.ColHeader, {
152
+ id: respondentsHeaderId,
153
+ height: "47px",
154
+ textAlign: "center"
155
+ }, t('Respondents')), /*#__PURE__*/React.createElement(Table.ColHeader, {
156
+ id: percentageHeaderId,
157
+ height: "47px",
158
+ textAlign: "center"
159
+ }, t('%')))), /*#__PURE__*/React.createElement(Table.Body, null, choices.map(_this.renderRow))));
160
+ };
161
+
162
+ return _this;
163
+ }
164
+
165
+ return ChoiceTypeTable;
166
+ }(Component), _class2.propTypes = {
167
+ itemId: PropTypes.number,
168
+ answerSummary: choiceTypeAnswerSummaryPropType
169
+ }.isRequired, _temp)) || _class);
@@ -0,0 +1,8 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing;
3
+ return {
4
+ tableBottomPadding: spacing.medium,
5
+ colorGreen: '#0b874b',
6
+ cellPadding: '0.75rem 0.75rem'
7
+ };
8
+ }
@@ -0,0 +1 @@
1
+ export { ChoiceType as default } from "./presenter.js";
@@ -0,0 +1,51 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
3
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
4
+ import React, { Component } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import ChoiceTypeTable from "./ChoiceTypeTable/index.js";
7
+ import { choiceTypeAnswerSummaryPropType } from "../../propTypes.js";
8
+ import AggregationTable from "../shared/AggregationTable/index.js";
9
+ import { AfsPartsContainer } from "../shared/AfsPartsContainer/presenter.js";
10
+ import AfsTableWrapper from "../shared/AfsTableWrapper/index.js";
11
+ export var ChoiceType = /*#__PURE__*/function (_Component) {
12
+ _inherits(ChoiceType, _Component);
13
+
14
+ var _super = _createSuper(ChoiceType);
15
+
16
+ function ChoiceType() {
17
+ var _this;
18
+
19
+ _classCallCheck(this, ChoiceType);
20
+
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+
25
+ _this = _super.call.apply(_super, [this].concat(args));
26
+
27
+ _this.render = function () {
28
+ var _this$props = _this.props,
29
+ answerSummary = _this$props.answerSummary,
30
+ itemId = _this$props.itemId;
31
+ return /*#__PURE__*/React.createElement(AfsTableWrapper, null, /*#__PURE__*/React.createElement(AfsPartsContainer, {
32
+ afsTable: /*#__PURE__*/React.createElement(ChoiceTypeTable, {
33
+ itemId: itemId,
34
+ answerSummary: answerSummary
35
+ }),
36
+ aggregationTable: /*#__PURE__*/React.createElement(AggregationTable, {
37
+ itemId: itemId,
38
+ answerSummary: answerSummary
39
+ })
40
+ }));
41
+ };
42
+
43
+ return _this;
44
+ }
45
+
46
+ return ChoiceType;
47
+ }(Component);
48
+ ChoiceType.propTypes = {
49
+ itemId: PropTypes.number,
50
+ answerSummary: choiceTypeAnswerSummaryPropType
51
+ }.isRequired;
@@ -30,6 +30,7 @@ import MatchingTypeOrderer from "../utils/matchingTypeOrderer.js";
30
30
  import { extractTextFromHtml } from '@instructure/quiz-interactions';
31
31
  import classNames from 'classnames';
32
32
  import theme from "./theme.js";
33
+ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
33
34
 
34
35
  var _ref = /*#__PURE__*/React.createElement(IconCheckSolid, null);
35
36
 
@@ -86,6 +87,10 @@ export var MatchingTypeTable = (_dec = themeable(theme, styles), _dec(_class = (
86
87
  }, answer.body)));
87
88
  };
88
89
 
90
+ _this.answerLabel = function (correct) {
91
+ return correct ? t('Correct answer') : t('Incorrect answer');
92
+ };
93
+
89
94
  _this.renderCell = function (questionKey, answerKey) {
90
95
  var _classNames;
91
96
 
@@ -99,13 +104,15 @@ export var MatchingTypeTable = (_dec = themeable(theme, styles), _dec(_class = (
99
104
  count = answer.count;
100
105
  var answerNumberCellId = "answer-number-cell-".concat(questionKey, "-").concat(answerKey, "-").concat(itemId);
101
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;
102
109
  return /*#__PURE__*/React.createElement(Table.Cell, {
103
110
  id: answerNumberCellId,
104
111
  key: answerNumberCellId,
105
112
  themeOverride: {
106
113
  padding: '0 0 0 0'
107
114
  }
108
- }, /*#__PURE__*/React.createElement("div", {
115
+ }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/React.createElement("div", {
109
116
  className: containerClassNames
110
117
  }, /*#__PURE__*/React.createElement(Flex, {
111
118
  direction: "row",
@@ -4,6 +4,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
4
4
  import React, { Component } from 'react';
5
5
  import { PropTypes } from '@instructure/quiz-interactions';
6
6
  import LegacyChoiceType from "./LegacyChoiceType/index.js";
7
+ import ChoiceType from "./ChoiceType/index.js";
7
8
  import AggregationType from "./AggregationType/index.js";
8
9
  import { MatchingType, OrderingType, CategorizationType } from "./MatchingType/index.js";
9
10
  import { afsFlags, answerSummaryPropType } from "../propTypes.js";
@@ -44,6 +45,10 @@ export var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
44
45
  if (afsFlags.categorizationEnabled) {
45
46
  _this.afsTableComponentMap.set('categorization', CategorizationType);
46
47
  }
48
+
49
+ if (afsFlags.trueFalseEnabled) {
50
+ _this.afsTableComponentMap.set('true-false', ChoiceType);
51
+ }
47
52
  };
48
53
 
49
54
  _this.render = function () {
@@ -14,23 +14,24 @@ import { IconCheckSolid, IconXSolid, IconNoSolid, IconOvalHalfSolid } from '@ins
14
14
  import { themeable } from '@instructure/ui-themeable';
15
15
  import theme from "./theme.js";
16
16
  var styles = {
17
- componentId: 'UvxSZ',
17
+ componentId: 'fSsSV',
18
18
  template: function template(theme) {
19
- return "\n\n.UvxSZ_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.UvxSZ_fPIL{min-width:500px}\n\n.UvxSZ_fPIL table{border-collapse:separate;border-spacing:0 12px}\n\n.UvxSZ_fPIL thead th{border-color:".concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}\n\n.UvxSZ_fPIL table tbody tr td{border-style:solid;border-width:2px 0 2px 0;width:33.33%}\n\n.UvxSZ_fPIL table tbody tr th:first-child{border-radius:4px 0 0 4px;border-style:solid;border-width:2px 0 2px 2px;font-weight:400}\n\n.UvxSZ_fPIL table tbody tr td:last-child{border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}\n\n.UvxSZ_fZpZ table tbody tr:first-child td,.UvxSZ_fZpZ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_fZpZ table tbody tr:nth-child(2) td,.UvxSZ_fZpZ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:first-child td,.UvxSZ_dgTJ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:nth-child(2) td,.UvxSZ_dgTJ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:nth-child(3) td,.UvxSZ_dgTJ table tbody tr:nth-child(3) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:first-child td,.UvxSZ_bUPM table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(2) td,.UvxSZ_bUPM table tbody tr:nth-child(2) th{border-color:").concat(theme.colorBlue || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(3) td,.UvxSZ_bUPM table tbody tr:nth-child(3) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(4) td,.UvxSZ_bUPM table tbody tr:nth-child(4) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_bvau{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_cxOH{background-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_eRkO{background-color:").concat(theme.colorBlue || 'inherit', "}\n\n.UvxSZ_eKcq{background-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_euQM{padding:12px 0 12px 10px}\n\n.UvxSZ_fuuc{padding-left:45px}\n\n.UvxSZ_vDgC svg{fill:#fff}\n\n.UvxSZ_fHMm{border-color:").concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}");
19
+ return "\n\n.fSsSV_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.fSsSV_fPIL{min-width:500px}\n\n.fSsSV_fPIL table{border-collapse:separate;border-spacing:0 12px}\n\n.fSsSV_fPIL thead th{border-color:".concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}\n\n.fSsSV_fPIL table tbody tr td{border-style:solid;border-width:2px 0 2px 0;width:33.33%}\n\n.fSsSV_fPIL table tbody tr th:first-child{border-radius:4px 0 0 4px;border-style:solid;border-width:2px 0 2px 2px;font-weight:400}\n\n.fSsSV_fPIL table tbody tr td:last-child{border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}\n\n.fSsSV_dzqP table tbody tr:first-child td,.fSsSV_dzqP table tbody tr:first-child th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_fZpZ table tbody tr:first-child td,.fSsSV_fZpZ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_fZpZ table tbody tr:nth-child(2) td,.fSsSV_fZpZ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:first-child td,.fSsSV_dgTJ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:nth-child(2) td,.fSsSV_dgTJ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:nth-child(3) td,.fSsSV_dgTJ table tbody tr:nth-child(3) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:first-child td,.fSsSV_bUPM table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(2) td,.fSsSV_bUPM table tbody tr:nth-child(2) th{border-color:").concat(theme.colorBlue || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(3) td,.fSsSV_bUPM table tbody tr:nth-child(3) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(4) td,.fSsSV_bUPM table tbody tr:nth-child(4) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_bvau{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_cxOH{background-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_eRkO{background-color:").concat(theme.colorBlue || 'inherit', "}\n\n.fSsSV_eKcq{background-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_euQM{padding:12px 0 12px 10px}\n\n.fSsSV_fuuc{padding-left:45px}\n\n.fSsSV_vDgC svg{fill:#fff}\n\n.fSsSV_fHMm{border-color:").concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}");
20
20
  },
21
- 'iconWrapper': 'UvxSZ_cvRx',
22
- 'collapsingTable': 'UvxSZ_fPIL',
23
- 'correctIncorrect': 'UvxSZ_fZpZ',
24
- 'correctIncorrectNoanswer': 'UvxSZ_dgTJ',
25
- 'correctIncorrectNoanswerPartial': 'UvxSZ_bUPM',
26
- 'correctBackground': 'UvxSZ_bvau',
27
- 'incorrectBackground': 'UvxSZ_cxOH',
28
- 'partialCorrectBackground': 'UvxSZ_eRkO',
29
- 'noAnswerBackground': 'UvxSZ_eKcq',
30
- 'labelWrapper': 'UvxSZ_euQM',
31
- 'firstHeaderCell': 'UvxSZ_fuuc',
32
- 'iconWhite': 'UvxSZ_vDgC',
33
- 'headerCell': 'UvxSZ_fHMm'
21
+ 'iconWrapper': 'fSsSV_cvRx',
22
+ 'collapsingTable': 'fSsSV_fPIL',
23
+ 'onlyNoanswer': 'fSsSV_dzqP',
24
+ 'correctIncorrect': 'fSsSV_fZpZ',
25
+ 'correctIncorrectNoanswer': 'fSsSV_dgTJ',
26
+ 'correctIncorrectNoanswerPartial': 'fSsSV_bUPM',
27
+ 'correctBackground': 'fSsSV_bvau',
28
+ 'incorrectBackground': 'fSsSV_cxOH',
29
+ 'partialCorrectBackground': 'fSsSV_eRkO',
30
+ 'noAnswerBackground': 'fSsSV_eKcq',
31
+ 'labelWrapper': 'fSsSV_euQM',
32
+ 'firstHeaderCell': 'fSsSV_fuuc',
33
+ 'iconWhite': 'fSsSV_vDgC',
34
+ 'headerCell': 'fSsSV_fHMm'
34
35
  };
35
36
  import { Flex } from '@instructure/ui-flex';
36
37
  import classNames from 'classnames';
@@ -117,12 +118,22 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
117
118
  }, /*#__PURE__*/React.createElement(Text, null, concatenatedPercentage)));
118
119
  };
119
120
 
120
- _this.isPartialCorrectExist = function () {
121
+ _this.partialCorrectExist = function () {
121
122
  var aggregate = _this.props.answerSummary.aggregate;
122
123
  return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.partial_correct);
123
124
  };
124
125
 
125
- _this.isNoAnswerExist = function () {
126
+ _this.correctExist = function () {
127
+ var aggregate = _this.props.answerSummary.aggregate;
128
+ return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.correct);
129
+ };
130
+
131
+ _this.incorrectExist = function () {
132
+ var aggregate = _this.props.answerSummary.aggregate;
133
+ return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.incorrect);
134
+ };
135
+
136
+ _this.noAnswerExist = function () {
126
137
  var no_answer = _this.props.answerSummary.no_answer;
127
138
  return !!no_answer;
128
139
  };
@@ -132,7 +143,7 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
132
143
  var correct = aggregate.correct;
133
144
  var correctCount = correct.count || 0;
134
145
  var correctPercentage = correct.percentage || 0;
135
- var correctLabel = _this.isPartialCorrectExist() ? t('Answered fully correctly') : t('Answered correctly');
146
+ var correctLabel = _this.partialCorrectExist() ? t('Answered fully correctly') : t('Answered correctly');
136
147
  return _this.renderRow(correctKey, _ref, correctLabel, correctCount, correctPercentage);
137
148
  };
138
149
 
@@ -150,7 +161,7 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
150
161
  var incorrect = aggregate.incorrect;
151
162
  var incorrectCount = incorrect.count || 0;
152
163
  var incorrectPercentage = incorrect.percentage || 0;
153
- var incorrectLabel = _this.isPartialCorrectExist() ? t('Answered fully incorrectly') : t('Answered incorrectly');
164
+ var incorrectLabel = _this.partialCorrectExist() ? t('Answered fully incorrectly') : t('Answered incorrectly');
154
165
  return _this.renderRow(incorrectKey, _ref3, incorrectLabel, incorrectCount, incorrectPercentage);
155
166
  };
156
167
 
@@ -165,10 +176,18 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
165
176
  _this.getColorProfile = function () {
166
177
  var colorProfile;
167
178
 
168
- if (!_this.isPartialCorrectExist() && _this.isNoAnswerExist()) {
179
+ var correctIncorrectNoAnswerPartial = _this.partialCorrectExist() && _this.noAnswerExist() && _this.correctExist() && _this.incorrectExist();
180
+
181
+ var correctIncorrectNoAnswer = !_this.partialCorrectExist() && _this.noAnswerExist() && _this.correctExist() && _this.incorrectExist();
182
+
183
+ var onlyNoAnswer = _this.noAnswerExist() && !_this.partialCorrectExist() && !_this.correctExist() && !_this.incorrectExist();
184
+
185
+ if (correctIncorrectNoAnswer) {
169
186
  colorProfile = 'correctIncorrectNoanswer';
170
- } else if (_this.isPartialCorrectExist() && _this.isNoAnswerExist()) {
187
+ } else if (correctIncorrectNoAnswerPartial) {
171
188
  colorProfile = 'correctIncorrectNoanswerPartial';
189
+ } else if (onlyNoAnswer) {
190
+ colorProfile = 'onlyNoanswer';
172
191
  } else {
173
192
  colorProfile = 'correctIncorrect';
174
193
  }
@@ -181,7 +200,7 @@ export var AggregationTable = (_dec = themeable(theme, styles), _dec(_class = (_
181
200
  className: classNames(styles.collapsingTable, styles[_this.getColorProfile()])
182
201
  }, /*#__PURE__*/React.createElement(Table, {
183
202
  caption: t('Answer Frequency Summary Aggregates')
184
- }, _this.renderHeaderRow(), /*#__PURE__*/React.createElement(Table.Body, null, _this.renderCorrect(), _this.isPartialCorrectExist() && _this.renderPartialCorrect(), _this.renderIncorrect(), _this.isNoAnswerExist() && _this.renderNoAnswer())));
203
+ }, _this.renderHeaderRow(), /*#__PURE__*/React.createElement(Table.Body, null, _this.correctExist() && _this.renderCorrect(), _this.partialCorrectExist() && _this.renderPartialCorrect(), _this.incorrectExist() && _this.renderIncorrect(), _this.noAnswerExist() && _this.renderNoAnswer())));
185
204
  };
186
205
 
187
206
  return _this;
@@ -11,7 +11,8 @@ function mapStateToProps(_state) {
11
11
  matchingEnabled: featureOn('ia_matching_afs'),
12
12
  orderingEnabled: featureOn('ia_ordering_afs'),
13
13
  hotSpotEnabled: featureOn('ia_hot_spot_afs'),
14
- categorizationEnabled: featureOn('ia_categorization_afs')
14
+ categorizationEnabled: featureOn('ia_categorization_afs'),
15
+ trueFalseEnabled: featureOn('ia_true_false_afs')
15
16
  }
16
17
  };
17
18
  }
@@ -87,5 +87,6 @@ export var afsFlags = PropTypes.shape({
87
87
  matchingEnabled: PropTypes.bool.isRequired,
88
88
  hotSpotEnabled: PropTypes.bool.isRequired,
89
89
  orderingEnabled: PropTypes.bool.isRequired,
90
- categorizationEnabled: PropTypes.bool.isRequired
90
+ categorizationEnabled: PropTypes.bool.isRequired,
91
+ trueFalseEnabled: PropTypes.bool.isRequired
91
92
  });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _presenter.ChoiceTypeTable;
10
+ }
11
+ });
12
+
13
+ var _presenter = require("./presenter.js");
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.ChoiceTypeTable = void 0;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
+
16
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
+
18
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
19
+
20
+ var _react = _interopRequireWildcard(require("react"));
21
+
22
+ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
23
+
24
+ var _uiTable = require("@instructure/ui-table");
25
+
26
+ var _uiThemeable = require("@instructure/ui-themeable");
27
+
28
+ var _uiA11yContent = require("@instructure/ui-a11y-content");
29
+
30
+ var _propTypes = _interopRequireDefault(require("prop-types"));
31
+
32
+ var _propTypes2 = require("../../../propTypes.js");
33
+
34
+ var _theme = _interopRequireDefault(require("./theme.js"));
35
+
36
+ var _classnames = _interopRequireDefault(require("classnames"));
37
+
38
+ var _uiIcons = require("@instructure/ui-icons");
39
+
40
+ var _quizInteractions = require("@instructure/quiz-interactions");
41
+
42
+ var _uiFlex = require("@instructure/ui-flex");
43
+
44
+ var _uiText = require("@instructure/ui-text");
45
+
46
+ var _dec, _class, _class2, _temp;
47
+
48
+ var styles = {
49
+ componentId: 'TErmM',
50
+ 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}");
52
+ },
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'
61
+ };
62
+
63
+ var _ref = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, null);
64
+
65
+ var _ref2 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconXSolid, null);
66
+
67
+ var ChoiceTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
68
+ (0, _inherits2.default)(ChoiceTypeTable, _Component);
69
+
70
+ var _super = (0, _createSuper2.default)(ChoiceTypeTable);
71
+
72
+ function ChoiceTypeTable() {
73
+ var _this;
74
+
75
+ (0, _classCallCheck2.default)(this, ChoiceTypeTable);
76
+
77
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
78
+ args[_key] = arguments[_key];
79
+ }
80
+
81
+ _this = _super.call.apply(_super, [this].concat(args));
82
+
83
+ _this.renderIcon = function (correct) {
84
+ var className = (0, _classnames.default)(styles.iconWrapper, (0, _defineProperty2.default)({}, styles.iconCorrect, correct));
85
+ return /*#__PURE__*/_react.default.createElement("div", {
86
+ className: className
87
+ }, correct ? _ref : _ref2);
88
+ };
89
+
90
+ _this.renderFirstCell = function (correct, content) {
91
+ var className = (0, _classnames.default)(styles.firstTextContainer, (0, _defineProperty2.default)({}, styles.correctRowBorder, correct));
92
+ return /*#__PURE__*/_react.default.createElement("div", {
93
+ className: className
94
+ }, content);
95
+ };
96
+
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));
108
+ return /*#__PURE__*/_react.default.createElement("div", {
109
+ className: className
110
+ }, content);
111
+ };
112
+
113
+ _this.answerLabel = function (correct) {
114
+ return correct ? (0, _formatMessage.default)('Correct answer') : (0, _formatMessage.default)('Incorrect answer');
115
+ };
116
+
117
+ _this.extractChoiceText = function (choiceBody, correct) {
118
+ var text = (0, _quizInteractions.extractTextFromHtml)(choiceBody);
119
+ if (text.trim().length > 0) return text;
120
+ return _this.answerLabel(correct);
121
+ };
122
+
123
+ _this.renderRow = function (choice, choiceIndex) {
124
+ var correct = choice.correct,
125
+ body = choice.body;
126
+
127
+ var extractedBody = _this.extractChoiceText(body, correct);
128
+
129
+ var screenReaderContent = "".concat(_this.answerLabel(correct), ": ").concat(extractedBody);
130
+ return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, {
131
+ key: choiceIndex
132
+ }, /*#__PURE__*/_react.default.createElement(_uiTable.Table.RowHeader, {
133
+ theme: {
134
+ padding: '0'
135
+ }
136
+ }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
137
+ direction: "row",
138
+ alignItems: "center"
139
+ }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
140
+ width: "46px",
141
+ textAlign: "center",
142
+ align: "stretch"
143
+ }, /*#__PURE__*/_react.default.createElement("div", {
144
+ className: (0, _classnames.default)(styles.iconWrapper)
145
+ }, _this.renderIcon(correct))), /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
146
+ shouldShrink: true,
147
+ shouldGrow: true
148
+ }, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, _this.renderFirstCell(correct, extractedBody))))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
149
+ theme: {
150
+ padding: '0'
151
+ }
152
+ }, _this.renderMiddleCell(correct, choice.count)), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
153
+ theme: {
154
+ padding: '0'
155
+ },
156
+ textAlign: "center"
157
+ }, _this.renderLastCell(correct, "".concat(choice.percentage, "%"))));
158
+ };
159
+
160
+ _this.render = function () {
161
+ var _this$props = _this.props,
162
+ answerSummary = _this$props.answerSummary,
163
+ itemId = _this$props.itemId;
164
+ var choices = answerSummary.choices;
165
+ var answerHeaderId = "answer-frequency-summary-answer-".concat(itemId);
166
+ var respondentsHeaderId = "answer-frequency-summary-respondents-".concat(itemId);
167
+ var percentageHeaderId = "answer-frequency-summary-percentage-".concat(itemId);
168
+ return /*#__PURE__*/_react.default.createElement("div", {
169
+ className: (0, _classnames.default)(styles.tableContainer)
170
+ }, /*#__PURE__*/_react.default.createElement(_uiTable.Table, {
171
+ caption: (0, _formatMessage.default)('Answer Frequency Summary')
172
+ }, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Head, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.Row, null, /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
173
+ id: answerHeaderId,
174
+ height: "47px",
175
+ theme: {
176
+ padding: '0 0 0 57px'
177
+ }
178
+ }, (0, _formatMessage.default)('Answer')), /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
179
+ id: respondentsHeaderId,
180
+ height: "47px",
181
+ textAlign: "center"
182
+ }, (0, _formatMessage.default)('Respondents')), /*#__PURE__*/_react.default.createElement(_uiTable.Table.ColHeader, {
183
+ id: percentageHeaderId,
184
+ height: "47px",
185
+ textAlign: "center"
186
+ }, (0, _formatMessage.default)('%')))), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Body, null, choices.map(_this.renderRow))));
187
+ };
188
+
189
+ return _this;
190
+ }
191
+
192
+ return ChoiceTypeTable;
193
+ }(_react.Component), _class2.propTypes = {
194
+ itemId: _propTypes.default.number,
195
+ answerSummary: _propTypes2.choiceTypeAnswerSummaryPropType
196
+ }.isRequired, _temp)) || _class);
197
+ exports.ChoiceTypeTable = ChoiceTypeTable;
@@ -0,0 +1,15 @@
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
+ tableBottomPadding: spacing.medium,
12
+ colorGreen: '#0b874b',
13
+ cellPadding: '0.75rem 0.75rem'
14
+ };
15
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _presenter.ChoiceType;
10
+ }
11
+ });
12
+
13
+ var _presenter = require("./presenter.js");
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.ChoiceType = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _propTypes = _interopRequireDefault(require("prop-types"));
21
+
22
+ var _index = _interopRequireDefault(require("./ChoiceTypeTable/index.js"));
23
+
24
+ var _propTypes2 = require("../../propTypes.js");
25
+
26
+ var _index2 = _interopRequireDefault(require("../shared/AggregationTable/index.js"));
27
+
28
+ var _presenter = require("../shared/AfsPartsContainer/presenter.js");
29
+
30
+ var _index3 = _interopRequireDefault(require("../shared/AfsTableWrapper/index.js"));
31
+
32
+ var ChoiceType = /*#__PURE__*/function (_Component) {
33
+ (0, _inherits2.default)(ChoiceType, _Component);
34
+
35
+ var _super = (0, _createSuper2.default)(ChoiceType);
36
+
37
+ function ChoiceType() {
38
+ var _this;
39
+
40
+ (0, _classCallCheck2.default)(this, ChoiceType);
41
+
42
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
+ args[_key] = arguments[_key];
44
+ }
45
+
46
+ _this = _super.call.apply(_super, [this].concat(args));
47
+
48
+ _this.render = function () {
49
+ var _this$props = _this.props,
50
+ answerSummary = _this$props.answerSummary,
51
+ itemId = _this$props.itemId;
52
+ return /*#__PURE__*/_react.default.createElement(_index3.default, null, /*#__PURE__*/_react.default.createElement(_presenter.AfsPartsContainer, {
53
+ afsTable: /*#__PURE__*/_react.default.createElement(_index.default, {
54
+ itemId: itemId,
55
+ answerSummary: answerSummary
56
+ }),
57
+ aggregationTable: /*#__PURE__*/_react.default.createElement(_index2.default, {
58
+ itemId: itemId,
59
+ answerSummary: answerSummary
60
+ })
61
+ }));
62
+ };
63
+
64
+ return _this;
65
+ }
66
+
67
+ return ChoiceType;
68
+ }(_react.Component);
69
+
70
+ exports.ChoiceType = ChoiceType;
71
+ ChoiceType.propTypes = {
72
+ itemId: _propTypes.default.number,
73
+ answerSummary: _propTypes2.choiceTypeAnswerSummaryPropType
74
+ }.isRequired;
@@ -41,6 +41,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
41
41
 
42
42
  var _theme = _interopRequireDefault(require("./theme.js"));
43
43
 
44
+ var _uiA11yContent = require("@instructure/ui-a11y-content");
45
+
44
46
  var _dec, _class, _class2, _temp;
45
47
 
46
48
  var styles = {
@@ -112,6 +114,10 @@ var MatchingTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styl
112
114
  }, answer.body)));
113
115
  };
114
116
 
117
+ _this.answerLabel = function (correct) {
118
+ return correct ? (0, _formatMessage.default)('Correct answer') : (0, _formatMessage.default)('Incorrect answer');
119
+ };
120
+
115
121
  _this.renderCell = function (questionKey, answerKey) {
116
122
  var _classNames;
117
123
 
@@ -125,13 +131,15 @@ var MatchingTypeTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, styl
125
131
  count = answer.count;
126
132
  var answerNumberCellId = "answer-number-cell-".concat(questionKey, "-").concat(answerKey, "-").concat(itemId);
127
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;
128
136
  return /*#__PURE__*/_react.default.createElement(_uiTable.Table.Cell, {
129
137
  id: answerNumberCellId,
130
138
  key: answerNumberCellId,
131
139
  themeOverride: {
132
140
  padding: '0 0 0 0'
133
141
  }
134
- }, /*#__PURE__*/_react.default.createElement("div", {
142
+ }, /*#__PURE__*/_react.default.createElement(_uiA11yContent.ScreenReaderContent, null, screenReaderContent), /*#__PURE__*/_react.default.createElement("div", {
135
143
  className: containerClassNames
136
144
  }, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, {
137
145
  direction: "row",
@@ -21,9 +21,11 @@ var _quizInteractions = require("@instructure/quiz-interactions");
21
21
 
22
22
  var _index = _interopRequireDefault(require("./LegacyChoiceType/index.js"));
23
23
 
24
- var _index2 = _interopRequireDefault(require("./AggregationType/index.js"));
24
+ var _index2 = _interopRequireDefault(require("./ChoiceType/index.js"));
25
25
 
26
- var _index3 = require("./MatchingType/index.js");
26
+ var _index3 = _interopRequireDefault(require("./AggregationType/index.js"));
27
+
28
+ var _index4 = require("./MatchingType/index.js");
27
29
 
28
30
  var _propTypes = require("../propTypes.js");
29
31
 
@@ -46,23 +48,27 @@ var AnswerFrequencySummary = /*#__PURE__*/function (_Component) {
46
48
 
47
49
  _this.addAfsComponentsByFlags = function (afsFlags) {
48
50
  if (afsFlags.formulaEnabled) {
49
- _this.afsTableComponentMap.set('formula', _index2.default);
51
+ _this.afsTableComponentMap.set('formula', _index3.default);
50
52
  }
51
53
 
52
54
  if (afsFlags.hotSpotEnabled) {
53
- _this.afsTableComponentMap.set('hot-spot', _index2.default);
55
+ _this.afsTableComponentMap.set('hot-spot', _index3.default);
54
56
  }
55
57
 
56
58
  if (afsFlags.matchingEnabled) {
57
- _this.afsTableComponentMap.set('matching', _index3.MatchingType);
59
+ _this.afsTableComponentMap.set('matching', _index4.MatchingType);
58
60
  }
59
61
 
60
62
  if (afsFlags.orderingEnabled) {
61
- _this.afsTableComponentMap.set('ordering', _index3.OrderingType);
63
+ _this.afsTableComponentMap.set('ordering', _index4.OrderingType);
62
64
  }
63
65
 
64
66
  if (afsFlags.categorizationEnabled) {
65
- _this.afsTableComponentMap.set('categorization', _index3.CategorizationType);
67
+ _this.afsTableComponentMap.set('categorization', _index4.CategorizationType);
68
+ }
69
+
70
+ if (afsFlags.trueFalseEnabled) {
71
+ _this.afsTableComponentMap.set('true-false', _index2.default);
66
72
  }
67
73
  };
68
74
 
@@ -42,23 +42,24 @@ var _uiText = require("@instructure/ui-text");
42
42
  var _dec, _class, _class2, _temp;
43
43
 
44
44
  var styles = {
45
- componentId: 'UvxSZ',
45
+ componentId: 'fSsSV',
46
46
  template: function template(theme) {
47
- return "\n\n.UvxSZ_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.UvxSZ_fPIL{min-width:500px}\n\n.UvxSZ_fPIL table{border-collapse:separate;border-spacing:0 12px}\n\n.UvxSZ_fPIL thead th{border-color:".concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}\n\n.UvxSZ_fPIL table tbody tr td{border-style:solid;border-width:2px 0 2px 0;width:33.33%}\n\n.UvxSZ_fPIL table tbody tr th:first-child{border-radius:4px 0 0 4px;border-style:solid;border-width:2px 0 2px 2px;font-weight:400}\n\n.UvxSZ_fPIL table tbody tr td:last-child{border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}\n\n.UvxSZ_fZpZ table tbody tr:first-child td,.UvxSZ_fZpZ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_fZpZ table tbody tr:nth-child(2) td,.UvxSZ_fZpZ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:first-child td,.UvxSZ_dgTJ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:nth-child(2) td,.UvxSZ_dgTJ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_dgTJ table tbody tr:nth-child(3) td,.UvxSZ_dgTJ table tbody tr:nth-child(3) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:first-child td,.UvxSZ_bUPM table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(2) td,.UvxSZ_bUPM table tbody tr:nth-child(2) th{border-color:").concat(theme.colorBlue || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(3) td,.UvxSZ_bUPM table tbody tr:nth-child(3) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_bUPM table tbody tr:nth-child(4) td,.UvxSZ_bUPM table tbody tr:nth-child(4) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_bvau{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.UvxSZ_cxOH{background-color:").concat(theme.colorRed || 'inherit', "}\n\n.UvxSZ_eRkO{background-color:").concat(theme.colorBlue || 'inherit', "}\n\n.UvxSZ_eKcq{background-color:").concat(theme.colorGrey || 'inherit', "}\n\n.UvxSZ_euQM{padding:12px 0 12px 10px}\n\n.UvxSZ_fuuc{padding-left:45px}\n\n.UvxSZ_vDgC svg{fill:#fff}\n\n.UvxSZ_fHMm{border-color:").concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}");
47
+ return "\n\n.fSsSV_cvRx{align-items:center;display:flex;height:100%;justify-content:center;min-height:47px;width:46px}\n\n.fSsSV_fPIL{min-width:500px}\n\n.fSsSV_fPIL table{border-collapse:separate;border-spacing:0 12px}\n\n.fSsSV_fPIL thead th{border-color:".concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}\n\n.fSsSV_fPIL table tbody tr td{border-style:solid;border-width:2px 0 2px 0;width:33.33%}\n\n.fSsSV_fPIL table tbody tr th:first-child{border-radius:4px 0 0 4px;border-style:solid;border-width:2px 0 2px 2px;font-weight:400}\n\n.fSsSV_fPIL table tbody tr td:last-child{border-radius:0 4px 4px 0;border-style:solid;border-width:2px 2px 2px 0}\n\n.fSsSV_dzqP table tbody tr:first-child td,.fSsSV_dzqP table tbody tr:first-child th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_fZpZ table tbody tr:first-child td,.fSsSV_fZpZ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_fZpZ table tbody tr:nth-child(2) td,.fSsSV_fZpZ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:first-child td,.fSsSV_dgTJ table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:nth-child(2) td,.fSsSV_dgTJ table tbody tr:nth-child(2) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_dgTJ table tbody tr:nth-child(3) td,.fSsSV_dgTJ table tbody tr:nth-child(3) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:first-child td,.fSsSV_bUPM table tbody tr:first-child th{border-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(2) td,.fSsSV_bUPM table tbody tr:nth-child(2) th{border-color:").concat(theme.colorBlue || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(3) td,.fSsSV_bUPM table tbody tr:nth-child(3) th{border-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_bUPM table tbody tr:nth-child(4) td,.fSsSV_bUPM table tbody tr:nth-child(4) th{border-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_bvau{background-color:").concat(theme.colorGreen || 'inherit', "}\n\n.fSsSV_cxOH{background-color:").concat(theme.colorRed || 'inherit', "}\n\n.fSsSV_eRkO{background-color:").concat(theme.colorBlue || 'inherit', "}\n\n.fSsSV_eKcq{background-color:").concat(theme.colorGrey || 'inherit', "}\n\n.fSsSV_euQM{padding:12px 0 12px 10px}\n\n.fSsSV_fuuc{padding-left:45px}\n\n.fSsSV_vDgC svg{fill:#fff}\n\n.fSsSV_fHMm{border-color:").concat(theme.colorHeaderBottomBorder || 'inherit', ";border-style:solid;border-width:0 0 1px 0}");
48
48
  },
49
- 'iconWrapper': 'UvxSZ_cvRx',
50
- 'collapsingTable': 'UvxSZ_fPIL',
51
- 'correctIncorrect': 'UvxSZ_fZpZ',
52
- 'correctIncorrectNoanswer': 'UvxSZ_dgTJ',
53
- 'correctIncorrectNoanswerPartial': 'UvxSZ_bUPM',
54
- 'correctBackground': 'UvxSZ_bvau',
55
- 'incorrectBackground': 'UvxSZ_cxOH',
56
- 'partialCorrectBackground': 'UvxSZ_eRkO',
57
- 'noAnswerBackground': 'UvxSZ_eKcq',
58
- 'labelWrapper': 'UvxSZ_euQM',
59
- 'firstHeaderCell': 'UvxSZ_fuuc',
60
- 'iconWhite': 'UvxSZ_vDgC',
61
- 'headerCell': 'UvxSZ_fHMm'
49
+ 'iconWrapper': 'fSsSV_cvRx',
50
+ 'collapsingTable': 'fSsSV_fPIL',
51
+ 'onlyNoanswer': 'fSsSV_dzqP',
52
+ 'correctIncorrect': 'fSsSV_fZpZ',
53
+ 'correctIncorrectNoanswer': 'fSsSV_dgTJ',
54
+ 'correctIncorrectNoanswerPartial': 'fSsSV_bUPM',
55
+ 'correctBackground': 'fSsSV_bvau',
56
+ 'incorrectBackground': 'fSsSV_cxOH',
57
+ 'partialCorrectBackground': 'fSsSV_eRkO',
58
+ 'noAnswerBackground': 'fSsSV_eKcq',
59
+ 'labelWrapper': 'fSsSV_euQM',
60
+ 'firstHeaderCell': 'fSsSV_fuuc',
61
+ 'iconWhite': 'fSsSV_vDgC',
62
+ 'headerCell': 'fSsSV_fHMm'
62
63
  };
63
64
  var noAnswerKey = 'noAnswer';
64
65
  var incorrectKey = 'incorrect';
@@ -142,12 +143,22 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
142
143
  }, /*#__PURE__*/_react.default.createElement(_uiText.Text, null, concatenatedPercentage)));
143
144
  };
144
145
 
145
- _this.isPartialCorrectExist = function () {
146
+ _this.partialCorrectExist = function () {
146
147
  var aggregate = _this.props.answerSummary.aggregate;
147
148
  return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.partial_correct);
148
149
  };
149
150
 
150
- _this.isNoAnswerExist = function () {
151
+ _this.correctExist = function () {
152
+ var aggregate = _this.props.answerSummary.aggregate;
153
+ return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.correct);
154
+ };
155
+
156
+ _this.incorrectExist = function () {
157
+ var aggregate = _this.props.answerSummary.aggregate;
158
+ return !!(aggregate === null || aggregate === void 0 ? void 0 : aggregate.incorrect);
159
+ };
160
+
161
+ _this.noAnswerExist = function () {
151
162
  var no_answer = _this.props.answerSummary.no_answer;
152
163
  return !!no_answer;
153
164
  };
@@ -157,7 +168,7 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
157
168
  var correct = aggregate.correct;
158
169
  var correctCount = correct.count || 0;
159
170
  var correctPercentage = correct.percentage || 0;
160
- var correctLabel = _this.isPartialCorrectExist() ? (0, _formatMessage.default)('Answered fully correctly') : (0, _formatMessage.default)('Answered correctly');
171
+ var correctLabel = _this.partialCorrectExist() ? (0, _formatMessage.default)('Answered fully correctly') : (0, _formatMessage.default)('Answered correctly');
161
172
  return _this.renderRow(correctKey, _ref, correctLabel, correctCount, correctPercentage);
162
173
  };
163
174
 
@@ -175,7 +186,7 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
175
186
  var incorrect = aggregate.incorrect;
176
187
  var incorrectCount = incorrect.count || 0;
177
188
  var incorrectPercentage = incorrect.percentage || 0;
178
- var incorrectLabel = _this.isPartialCorrectExist() ? (0, _formatMessage.default)('Answered fully incorrectly') : (0, _formatMessage.default)('Answered incorrectly');
189
+ var incorrectLabel = _this.partialCorrectExist() ? (0, _formatMessage.default)('Answered fully incorrectly') : (0, _formatMessage.default)('Answered incorrectly');
179
190
  return _this.renderRow(incorrectKey, _ref3, incorrectLabel, incorrectCount, incorrectPercentage);
180
191
  };
181
192
 
@@ -190,10 +201,18 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
190
201
  _this.getColorProfile = function () {
191
202
  var colorProfile;
192
203
 
193
- if (!_this.isPartialCorrectExist() && _this.isNoAnswerExist()) {
204
+ var correctIncorrectNoAnswerPartial = _this.partialCorrectExist() && _this.noAnswerExist() && _this.correctExist() && _this.incorrectExist();
205
+
206
+ var correctIncorrectNoAnswer = !_this.partialCorrectExist() && _this.noAnswerExist() && _this.correctExist() && _this.incorrectExist();
207
+
208
+ var onlyNoAnswer = _this.noAnswerExist() && !_this.partialCorrectExist() && !_this.correctExist() && !_this.incorrectExist();
209
+
210
+ if (correctIncorrectNoAnswer) {
194
211
  colorProfile = 'correctIncorrectNoanswer';
195
- } else if (_this.isPartialCorrectExist() && _this.isNoAnswerExist()) {
212
+ } else if (correctIncorrectNoAnswerPartial) {
196
213
  colorProfile = 'correctIncorrectNoanswerPartial';
214
+ } else if (onlyNoAnswer) {
215
+ colorProfile = 'onlyNoanswer';
197
216
  } else {
198
217
  colorProfile = 'correctIncorrect';
199
218
  }
@@ -206,7 +225,7 @@ var AggregationTable = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
206
225
  className: (0, _classnames.default)(styles.collapsingTable, styles[_this.getColorProfile()])
207
226
  }, /*#__PURE__*/_react.default.createElement(_uiTable.Table, {
208
227
  caption: (0, _formatMessage.default)('Answer Frequency Summary Aggregates')
209
- }, _this.renderHeaderRow(), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Body, null, _this.renderCorrect(), _this.isPartialCorrectExist() && _this.renderPartialCorrect(), _this.renderIncorrect(), _this.isNoAnswerExist() && _this.renderNoAnswer())));
228
+ }, _this.renderHeaderRow(), /*#__PURE__*/_react.default.createElement(_uiTable.Table.Body, null, _this.correctExist() && _this.renderCorrect(), _this.partialCorrectExist() && _this.renderPartialCorrect(), _this.incorrectExist() && _this.renderIncorrect(), _this.noAnswerExist() && _this.renderNoAnswer())));
210
229
  };
211
230
 
212
231
  return _this;
@@ -20,7 +20,8 @@ function mapStateToProps(_state) {
20
20
  matchingEnabled: (0, _featureCheck.featureOn)('ia_matching_afs'),
21
21
  orderingEnabled: (0, _featureCheck.featureOn)('ia_ordering_afs'),
22
22
  hotSpotEnabled: (0, _featureCheck.featureOn)('ia_hot_spot_afs'),
23
- categorizationEnabled: (0, _featureCheck.featureOn)('ia_categorization_afs')
23
+ categorizationEnabled: (0, _featureCheck.featureOn)('ia_categorization_afs'),
24
+ trueFalseEnabled: (0, _featureCheck.featureOn)('ia_true_false_afs')
24
25
  }
25
26
  };
26
27
  }
@@ -120,7 +120,8 @@ var afsFlags = _propTypes.default.shape({
120
120
  matchingEnabled: _propTypes.default.bool.isRequired,
121
121
  hotSpotEnabled: _propTypes.default.bool.isRequired,
122
122
  orderingEnabled: _propTypes.default.bool.isRequired,
123
- categorizationEnabled: _propTypes.default.bool.isRequired
123
+ categorizationEnabled: _propTypes.default.bool.isRequired,
124
+ trueFalseEnabled: _propTypes.default.bool.isRequired
124
125
  });
125
126
 
126
127
  exports.afsFlags = afsFlags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "19.0.0",
3
+ "version": "19.0.1-rc.0+f1b45ad5e",
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.0",
48
- "@instructure/quiz-i18n": "^19.0.0",
49
- "@instructure/quiz-interactions": "^19.0.0",
50
- "@instructure/quiz-number-input": "^19.0.0",
51
- "@instructure/quiz-rce": "^19.0.0",
47
+ "@instructure/quiz-common": "19.0.1-rc.0+f1b45ad5e",
48
+ "@instructure/quiz-i18n": "19.0.1-rc.0+f1b45ad5e",
49
+ "@instructure/quiz-interactions": "19.0.1-rc.0+f1b45ad5e",
50
+ "@instructure/quiz-number-input": "19.0.1-rc.0+f1b45ad5e",
51
+ "@instructure/quiz-rce": "19.0.1-rc.0+f1b45ad5e",
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.0",
113
+ "instructure-validations": "19.0.1-rc.0+f1b45ad5e",
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": "^19.0.0",
145
+ "@instructure/quiz-scripts": "19.0.0",
146
146
  "@instructure/ui-axe-check": "^8.48.3",
147
147
  "@instructure/ui-babel-preset": "^7.22.1",
148
148
  "@instructure/ui-karma-config": "^7.22.1",
@@ -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.0",
164
+ "quiz-presets": "19.0.1-rc.0+f1b45ad5e",
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": "080cbf2be218e316025a6be3e28db729dd215126"
180
+ "gitHead": "f1b45ad5ed1c53c9b8929d4acdf3e0b3a6445389"
181
181
  }