@instructure/quiz-core 17.58.2-rc.6 → 17.58.2-rc.7

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 (25) hide show
  1. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +2 -0
  2. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +64 -0
  3. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +3 -0
  4. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +2 -0
  5. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +75 -0
  6. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +6 -0
  7. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -0
  8. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +18 -0
  9. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +245 -0
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +9 -0
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +55 -57
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +5 -16
  13. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +11 -0
  14. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +83 -0
  15. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +10 -0
  16. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +11 -0
  17. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +95 -0
  18. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +13 -0
  19. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +11 -0
  20. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +27 -0
  21. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +274 -0
  22. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +16 -0
  23. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +59 -62
  24. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +7 -18
  25. package/package.json +9 -9
@@ -0,0 +1,2 @@
1
+ import { AnalysisMetric } from "./presenter.js";
2
+ export default AnalysisMetric;
@@ -0,0 +1,64 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
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 { themeable } from '@instructure/ui-themeable';
9
+ import theme from "./theme.js";
10
+ var styles = {
11
+ componentId: 'flBnP',
12
+ template: function template(theme) {
13
+ return "\n\n.flBnP_eckF{margin:0;max-width:159px;text-transform:uppercase}";
14
+ },
15
+ 'metricLabel': 'flBnP_eckF'
16
+ };
17
+ import React, { Component } from 'react';
18
+ import { getSanitizedMetricValue } from "../utils.js";
19
+ import { Metric } from '@instructure/ui-metric';
20
+ import PropTypes from 'prop-types';
21
+ export var AnalysisMetric = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
22
+ _inherits(AnalysisMetric, _Component);
23
+
24
+ var _super = _createSuper(AnalysisMetric);
25
+
26
+ function AnalysisMetric() {
27
+ _classCallCheck(this, AnalysisMetric);
28
+
29
+ return _super.apply(this, arguments);
30
+ }
31
+
32
+ _createClass(AnalysisMetric, [{
33
+ key: "render",
34
+ value: function render() {
35
+ var _this$props = this.props,
36
+ metricKey = _this$props.metricKey,
37
+ label = _this$props.label,
38
+ value = _this$props.value,
39
+ suffix = _this$props.suffix;
40
+ return /*#__PURE__*/React.createElement(Metric, {
41
+ theme: {
42
+ valueFontWeight: 500,
43
+ padding: '0'
44
+ },
45
+ textAlign: "start",
46
+ key: metricKey,
47
+ renderLabel: /*#__PURE__*/React.createElement("p", {
48
+ className: styles.metricLabel
49
+ }, label),
50
+ renderValue: getSanitizedMetricValue(value, suffix)
51
+ });
52
+ }
53
+ }]);
54
+
55
+ AnalysisMetric.displayName = "AnalysisMetric";
56
+ return AnalysisMetric;
57
+ }(Component), _class2.propTypes = {
58
+ metricKey: PropTypes.string.isRequired,
59
+ label: PropTypes.string.isRequired,
60
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
61
+ suffix: PropTypes.string
62
+ }, _class2.defaultProps = {
63
+ suffix: ''
64
+ }, _temp)) || _class);
@@ -0,0 +1,3 @@
1
+ export default function generator() {
2
+ return {};
3
+ }
@@ -0,0 +1,2 @@
1
+ import { AnalysisPopoverMetric } from "./presenter.js";
2
+ export default AnalysisPopoverMetric;
@@ -0,0 +1,75 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
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 { Metric } from '@instructure/ui-metric';
10
+ import { getSanitizedMetricValue } from "../utils.js";
11
+ var styles = {
12
+ componentId: 'bLVhr',
13
+ template: function template(theme) {
14
+ return "\n\n.bLVhr_dqHR{padding-left:5px}\n\n.bLVhr_eckF{margin:0;max-width:159px;text-transform:uppercase}";
15
+ },
16
+ 'popoverContainer': 'bLVhr_dqHR',
17
+ 'metricLabel': 'bLVhr_eckF'
18
+ };
19
+ import MetricPopover from "../MetricPopover/index.js";
20
+ import { themeable } from '@instructure/ui-themeable';
21
+ import theme from "./theme.js";
22
+ import PropTypes from 'prop-types';
23
+ export var AnalysisPopoverMetric = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
24
+ _inherits(AnalysisPopoverMetric, _Component);
25
+
26
+ var _super = _createSuper(AnalysisPopoverMetric);
27
+
28
+ function AnalysisPopoverMetric() {
29
+ _classCallCheck(this, AnalysisPopoverMetric);
30
+
31
+ return _super.apply(this, arguments);
32
+ }
33
+
34
+ _createClass(AnalysisPopoverMetric, [{
35
+ key: "renderLabelWithPopover",
36
+ value: function renderLabelWithPopover(texts) {
37
+ return /*#__PURE__*/React.createElement("p", {
38
+ className: styles.metricLabel
39
+ }, this.props.label, /*#__PURE__*/React.createElement("span", {
40
+ className: styles.popoverContainer
41
+ }, /*#__PURE__*/React.createElement(MetricPopover, texts)));
42
+ }
43
+ }, {
44
+ key: "render",
45
+ value: function render() {
46
+ var _this$props = this.props,
47
+ metricKey = _this$props.metricKey,
48
+ popoverDescription = _this$props.popoverDescription,
49
+ value = _this$props.value;
50
+ return /*#__PURE__*/React.createElement(Metric, {
51
+ theme: {
52
+ valueFontWeight: 500,
53
+ padding: '0'
54
+ },
55
+ textAlign: "start",
56
+ key: metricKey,
57
+ renderLabel: this.renderLabelWithPopover(popoverDescription),
58
+ renderValue: getSanitizedMetricValue(value)
59
+ });
60
+ }
61
+ }]);
62
+
63
+ AnalysisPopoverMetric.displayName = "AnalysisPopoverMetric";
64
+ return AnalysisPopoverMetric;
65
+ }(Component), _class2.propTypes = {
66
+ metricKey: PropTypes.string.isRequired,
67
+ label: PropTypes.string.isRequired,
68
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
69
+ popoverDescription: PropTypes.shape({
70
+ title: PropTypes.string,
71
+ subtitle: PropTypes.string,
72
+ body: PropTypes.string,
73
+ screenReaderLabel: PropTypes.string
74
+ }).isRequired
75
+ }, _temp)) || _class);
@@ -0,0 +1,6 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing;
3
+ return {
4
+ headerPaddingBottom: spacing.medium
5
+ };
6
+ }
@@ -0,0 +1,2 @@
1
+ import { NewItemAnalysis } from "./presenter.js";
2
+ export default NewItemAnalysis;
@@ -0,0 +1,18 @@
1
+ export var difficultyIndex = {
2
+ title: 'Difficulty title',
3
+ subtitle: 'difficulty subtitle',
4
+ body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi elementum interdum risus sed condimentum. Duis vel nisi at quam luctus dictum id eu risus. Donec eget tristique justo',
5
+ screenReaderLabel: 'Lorem one'
6
+ };
7
+ export var discriminationIndex = {
8
+ title: 'Discrimination title',
9
+ subtitle: 'discrimination subtitle',
10
+ body: 'Lorem ipsum dolor sit amet',
11
+ screenReaderLabel: 'Lorem two'
12
+ };
13
+ export var pearsonCorrelation = {
14
+ title: 'Pearson correlation title',
15
+ subtitle: 'pearson correlation subtitle',
16
+ body: 'Lorem ipsum dolor sit amet',
17
+ screenReaderLabel: 'Lorem three'
18
+ };
@@ -0,0 +1,245 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+
7
+ var _dec, _class, _class2, _temp;
8
+
9
+ import { Heading } from '@instructure/ui-heading';
10
+ import React, { Component } from 'react';
11
+ var styles = {
12
+ componentId: 'dcJyB',
13
+ template: function template(theme) {
14
+ return "\n\n.dcJyB_eDnN{display:flex;flex-basis:45%;flex-direction:column;overflow:hidden}\n\n.dcJyB_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.dcJyB_eIAv{display:flex;position:relative}\n\n.dcJyB_ePHw{flex-basis:91%;overflow:hidden;padding-bottom:10px;text-overflow:ellipsis;white-space:nowrap}\n\n.dcJyB_dzsH{overflow:visible;text-overflow:unset;white-space:normal}\n\n.dcJyB_byoJ{position:absolute;right:7px;top:-8px}\n\n.dcJyB_evBt{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}\n\n.dcJyB_pAQb{display:flex;flex-direction:column;height:60px}\n\n.dcJyB_zefc{display:flex;flex-basis:55%;justify-content:flex-end}\n\n.dcJyB_dPzc{flex-direction:column}\n\n.dcJyB_dPzc,.dcJyB_dzph{display:flex;flex-basis:100%}\n\n.dcJyB_dzph{align-items:flex-start;box-sizing:border-box;column-gap:5px;justify-content:space-between;padding:0 30px 0 25px}\n\n.dcJyB_eobd{padding-top:1rem}\n\n.dcJyB_NpIG{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n@media screen and (--tabletBreakPoint){.dcJyB_zefc{flex-basis:100%;justify-content:flex-start}.dcJyB_ePHw{flex-basis:94%}.dcJyB_eDnN{flex-basis:100%}.dcJyB_dzph{padding:0}.dcJyB_eDnN h3{padding-right:30px}.dcJyB_NpIG{right:17px}.dcJyB_eIAv{margin-bottom:20px}.dcJyB_byoJ{right:-7px}.dcJyB_dzph{flex-wrap:wrap}}");
15
+ },
16
+ 'heading': 'dcJyB_eDnN',
17
+ 'cardWrapper': 'dcJyB_eKXQ',
18
+ 'bodyPresentation': 'dcJyB_eIAv',
19
+ 'bodyExcerpt': 'dcJyB_ePHw',
20
+ 'bodyExcerptExpanded': 'dcJyB_dzsH',
21
+ 'bodyExpandButtonWrapper': 'dcJyB_byoJ',
22
+ 'innerWrapper': 'dcJyB_evBt',
23
+ 'expandableInnerWrapper': 'dcJyB_pAQb',
24
+ 'metricsWithControls': 'dcJyB_zefc',
25
+ 'metricGroup': 'dcJyB_dPzc',
26
+ 'metricsRow': 'dcJyB_dzph',
27
+ 'metricsRowPaginated': 'dcJyB_eobd',
28
+ 'itemCardToggleButtonWrapper': 'dcJyB_NpIG'
29
+ };
30
+ import t from '@instructure/quiz-i18n/es/format-message';
31
+ import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
32
+ import { Text } from '@instructure/ui-text';
33
+ import { themeable } from '@instructure/ui-themeable';
34
+ import theme from "./theme.js";
35
+ import { difficultyIndex, discriminationIndex, pearsonCorrelation } from "./popoverContent.js";
36
+ import Card from "../../../../../common/components/shared/Card/index.js";
37
+ import AnalysisMetric from "../AnalysisMetric/index.js";
38
+ import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
39
+ import PropTypes from 'prop-types';
40
+ import classnames from 'classnames';
41
+ import { interactionTypesNameDictionary } from "../../../../../common/util/interactionTypeMetadata.js";
42
+ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
43
+ _inherits(NewItemAnalysis, _Component);
44
+
45
+ var _super = _createSuper(NewItemAnalysis);
46
+
47
+ function NewItemAnalysis() {
48
+ var _this;
49
+
50
+ _classCallCheck(this, NewItemAnalysis);
51
+
52
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
+ args[_key] = arguments[_key];
54
+ }
55
+
56
+ _this = _super.call.apply(_super, [this].concat(args));
57
+ _this.state = {
58
+ bodyToggable: false,
59
+ bodyExpanded: false,
60
+ itemExpanded: false,
61
+ metricsExpanded: false
62
+ };
63
+
64
+ _this.mapInteractionTypeToTranslation = function (interactionType) {
65
+ return interactionTypesNameDictionary({
66
+ slug: interactionType,
67
+ name: t('Question')
68
+ });
69
+ };
70
+
71
+ _this.buildItemCardHeadingId = function () {
72
+ return "itemCardHeading-".concat(_this.props.itemAnalysis.metadata.item_id);
73
+ };
74
+
75
+ _this.buildItemCardBodyId = function () {
76
+ return "itemCardBody-".concat(_this.props.itemAnalysis.metadata.item_id);
77
+ };
78
+
79
+ _this.bodyExceedsLimit = function (bodyElement, headingElement) {
80
+ if (!bodyElement || !headingElement) {
81
+ return;
82
+ }
83
+
84
+ return bodyElement.scrollWidth > headingElement.clientWidth || _this.state.bodyExpanded;
85
+ };
86
+
87
+ _this.handleBodyWidth = function () {
88
+ var bodyElement = document.getElementById(_this.buildItemCardBodyId());
89
+ var headingElement = document.getElementById(_this.buildItemCardHeadingId());
90
+
91
+ _this.setState({
92
+ bodyToggable: _this.bodyExceedsLimit(bodyElement, headingElement)
93
+ });
94
+ };
95
+
96
+ _this.handleToggle = function () {
97
+ _this.setState({
98
+ metricsExpanded: !_this.state.metricsExpanded
99
+ });
100
+
101
+ _this.setState({
102
+ itemExpanded: !_this.state.itemExpanded
103
+ });
104
+ };
105
+
106
+ _this.handleBodyToggle = function () {
107
+ _this.setState({
108
+ bodyExpanded: !_this.state.bodyExpanded
109
+ });
110
+ };
111
+
112
+ _this.renderExpandItemCardButton = function () {
113
+ return /*#__PURE__*/React.createElement("div", {
114
+ className: styles.itemCardToggleButtonWrapper
115
+ }, /*#__PURE__*/React.createElement(ExpandButton, {
116
+ onClick: _this.handleToggle,
117
+ title: _this.state.metricsExpanded ? t('collapse item card') : t('expand item card'),
118
+ isExpanded: _this.state.metricsExpanded
119
+ }));
120
+ };
121
+
122
+ _this.renderBodyToggleButton = function () {
123
+ return /*#__PURE__*/React.createElement("div", {
124
+ className: styles.bodyExpandButtonWrapper
125
+ }, /*#__PURE__*/React.createElement(ExpandButton, {
126
+ onClick: _this.handleBodyToggle,
127
+ title: _this.state.bodyExpanded ? t('collapse question stem') : t('expand question stem'),
128
+ isExpanded: _this.state.bodyExpanded
129
+ }));
130
+ };
131
+
132
+ _this.renderExpanded = function () {
133
+ var scores = _this.props.itemAnalysis.scores;
134
+ return /*#__PURE__*/React.createElement("div", {
135
+ className: [styles.metricsRow, styles.metricsRowPaginated].join(' ')
136
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
137
+ metricKey: "pearson_correlation",
138
+ label: t('Pearson Correlation Coefficient'),
139
+ value: t.number(scores.pearson_correlation),
140
+ popoverDescription: pearsonCorrelation
141
+ }));
142
+ };
143
+
144
+ return _this;
145
+ }
146
+
147
+ _createClass(NewItemAnalysis, [{
148
+ key: "componentDidMount",
149
+ value: function componentDidMount() {
150
+ this.handleBodyWidth();
151
+ window.addEventListener('resize', this.handleBodyWidth);
152
+ }
153
+ }, {
154
+ key: "componentWillUnmount",
155
+ value: function componentWillUnmount() {
156
+ window.removeEventListener('resize', this.handleBodyWidth);
157
+ }
158
+ }, {
159
+ key: "render",
160
+ value: function render() {
161
+ var _this$props$itemAnaly = this.props.itemAnalysis,
162
+ metadata = _this$props$itemAnaly.metadata,
163
+ scores = _this$props$itemAnaly.scores;
164
+ var bodyClass = classnames(styles.bodyExcerpt, _defineProperty({}, styles.bodyExcerptExpanded, this.state.bodyExpanded));
165
+ var headingId = this.buildItemCardHeadingId();
166
+ var bodyId = this.buildItemCardBodyId();
167
+ return /*#__PURE__*/React.createElement(Card, {
168
+ className: styles.cardWrapper
169
+ }, /*#__PURE__*/React.createElement("div", {
170
+ className: styles.innerWrapper
171
+ }, /*#__PURE__*/React.createElement("div", {
172
+ id: headingId,
173
+ className: styles.heading
174
+ }, /*#__PURE__*/React.createElement(Heading, {
175
+ margin: "0 0 small 0",
176
+ level: "h3",
177
+ weight: "bold",
178
+ color: "primary"
179
+ }, metadata.item_title), /*#__PURE__*/React.createElement(Text, {
180
+ size: "small",
181
+ weight: "bold",
182
+ transform: "capitalize"
183
+ }, this.mapInteractionTypeToTranslation(metadata.interaction_type)), /*#__PURE__*/React.createElement("div", {
184
+ id: "itemBody",
185
+ className: styles.bodyPresentation
186
+ }, /*#__PURE__*/React.createElement("div", {
187
+ id: bodyId,
188
+ className: bodyClass
189
+ }, /*#__PURE__*/React.createElement(Text, {
190
+ size: "small"
191
+ }, metadata.item_body)), this.state.bodyToggable && this.renderBodyToggleButton())), /*#__PURE__*/React.createElement("div", {
192
+ className: styles.metricsWithControls
193
+ }, /*#__PURE__*/React.createElement("div", {
194
+ className: styles.metricGroup
195
+ }, /*#__PURE__*/React.createElement("div", {
196
+ className: styles.metricsRow
197
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
198
+ metricKey: "difficulty_index",
199
+ label: t('Item Difficulty'),
200
+ value: t.number(scores.difficulty_index),
201
+ popoverDescription: difficultyIndex
202
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
203
+ metricKey: "mean",
204
+ label: t('Mean Earned Points'),
205
+ value: t.number(scores.mean)
206
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
207
+ metricKey: "median",
208
+ label: t('Median Earned Points'),
209
+ value: t.number(scores.median)
210
+ }), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
211
+ metricKey: "discrimination_index",
212
+ label: t('Discrimination Index'),
213
+ value: t.number(scores.discrimination_index),
214
+ popoverDescription: discriminationIndex
215
+ }), this.renderExpandItemCardButton()), this.state.metricsExpanded && this.renderExpanded()))), this.state.itemExpanded && /*#__PURE__*/React.createElement("div", {
216
+ className: styles.expandableInnerWrapper
217
+ }));
218
+ }
219
+ }]);
220
+
221
+ NewItemAnalysis.displayName = "NewItemAnalysis";
222
+ return NewItemAnalysis;
223
+ }(Component), _class2.propTypes = {
224
+ itemAnalysis: PropTypes.shape({
225
+ attempts: PropTypes.shape({
226
+ students_responded: PropTypes.number,
227
+ students_without_response: PropTypes.number
228
+ }),
229
+ metadata: PropTypes.shape({
230
+ interaction_type: PropTypes.string,
231
+ item_body: PropTypes.string,
232
+ item_id: PropTypes.string,
233
+ item_title: PropTypes.string
234
+ }),
235
+ scores: PropTypes.shape({
236
+ difficulty_index: PropTypes.number,
237
+ discrimination_index: PropTypes.number,
238
+ mean: PropTypes.number,
239
+ median: PropTypes.number,
240
+ pearson_correlation: PropTypes.number,
241
+ points_possible: PropTypes.number,
242
+ quartile_distribution: PropTypes.arrayOf(PropTypes.number)
243
+ })
244
+ }).isRequired
245
+ }, _temp)) || _class);
@@ -0,0 +1,9 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing,
3
+ breakpoints = _ref.breakpoints;
4
+ return {
5
+ tabletBreakPoint: "max-width: ".concat(breakpoints.large),
6
+ cardWrapperPadding: spacing.medium,
7
+ viewPadding: spacing.small
8
+ };
9
+ }
@@ -6,42 +6,37 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
  var _dec, _class, _class2, _temp;
7
7
 
8
8
  import { Heading } from '@instructure/ui-heading';
9
- import { Metric } from '@instructure/ui-metric';
10
9
  import React, { Component } from 'react';
11
10
  var styles = {
12
- componentId: 'bsfUh',
11
+ componentId: 'ePPpE',
13
12
  template: function template(theme) {
14
- return "\n\n.bsfUh_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.bsfUh_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.bsfUh_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.bsfUh_eckF{text-transform:uppercase}\n\n.bsfUh_dPzc,.bsfUh_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}\n\n.bsfUh_dPzc{margin-left:-8px}\n\n.bsfUh_dqHR{padding-left:5px}\n\n.bsfUh_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}");
13
+ return "\n\n.ePPpE_eDnN{display:flex;justify-content:space-between;padding-bottom:".concat(theme.headingPadding || 'inherit', "}\n\n.ePPpE_eKXQ{padding:").concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.ePPpE_crZr{padding-top:").concat(theme.metricGroupPaddingTop || 'inherit', "}\n\n.ePPpE_bTHH{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n.ePPpE_dPzc,.ePPpE_cpZE{column-gap:").concat(theme.metricsColumnGap || 'inherit', ";display:flex;flex-wrap:wrap;justify-content:flex-start;row-gap:1.5rem}\n\n.ePPpE_dPzc{margin-left:-8px}");
15
14
  },
16
- 'heading': 'bsfUh_eDnN',
17
- 'cardWrapper': 'bsfUh_eKXQ',
18
- 'container': 'bsfUh_crZr',
19
- 'metricLabel': 'bsfUh_eckF',
20
- 'metricGroup': 'bsfUh_dPzc',
21
- 'metricsWrapper': 'bsfUh_cpZE',
22
- 'popoverContainer': 'bsfUh_dqHR',
23
- 'expandButtonContainer': 'bsfUh_bTHH'
15
+ 'heading': 'ePPpE_eDnN',
16
+ 'cardWrapper': 'ePPpE_eKXQ',
17
+ 'container': 'ePPpE_crZr',
18
+ 'expandButtonContainer': 'ePPpE_bTHH',
19
+ 'metricGroup': 'ePPpE_dPzc',
20
+ 'metricsWrapper': 'ePPpE_cpZE'
24
21
  };
25
22
  import t from '@instructure/quiz-i18n/es/format-message';
26
23
  import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
27
24
  import { Text } from '@instructure/ui-text';
28
25
  import { themeable } from '@instructure/ui-themeable';
29
26
  import theme from "./theme.js";
30
- import { getSanitizedMetricValue } from "../utils.js";
31
- import MetricPopover from "../MetricPopover/index.js";
32
27
  import { formatTimeToFullNumeric } from "../../../../../common/util/formatTimespan.js";
33
28
  import PropTypes from 'prop-types';
34
29
  import Card from "../../../../../common/components/shared/Card/index.js";
30
+ import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
31
+ import AnalysisMetric from "../AnalysisMetric/index.js";
35
32
  import { ScoreDistribution } from "../charts/ScoreDistribution/presenter.js";
36
33
  var stdDevPopoverTexts = {
37
- metricLabel: 'standard deviation',
38
34
  title: 'Lorem ipsum ',
39
35
  subtitle: 'subtitle',
40
36
  body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor',
41
37
  screenReaderLabel: 'standard deviation tooltip'
42
38
  };
43
39
  var cronbachsAlphaPopoverTexts = {
44
- metricLabel: 'cronbach\'s alpha',
45
40
  title: 'Lorem ipsum ',
46
41
  subtitle: 'subtitle',
47
42
  body: 'cronbach\'s alpha description',
@@ -81,50 +76,28 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
81
76
  className: styles.container
82
77
  }, /*#__PURE__*/React.createElement("div", {
83
78
  className: styles.metricGroup
84
- }, _this.renderMetric('median_percentage', t('median score'), t.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage), '%'), _this.renderMetricWithPopover('stddev', stdDevPopoverTexts, t.number(scores === null || scores === void 0 ? void 0 : scores.stddev)), _this.renderMetricWithPopover('cronbachs_alpha', cronbachsAlphaPopoverTexts, t.number(scores === null || scores === void 0 ? void 0 : scores.cronbachs_alpha))));
79
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
80
+ metricKey: "median_percentage",
81
+ label: t('Median Score'),
82
+ value: t.number(scores === null || scores === void 0 ? void 0 : scores.median_percentage),
83
+ suffix: "%"
84
+ }), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
85
+ metricKey: "stddev",
86
+ value: t.number(scores === null || scores === void 0 ? void 0 : scores.stddev),
87
+ label: t('Standard Deviation'),
88
+ popoverDescription: stdDevPopoverTexts
89
+ }), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
90
+ metricKey: "cronbachs_alpha",
91
+ value: t.number(scores === null || scores === void 0 ? void 0 : scores.cronbachs_alpha),
92
+ label: t('Cronbach\'s Alpha'),
93
+ popoverDescription: cronbachsAlphaPopoverTexts
94
+ })));
85
95
  };
86
96
 
87
97
  return _this;
88
98
  }
89
99
 
90
100
  _createClass(NewQuizAnalysis, [{
91
- key: "renderLabelWithPopover",
92
- value: function renderLabelWithPopover(texts) {
93
- return /*#__PURE__*/React.createElement("span", {
94
- className: styles.metricLabel
95
- }, texts.metricLabel, /*#__PURE__*/React.createElement("span", {
96
- className: styles.popoverContainer
97
- }, /*#__PURE__*/React.createElement(MetricPopover, texts)));
98
- }
99
- }, {
100
- key: "renderMetric",
101
- value: function renderMetric(key, label, value, suffix) {
102
- return /*#__PURE__*/React.createElement(Metric, {
103
- theme: {
104
- valueFontWeight: 500
105
- },
106
- textAlign: "start",
107
- key: key,
108
- renderLabel: /*#__PURE__*/React.createElement("span", {
109
- className: styles.metricLabel
110
- }, label),
111
- renderValue: getSanitizedMetricValue(value, suffix)
112
- });
113
- }
114
- }, {
115
- key: "renderMetricWithPopover",
116
- value: function renderMetricWithPopover(key, texts, value) {
117
- return /*#__PURE__*/React.createElement(Metric, {
118
- theme: {
119
- valueFontWeight: 500
120
- },
121
- textAlign: "start",
122
- key: key,
123
- renderLabel: this.renderLabelWithPopover(texts),
124
- renderValue: getSanitizedMetricValue(value)
125
- });
126
- }
127
- }, {
128
101
  key: "render",
129
102
  value: function render() {
130
103
  var quizAnalysis = this.props.quizAnalysis;
@@ -143,9 +116,32 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
143
116
  className: styles.metricGroup
144
117
  }, /*#__PURE__*/React.createElement("div", {
145
118
  className: styles.metricsWrapper
146
- }, this.renderMetric('highscore', t('high score'), scores === null || scores === void 0 ? void 0 : scores.max_percentage, '%'), this.renderMetric('lowscore', t('low score'), scores === null || scores === void 0 ? void 0 : scores.min_percentage, '%'), this.renderMetric('meanscore', t('mean score'), scores === null || scores === void 0 ? void 0 : scores.mean_percentage, '%')), /*#__PURE__*/React.createElement("div", {
119
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
120
+ metricKey: "highscore",
121
+ label: t('high score'),
122
+ value: scores === null || scores === void 0 ? void 0 : scores.max_percentage,
123
+ suffix: "%"
124
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
125
+ metricKey: "lowscore",
126
+ label: t('low score'),
127
+ value: scores === null || scores === void 0 ? void 0 : scores.min_percentage,
128
+ suffix: "%"
129
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
130
+ metricKey: "meanscore",
131
+ label: t('mean score'),
132
+ value: scores === null || scores === void 0 ? void 0 : scores.mean_percentage,
133
+ suffix: "%"
134
+ })), /*#__PURE__*/React.createElement("div", {
147
135
  className: styles.metricsWrapper
148
- }, this.renderMetric('average_attempts', t('average attempts'), t.number(attempts === null || attempts === void 0 ? void 0 : attempts.average_attempts)), this.renderMetric('mean_elapsed_sec', t('mean elapsed time'), formatTimeToFullNumeric(attempts === null || attempts === void 0 ? void 0 : attempts.mean_elapsed_sec))), /*#__PURE__*/React.createElement("div", {
136
+ }, /*#__PURE__*/React.createElement(AnalysisMetric, {
137
+ metricKey: "average_attempts",
138
+ label: t('average attempts'),
139
+ value: t.number(attempts === null || attempts === void 0 ? void 0 : attempts.average_attempts)
140
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
141
+ metricKey: "mean_elapsed_sec",
142
+ label: t('mean elapsed time'),
143
+ value: formatTimeToFullNumeric(attempts === null || attempts === void 0 ? void 0 : attempts.mean_elapsed_sec)
144
+ })), /*#__PURE__*/React.createElement("div", {
149
145
  className: styles.expandButtonContainer
150
146
  }, /*#__PURE__*/React.createElement(ExpandButton, {
151
147
  onClick: this.handleToggle,
@@ -163,10 +159,10 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
163
159
  return NewQuizAnalysis;
164
160
  }(Component), _class2.propTypes = {
165
161
  quizAnalysis: PropTypes.shape({
166
- created_timestamp: PropTypes.string,
162
+ created_timestamp: PropTypes.string.isRequired,
167
163
  metadata: PropTypes.shape({
168
164
  quiz_title: PropTypes.string
169
- }),
165
+ }).isRequired,
170
166
  scores: PropTypes.shape({
171
167
  decile_distribution: PropTypes.arrayOf(PropTypes.number),
172
168
  cronbachs_alpha: PropTypes.number,
@@ -184,4 +180,6 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
184
180
  average_attempts: PropTypes.number
185
181
  }).isRequired
186
182
  }).isRequired
183
+ }, _class2.defaultProps = {
184
+ quizAnalysis: {}
187
185
  }, _temp)) || _class);
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  import React, { useEffect, useState } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { Heading } from '@instructure/ui-heading';
7
- import { Metric, MetricGroup } from '@instructure/ui-metric';
7
+ import NewItemAnalysis from "./NewItemAnalysis/index.js";
8
8
  import Spinner from "../../../../common/components/shared/spinner/Spinner.js";
9
9
  import NewQuizAnalysis from "./NewQuizAnalysis/index.js";
10
10
 
@@ -106,21 +106,10 @@ export var NewQuizAndItemAnalysis = function NewQuizAndItemAnalysis(_ref) {
106
106
  return /*#__PURE__*/React.createElement("div", {
107
107
  className: "fs-mask"
108
108
  }, _ref4, _ref5, itemAnalyses === null || itemAnalyses === void 0 ? void 0 : itemAnalyses.map(function (itemAnalysis) {
109
- return /*#__PURE__*/React.createElement(MetricGroup, {
110
- key: itemAnalysis.metadata.item_id
111
- }, /*#__PURE__*/React.createElement(Metric, {
112
- key: "itemdifficulty",
113
- renderLabel: "ITEM DIFFICULTY",
114
- renderValue: itemAnalysis.scores.difficulty_index
115
- }), /*#__PURE__*/React.createElement(Metric, {
116
- key: "responded",
117
- renderLabel: "RESPONDED",
118
- renderValue: itemAnalysis.attempts.students_responded
119
- }), /*#__PURE__*/React.createElement(Metric, {
120
- key: "skipped",
121
- renderLabel: "SKIPPED/NO RESPONSE",
122
- renderValue: itemAnalysis.attempts.students_without_response
123
- }));
109
+ return /*#__PURE__*/React.createElement(NewItemAnalysis, {
110
+ key: itemAnalysis.metadata.item_id,
111
+ itemAnalysis: itemAnalysis
112
+ });
124
113
  }));
125
114
  /* eslint-enable react/jsx-no-literals */
126
115
  }; // TODO: distinguish between loading and empty item analyses (eg. when there is no items in a quiz)
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _presenter = require("./presenter.js");
9
+
10
+ var _default = _presenter.AnalysisMetric;
11
+ exports.default = _default;