@instructure/quiz-core 17.58.2-rc.0 → 17.58.2-rc.10

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 (63) hide show
  1. package/es/banks/api/banks.js +35 -1
  2. package/es/banks/components/Bank/index.js +16 -7
  3. package/es/banks/components/Bank/presenter.js +198 -18
  4. package/es/building/components/layout/header/BuildingButtons/index.js +2 -0
  5. package/es/building/components/layout/header/BuildingButtons/presenter.js +8 -0
  6. package/es/building/components/resources/BanksTray/presenter.js +2 -1
  7. package/es/common/actions/sharedBanks.js +2 -2
  8. package/es/index.js +1 -0
  9. package/es/moderating/components/events/Event.js +1 -1
  10. package/es/moderating/components/resources/AccommodationsModal/index.js +1 -1
  11. package/es/moderating/components/resources/ModerateTable/presenter.js +2 -2
  12. package/es/moderating/components/resources/ModerateTableRow/index.js +1 -1
  13. package/es/reporting/components/charts/QuintileDistribution/presenter.js +15 -2
  14. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +2 -0
  15. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +64 -0
  16. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +3 -0
  17. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +2 -0
  18. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +75 -0
  19. package/es/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +6 -0
  20. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +2 -0
  21. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +18 -0
  22. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +262 -0
  23. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +12 -0
  24. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +59 -58
  25. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +68 -0
  26. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/index.js +2 -0
  27. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +84 -0
  28. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +12 -0
  29. package/es/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +13 -18
  30. package/es/reporting/components/resources/NewQuizAndItemAnalysis/utils.js +1 -1
  31. package/es/reporting/components/resources/ReportCard/index.js +1 -1
  32. package/lib/banks/api/banks.js +40 -2
  33. package/lib/banks/components/Bank/index.js +15 -2
  34. package/lib/banks/components/Bank/presenter.js +203 -17
  35. package/lib/building/components/layout/header/BuildingButtons/index.js +3 -0
  36. package/lib/building/components/layout/header/BuildingButtons/presenter.js +8 -0
  37. package/lib/building/components/resources/BanksTray/presenter.js +2 -1
  38. package/lib/common/actions/sharedBanks.js +2 -2
  39. package/lib/index.js +107 -98
  40. package/lib/moderating/components/events/Event.js +1 -1
  41. package/lib/moderating/components/resources/AccommodationsModal/index.js +1 -1
  42. package/lib/moderating/components/resources/ModerateTable/presenter.js +2 -2
  43. package/lib/moderating/components/resources/ModerateTableRow/index.js +1 -1
  44. package/lib/reporting/components/charts/QuintileDistribution/presenter.js +15 -2
  45. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/index.js +11 -0
  46. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/presenter.js +83 -0
  47. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisMetric/theme.js +10 -0
  48. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/index.js +11 -0
  49. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/presenter.js +95 -0
  50. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/AnalysisPopoverMetric/theme.js +13 -0
  51. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/index.js +11 -0
  52. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/popoverContent.js +27 -0
  53. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/presenter.js +291 -0
  54. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewItemAnalysis/theme.js +19 -0
  55. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +64 -63
  56. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/index.js +91 -0
  57. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/index.js +11 -0
  58. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +106 -0
  59. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +19 -0
  60. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/presenter.js +15 -20
  61. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/utils.js +1 -1
  62. package/lib/reporting/components/resources/ReportCard/index.js +1 -1
  63. package/package.json +9 -9
@@ -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, PropTypes.array]).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,262 @@
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: 'eLWCD',
13
+ template: function template(theme) {
14
+ return "\n\n.eLWCD_eDnN{display:flex;flex-basis:45%;flex-direction:column;overflow:hidden}\n\n.eLWCD_eKXQ{padding:".concat(theme.cardWrapperPadding || 'inherit', ";position:relative}\n\n.eLWCD_eoBe{font-size:").concat(theme.metricNumberContextFontSize || 'inherit', ";font-weight:").concat(theme.metricNumberContextFontWeight || 'inherit', "}\n\n.eLWCD_eIAv{display:flex;position:relative}\n\n.eLWCD_ePHw{flex-basis:91%;overflow:hidden;padding-bottom:10px;text-overflow:ellipsis;white-space:nowrap}\n\n.eLWCD_dzsH{overflow:visible;text-overflow:unset;white-space:normal}\n\n.eLWCD_byoJ{position:absolute;right:7px;top:-8px}\n\n.eLWCD_evBt{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}\n\n.eLWCD_pAQb{display:flex;flex-direction:column;height:60px}\n\n.eLWCD_zefc{display:flex;flex-basis:55%;justify-content:flex-end}\n\n.eLWCD_dPzc{flex-direction:column}\n\n.eLWCD_dPzc,.eLWCD_dzph{display:flex;flex-basis:100%}\n\n.eLWCD_dzph{align-items:flex-start;box-sizing:border-box;column-gap:5px;justify-content:space-between;padding:0 30px 0 25px}\n\n.eLWCD_eobd{padding-top:1rem}\n\n.eLWCD_NpIG{position:absolute;right:").concat(theme.viewPadding || 'inherit', ";top:").concat(theme.viewPadding || 'inherit', "}\n\n@media screen and (--tabletBreakPoint){.eLWCD_zefc{flex-basis:100%;justify-content:flex-start}.eLWCD_ePHw{flex-basis:94%}.eLWCD_eDnN{flex-basis:100%}.eLWCD_dzph{padding:0}.eLWCD_eDnN h3{padding-right:30px}.eLWCD_NpIG{right:17px}.eLWCD_eIAv{margin-bottom:20px}.eLWCD_byoJ{right:-7px}.eLWCD_dzph{flex-wrap:wrap}}");
15
+ },
16
+ 'heading': 'eLWCD_eDnN',
17
+ 'cardWrapper': 'eLWCD_eKXQ',
18
+ 'metricNumberContext': 'eLWCD_eoBe',
19
+ 'bodyPresentation': 'eLWCD_eIAv',
20
+ 'bodyExcerpt': 'eLWCD_ePHw',
21
+ 'bodyExcerptExpanded': 'eLWCD_dzsH',
22
+ 'bodyExpandButtonWrapper': 'eLWCD_byoJ',
23
+ 'innerWrapper': 'eLWCD_evBt',
24
+ 'expandableInnerWrapper': 'eLWCD_pAQb',
25
+ 'metricsWithControls': 'eLWCD_zefc',
26
+ 'metricGroup': 'eLWCD_dPzc',
27
+ 'metricsRow': 'eLWCD_dzph',
28
+ 'metricsRowPaginated': 'eLWCD_eobd',
29
+ 'itemCardToggleButtonWrapper': 'eLWCD_NpIG'
30
+ };
31
+ import t from '@instructure/quiz-i18n/es/format-message';
32
+ import ExpandButton from "../../../../../common/components/shared/ExpandButton/index.js";
33
+ import { Text } from '@instructure/ui-text';
34
+ import { themeable } from '@instructure/ui-themeable';
35
+ import theme from "./theme.js";
36
+ import { difficultyIndex, discriminationIndex, pearsonCorrelation } from "./popoverContent.js";
37
+ import Card from "../../../../../common/components/shared/Card/index.js";
38
+ import AnalysisMetric from "../AnalysisMetric/index.js";
39
+ import AnalysisPopoverMetric from "../AnalysisPopoverMetric/index.js";
40
+ import PropTypes from 'prop-types';
41
+ import classnames from 'classnames';
42
+ import { interactionTypesNameDictionary } from "../../../../../common/util/interactionTypeMetadata.js";
43
+ export var NewItemAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
44
+ _inherits(NewItemAnalysis, _Component);
45
+
46
+ var _super = _createSuper(NewItemAnalysis);
47
+
48
+ function NewItemAnalysis() {
49
+ var _this;
50
+
51
+ _classCallCheck(this, NewItemAnalysis);
52
+
53
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
54
+ args[_key] = arguments[_key];
55
+ }
56
+
57
+ _this = _super.call.apply(_super, [this].concat(args));
58
+ _this.state = {
59
+ bodyToggable: false,
60
+ bodyExpanded: false,
61
+ itemExpanded: false,
62
+ metricsExpanded: false
63
+ };
64
+
65
+ _this.mapInteractionTypeToTranslation = function (interactionType) {
66
+ return interactionTypesNameDictionary({
67
+ slug: interactionType,
68
+ name: t('Question')
69
+ });
70
+ };
71
+
72
+ _this.buildItemCardHeadingId = function () {
73
+ return "itemCardHeading-".concat(_this.props.itemAnalysis.metadata.item_id);
74
+ };
75
+
76
+ _this.buildItemCardBodyId = function () {
77
+ return "itemCardBody-".concat(_this.props.itemAnalysis.metadata.item_id);
78
+ };
79
+
80
+ _this.bodyExceedsLimit = function (bodyElement, headingElement) {
81
+ if (!bodyElement || !headingElement) {
82
+ return;
83
+ }
84
+
85
+ return bodyElement.scrollWidth > headingElement.clientWidth || _this.state.bodyExpanded;
86
+ };
87
+
88
+ _this.handleBodyWidth = function () {
89
+ var bodyElement = document.getElementById(_this.buildItemCardBodyId());
90
+ var headingElement = document.getElementById(_this.buildItemCardHeadingId());
91
+
92
+ _this.setState({
93
+ bodyToggable: _this.bodyExceedsLimit(bodyElement, headingElement)
94
+ });
95
+ };
96
+
97
+ _this.handleToggle = function () {
98
+ _this.setState({
99
+ metricsExpanded: !_this.state.metricsExpanded
100
+ });
101
+
102
+ _this.setState({
103
+ itemExpanded: !_this.state.itemExpanded
104
+ });
105
+ };
106
+
107
+ _this.handleBodyToggle = function () {
108
+ _this.setState({
109
+ bodyExpanded: !_this.state.bodyExpanded
110
+ });
111
+ };
112
+
113
+ _this.renderExpandItemCardButton = function () {
114
+ return /*#__PURE__*/React.createElement("div", {
115
+ className: styles.itemCardToggleButtonWrapper
116
+ }, /*#__PURE__*/React.createElement(ExpandButton, {
117
+ onClick: _this.handleToggle,
118
+ title: _this.state.metricsExpanded ? t('collapse item card') : t('expand item card'),
119
+ isExpanded: _this.state.metricsExpanded
120
+ }));
121
+ };
122
+
123
+ _this.renderBodyToggleButton = function () {
124
+ return /*#__PURE__*/React.createElement("div", {
125
+ className: styles.bodyExpandButtonWrapper
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.calculateValueWithPointsPossible = function (metricKey, metricValue) {
134
+ var pointsPossible = _this.props.itemAnalysis.scores.points_possible;
135
+ return t.rich('{score, number}<s>/{possible, number} PTS</s>', {
136
+ s: function s(_ref) {
137
+ var children = _ref.children;
138
+ return /*#__PURE__*/React.createElement("span", {
139
+ key: metricKey,
140
+ className: styles.metricNumberContext
141
+ }, children);
142
+ },
143
+ score: metricValue,
144
+ possible: pointsPossible
145
+ });
146
+ };
147
+
148
+ _this.renderExpanded = function () {
149
+ var scores = _this.props.itemAnalysis.scores;
150
+ var classes = classnames(styles.metricsRow, styles.metricsRowPaginated);
151
+ return /*#__PURE__*/React.createElement("div", {
152
+ className: classes
153
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
154
+ metricKey: "pearson_correlation",
155
+ label: t('Pearson Correlation Coefficient'),
156
+ value: t.number(scores.pearson_correlation),
157
+ popoverDescription: pearsonCorrelation
158
+ }));
159
+ };
160
+
161
+ return _this;
162
+ }
163
+
164
+ _createClass(NewItemAnalysis, [{
165
+ key: "componentDidMount",
166
+ value: function componentDidMount() {
167
+ this.handleBodyWidth();
168
+ window.addEventListener('resize', this.handleBodyWidth);
169
+ }
170
+ }, {
171
+ key: "componentWillUnmount",
172
+ value: function componentWillUnmount() {
173
+ window.removeEventListener('resize', this.handleBodyWidth);
174
+ }
175
+ }, {
176
+ key: "render",
177
+ value: function render() {
178
+ var _this$props$itemAnaly = this.props.itemAnalysis,
179
+ metadata = _this$props$itemAnaly.metadata,
180
+ scores = _this$props$itemAnaly.scores;
181
+ var bodyClass = classnames(styles.bodyExcerpt, _defineProperty({}, styles.bodyExcerptExpanded, this.state.bodyExpanded));
182
+ var headingId = this.buildItemCardHeadingId();
183
+ var bodyId = this.buildItemCardBodyId();
184
+ return /*#__PURE__*/React.createElement(Card, {
185
+ className: styles.cardWrapper
186
+ }, /*#__PURE__*/React.createElement("div", {
187
+ className: styles.innerWrapper
188
+ }, /*#__PURE__*/React.createElement("div", {
189
+ id: headingId,
190
+ className: styles.heading
191
+ }, /*#__PURE__*/React.createElement(Heading, {
192
+ margin: "0 0 small 0",
193
+ level: "h3",
194
+ weight: "bold",
195
+ color: "primary"
196
+ }, metadata.item_title), /*#__PURE__*/React.createElement(Text, {
197
+ size: "small",
198
+ weight: "bold",
199
+ transform: "capitalize"
200
+ }, this.mapInteractionTypeToTranslation(metadata.interaction_type)), /*#__PURE__*/React.createElement("div", {
201
+ id: "itemBody",
202
+ className: styles.bodyPresentation
203
+ }, /*#__PURE__*/React.createElement("div", {
204
+ id: bodyId,
205
+ className: bodyClass
206
+ }, /*#__PURE__*/React.createElement(Text, {
207
+ size: "small"
208
+ }, metadata.item_body)), this.state.bodyToggable && this.renderBodyToggleButton())), /*#__PURE__*/React.createElement("div", {
209
+ className: styles.metricsWithControls
210
+ }, /*#__PURE__*/React.createElement("div", {
211
+ className: styles.metricGroup
212
+ }, /*#__PURE__*/React.createElement("div", {
213
+ className: styles.metricsRow
214
+ }, /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
215
+ metricKey: "difficulty_index",
216
+ label: t('Item Difficulty'),
217
+ value: t.number(scores.difficulty_index),
218
+ popoverDescription: difficultyIndex
219
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
220
+ metricKey: "mean",
221
+ label: t('Mean Earned Points'),
222
+ value: this.calculateValueWithPointsPossible('mean', scores.mean)
223
+ }), /*#__PURE__*/React.createElement(AnalysisMetric, {
224
+ metricKey: "median",
225
+ label: t('Median Earned Points'),
226
+ value: this.calculateValueWithPointsPossible('median', scores.median)
227
+ }), /*#__PURE__*/React.createElement(AnalysisPopoverMetric, {
228
+ metricKey: "discrimination_index",
229
+ label: t('Discrimination Index'),
230
+ value: t.number(scores.discrimination_index),
231
+ popoverDescription: discriminationIndex
232
+ }), this.renderExpandItemCardButton()), this.state.metricsExpanded && this.renderExpanded()))), this.state.itemExpanded && /*#__PURE__*/React.createElement("div", {
233
+ className: styles.expandableInnerWrapper
234
+ }));
235
+ }
236
+ }]);
237
+
238
+ NewItemAnalysis.displayName = "NewItemAnalysis";
239
+ return NewItemAnalysis;
240
+ }(Component), _class2.propTypes = {
241
+ itemAnalysis: PropTypes.shape({
242
+ attempts: PropTypes.shape({
243
+ students_responded: PropTypes.number,
244
+ students_without_response: PropTypes.number
245
+ }),
246
+ metadata: PropTypes.shape({
247
+ interaction_type: PropTypes.string,
248
+ item_body: PropTypes.string,
249
+ item_id: PropTypes.string,
250
+ item_title: PropTypes.string
251
+ }),
252
+ scores: PropTypes.shape({
253
+ difficulty_index: PropTypes.number,
254
+ discrimination_index: PropTypes.number,
255
+ mean: PropTypes.number,
256
+ median: PropTypes.number,
257
+ pearson_correlation: PropTypes.number,
258
+ points_possible: PropTypes.number,
259
+ quartile_distribution: PropTypes.arrayOf(PropTypes.number)
260
+ })
261
+ }).isRequired
262
+ }, _temp)) || _class);
@@ -0,0 +1,12 @@
1
+ export default function generator(_ref) {
2
+ var spacing = _ref.spacing,
3
+ breakpoints = _ref.breakpoints,
4
+ typography = _ref.typography;
5
+ return {
6
+ tabletBreakPoint: "max-width: ".concat(breakpoints.large),
7
+ cardWrapperPadding: spacing.medium,
8
+ viewPadding: spacing.small,
9
+ metricNumberContextFontSize: typography.fontSizeMedium,
10
+ metricNumberContextFontWeight: typography.fontWeightNormal
11
+ };
12
+ }
@@ -6,41 +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";
32
+ import { ScoreDistribution } from "../charts/ScoreDistribution/presenter.js";
35
33
  var stdDevPopoverTexts = {
36
- metricLabel: 'standard deviation',
37
34
  title: 'Lorem ipsum ',
38
35
  subtitle: 'subtitle',
39
36
  body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor',
40
37
  screenReaderLabel: 'standard deviation tooltip'
41
38
  };
42
39
  var cronbachsAlphaPopoverTexts = {
43
- metricLabel: 'cronbach\'s alpha',
44
40
  title: 'Lorem ipsum ',
45
41
  subtitle: 'subtitle',
46
42
  body: 'cronbach\'s alpha description',
@@ -80,50 +76,28 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
80
76
  className: styles.container
81
77
  }, /*#__PURE__*/React.createElement("div", {
82
78
  className: styles.metricGroup
83
- }, _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
+ })));
84
95
  };
85
96
 
86
97
  return _this;
87
98
  }
88
99
 
89
100
  _createClass(NewQuizAnalysis, [{
90
- key: "renderLabelWithPopover",
91
- value: function renderLabelWithPopover(texts) {
92
- return /*#__PURE__*/React.createElement("span", {
93
- className: styles.metricLabel
94
- }, texts.metricLabel, /*#__PURE__*/React.createElement("span", {
95
- className: styles.popoverContainer
96
- }, /*#__PURE__*/React.createElement(MetricPopover, texts)));
97
- }
98
- }, {
99
- key: "renderMetric",
100
- value: function renderMetric(key, label, value, suffix) {
101
- return /*#__PURE__*/React.createElement(Metric, {
102
- theme: {
103
- valueFontWeight: 500
104
- },
105
- textAlign: "start",
106
- key: key,
107
- renderLabel: /*#__PURE__*/React.createElement("span", {
108
- className: styles.metricLabel
109
- }, label),
110
- renderValue: getSanitizedMetricValue(value, suffix)
111
- });
112
- }
113
- }, {
114
- key: "renderMetricWithPopover",
115
- value: function renderMetricWithPopover(key, texts, value) {
116
- return /*#__PURE__*/React.createElement(Metric, {
117
- theme: {
118
- valueFontWeight: 500
119
- },
120
- textAlign: "start",
121
- key: key,
122
- renderLabel: this.renderLabelWithPopover(texts),
123
- renderValue: getSanitizedMetricValue(value)
124
- });
125
- }
126
- }, {
127
101
  key: "render",
128
102
  value: function render() {
129
103
  var quizAnalysis = this.props.quizAnalysis;
@@ -142,15 +116,40 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
142
116
  className: styles.metricGroup
143
117
  }, /*#__PURE__*/React.createElement("div", {
144
118
  className: styles.metricsWrapper
145
- }, 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", {
146
135
  className: styles.metricsWrapper
147
- }, 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", {
148
145
  className: styles.expandButtonContainer
149
146
  }, /*#__PURE__*/React.createElement(ExpandButton, {
150
147
  onClick: this.handleToggle,
151
148
  title: expanded ? t('collapse quiz analysis') : t('expand quiz analysis'),
152
149
  isExpanded: expanded
153
- }))), expanded && this.renderExpanded(), /*#__PURE__*/React.createElement(Text, {
150
+ }))), expanded && this.renderExpanded(), /*#__PURE__*/React.createElement(ScoreDistribution, {
151
+ decileDistribution: quizAnalysis.scores.decile_distribution
152
+ }), /*#__PURE__*/React.createElement(Text, {
154
153
  size: "x-small"
155
154
  }, _ref, /*#__PURE__*/React.createElement("b", null, t('Data Last Updated:')), "\xA0", t.date(Date.parse(quizAnalysis.created_timestamp), 'medium')));
156
155
  }
@@ -160,10 +159,10 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
160
159
  return NewQuizAnalysis;
161
160
  }(Component), _class2.propTypes = {
162
161
  quizAnalysis: PropTypes.shape({
163
- created_timestamp: PropTypes.string,
162
+ created_timestamp: PropTypes.string.isRequired,
164
163
  metadata: PropTypes.shape({
165
164
  quiz_title: PropTypes.string
166
- }),
165
+ }).isRequired,
167
166
  scores: PropTypes.shape({
168
167
  decile_distribution: PropTypes.arrayOf(PropTypes.number),
169
168
  cronbachs_alpha: PropTypes.number,
@@ -181,4 +180,6 @@ export var NewQuizAnalysis = (_dec = themeable(theme, styles), _dec(_class = (_t
181
180
  average_attempts: PropTypes.number
182
181
  }).isRequired
183
182
  }).isRequired
183
+ }, _class2.defaultProps = {
184
+ quizAnalysis: {}
184
185
  }, _temp)) || _class);