@instructure/quiz-core 17.63.1-rc.3 → 17.63.1-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,20 +7,19 @@ var _dec, _class, _class2, _temp;
7
7
 
8
8
  import React, { Component } from 'react';
9
9
  import PropTypes from 'prop-types';
10
+ import { Text } from '@instructure/ui-text';
10
11
  import { Spinner } from '@instructure/ui-spinner';
11
- import { Heading } from '@instructure/ui-heading';
12
12
  import { PresentationContent } from '@instructure/ui-a11y-content';
13
13
  import { themeable } from '@instructure/ui-themeable';
14
14
  import t from '@instructure/quiz-i18n/es/format-message';
15
15
  var styles = {
16
- componentId: 'ebGcj',
16
+ componentId: 'cJgyM',
17
17
  template: function template(theme) {
18
- return "\n\n.ebGcj_gasz{align-items:center;display:inline-flex;flex:1 1 auto;height:100%;justify-content:center;min-height:500px;width:100%}\n\n:root .ebGcj_gasz,_:-ms-fullscreen{height:10rem}\n\n.ebGcj_bZBM .ebGcj_qrQc{flex:1 1 auto}\n\n.ebGcj_fBqo{font-size:".concat(theme.mainTextFontSize || 'inherit', "}");
18
+ return "\n\n.cJgyM_gasz{align-items:center;column-gap:10px;display:inline-flex;flex:1 1 auto;height:100%;justify-content:center;width:100%}\n\n:root .cJgyM_gasz,_:-ms-fullscreen{height:10rem}\n\n.cJgyM_bZBM .cJgyM_qrQc{flex:1 1 auto}";
19
19
  },
20
- 'wrapper': 'ebGcj_gasz',
21
- 'left': 'ebGcj_bZBM',
22
- 'right': 'ebGcj_qrQc',
23
- 'mainText': 'ebGcj_fBqo'
20
+ 'wrapper': 'cJgyM_gasz',
21
+ 'left': 'cJgyM_bZBM',
22
+ 'right': 'cJgyM_qrQc'
24
23
  };
25
24
  import theme from "./theme.js";
26
25
  export var QuizzesSpinner = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
@@ -37,34 +36,50 @@ export var QuizzesSpinner = (_dec = themeable(theme, styles), _dec(_class = (_te
37
36
  _createClass(QuizzesSpinner, [{
38
37
  key: "mainText",
39
38
  value: function mainText() {
40
- return this.props.mainText || t('Loading...');
39
+ var _this$props = this.props,
40
+ color = _this$props.color,
41
+ mainText = _this$props.mainText,
42
+ fontSize = _this$props.fontSize;
43
+ return /*#__PURE__*/React.createElement(Text, {
44
+ size: fontSize,
45
+ color: color
46
+ }, mainText || t('Loading...'));
41
47
  }
42
48
  }, {
43
49
  key: "render",
44
50
  value: function render() {
51
+ var _this$props2 = this.props,
52
+ size = _this$props2.size,
53
+ minHeight = _this$props2.minHeight;
45
54
  return /*#__PURE__*/React.createElement("div", {
46
- className: styles.wrapper
55
+ className: styles.wrapper,
56
+ style: {
57
+ minHeight: minHeight
58
+ }
47
59
  }, /*#__PURE__*/React.createElement("div", {
48
60
  className: styles.left
49
61
  }, /*#__PURE__*/React.createElement(Spinner, {
50
62
  renderTitle: this.mainText(),
51
- size: "large"
63
+ size: size
52
64
  })), /*#__PURE__*/React.createElement("div", {
53
65
  className: styles.right
54
- }, /*#__PURE__*/React.createElement(PresentationContent, null, /*#__PURE__*/React.createElement(Heading, {
55
- level: "h2",
56
- as: "h1"
57
- }, /*#__PURE__*/React.createElement("div", {
58
- className: styles.mainText
59
- }, this.mainText())))));
66
+ }, /*#__PURE__*/React.createElement(PresentationContent, null, this.mainText())));
60
67
  }
61
68
  }]);
62
69
 
63
70
  QuizzesSpinner.displayName = "QuizzesSpinner";
64
71
  return QuizzesSpinner;
65
72
  }(Component), _class2.propTypes = {
66
- mainText: PropTypes.string
73
+ mainText: PropTypes.string,
74
+ fontSize: PropTypes.oneOf(['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large']),
75
+ size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
76
+ color: PropTypes.string,
77
+ minHeight: PropTypes.string
67
78
  }, _class2.defaultProps = {
68
- mainText: null
79
+ mainText: null,
80
+ size: 'large',
81
+ fontSize: 'xx-large',
82
+ minHeight: '500px',
83
+ color: 'primary'
69
84
  }, _temp)) || _class);
70
85
  export default QuizzesSpinner;
@@ -1,6 +1,3 @@
1
- export default function generator(_ref) {
2
- var typography = _ref.typography;
3
- return {
4
- mainTextFontSize: typography.fontSizeXXLarge
5
- };
1
+ export default function generator() {
2
+ return {};
6
3
  }
@@ -9,27 +9,18 @@ var _dec, _class, _class2, _temp;
9
9
  import { Heading } from '@instructure/ui-heading';
10
10
  import React, { Component } from 'react';
11
11
  var styles = {
12
- componentId: 'bCOJX',
12
+ componentId: 'bnyej',
13
13
  template: function template(theme) {
14
- return "\n\n.bCOJX_eDnN{display:flex;flex-basis:45%;flex-direction:column;overflow:hidden}\n\n.bCOJX_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bCOJX_eoBe{font-size:").concat(theme.metricNumberContextFontSize || 'inherit', ";font-weight:").concat(theme.metricNumberContextFontWeight || 'inherit', "}\n\n.bCOJX_eIAv{display:flex;position:relative}\n\n.bCOJX_ePHw{flex-basis:91%;overflow:hidden;padding-bottom:10px;text-overflow:ellipsis;white-space:nowrap}\n\n.bCOJX_dzsH{overflow:visible;text-overflow:unset;white-space:normal}\n\n.bCOJX_byoJ{position:absolute;right:7px;top:-8px}\n\n.bCOJX_evBt{flex-wrap:wrap;justify-content:space-between}\n\n.bCOJX_pAQb,.bCOJX_evBt{display:flex;flex-direction:row}\n\n.bCOJX_zefc{display:flex;flex-basis:55%;justify-content:flex-end}\n\n.bCOJX_dPzc{flex-direction:column}\n\n.bCOJX_dPzc,.bCOJX_dzph{display:flex;flex-basis:100%}\n\n.bCOJX_dzph{align-items:flex-start;box-sizing:border-box;column-gap:5px;justify-content:space-between;padding:0 30px 0 25px}\n\n.bCOJX_eobd{padding-top:1rem}\n\n.bCOJX_NpIG{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.bCOJX_csiQ{display:flex;flex-basis:100%}\n\n.bCOJX_fjVl{display:flex;flex-basis:50%}\n\n.bCOJX_eZLI{display:flex;flex-basis:40%}\n\n@media screen and (--tabletBreakPoint){.bCOJX_zefc{flex-basis:100%;justify-content:flex-start}.bCOJX_ePHw{flex-basis:94%}.bCOJX_eDnN{flex-basis:100%}.bCOJX_dzph{padding:0}.bCOJX_eDnN h3{padding-right:30px}.bCOJX_NpIG{right:17px}.bCOJX_eIAv{margin-bottom:20px}.bCOJX_byoJ{right:-7px}.bCOJX_dzph{flex-wrap:wrap}}");
14
+ return "\n\n.bnyej_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bnyej_bwlc{align-items:flex-start;gap:24px;justify-content:space-between;row-gap:32px}\n\n.bnyej_bwlc,.bnyej_bqdH{display:flex;flex-direction:row;flex-wrap:wrap}\n\n.bnyej_bqdH{align-items:center;row-gap:24px}\n\n.bnyej_NpIG{position:absolute;right:").concat(theme.viewPaddingRight || 'inherit', ";top:").concat(theme.viewPaddingTop || 'inherit', "}\n\n.bnyej_eoBe{font-size:").concat(theme.metricNumberContextFontSize || 'inherit', ";font-weight:").concat(theme.metricNumberContextFontWeight || 'inherit', "}\n\n.bnyej_fFDJ{display:none}\n\n.bnyej_esVF{min-height:48px}\n\n.bnyej_eTZq{position:relative}\n\n.bnyej_eTZq:after{background:linear-gradient(180deg,hsla(0,0%,100%,0),#fff);content:\"\";height:48px;left:0;position:absolute;top:0;width:100%}");
15
15
  },
16
- 'heading': 'bCOJX_eDnN',
17
- 'cardWrapper': 'bCOJX_eKXQ',
18
- 'metricNumberContext': 'bCOJX_eoBe',
19
- 'bodyPresentation': 'bCOJX_eIAv',
20
- 'bodyExcerpt': 'bCOJX_ePHw',
21
- 'bodyExcerptExpanded': 'bCOJX_dzsH',
22
- 'bodyExpandButtonWrapper': 'bCOJX_byoJ',
23
- 'innerWrapper': 'bCOJX_evBt',
24
- 'expandableInnerWrapper': 'bCOJX_pAQb',
25
- 'metricsWithControls': 'bCOJX_zefc',
26
- 'metricGroup': 'bCOJX_dPzc',
27
- 'metricsRow': 'bCOJX_dzph',
28
- 'metricsRowPaginated': 'bCOJX_eobd',
29
- 'itemCardToggleButtonWrapper': 'bCOJX_NpIG',
30
- 'expandableContent': 'bCOJX_csiQ',
31
- 'tableColumn': 'bCOJX_fjVl',
32
- 'performanceColumn': 'bCOJX_eZLI'
16
+ 'cardWrapper': 'bnyej_eKXQ',
17
+ 'itemCardInnerContainer': 'bnyej_bwlc',
18
+ 'metricsContainer': 'bnyej_bqdH',
19
+ 'itemCardToggleButtonWrapper': 'bnyej_NpIG',
20
+ 'metricNumberContext': 'bnyej_eoBe',
21
+ 'hiddenMetrics': 'bnyej_fFDJ',
22
+ 'itemBody': 'bnyej_esVF',
23
+ 'hiddenItemBody': 'bnyej_eTZq'
33
24
  };
34
25
  import t from '@instructure/quiz-i18n/es/format-message';
35
26
  import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
@@ -44,6 +35,8 @@ import classnames from 'classnames';
44
35
  import { interactionTypesNameDictionary } from "../../../../../common/util/interactionTypeMetadata.js";
45
36
  import AnswerSummaryTable from "../AnswerSummaryTable/index.js";
46
37
  import { itemAnalysisPropType } from "../propTypes.js";
38
+ import { RichContentRenderer } from '@instructure/quiz-rce';
39
+ import { Flex } from '@instructure/ui-flex';
47
40
  var supportedTables = ['choice', 'true-false', 'multi-answer'];
48
41
  export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
49
42
  _inherits(NewItemAnalysis, _Component);
@@ -61,9 +54,7 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
61
54
 
62
55
  _this = _super.call.apply(_super, [this].concat(args));
63
56
  _this.state = {
64
- bodyToggable: false,
65
57
  bodyExpanded: false,
66
- itemExpanded: false,
67
58
  metricsExpanded: false
68
59
  };
69
60
 
@@ -74,39 +65,10 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
74
65
  });
75
66
  };
76
67
 
77
- _this.buildItemCardHeadingId = function () {
78
- return "itemCardHeading-".concat(_this.props.itemAnalysis.metadata.item_id);
79
- };
80
-
81
- _this.buildItemCardBodyId = function () {
82
- return "itemCardBody-".concat(_this.props.itemAnalysis.metadata.item_id);
83
- };
84
-
85
- _this.bodyExceedsLimit = function (bodyElement, headingElement) {
86
- if (!bodyElement || !headingElement) {
87
- return;
88
- }
89
-
90
- return bodyElement.scrollWidth > headingElement.clientWidth || _this.state.bodyExpanded;
91
- };
92
-
93
- _this.handleBodyWidth = function () {
94
- var bodyElement = document.getElementById(_this.buildItemCardBodyId());
95
- var headingElement = document.getElementById(_this.buildItemCardHeadingId());
96
-
97
- _this.setState({
98
- bodyToggable: _this.bodyExceedsLimit(bodyElement, headingElement)
99
- });
100
- };
101
-
102
- _this.handleToggle = function () {
68
+ _this.handleMetricToggle = function () {
103
69
  _this.setState({
104
70
  metricsExpanded: !_this.state.metricsExpanded
105
71
  });
106
-
107
- _this.setState({
108
- itemExpanded: !_this.state.itemExpanded
109
- });
110
72
  };
111
73
 
112
74
  _this.handleBodyToggle = function () {
@@ -115,26 +77,6 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
115
77
  });
116
78
  };
117
79
 
118
- _this.renderExpandItemCardButton = function () {
119
- return /*#__PURE__*/React.createElement("div", {
120
- className: styles.itemCardToggleButtonWrapper
121
- }, /*#__PURE__*/React.createElement(ExpandButton, {
122
- onClick: _this.handleToggle,
123
- title: _this.state.metricsExpanded ? t('collapse item card') : t('expand item card'),
124
- isExpanded: _this.state.metricsExpanded
125
- }));
126
- };
127
-
128
- _this.renderBodyToggleButton = function () {
129
- return /*#__PURE__*/React.createElement("div", {
130
- className: styles.bodyExpandButtonWrapper
131
- }, /*#__PURE__*/React.createElement(ExpandButton, {
132
- onClick: _this.handleBodyToggle,
133
- title: _this.state.bodyExpanded ? t('collapse question stem') : t('expand question stem'),
134
- isExpanded: _this.state.bodyExpanded
135
- }));
136
- };
137
-
138
80
  _this.calculateValueWithPointsPossible = function (metricKey, metricValue) {
139
81
  var pointsPossible = _this.props.itemAnalysis.scores.points_possible;
140
82
  return t.rich('{score, number}<s>/{possible, number} PTS</s>', {
@@ -150,103 +92,145 @@ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
150
92
  });
151
93
  };
152
94
 
153
- _this.renderExpanded = function () {
154
- var scores = _this.props.itemAnalysis.scores;
155
- var classes = classnames(styles.metricsRow, styles.metricsRowPaginated);
156
- return /*#__PURE__*/React.createElement("div", {
157
- className: classes
158
- }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
159
- metricKey: "pearson_correlation",
160
- label: t('Pearson Correlation Coefficient'),
161
- value: t.number(scores.pearson_correlation),
162
- popoverDescription: pearsonCorrelation
163
- }));
164
- };
165
-
166
- return _this;
167
- }
168
-
169
- _createClass(NewItemAnalysis, [{
170
- key: "componentDidMount",
171
- value: function componentDidMount() {
172
- this.handleBodyWidth();
173
- window.addEventListener('resize', this.handleBodyWidth);
174
- }
175
- }, {
176
- key: "componentWillUnmount",
177
- value: function componentWillUnmount() {
178
- window.removeEventListener('resize', this.handleBodyWidth);
179
- }
180
- }, {
181
- key: "render",
182
- value: function render() {
183
- var _this$props$itemAnaly = this.props.itemAnalysis,
184
- answer_summary = _this$props$itemAnaly.answer_summary,
185
- metadata = _this$props$itemAnaly.metadata,
186
- scores = _this$props$itemAnaly.scores;
187
- var bodyClass = classnames(styles.bodyExcerpt, _defineProperty({}, styles.bodyExcerptExpanded, this.state.bodyExpanded));
188
- var headingId = this.buildItemCardHeadingId();
189
- var bodyId = this.buildItemCardBodyId();
190
- var isSupportedTable = supportedTables.includes(metadata.interaction_type);
191
- return /*#__PURE__*/React.createElement(Card, {
192
- className: styles.cardWrapper
193
- }, /*#__PURE__*/React.createElement("div", {
194
- className: styles.innerWrapper
195
- }, /*#__PURE__*/React.createElement("div", {
196
- id: headingId,
197
- className: styles.heading
198
- }, /*#__PURE__*/React.createElement(Heading, {
199
- margin: "0 0 small 0",
95
+ _this.renderTitle = function (title) {
96
+ return /*#__PURE__*/React.createElement(Heading, {
97
+ margin: "0 x-large small 0",
200
98
  level: "h3",
201
99
  weight: "bold",
202
100
  color: "primary"
203
- }, metadata.item_title), /*#__PURE__*/React.createElement(Text, {
101
+ }, title);
102
+ };
103
+
104
+ _this.renderInteractionType = function (interactionType) {
105
+ return /*#__PURE__*/React.createElement(Text, {
204
106
  size: "small",
205
107
  weight: "bold",
206
108
  transform: "capitalize"
207
- }, this.mapInteractionTypeToTranslation(metadata.interaction_type)), /*#__PURE__*/React.createElement("div", {
208
- id: "itemBody",
209
- className: styles.bodyPresentation
210
- }, /*#__PURE__*/React.createElement("div", {
211
- id: bodyId,
212
- className: bodyClass
213
- }, /*#__PURE__*/React.createElement(Text, {
214
- size: "small"
215
- }, metadata.item_body)), this.state.bodyToggable && this.renderBodyToggleButton())), /*#__PURE__*/React.createElement("div", {
216
- className: styles.metricsWithControls
109
+ }, _this.mapInteractionTypeToTranslation(interactionType));
110
+ };
111
+
112
+ _this.renderRichContent = function (itemBody, itemBodyClass) {
113
+ return /*#__PURE__*/React.createElement(Flex, {
114
+ direction: "row",
115
+ alignItems: "start"
116
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
117
+ shouldShrink: true,
118
+ shouldGrow: true
217
119
  }, /*#__PURE__*/React.createElement("div", {
218
- className: styles.metricGroup
120
+ className: itemBodyClass
121
+ }, /*#__PURE__*/React.createElement(RichContentRenderer, {
122
+ content: itemBody
123
+ }))), /*#__PURE__*/React.createElement(Flex.Item, {
124
+ margin: "xx-small small none x-small",
125
+ size: "38px"
126
+ }, /*#__PURE__*/React.createElement(ExpandButton, {
127
+ onClick: _this.handleBodyToggle,
128
+ title: _this.state.bodyExpanded ? t('collapse question stem') : t('expand question stem'),
129
+ isExpanded: _this.state.bodyExpanded
130
+ })));
131
+ };
132
+
133
+ _this.renderMetrics = function (scores, metricsClass) {
134
+ return /*#__PURE__*/React.createElement(Flex, {
135
+ direction: "column"
136
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
137
+ overflowY: "visible"
219
138
  }, /*#__PURE__*/React.createElement("div", {
220
- className: styles.metricsRow
139
+ className: styles.metricsContainer
140
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
141
+ margin: "none medium none none"
221
142
  }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
222
143
  metricKey: "difficulty_index",
223
144
  label: t('Item Difficulty'),
224
145
  value: t.number(scores.difficulty_index),
225
146
  popoverDescription: difficultyIndex
226
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
147
+ })), /*#__PURE__*/React.createElement(Flex.Item, {
148
+ margin: "none medium none none"
149
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
227
150
  metricKey: "mean",
228
151
  label: t('Mean Earned Points'),
229
- value: this.calculateValueWithPointsPossible('mean', scores.mean)
230
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
152
+ value: _this.calculateValueWithPointsPossible('mean', scores.mean)
153
+ })), /*#__PURE__*/React.createElement(Flex.Item, {
154
+ margin: "none medium none none"
155
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
231
156
  metricKey: "median",
232
157
  label: t('Median Earned Points'),
233
- value: this.calculateValueWithPointsPossible('median', scores.median)
234
- }), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
158
+ value: _this.calculateValueWithPointsPossible('median', scores.median)
159
+ })), /*#__PURE__*/React.createElement(Flex.Item, {
160
+ margin: "none large none none"
161
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
235
162
  metricKey: "discrimination_index",
236
163
  label: t('Discrimination Index'),
237
164
  value: t.number(scores.discrimination_index),
238
165
  popoverDescription: discriminationIndex
239
- }), this.renderExpandItemCardButton()), this.state.metricsExpanded && this.renderExpanded()))), this.state.itemExpanded && /*#__PURE__*/React.createElement("div", {
240
- className: styles.expandableInnerWrapper
166
+ })))), /*#__PURE__*/React.createElement(Flex.Item, {
167
+ overflowY: "visible",
168
+ margin: "medium none none none"
241
169
  }, /*#__PURE__*/React.createElement("div", {
242
- className: styles.expandableContent
170
+ className: metricsClass
243
171
  }, /*#__PURE__*/React.createElement("div", {
244
- className: styles.tableColumn
245
- }, isSupportedTable && /*#__PURE__*/React.createElement(AnswerSummaryTable, {
172
+ className: styles.metricsContainer
173
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
174
+ margin: "none medium none none"
175
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
176
+ metricKey: "pearson_correlation",
177
+ label: t('Pearson Correlation Coefficient'),
178
+ value: t.number(scores.pearson_correlation),
179
+ popoverDescription: pearsonCorrelation
180
+ }))))));
181
+ };
182
+
183
+ _this.renderAnswerSummaryTable = function (answer_summary, isSupportedTable, metricsClass) {
184
+ return /*#__PURE__*/React.createElement("div", {
185
+ className: metricsClass
186
+ }, isSupportedTable && /*#__PURE__*/React.createElement(Flex, {
187
+ direction: "row"
188
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
189
+ size: "55%"
190
+ }, /*#__PURE__*/React.createElement(AnswerSummaryTable, {
246
191
  answerSummary: answer_summary
247
- })), /*#__PURE__*/React.createElement("div", {
248
- className: styles.performanceColumn
249
192
  }))));
193
+ };
194
+
195
+ return _this;
196
+ }
197
+
198
+ _createClass(NewItemAnalysis, [{
199
+ key: "render",
200
+ value: function render() {
201
+ var _this$props$itemAnaly = this.props.itemAnalysis,
202
+ answer_summary = _this$props$itemAnaly.answer_summary,
203
+ metadata = _this$props$itemAnaly.metadata,
204
+ scores = _this$props$itemAnaly.scores;
205
+ var isSupportedTable = supportedTables.includes(metadata.interaction_type);
206
+ var metricsClass = classnames(_defineProperty({}, styles.hiddenMetrics, !this.state.metricsExpanded));
207
+ var itemBodyClass = classnames(styles.itemBody, _defineProperty({}, styles.hiddenItemBody, !this.state.bodyExpanded));
208
+ return /*#__PURE__*/React.createElement(Card, {
209
+ className: styles.cardWrapper
210
+ }, /*#__PURE__*/React.createElement("div", {
211
+ className: styles.itemCardToggleButtonWrapper
212
+ }, /*#__PURE__*/React.createElement(ExpandButton, {
213
+ onClick: this.handleMetricToggle,
214
+ title: this.state.metricsExpanded ? t('collapse item card') : t('expand item card'),
215
+ isExpanded: this.state.metricsExpanded
216
+ })), /*#__PURE__*/React.createElement(Flex, {
217
+ direction: "column"
218
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
219
+ overflowY: "visible"
220
+ }, /*#__PURE__*/React.createElement("div", {
221
+ className: styles.itemCardInnerContainer
222
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
223
+ shouldGrow: true,
224
+ shouldShrink: true,
225
+ size: "45%"
226
+ }, /*#__PURE__*/React.createElement(Flex, {
227
+ direction: "column",
228
+ justifyItems: "start"
229
+ }, /*#__PURE__*/React.createElement(Flex.Item, null, this.renderTitle(metadata.item_title)), /*#__PURE__*/React.createElement(Flex.Item, null, this.renderInteractionType(metadata.interaction_type)), /*#__PURE__*/React.createElement(Flex.Item, {
230
+ shouldShrink: true,
231
+ overflowY: "hidden",
232
+ size: !this.state.bodyExpanded ? '48px' : void 0
233
+ }, this.renderRichContent(metadata.item_body, itemBodyClass)))), /*#__PURE__*/React.createElement(Flex.Item, null, this.renderMetrics(scores, metricsClass)))), /*#__PURE__*/React.createElement(Flex.Item, null, this.renderAnswerSummaryTable(answer_summary, isSupportedTable, metricsClass))));
250
234
  }
251
235
  }]);
252
236
 
@@ -5,7 +5,8 @@ export default function generator(_ref) {
5
5
  return {
6
6
  tabletBreakPoint: "max-width: ".concat(breakpoints.large),
7
7
  cardWrapperPadding: spacing.medium,
8
- viewPadding: spacing.small,
8
+ viewPaddingRight: spacing.large,
9
+ viewPaddingTop: spacing.medium,
9
10
  metricNumberContextFontSize: typography.fontSizeMedium,
10
11
  metricNumberContextFontWeight: typography.fontWeightNormal
11
12
  };
@@ -8,16 +8,16 @@ var _dec, _class, _class2, _temp;
8
8
  import { Heading } from '@instructure/ui-heading';
9
9
  import React, { Component } from 'react';
10
10
  var styles = {
11
- componentId: 'bnEXV',
11
+ componentId: 'fQZVs',
12
12
  template: function template(theme) {
13
- return "\n\n.bnEXV_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.bnEXV_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bnEXV_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.bnEXV_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.bnEXV_dPzc,.bnEXV_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}");
13
+ return "\n\n.fQZVs_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.fQZVs_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.fQZVs_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.fQZVs_bTHH{position:absolute;right:").concat(theme.viewPaddingRight || 'inherit', ";top:").concat(theme.viewPaddingTop || 'inherit', "}\n\n.fQZVs_dPzc,.fQZVs_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}");
14
14
  },
15
- 'heading': 'bnEXV_eDnN',
16
- 'cardWrapper': 'bnEXV_eKXQ',
17
- 'container': 'bnEXV_crZr',
18
- 'expandButtonContainer': 'bnEXV_bTHH',
19
- 'metricGroup': 'bnEXV_dPzc',
20
- 'metricsWrapper': 'bnEXV_cpZE'
15
+ 'heading': 'fQZVs_eDnN',
16
+ 'cardWrapper': 'fQZVs_eKXQ',
17
+ 'container': 'fQZVs_crZr',
18
+ 'expandButtonContainer': 'fQZVs_bTHH',
19
+ 'metricGroup': 'fQZVs_dPzc',
20
+ 'metricsWrapper': 'fQZVs_cpZE'
21
21
  };
22
22
  import t from '@instructure/quiz-i18n/es/format-message';
23
23
  import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
@@ -102,6 +102,7 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
102
102
  className: styles.heading
103
103
  }, /*#__PURE__*/React.createElement(Heading, {
104
104
  level: "h4",
105
+ margin: "0 x-large 0 0",
105
106
  color: "primary"
106
107
  }, t('Quiz summary:'), " ", metadata === null || metadata === void 0 ? void 0 : metadata.quiz_title)), /*#__PURE__*/React.createElement("div", {
107
108
  className: styles.metricGroup
@@ -2,7 +2,8 @@ export default function generator(_ref) {
2
2
  var spacing = _ref.spacing;
3
3
  return {
4
4
  metricGroupPaddingTop: spacing.medium,
5
- viewPadding: spacing.small,
5
+ viewPaddingRight: spacing.large,
6
+ viewPaddingTop: spacing.medium,
6
7
  headingPadding: spacing.medium,
7
8
  cardWrapperPadding: spacing.medium,
8
9
  metricsColumnGap: '82px'
@@ -14,22 +14,22 @@ import { Flex } from '@instructure/ui-flex';
14
14
  import { themeable } from '@instructure/ui-themeable';
15
15
  import Card from "../../../../../common/components/shared/Card/index.js";
16
16
  var styles = {
17
- componentId: 'eJSiT',
17
+ componentId: 'boQPo',
18
18
  template: function template(theme) {
19
- return "\n\n.eJSiT_bqdH{column-gap:5px;display:flex;justify-content:space-between;padding:".concat(theme.metricsPadding || 'inherit', " 0}\n\n.eJSiT_fbIL{border-radius:").concat(theme.cardBorderRadius || 'inherit', ";box-shadow:").concat(theme.cardBoxShadow || 'inherit', ";display:inline-flex;flex-direction:column;margin:").concat(theme.cardMargin || 'inherit', ";padding:").concat(theme.cardPadding || 'inherit', ";width:").concat(theme.cardWidth || 'inherit', "}\n\n.eJSiT_blRb{max-width:160px;padding-right:10px}");
19
+ return "\n\n.boQPo_bqdH{column-gap:5px;display:flex;justify-content:space-between;padding-bottom:".concat(theme.metricsPadding || 'inherit', "}\n\n.boQPo_PFlN{border-radius:").concat(theme.cardBorderRadius || 'inherit', ";box-shadow:").concat(theme.cardBoxShadow || 'inherit', ";display:inline-flex;flex-direction:column;margin:").concat(theme.cardMargin || 'inherit', ";padding:").concat(theme.cardPadding || 'inherit', ";width:").concat(theme.cardWidth || 'inherit', "}\n\n.boQPo_blRb{max-width:160px;padding-right:10px}\n\n.boQPo_bxzy{border-bottom:1px solid ").concat(theme.quizSummaryBorderBottomColor || 'inherit', ";margin-bottom:15px;padding-bottom:15px}\n\n.boQPo_dKIc{padding-bottom:15px}\n\n.boQPo_cGHR{align-self:flex-end}");
20
20
  },
21
- 'metricsContainer': 'eJSiT_bqdH',
22
- 'card': 'eJSiT_fbIL',
23
- 'dateContainer': 'eJSiT_blRb'
21
+ 'metricsContainer': 'boQPo_bqdH',
22
+ 'reportCard': 'boQPo_PFlN',
23
+ 'dateContainer': 'boQPo_blRb',
24
+ 'quizAnalysisSummary': 'boQPo_bxzy',
25
+ 'titleContainer': 'boQPo_dKIc',
26
+ 'spinnerContainer': 'boQPo_cGHR'
24
27
  };
25
28
  import theme from "./theme.js";
26
29
  import AnalysisMetric from "../AnalysisMetric/index.js";
27
30
  import Spinner from "../../../../../common/components/shared/spinner/Spinner.js";
28
31
  import { AnalysisUpdateDate } from "../AnalysisUpdateDate/index.js";
29
- import { quizAnalysisPropType } from "../propTypes.js";
30
-
31
- var _ref = /*#__PURE__*/React.createElement(Spinner, null);
32
-
32
+ import { itemAnalysisPropType, quizAnalysisPropType } from "../propTypes.js";
33
33
  export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
34
34
  _inherits(NewQuizAndItemAnalysisReportCardPresenter, _Component);
35
35
 
@@ -70,20 +70,14 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
70
70
  }));
71
71
  };
72
72
 
73
- return _this;
74
- }
75
-
76
- _createClass(NewQuizAndItemAnalysisReportCardPresenter, [{
77
- key: "renderContent",
78
- value: function renderContent() {
79
- var _this$props = this.props,
80
- name = _this$props.name,
81
- href = _this$props.href,
82
- quizAnalysis = _this$props.quizAnalysis;
83
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
84
- size: "medium",
85
- weight: "bold"
86
- }, name), this.renderMetrics(), /*#__PURE__*/React.createElement(Flex, {
73
+ _this.renderQuizAnalysisSummary = function () {
74
+ var _this$props = _this.props,
75
+ quizAnalysis = _this$props.quizAnalysis,
76
+ itemAnalyses = _this$props.itemAnalyses,
77
+ href = _this$props.href;
78
+ return /*#__PURE__*/React.createElement("div", {
79
+ className: styles.quizAnalysisSummary
80
+ }, _this.renderMetrics(), /*#__PURE__*/React.createElement(Flex, {
87
81
  direction: "row",
88
82
  justifyItems: "space-between"
89
83
  }, /*#__PURE__*/React.createElement("div", {
@@ -91,18 +85,66 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
91
85
  }, /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
92
86
  date: quizAnalysis.created_timestamp,
93
87
  multiline: true
94
- })), /*#__PURE__*/React.createElement(Link, {
88
+ })), quizAnalysis && itemAnalyses && /*#__PURE__*/React.createElement(Link, {
95
89
  href: href
96
90
  }, /*#__PURE__*/React.createElement(Text, {
97
91
  size: "small"
98
92
  }, t('View Report')))));
99
- }
100
- }, {
93
+ };
94
+
95
+ _this.renderSpinner = function (mainText) {
96
+ return /*#__PURE__*/React.createElement(Spinner, {
97
+ size: "x-small",
98
+ color: "brand",
99
+ minHeight: "0",
100
+ mainText: mainText,
101
+ fontSize: "x-small"
102
+ });
103
+ };
104
+
105
+ _this.renderReportCardFooter = function () {
106
+ var _this$props2 = _this.props,
107
+ generationInProgress = _this$props2.generationInProgress,
108
+ generateReports = _this$props2.generateReports,
109
+ analysisError = _this$props2.analysisError;
110
+ return /*#__PURE__*/React.createElement(Flex, {
111
+ direction: "row",
112
+ justifyItems: "space-between"
113
+ }, /*#__PURE__*/React.createElement(Flex.Item, {
114
+ shouldShrink: true
115
+ }, analysisError && !generationInProgress && /*#__PURE__*/React.createElement(Text, {
116
+ size: "x-small",
117
+ lineHeight: "fit",
118
+ weight: "bold",
119
+ color: "danger"
120
+ }, analysisError)), /*#__PURE__*/React.createElement(Flex.Item, null, generationInProgress ? _this.renderSpinner(t('Generation In Progress')) : /*#__PURE__*/React.createElement(Link, {
121
+ onClick: generateReports,
122
+ role: "button"
123
+ }, /*#__PURE__*/React.createElement(Text, {
124
+ size: "small"
125
+ }, t('Generate Report')))));
126
+ };
127
+
128
+ return _this;
129
+ }
130
+
131
+ _createClass(NewQuizAndItemAnalysisReportCardPresenter, [{
101
132
  key: "render",
102
133
  value: function render() {
134
+ var _this$props3 = this.props,
135
+ fetchInProgress = _this$props3.fetchInProgress,
136
+ name = _this$props3.name,
137
+ quizAnalysis = _this$props3.quizAnalysis;
103
138
  return /*#__PURE__*/React.createElement(Card, {
104
- className: styles.card
105
- }, this.props.quizAnalysis ? this.renderContent() : _ref);
139
+ className: styles.reportCard
140
+ }, /*#__PURE__*/React.createElement("div", {
141
+ className: styles.titleContainer
142
+ }, /*#__PURE__*/React.createElement(Text, {
143
+ size: "medium",
144
+ weight: "bold"
145
+ }, name)), !fetchInProgress && quizAnalysis && this.renderQuizAnalysisSummary(), fetchInProgress && /*#__PURE__*/React.createElement("div", {
146
+ className: styles.spinnerContainer
147
+ }, this.renderSpinner()), !fetchInProgress && this.renderReportCardFooter());
106
148
  }
107
149
  }]);
108
150
 
@@ -111,9 +153,17 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
111
153
  }(Component), _class2.propTypes = {
112
154
  name: PropTypes.node,
113
155
  href: PropTypes.string,
114
- quizAnalysis: quizAnalysisPropType
156
+ quizAnalysis: quizAnalysisPropType,
157
+ itemAnalyses: PropTypes.arrayOf(itemAnalysisPropType),
158
+ fetchInProgress: PropTypes.bool.isRequired,
159
+ generationInProgress: PropTypes.bool.isRequired,
160
+ analysisError: PropTypes.string,
161
+ generateReports: PropTypes.func.isRequired
115
162
  }, _class2.defaultProps = {
116
163
  name: void 0,
117
164
  href: void 0,
118
- quizAnalysis: void 0
165
+ analysisError: void 0,
166
+ generationInProgress: void 0,
167
+ quizAnalysis: void 0,
168
+ itemAnalyses: void 0
119
169
  }, _temp)) || _class);