@instructure/quiz-core 20.4.1 → 20.4.2-rc.1

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 (31) hide show
  1. package/es/reporting/components/Caption/index.js +13 -18
  2. package/es/reporting/components/Caption/styles.js +12 -0
  3. package/es/reporting/components/Caption/theme.js +4 -2
  4. package/es/reporting/components/charts/Legend/index.js +45 -33
  5. package/es/reporting/components/charts/Legend/styles.js +44 -0
  6. package/es/reporting/components/charts/Legend/theme.js +4 -2
  7. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +61 -79
  8. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/styles.js +100 -0
  9. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/theme.js +4 -2
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +34 -44
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/styles.js +40 -0
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +4 -2
  13. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +27 -26
  14. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/styles.js +20 -0
  15. package/es/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +4 -2
  16. package/lib/reporting/components/Caption/index.js +12 -19
  17. package/lib/reporting/components/Caption/styles.js +20 -0
  18. package/lib/reporting/components/Caption/theme.js +6 -3
  19. package/lib/reporting/components/charts/Legend/index.js +44 -34
  20. package/lib/reporting/components/charts/Legend/styles.js +54 -0
  21. package/lib/reporting/components/charts/Legend/theme.js +6 -3
  22. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +61 -80
  23. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/styles.js +110 -0
  24. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/theme.js +6 -3
  25. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/presenter.js +33 -45
  26. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/styles.js +48 -0
  27. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/NewQuizAnalysis/theme.js +6 -3
  28. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/presenter.js +27 -26
  29. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/styles.js +28 -0
  30. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/charts/ScoreDistribution/theme.js +6 -3
  31. package/package.json +10 -11
@@ -5,20 +5,14 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
 
6
6
  var _dec, _class, _class2, _temp;
7
7
 
8
- import React, { Component } from 'react';
8
+ /** @jsx jsx */
9
+ import { Component } from 'react';
9
10
  import PropTypes from 'prop-types';
10
11
  import { Heading } from '@instructure/ui-heading';
11
- import { themeable } from '@instructure/ui-themeable';
12
- var styles = {
13
- componentId: 'bEEaV',
14
- template: function template(theme) {
15
- return "\n\n.bEEaV_caGd{margin:".concat(theme.contentMargin || 'inherit', "}\n\n.bEEaV_biBD{padding-top:").concat(theme.childrenPadding || 'inherit', "}");
16
- },
17
- 'content': 'bEEaV_caGd',
18
- 'children': 'bEEaV_biBD'
19
- };
20
- import theme from "./theme.js";
21
- export var Caption = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
12
+ import { withStyle, jsx } from '@instructure/emotion';
13
+ import generateStyle from "./styles.js";
14
+ import generateComponentTheme from "./theme.js";
15
+ export var Caption = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
22
16
  _inherits(Caption, _Component);
23
17
 
24
18
  var _super = _createSuper(Caption);
@@ -32,15 +26,15 @@ export var Caption = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
32
26
  _createClass(Caption, [{
33
27
  key: "render",
34
28
  value: function render() {
35
- return /*#__PURE__*/React.createElement("div", {
36
- className: styles.content
37
- }, /*#__PURE__*/React.createElement(Heading, {
29
+ return jsx("div", {
30
+ css: this.props.styles.content
31
+ }, jsx(Heading, {
38
32
  level: "reset",
39
33
  as: "h2",
40
34
  border: "bottom",
41
35
  color: "primary"
42
- }, this.props.text), /*#__PURE__*/React.createElement("div", {
43
- className: styles.children
36
+ }, this.props.text), jsx("div", {
37
+ css: this.props.styles.children
44
38
  }, this.props.children));
45
39
  }
46
40
  }]);
@@ -49,7 +43,8 @@ export var Caption = (_dec = themeable(theme, styles), _dec(_class = (_temp = _c
49
43
  return Caption;
50
44
  }(Component), _class2.propTypes = {
51
45
  text: PropTypes.string,
52
- children: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)])
46
+ children: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]),
47
+ styles: PropTypes.object
53
48
  }, _class2.defaultProps = {
54
49
  text: void 0,
55
50
  children: void 0
@@ -0,0 +1,12 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ content: {
4
+ margin: componentTheme.contentMargin
5
+ },
6
+ children: {
7
+ paddingTop: componentTheme.childrenPadding
8
+ }
9
+ };
10
+ };
11
+
12
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var spacing = _ref.spacing,
3
3
  borders = _ref.borders,
4
4
  colors = _ref.colors;
@@ -6,4 +6,6 @@ export default function generator(_ref) {
6
6
  contentMargin: spacing.small,
7
7
  childrenPadding: spacing.xSmall
8
8
  };
9
- }
9
+ };
10
+
11
+ export default generateComponentTheme;
@@ -1,3 +1,4 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -5,25 +6,14 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
6
 
6
7
  var _dec, _class, _class2, _temp;
7
8
 
8
- import React, { Component } from 'react';
9
+ /** @jsx jsx */
10
+ import { Component } from 'react';
9
11
  import PropTypes from 'prop-types';
10
12
  import { PresentationContent } from '@instructure/ui-a11y-content';
11
- import classnames from 'classnames';
12
- import { themeable } from '@instructure/ui-themeable';
13
- var styles = {
14
- componentId: 'gafaO',
15
- template: function template(theme) {
16
- return "\n\n.gafaO_fEOG{border:".concat(theme.containerBorderWidth || 'inherit', " solid ").concat(theme.containerBorderColor || 'inherit', "}\n\n.gafaO_dWcO{margin:0 calc(-1*").concat(theme.seriesContainerRowMargin || 'inherit', ")}\n\n.gafaO_czwp{align-items:center;flex-direction:row;margin:").concat(theme.seriesContainerMargin || 'inherit', "}\n\n.gafaO_fEOG .gafaO_czwp{display:flex}\n\n.gafaO_dWcO .gafaO_czwp{display:inline-flex;padding:0 ").concat(theme.seriesContainerRowMargin || 'inherit', "}\n\n.gafaO_crhW{display:flex;height:1.2rem;margin-right:").concat(theme.seriesSwatchMargin || 'inherit', ";width:1.2rem}\n\n.gafaO_fAPS{flex:1}\n\n.gafaO_eVVT{color:").concat(theme.seriesLabelColor || 'inherit', ";font-family:").concat(theme.seriesLabelFontFamily || 'inherit', ";font-size:").concat(theme.seriesLabelFontSize || 'inherit', ";white-space:nowrap}");
17
- },
18
- 'containerColumn': 'gafaO_fEOG',
19
- 'containerRow': 'gafaO_dWcO',
20
- 'seriesContainer': 'gafaO_czwp',
21
- 'seriesSwatchContainer': 'gafaO_crhW',
22
- 'seriesSwatch': 'gafaO_fAPS',
23
- 'seriesLabel': 'gafaO_eVVT'
24
- };
25
- import theme from "./theme.js";
26
- export var Legend = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
13
+ import { withStyle, jsx } from '@instructure/emotion';
14
+ import generateStyle from "./styles.js";
15
+ import generateComponentTheme from "./theme.js";
16
+ export var Legend = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
27
17
  _inherits(Legend, _Component);
28
18
 
29
19
  var _super = _createSuper(Legend);
@@ -35,27 +25,47 @@ export var Legend = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
35
25
  }
36
26
 
37
27
  _createClass(Legend, [{
28
+ key: "componentDidMount",
29
+ value: function componentDidMount() {
30
+ this.props.makeStyles();
31
+ }
32
+ }, {
33
+ key: "componentDidUpdate",
34
+ value: function componentDidUpdate() {
35
+ this.props.makeStyles();
36
+ }
37
+ }, {
38
38
  key: "renderSeries",
39
- value: function renderSeries(series, index) {
40
- return /*#__PURE__*/React.createElement("div", {
39
+ value: function renderSeries(series, index, styles) {
40
+ var customStyles = series.customStyles ? series.customStyles : {};
41
+ return jsx("div", {
41
42
  key: index,
42
- className: styles.seriesContainer
43
- }, /*#__PURE__*/React.createElement("div", {
44
- className: styles.seriesSwatchContainer
45
- }, /*#__PURE__*/React.createElement("div", {
46
- className: classnames([styles.seriesSwatch, series.className])
47
- })), /*#__PURE__*/React.createElement("div", {
48
- className: styles.seriesLabel
43
+ className: "seriesContainer",
44
+ css: styles.seriesContainer
45
+ }, jsx("div", {
46
+ css: styles.seriesSwatchContainer
47
+ }, jsx("div", {
48
+ css: _objectSpread(_objectSpread({}, styles.seriesSwatch), customStyles)
49
+ })), jsx("div", {
50
+ css: styles.seriesLabel
49
51
  }, series.label));
50
52
  }
51
53
  }, {
52
54
  key: "render",
53
55
  value: function render() {
54
- var variant = this.props.variant;
55
- var containerClass = variant === 'row' ? styles.containerRow : styles.containerColumn;
56
- return /*#__PURE__*/React.createElement(PresentationContent, null, /*#__PURE__*/React.createElement("div", {
57
- className: containerClass
58
- }, this.props.series.map(this.renderSeries)));
56
+ var _this = this;
57
+
58
+ var _this$props = this.props,
59
+ variant = _this$props.variant,
60
+ series = _this$props.series,
61
+ styles = _this$props.styles;
62
+ var containerClass = variant === 'row' ? 'containerRow' : 'containerColumn';
63
+ return jsx(PresentationContent, null, jsx("div", {
64
+ className: containerClass,
65
+ css: styles.containerStyle
66
+ }, series.map(function (s, i) {
67
+ return _this.renderSeries(s, i, styles);
68
+ })));
59
69
  }
60
70
  }]);
61
71
 
@@ -64,9 +74,11 @@ export var Legend = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
64
74
  }(Component), _class2.propTypes = {
65
75
  series: PropTypes.arrayOf(PropTypes.shape({
66
76
  label: PropTypes.string.isRequired,
67
- className: PropTypes.string.isRequired
77
+ customStyles: PropTypes.object.isRequired
68
78
  })),
69
- variant: PropTypes.oneOf(['column', 'row'])
79
+ variant: PropTypes.oneOf(['column', 'row']),
80
+ makeStyles: PropTypes.func,
81
+ styles: PropTypes.object
70
82
  }, _class2.defaultProps = {
71
83
  series: [],
72
84
  variant: 'column'
@@ -0,0 +1,44 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+
3
+ var generateStyle = function generateStyle(componentTheme, props) {
4
+ var containerVariant = {
5
+ row: {
6
+ margin: "0 calc(-1 * ".concat(componentTheme.seriesContainerRowMargin, ")"),
7
+ '.seriesContainer': {
8
+ display: 'inline-flex',
9
+ padding: "0 ".concat(componentTheme.seriesContainerRowMargin)
10
+ }
11
+ },
12
+ column: {
13
+ border: "".concat(componentTheme.containerBorderWidth, " solid ").concat(componentTheme.containerBorderColor),
14
+ '.seriesContainer': {
15
+ display: 'flex'
16
+ }
17
+ }
18
+ };
19
+ return {
20
+ seriesContainer: {
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ margin: componentTheme.seriesContainerMargin
24
+ },
25
+ containerStyle: _objectSpread({}, containerVariant[props.variant]),
26
+ seriesSwatchContainer: {
27
+ width: '1.2rem',
28
+ height: '1.2rem',
29
+ marginRight: componentTheme.seriesSwatchMargin,
30
+ display: 'flex'
31
+ },
32
+ seriesSwatch: {
33
+ flex: 1
34
+ },
35
+ seriesLabel: {
36
+ fontFamily: componentTheme.seriesLabelFontFamily,
37
+ fontSize: componentTheme.seriesLabelFontSize,
38
+ whiteSpace: 'nowrap',
39
+ color: componentTheme.seriesLabelColor
40
+ }
41
+ };
42
+ };
43
+
44
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var borders = _ref.borders,
3
3
  spacing = _ref.spacing,
4
4
  colors = _ref.colors,
@@ -14,4 +14,6 @@ export default function generator(_ref) {
14
14
  seriesLabelFontSize: typography.fontSizeXSmall,
15
15
  seriesLabelColor: colors.textDarkest
16
16
  };
17
- }
17
+ };
18
+
19
+ export default generateComponentTheme;
@@ -5,6 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
 
6
6
  var _dec, _class, _class2, _temp;
7
7
 
8
+ /** @jsx jsx */
8
9
  import React, { Component } from 'react';
9
10
  import PropTypes from 'prop-types';
10
11
  import ImmutablePropTypes from 'react-immutable-proptypes';
@@ -12,7 +13,7 @@ import OutcomeList from '@instructure/outcomes-ui/es/containers/OutcomeList';
12
13
  import { MetricGroup } from '@instructure/ui-metric';
13
14
  import { Heading } from '@instructure/ui-heading';
14
15
  import { ScreenReaderContent, PresentationContent } from '@instructure/ui-a11y-content';
15
- import { themeable } from '@instructure/ui-themeable';
16
+ import { withStyle, jsx } from '@instructure/emotion';
16
17
  import { RichContentRenderer } from '@instructure/quiz-rce';
17
18
  import Card from "../../../../common/components/shared/Card/index.js";
18
19
  import ExpandButton from "../../../../common/components/shared/ExpandButton/index.js";
@@ -24,34 +25,12 @@ import Caption from "../../Caption/index.js";
24
25
  import MetricsListItem from "../../MetricsListItem/index.js";
25
26
  import t from '@instructure/quiz-i18n/es/format-message';
26
27
  import { liveRegion, withI18nSupport } from '@instructure/quiz-common';
27
- var styles = {
28
- componentId: 'eCUxk',
29
- template: function template(theme) {
30
- return "\n\n.eCUxk_cQXk{margin-bottom:".concat(theme.itemAnalysisRowMargin || 'inherit', ";padding:").concat(theme.itemAnalysisRowPadding || 'inherit', ";position:relative}\n\n.eCUxk_dlpV{align-items:flex-start;display:flex;flex-direction:row;justify-content:space-between}\n\n.eCUxk_fAhB{color:").concat(theme.headerTextColor || 'inherit', ";font-size:").concat(theme.headerTextFontSize || 'inherit', "}\n\n.eCUxk_dzph{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;padding-bottom:").concat(theme.metricsRowLowerPadding || 'inherit', "}\n\n.eCUxk_dFNV{color:").concat(theme.metricNoteColor || 'inherit', ";font-size:").concat(theme.metricNoteFontSize || 'inherit', "}\n\n.eCUxk_cloC{flex:1 0 35%;font-size:").concat(theme.stemFontSize || 'inherit', ";line-height:").concat(theme.stemLineHeight || 'inherit', ";margin-bottom:").concat(theme.stemMargin || 'inherit', "}\n\n.eCUxk_cloC p{margin:0}\n\n.eCUxk_bQrf{flex:0 1 42rem}\n\n.eCUxk_eiMu{justify-content:center}\n\n.eCUxk_bwKH{color:").concat(theme.emptyTextColor || 'inherit', ";flex:0 1 42rem;padding:").concat(theme.emptyTextPadding || 'inherit', ";text-align:center}\n\n[dir=ltr] .eCUxk_bwKH,[dir=rtl] .eCUxk_bwKH{text-align:center}\n\n.eCUxk_sIdV{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;margin:0 -1rem}\n\n.eCUxk_dvfr{flex:10 1 45%}\n\n.eCUxk_dYYR{flex:1 1 auto;min-width:1%}\n\n.eCUxk_eFpQ{align-items:center;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:center;padding:0 ").concat(theme.answerDistributionPadding || 'inherit', ";position:relative}\n\n.eCUxk_dFwC{padding:0 ").concat(theme.answerDistributionChartPadding || 'inherit', ";width:19rem}\n\n.eCUxk_bqaR{padding:0 ").concat(theme.answerDistributionLegendPadding || 'inherit', "}\n\n.eCUxk_RMvh{background-color:").concat(theme.answerDistributionSwatchColor || 'inherit', "}\n\n.eCUxk_dMVr{display:flex;margin:0 -1rem}\n\n@media screen and (--phoneBreakPoint){.eCUxk_eFpQ{padding:0}.eCUxk_eiMu{flex-basis:50%}}");
31
- },
32
- 'itemAnalysisRow': 'eCUxk_cQXk',
33
- 'headerRow': 'eCUxk_dlpV',
34
- 'headerText': 'eCUxk_fAhB',
35
- 'metricsRow': 'eCUxk_dzph',
36
- 'metricNote': 'eCUxk_dFNV',
37
- 'stem': 'eCUxk_cloC',
38
- 'metrics': 'eCUxk_bQrf',
39
- 'metric': 'eCUxk_eiMu',
40
- 'emptyText': 'eCUxk_bwKH',
41
- 'answerAnalysis': 'eCUxk_sIdV',
42
- 'answerTableSection': 'eCUxk_dvfr',
43
- 'answerDistributionSection': 'eCUxk_dYYR',
44
- 'answerDistribution': 'eCUxk_eFpQ',
45
- 'answerDistributionChart': 'eCUxk_dFwC',
46
- 'answerDistributionLegend': 'eCUxk_bqaR',
47
- 'answerDistributionSwatch': 'eCUxk_RMvh',
48
- 'outcomeAlignments': 'eCUxk_dMVr'
49
- };
50
- import theme from "./theme.js";
28
+ import generateStyle from "./styles.js";
29
+ import generateComponentTheme from "./theme.js";
51
30
 
52
- var _ref2 = /*#__PURE__*/React.createElement(Spinner, null);
31
+ var _ref2 = jsx(Spinner, null);
53
32
 
54
- export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_withI18nSupport) {
33
+ export var ItemAnalysisRow = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_withI18nSupport) {
55
34
  _inherits(ItemAnalysisRow, _withI18nSupport);
56
35
 
57
36
  var _super = _createSuper(ItemAnalysisRow);
@@ -94,7 +73,7 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
94
73
  position: position,
95
74
  expanded: expanded
96
75
  });
97
- return /*#__PURE__*/React.createElement(ExpandButton, {
76
+ return jsx(ExpandButton, {
98
77
  onClick: this.toggleExpanded,
99
78
  title: title,
100
79
  isExpanded: expanded,
@@ -108,73 +87,75 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
108
87
  var interactionType = this.props.itemAnalysis.interactionTypeName();
109
88
  var pointsPossible = this.props.itemAnalysis.pointsPossible;
110
89
  var separator = ' | ';
111
- return /*#__PURE__*/React.createElement("div", {
112
- className: styles.headerRow
113
- }, /*#__PURE__*/React.createElement("div", {
114
- className: styles.headerText
115
- }, /*#__PURE__*/React.createElement(Heading, {
90
+ return jsx("div", {
91
+ css: this.props.styles.headerRow
92
+ }, jsx("div", {
93
+ css: this.props.styles.headerText
94
+ }, jsx(Heading, {
116
95
  level: "reset",
117
96
  as: "h3"
118
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Question {position, number}', {
97
+ }, jsx(ScreenReaderContent, null, t('Question {position, number}', {
119
98
  position: position
120
- })), interactionType, /*#__PURE__*/React.createElement(PresentationContent, null, separator), t('{pointsPossible, number} points possible', {
99
+ })), interactionType, jsx(PresentationContent, null, separator), t('{pointsPossible, number} points possible', {
121
100
  pointsPossible: pointsPossible
122
101
  }))), this.props.itemAnalysis.isPresent() && this.renderExpandButton());
123
102
  }
124
103
  }, {
125
104
  key: "renderStem",
126
105
  value: function renderStem() {
127
- return /*#__PURE__*/React.createElement(RichContentRenderer, {
128
- customStyles: styles.stem,
106
+ return jsx(RichContentRenderer, {
107
+ customStyles: this.props.styles.stem,
129
108
  content: this.props.itemAnalysis.itemBody
130
109
  });
131
110
  }
132
111
  }, {
133
112
  key: "defaultMetricsList",
134
113
  value: function defaultMetricsList() {
114
+ var _this2 = this;
115
+
135
116
  var mean = t.rich('{score}<0>/{possible, number} pts</0>', {
136
117
  0: function _(_ref) {
137
118
  var children = _ref.children;
138
- return /*#__PURE__*/React.createElement("span", {
119
+ return jsx("span", {
139
120
  key: "mean",
140
- className: styles.metricNote
121
+ css: _this2.props.styles.metricNote
141
122
  }, children);
142
123
  },
143
124
  score: this.props.itemAnalysis.meanScore(this.locale) || 0,
144
125
  possible: this.props.itemAnalysis.pointsPossible
145
126
  });
146
- return /*#__PURE__*/React.createElement(MetricGroup, null, /*#__PURE__*/React.createElement(MetricsListItem, {
127
+ return jsx(MetricGroup, null, jsx(MetricsListItem, {
147
128
  key: "difficultyIndex",
148
129
  renderLabel: t('Difficulty Index'),
149
130
  renderValue: this.props.itemAnalysis.difficultyIndex(this.locale),
150
- className: styles.metric,
131
+ css: this.props.styles.metric,
151
132
  isGroupChild: true
152
- }), /*#__PURE__*/React.createElement(MetricsListItem, {
133
+ }), jsx(MetricsListItem, {
153
134
  key: "discriminationIndex",
154
135
  renderLabel: t('Discrimination Index'),
155
136
  renderValue: this.props.itemAnalysis.discriminationIndex(this.locale),
156
- className: styles.metric,
137
+ css: this.props.styles.metric,
157
138
  isGroupChild: true
158
- }), /*#__PURE__*/React.createElement(MetricsListItem, {
139
+ }), jsx(MetricsListItem, {
159
140
  key: "rpb",
160
141
  renderLabel: t('RPB'),
161
142
  renderValue: this.props.itemAnalysis.pointBiserial(this.locale),
162
- className: styles.metric,
143
+ css: this.props.styles.metric,
163
144
  isGroupChild: true
164
- }), /*#__PURE__*/React.createElement(MetricsListItem, {
145
+ }), jsx(MetricsListItem, {
165
146
  key: "meanEarnedScore",
166
147
  renderLabel: t('Mean Earned Score'),
167
148
  renderValue: mean,
168
- className: styles.metric,
149
+ css: this.props.styles.metric,
169
150
  isGroupChild: true
170
151
  }));
171
152
  }
172
153
  }, {
173
154
  key: "renderMetrics",
174
155
  value: function renderMetrics() {
175
- var list = React.Children.count(this.props.children) === 0 ? this.defaultMetricsList() : /*#__PURE__*/React.createElement(MetricGroup, null, this.props.children);
176
- return /*#__PURE__*/React.createElement("div", {
177
- className: styles.metrics
156
+ var list = React.Children.count(this.props.children) === 0 ? this.defaultMetricsList() : jsx(MetricGroup, null, this.props.children);
157
+ return jsx("div", {
158
+ css: this.props.styles.metrics
178
159
  }, list);
179
160
  }
180
161
  }, {
@@ -184,11 +165,11 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
184
165
  return;
185
166
  }
186
167
 
187
- return /*#__PURE__*/React.createElement("div", {
188
- className: styles.answerTableSection
189
- }, /*#__PURE__*/React.createElement(Caption, {
168
+ return jsx("div", {
169
+ css: this.props.styles.answerTableSection
170
+ }, jsx(Caption, {
190
171
  text: t('Answer Frequency Summary')
191
- }, /*#__PURE__*/React.createElement(AnswerFrequencySummary, {
172
+ }, jsx(AnswerFrequencySummary, {
192
173
  itemAnalysis: this.props.itemAnalysis
193
174
  })));
194
175
  }
@@ -197,26 +178,26 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
197
178
  value: function renderAnswerAnalysis() {
198
179
  if (this.props.expanded) {
199
180
  var quintile = this.props.itemAnalysis.quintile();
200
- return /*#__PURE__*/React.createElement("div", {
201
- className: styles.answerAnalysis
202
- }, this.renderAnswerAnalysisChart(), /*#__PURE__*/React.createElement("div", {
203
- className: styles.answerDistributionSection,
181
+ return jsx("div", {
182
+ css: this.props.styles.answerAnalysis
183
+ }, this.renderAnswerAnalysisChart(), jsx("div", {
184
+ css: this.props.styles.answerDistributionSection,
204
185
  "data-automation": "sdk-reporting-answer-distribution"
205
- }, /*#__PURE__*/React.createElement(Caption, {
186
+ }, jsx(Caption, {
206
187
  text: t('Performance by Quintile')
207
- }, /*#__PURE__*/React.createElement("div", {
208
- className: styles.answerDistribution
209
- }, /*#__PURE__*/React.createElement("div", {
210
- className: styles.answerDistributionChart
211
- }, /*#__PURE__*/React.createElement(QuintileDistribution, {
188
+ }, jsx("div", {
189
+ css: this.props.styles.answerDistribution
190
+ }, jsx("div", {
191
+ css: this.props.styles.answerDistributionChart
192
+ }, jsx(QuintileDistribution, {
212
193
  visualDistribution: quintile,
213
194
  animateDelay: this.props.animateDelay,
214
195
  animateDuration: this.props.animateDuration
215
- })), /*#__PURE__*/React.createElement("div", {
216
- className: styles.answerDistributionLegend
217
- }, /*#__PURE__*/React.createElement(Legend, {
196
+ })), jsx("div", {
197
+ css: this.props.styles.answerDistributionLegend
198
+ }, jsx(Legend, {
218
199
  series: [{
219
- className: styles.answerDistributionSwatch,
200
+ customStyles: this.props.styles.answerDistributionSwatch,
220
201
  label: t('Number of Students')
221
202
  }]
222
203
  }))))));
@@ -232,11 +213,11 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
232
213
  outcomesToken = _this$props3.outcomesToken;
233
214
 
234
215
  if (expanded && outcomesEndpoint && itemAnalysis.outcomeAlignmentSetGuid) {
235
- return /*#__PURE__*/React.createElement("div", {
236
- className: styles.outcomeAlignments
237
- }, /*#__PURE__*/React.createElement(Caption, {
216
+ return jsx("div", {
217
+ css: this.props.styles.outcomeAlignments
218
+ }, jsx(Caption, {
238
219
  text: t('Outcomes')
239
- }, /*#__PURE__*/React.createElement(OutcomeList, {
220
+ }, jsx(OutcomeList, {
240
221
  artifactType: "quizzes.item",
241
222
  artifactId: itemAnalysis.itemId,
242
223
  alignmentSetId: itemAnalysis.outcomeAlignmentSetGuid,
@@ -251,8 +232,8 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
251
232
  }, {
252
233
  key: "renderNotFound",
253
234
  value: function renderNotFound() {
254
- return /*#__PURE__*/React.createElement("div", {
255
- className: styles.emptyText
235
+ return jsx("div", {
236
+ css: this.props.styles.emptyText
256
237
  }, t('No submissions yet'));
257
238
  }
258
239
  }, {
@@ -263,11 +244,11 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
263
244
  }
264
245
 
265
246
  var present = this.props.itemAnalysis.isPresent();
266
- return /*#__PURE__*/React.createElement(Card, {
247
+ return jsx(Card, {
267
248
  key: this.props.itemId,
268
- className: styles.itemAnalysisRow
269
- }, this.renderHeader(), /*#__PURE__*/React.createElement("div", {
270
- className: styles.metricsRow
249
+ css: this.props.styles.itemAnalysisRow
250
+ }, this.renderHeader(), jsx("div", {
251
+ css: this.props.styles.metricsRow
271
252
  }, this.renderStem(), present ? this.renderMetrics() : this.renderNotFound()), present && this.renderAnswerAnalysis(), this.renderOutcomeAlignments());
272
253
  }
273
254
  }]);
@@ -286,7 +267,8 @@ export var ItemAnalysisRow = (_dec = themeable(theme, styles), _dec(_class = (_t
286
267
  outcomesToken: PropTypes.string,
287
268
  screenreaderNotification: PropTypes.func.isRequired,
288
269
  children: PropTypes.arrayOf(PropTypes.node),
289
- locale: PropTypes.string
270
+ locale: PropTypes.string,
271
+ styles: PropTypes.object
290
272
  }, _class2.defaultProps = {
291
273
  animateDelay: void 0,
292
274
  animateDuration: void 0,
@@ -0,0 +1,100 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var generateStyle = function generateStyle(componentTheme) {
4
+ var mq = "@media screen and (".concat(componentTheme.phoneBreakPoint, ")");
5
+ return {
6
+ itemAnalysisRow: {
7
+ padding: componentTheme.itemAnalysisRowPadding,
8
+ marginBottom: componentTheme.itemAnalysisRowMargin,
9
+ position: 'relative'
10
+ },
11
+ headerRow: {
12
+ display: 'flex',
13
+ flexDirection: 'row',
14
+ justifyContent: 'space-between',
15
+ alignItems: 'flex-start'
16
+ },
17
+ headerText: {
18
+ color: componentTheme.headerTextColor,
19
+ fontSize: componentTheme.headerTextFontSize
20
+ },
21
+ metricsRow: {
22
+ display: 'flex',
23
+ flexDirection: 'row',
24
+ flexWrap: 'wrap',
25
+ justifyContent: 'center',
26
+ paddingBottom: componentTheme.metricsRowLowerPadding
27
+ },
28
+ metricNote: {
29
+ fontSize: componentTheme.metricNoteFontSize,
30
+ color: componentTheme.metricNoteColor
31
+ },
32
+ stem: {
33
+ flex: '1 0 35%',
34
+ fontSize: componentTheme.stemFontSize,
35
+ lineHeight: componentTheme.stemLineHeight,
36
+ marginBottom: componentTheme.stemMargin,
37
+ '& p': {
38
+ margin: 0
39
+ }
40
+ },
41
+ metrics: {
42
+ flex: '0 1 42rem'
43
+ },
44
+ metric: _defineProperty({
45
+ justifyContent: 'center'
46
+ }, mq, {
47
+ flexBasis: '50%'
48
+ }),
49
+ emptyText: {
50
+ flex: '0 1 42rem',
51
+ padding: componentTheme.emptyTextPadding,
52
+ textAlign: 'center',
53
+ color: componentTheme.emptyTextColor
54
+ },
55
+ answerAnalysis: {
56
+ display: 'flex',
57
+ flexDirection: 'row',
58
+ flexWrap: 'wrap',
59
+ justifyContent: 'center',
60
+ margin: '0 -1rem'
61
+ },
62
+ answerTableSection: {
63
+ /* Explicit flex-basis is a workaround for https://bugs.webkit.org/show_bug.cgi?id=136041 */
64
+ flex: '10 1 45%'
65
+ },
66
+ answerDistributionSection: {
67
+ flex: '1 1 auto',
68
+
69
+ /* Non-zero width for IE11 flex-wrap */
70
+ minWidth: '1%'
71
+ },
72
+ answerDistribution: _defineProperty({
73
+ display: 'flex',
74
+ flexDirection: 'row',
75
+ flexWrap: 'wrap',
76
+ justifyContent: 'center',
77
+ alignItems: 'center',
78
+ padding: "0 ".concat(componentTheme.answerDistributionPadding),
79
+ position: 'relative'
80
+ }, mq, {
81
+ padding: 0
82
+ }),
83
+ answerDistributionChart: {
84
+ width: '19rem',
85
+ padding: "0 ".concat(componentTheme.answerDistributionChartPadding)
86
+ },
87
+ answerDistributionLegend: {
88
+ padding: "0 ".concat(componentTheme.answerDistributionLegendPadding)
89
+ },
90
+ answerDistributionSwatch: {
91
+ backgroundColor: componentTheme.answerDistributionSwatchColor
92
+ },
93
+ outcomeAlignments: {
94
+ display: 'flex',
95
+ margin: '0 - 1rem'
96
+ }
97
+ };
98
+ };
99
+
100
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var spacing = _ref.spacing,
3
3
  colors = _ref.colors,
4
4
  typography = _ref.typography,
@@ -22,4 +22,6 @@ export default function generator(_ref) {
22
22
  answerDistributionSwatchColor: colors.electric,
23
23
  phoneBreakPoint: "max-width: ".concat(breakpoints.medium)
24
24
  };
25
- }
25
+ };
26
+
27
+ export default generateComponentTheme;